Repository navigation
Commit 01aaa3e
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@main1 parent 63d08db commit 01aaa3e
5 files changed
Lines changed: 7 additions & 17 deletions
File tree
- LayoutTests
- platform
- glib/fast
- dynamic
- scrolling
- ios/fast/dynamic
- Source/WebCore/rendering
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5904 | 5904 | | |
5905 | 5905 | | |
5906 | 5906 | | |
5907 | | - | |
5908 | | - | |
5909 | 5907 | | |
5910 | 5908 | | |
5911 | 5909 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
This file was deleted.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
| 39 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2123 | 2123 | | |
2124 | 2124 | | |
2125 | 2125 | | |
2126 | | - | |
2127 | | - | |
| 2126 | + | |
| 2127 | + | |
| 2128 | + | |
| 2129 | + | |
| 2130 | + | |
2128 | 2131 | | |
2129 | 2132 | | |
2130 | 2133 | | |
| |||
0 commit comments