Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 079d6409fe009b33b2863648e519dc6af2d7f7cc
      
https://github.com/WebKit/WebKit/commit/079d6409fe009b33b2863648e519dc6af2d7f7cc
  Author: Simon Fraser <[email protected]>
  Date:   2026-04-17 (Fri, 17 Apr 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-padding-focus-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-padding-focus.html
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-padding-percentage-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-padding-percentage.html
    M 
LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-stuck.tentative-expected.txt
    M Source/WebCore/rendering/RenderLayerScrollableArea.cpp
    M Source/WebCore/rendering/RenderLayerScrollableArea.h

  Log Message:
  -----------
  Tabbing in a scroll container with scroll-padding set does not scroll focused 
element into view
https://bugs.webkit.org/show_bug.cgi?id=290096
rdar://147513379

Reviewed by Alan Baradlay.

The existing code took scroll-padding into account by inflating the 
`localExposeRect`, but this doesn't
have the correct behavior because it makes this rect wider. The correct 
approach is to shrink the
the scrolling viewport. We can also simplify the code by keeping all the rects 
in coordinates local
to the RenderBox, so `paddingBoxRect()` gives the correct scroll viewport with 
the left scrollbar
taken into account.

Also handle the case of the scroll padding being larger than the scrollport by 
proportionally shrinking
it; this behavior is not specified, but seems reasonable.

* 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-padding-focus-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-padding-focus.html:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-padding-percentage-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/css/css-scroll-snap/scroll-padding-percentage.html:
 Added.
* 
LayoutTests/platform/ios/imported/w3c/web-platform-tests/css/cssom-view/scrollIntoView-stuck.tentative-expected.txt:
* Source/WebCore/rendering/RenderLayerScrollableArea.cpp:
(WebCore::computeLocalExposeRect):
(WebCore::RenderLayerScrollableArea::scrollRectToVisible):
(WebCore::RenderLayerScrollableArea::updateScrollPositionForScrollIntoView): 
This only needs the offset to
reveal, not the entire rect.
(WebCore::getLocalExposeRect): Deleted.
* Source/WebCore/rendering/RenderLayerScrollableArea.h:

Canonical link: https://commits.webkit.org/311512@main



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to