Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 01aaa3e0be0c606e0e276f9b5266bc1915a86277
https://github.com/WebKit/WebKit/commit/01aaa3e0be0c606e0e276f9b5266bc1915a86277
Author: Ahmad Saleem <[email protected]>
Date: 2026-07-25 (Sat, 25 Jul 2026)
Changed paths:
M LayoutTests/TestExpectations
M LayoutTests/platform/glib/fast/dynamic/anchor-lock-expected.txt
R
LayoutTests/platform/glib/fast/scrolling/scroll-to-anchor-zoomed-header-expected.txt
M LayoutTests/platform/ios/fast/dynamic/anchor-lock-expected.txt
M Source/WebCore/rendering/RenderElement.cpp
Log Message:
-----------
scrollIntoView() on an inline element sharing a tall line scrolls to the line
box top instead of the element's bounding rect
https://bugs.webkit.org/show_bug.cgi?id=316063
rdar://178491868
Reviewed by Alan Baradlay.
This patch aligns WebKit with Blink / Chromium.
RenderElement::getLeadingCorner() computed the leading corner of an
inline element's anchor rect by taking the x from the text's
linesBoundingBox() but the y from the line box's contentLogicalTop().
When the inline shares a line with a much taller sibling (e.g. a
100vh image), the line box is inflated and its top sits far above the
baseline-aligned text, so the leading corner pointed at the top of the
line box rather than at the text itself. This made scrollIntoView()
scroll to the wrong position, since getTrailingCorner() already uses
the text's linesBoundingBox().
Take both x and y from the text's linesBoundingBox(), mirroring
getTrailingCorner(), so the anchor rect is the element's own bounding
rect. For normal lines linesBoundingBox().y() equals
contentLogicalTop(), so only the tall-line case changes behavior.
* LayoutTests/TestExpectations: Remove [ Failure ] expectations
* Source/WebCore/rendering/RenderElement.cpp:
(WebCore::RenderElement::getLeadingCorner const):
> Platform Specific Updates:
*
LayoutTests/platform/glib/fast/scrolling/scroll-to-anchor-zoomed-header-expected.txt:
Removed. (Now matches pass expectation)
* LayoutTests/platform/ios/fast/dynamic/anchor-lock-expected.txt: Rebaselined
* LayoutTests/platform/glib/fast/dynamic/anchor-lock-expected.txt: Ditto
Canonical link: https://commits.webkit.org/317933@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications