WebKit Bugzilla
New
Browse
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
RESOLVED FIXED
238985
REGRESSION(
r290770
): element.scrollIntoViewIfNeeded() scrolls to top even when element is already in viewport
https://bugs.webkit.org/show_bug.cgi?id=238985
Summary
REGRESSION(r290770): element.scrollIntoViewIfNeeded() scrolls to top even whe...
Nikita Vasilyev
Reported
2022-04-07 23:26:34 PDT
Created
attachment 457025
[details]
[HTML] Reduction Steps: 1. Open attached HTML reduction 2. Click anywhere on the text Expected: scrollTop doesn't change. Actual: Starting
r290770
, #box elements scrolls to top.
Attachments
[HTML] Reduction
(1.16 KB, text/html)
2022-04-07 23:26 PDT
,
Nikita Vasilyev
no flags
Details
Patch
(4.56 KB, patch)
2022-04-08 03:53 PDT
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Patch
(5.91 KB, patch)
2022-04-08 06:07 PDT
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Patch
(8.11 KB, patch)
2022-04-08 08:36 PDT
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Patch
(8.09 KB, patch)
2022-04-13 00:51 PDT
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Patch
(6.72 KB, patch)
2022-04-29 01:52 PDT
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Patch
(6.48 KB, patch)
2022-04-29 08:49 PDT
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Patch
(6.61 KB, patch)
2022-04-29 10:22 PDT
,
Rob Buis
no flags
Details
Formatted Diff
Diff
Show Obsolete
(6)
View All
Add attachment
proposed patch, testcase, etc.
Rob Buis
Comment 1
2022-04-08 03:53:20 PDT
Created
attachment 457038
[details]
Patch
Rob Buis
Comment 2
2022-04-08 06:07:33 PDT
Created
attachment 457060
[details]
Patch
Rob Buis
Comment 3
2022-04-08 08:36:32 PDT
Created
attachment 457074
[details]
Patch
EWS Watchlist
Comment 4
2022-04-08 08:38:44 PDT
This patch modifies the imported WPT tests. Please ensure that any changes on the tests (not coming from a WPT import) are exported to WPT. Please see
https://trac.webkit.org/wiki/WPTExportProcess
Rob Buis
Comment 5
2022-04-13 00:51:10 PDT
Created
attachment 457512
[details]
Patch
Radar WebKit Bug Importer
Comment 6
2022-04-14 23:27:13 PDT
<
rdar://problem/91797137
>
Simon Fraser (smfr)
Comment 7
2022-04-28 10:26:01 PDT
Comment on
attachment 457512
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=457512&action=review
> Source/WebCore/rendering/RenderLayer.cpp:2659 > + bool intersects = exposeRect.maxX() >= visibleRect.x() && exposeRect.x() <= visibleRect.maxX();
call this intersectsInX
> Source/WebCore/rendering/RenderLayer.cpp:2664 > + LayoutUnit intersectWidth = intersection(visibleRect, exposeRectX).width();
Seems like you could compute intersectWidth without making a rect.
> Source/WebCore/rendering/RenderLayer.cpp:-2674 > - } else if (intersectWidth > 0) {
Keep the braces because the comment makes it a multi-line clause.
> Source/WebCore/rendering/RenderLayer.cpp:2696 > + intersects = exposeRect.maxY() >= visibleRect.y() && exposeRect.y() <= visibleRect.maxY();
bool intersectsInY =
> Source/WebCore/rendering/RenderLayer.cpp:2700 > + LayoutRect exposeRectY(visibleRect.x(), exposeRect.y(), visibleRect.width(), exposeRect.height());
Ditto
> Source/WebCore/rendering/RenderLayer.cpp:2710 > + } else if (intersectHeight > 0)
Ditto
Simon Fraser (smfr)
Comment 8
2022-04-28 16:49:35 PDT
<
rdar://90985370
>
Rob Buis
Comment 9
2022-04-29 01:52:27 PDT
Created
attachment 458577
[details]
Patch
Rob Buis
Comment 10
2022-04-29 08:49:20 PDT
Created
attachment 458590
[details]
Patch
Rob Buis
Comment 11
2022-04-29 10:22:48 PDT
Created
attachment 458592
[details]
Patch
Darin Adler
Comment 12
2022-04-29 13:14:31 PDT
Comment on
attachment 458592
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=458592&action=review
> Source/WebCore/rendering/RenderLayer.cpp:2655 > + bool intersectsInX = exposeRect.maxX() >= visibleRect.x() && exposeRect.x() <= visibleRect.maxX();
Does this handle the "touches but does not intersect" case correctly?
Rob Buis
Comment 13
2022-04-29 22:25:32 PDT
Comment on
attachment 457512
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=457512&action=review
>> Source/WebCore/rendering/RenderLayer.cpp:2659 >> + bool intersects = exposeRect.maxX() >= visibleRect.x() && exposeRect.x() <= visibleRect.maxX(); > > call this intersectsInX
Done.
>> Source/WebCore/rendering/RenderLayer.cpp:2664 >> + LayoutUnit intersectWidth = intersection(visibleRect, exposeRectX).width(); > > Seems like you could compute intersectWidth without making a rect.
Done.
>> Source/WebCore/rendering/RenderLayer.cpp:-2674 >> - } else if (intersectWidth > 0) { > > Keep the braces because the comment makes it a multi-line clause.
Done.
>> Source/WebCore/rendering/RenderLayer.cpp:2696 >> + intersects = exposeRect.maxY() >= visibleRect.y() && exposeRect.y() <= visibleRect.maxY(); > > bool intersectsInY =
Done.
>> Source/WebCore/rendering/RenderLayer.cpp:2700 >> + LayoutRect exposeRectY(visibleRect.x(), exposeRect.y(), visibleRect.width(), exposeRect.height()); > > Ditto
Done.
>> Source/WebCore/rendering/RenderLayer.cpp:2710 >> + } else if (intersectHeight > 0) > > Ditto
Done.
EWS
Comment 14
2022-04-29 23:08:39 PDT
Committed
r293642
(
250146@main
): <
https://commits.webkit.org/250146@main
> All reviewed patches have been landed. Closing bug and clearing flags on
attachment 458592
[details]
.
Rob Buis
Comment 15
2022-04-29 23:24:54 PDT
Comment on
attachment 458592
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=458592&action=review
>> Source/WebCore/rendering/RenderLayer.cpp:2655 >> + bool intersectsInX = exposeRect.maxX() >= visibleRect.x() && exposeRect.x() <= visibleRect.maxX(); > > Does this handle the "touches but does not intersect" case correctly?
I believe so, {(0,0), (10,10)} and {(11,0),(20, 10)} touch but do not intersect, matched by the expression above.
Darin Adler
Comment 16
2022-04-30 13:43:47 PDT
Comment on
attachment 458592
[details]
Patch View in context:
https://bugs.webkit.org/attachment.cgi?id=458592&action=review
>>> Source/WebCore/rendering/RenderLayer.cpp:2655 >>> + bool intersectsInX = exposeRect.maxX() >= visibleRect.x() && exposeRect.x() <= visibleRect.maxX(); >> >> Does this handle the "touches but does not intersect" case correctly? > > I believe so, {(0,0), (10,10)} and {(11,0),(20, 10)} touch but do not intersect, matched by the expression above.
So you’re saying that we want "touches but not intersect" to return true here. Not obvious to me, but glad you thought it through.
Simon Fraser (smfr)
Comment 17
2022-06-23 10:15:41 PDT
***
Bug 238567
has been marked as a duplicate of this bug. ***
Tim Nguyen (:ntim)
Comment 18
2024-07-30 15:50:20 PDT
Submitted web-platform-tests pull request:
https://github.com/web-platform-tests/wpt/pull/47376
Note
You need to
log in
before you can comment on or make changes to this bug.
Top of Page
Format For Printing
XML
Clone This Bug