Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make css/css-scroll-snap/scroll-target-margin-005.html pass #3412

Closed
wants to merge 1 commit into from

Conversation

nt1m
Copy link
Member

@nt1m nt1m commented Aug 17, 2022

3fa32d7

Make css/css-scroll-snap/scroll-target-margin-005.html pass
https://bugs.webkit.org/show_bug.cgi?id=244038

Reviewed by NOBODY (OOPS!).

There are 3 issues:
- The focus() ScrollRectToVisibleOptions does not match the scrollIntoView() one
- The test uses <input type="date">, which redirects focus inside the UA shadow root, so we don't take in account the shadow host scroll margin
- The test should wait for a tick, since scrolling to the focused element doesn't happen immediately in WebKit

* LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-margin-005-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-margin-005.html:
* Source/WebCore/Sources.txt:
* Source/WebCore/dom/Element.cpp:
(WebCore::toScrollAlignmentForInlineDirection): Deleted.
(WebCore::toScrollAlignmentForBlockDirection): Deleted.
* Source/WebCore/page/FrameView.cpp:
(WebCore::FrameView::scrollToFocusedElementInternal):
* Source/WebCore/page/ScrollLogicalPosition.cpp: Added.
(WebCore::toScrollAlignmentForInlineDirection):
(WebCore::toScrollAlignmentForBlockDirection):

3fa32d7

Misc iOS, tvOS & watchOS macOS Linux Windows
βœ… πŸ§ͺ style βœ… πŸ›  ios βœ… πŸ›  mac βœ… πŸ›  wpe ❌ πŸ›  πŸ§ͺ win
βœ… πŸ§ͺ bindings βœ… πŸ›  ios-sim βœ… πŸ›  mac-debug βœ… πŸ›  gtk βœ… πŸ›  wincairo
βœ… πŸ§ͺ webkitperl ❌ πŸ§ͺ ios-wk2 βœ… πŸ›  mac-AS-debug ❌ πŸ§ͺ gtk-wk2
βœ… πŸ§ͺ api-ios βœ… πŸ§ͺ api-mac ❌ πŸ§ͺ api-gtk
βœ… πŸ›  tv ❌ πŸ§ͺ mac-wk1
βœ… πŸ›  tv-sim ❌ πŸ§ͺ mac-wk2
βœ… πŸ›  watch ❌ πŸ§ͺ mac-AS-debug-wk2
βœ… πŸ›  watch-sim βœ… πŸ§ͺ mac-wk2-stress

@nt1m nt1m requested review from cdumez and rniwa as code owners August 17, 2022 17:01
@nt1m nt1m self-assigned this Aug 17, 2022
@nt1m nt1m added Scrolling Bugs related to main thread and off-main thread scrolling WebKit Nightly Build labels Aug 17, 2022
@nt1m nt1m requested review from whsieh and smfr August 17, 2022 17:02
Source/WebCore/platform/ScrollAlignment.h Outdated Show resolved Hide resolved
@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 17, 2022
https://bugs.webkit.org/show_bug.cgi?id=244038

Reviewed by NOBODY (OOPS!).

There are 3 issues:
- The focus() ScrollRectToVisibleOptions does not match the scrollIntoView() one
- The test uses <input type="date">, which redirects focus inside the UA shadow root, so we don't take in account the shadow host scroll margin
- The test should wait for a tick, since scrolling to the focused element doesn't happen immediately in WebKit

* LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-margin-005-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-target-margin-005.html:
* Source/WebCore/Sources.txt:
* Source/WebCore/dom/Element.cpp:
(WebCore::toScrollAlignmentForInlineDirection): Deleted.
(WebCore::toScrollAlignmentForBlockDirection): Deleted.
* Source/WebCore/page/FrameView.cpp:
(WebCore::FrameView::scrollToFocusedElementInternal):
* Source/WebCore/page/ScrollLogicalPosition.cpp: Added.
(WebCore::toScrollAlignmentForInlineDirection):
(WebCore::toScrollAlignmentForBlockDirection):
@nt1m nt1m removed the merging-blocked Applied to prevent a change from being merged label Aug 17, 2022
@nt1m nt1m requested a review from smfr August 17, 2022 19:03
auto* renderer = updateTarget->renderer();
if (!renderer || renderer->isWidget())
return;

auto writingMode = renderer->style().writingMode();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is repeating code that exists in Element::scrollIntoView(). Can we share it?

@webkit-ews-buildbot webkit-ews-buildbot added the merging-blocked Applied to prevent a change from being merged label Aug 17, 2022
@nt1m nt1m closed this Aug 27, 2022
@nt1m nt1m deleted the scroll-test-5 branch September 21, 2022 00:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merging-blocked Applied to prevent a change from being merged Scrolling Bugs related to main thread and off-main thread scrolling
Projects
None yet
4 participants