-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
https://bugs.webkit.org/show_bug.cgi?id=263946 rdar://116843612 Reviewed by Tim Horton. The `RequestedScrollData` that's processed on the scrolling thread or in the UI process for a programmatic scroll can contain secondary data that says what to do before starting an animated scroll, in `requestedDataBeforeAnimatedScroll`. The three places that process this data were failing to take into account the `ScrollRequestType::CancelAnimatedScroll` request type, which resulted in using `positionOrDeltaBeforeAnimatedScroll` to do an initial non-animated scroll, which would always end up as 0,0 thus triggering the scroll to top behavior. * LayoutTests/fast/scrolling/cancel-animated-scroll-should-not-scroll-from-zero-expected.txt: Added. * LayoutTests/fast/scrolling/cancel-animated-scroll-should-not-scroll-from-zero-overflow-expected.txt: Added. * LayoutTests/fast/scrolling/cancel-animated-scroll-should-not-scroll-from-zero-overflow.html: Added. * LayoutTests/fast/scrolling/cancel-animated-scroll-should-not-scroll-from-zero.html: Added. * Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp: (WebCore::ScrollingTreeScrollingNode::handleScrollPositionRequest): * Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm: (WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTreeTransaction): * Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.mm: (WebKit::RemoteScrollingTreeMac::startPendingScrollAnimations): Canonical link: https://commits.webkit.org/270077@main
- Loading branch information
Showing
7 changed files
with
149 additions
and
5 deletions.
There are no files selected for viewing
9 changes: 9 additions & 0 deletions
9
LayoutTests/fast/scrolling/cancel-animated-scroll-should-not-scroll-from-zero-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
When canceling an animated scroll, we should not trigger a scroll from zero. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
9 changes: 9 additions & 0 deletions
9
...s/fast/scrolling/cancel-animated-scroll-should-not-scroll-from-zero-overflow-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
When canceling an animated scroll, we should not trigger a scroll from zero. | ||
|
||
On success, you will see a series of "PASS" messages, followed by "TEST COMPLETE". | ||
|
||
|
||
PASS successfullyParsed is true | ||
|
||
TEST COMPLETE | ||
|
57 changes: 57 additions & 0 deletions
57
LayoutTests/fast/scrolling/cancel-animated-scroll-should-not-scroll-from-zero-overflow.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
<!DOCTYPE html> <!-- webkit-test-runner [ AsyncOverflowScrollingEnabled=true ] --> | ||
<html> | ||
<head> | ||
<style> | ||
.scroller { | ||
width: 300px; | ||
height: 300px; | ||
overflow: scroll; | ||
border: 1px solid black; | ||
} | ||
|
||
.content { | ||
height: 2000px; | ||
background-image: repeating-linear-gradient(transparent, silver 200px); | ||
} | ||
</style> | ||
<script src="../../resources/ui-helper.js"></script> | ||
<script src="../../resources/js-test-pre.js"></script> | ||
<script> | ||
jsTestIsAsync = true; | ||
|
||
description('When canceling an animated scroll, we should not trigger a scroll from zero.'); | ||
window.addEventListener('load', async () => { | ||
let scroller = document.getElementsByClassName('scroller')[0]; | ||
|
||
const startingScrollOffset = 400; | ||
scroller.scrollTo(0, startingScrollOffset); | ||
|
||
scroller.addEventListener('scroll', () => { | ||
if (scroller.scrollTop < startingScrollOffset) | ||
testFailed(`We should never see a scroll offset less than ${startingScrollOffset} - saw ${scroller.scrollTop}`); | ||
}, false); | ||
|
||
setTimeout(() => { | ||
scroller.scrollTo({ top: 500, behavior: 'smooth' }); | ||
}, 10); | ||
|
||
await UIHelper.startMonitoringWheelEvents(); | ||
|
||
setTimeout(() => { | ||
scroller.scrollTo({ top: 520, behavior: 'smooth' }); | ||
}, 60); | ||
|
||
await UIHelper.waitForScrollCompletion(); | ||
finishJSTest(); | ||
|
||
}, false); | ||
</script> | ||
</head> | ||
<body> | ||
<div class="scroller"> | ||
<div class="content"></div> | ||
</div> | ||
<div id="console"></div> | ||
<script src="../../resources/js-test-post.js"></script> | ||
</body> | ||
</html> |
48 changes: 48 additions & 0 deletions
48
LayoutTests/fast/scrolling/cancel-animated-scroll-should-not-scroll-from-zero.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<!DOCTYPE html> | ||
<html> | ||
<head> | ||
<style> | ||
body { | ||
height: 5000px; | ||
background-image: repeating-linear-gradient(transparent, silver 500px); | ||
} | ||
</style> | ||
<script src="../../resources/ui-helper.js"></script> | ||
<script src="../../resources/js-test-pre.js"></script> | ||
<script> | ||
jsTestIsAsync = true; | ||
|
||
description('When canceling an animated scroll, we should not trigger a scroll from zero.'); | ||
window.addEventListener('load', async () => { | ||
const startingScrollOffset = 400; | ||
window.scrollTo(0, startingScrollOffset); | ||
|
||
window.addEventListener('scroll', () => { | ||
if (window.scrollTop < startingScrollOffset) | ||
testFailed(`We should never see a scroll offset less than ${startingScrollOffset} - saw ${window.scrollTop}`); | ||
}, false); | ||
|
||
setTimeout(() => { | ||
window.scrollTo({ top: 500, behavior: 'smooth' }); | ||
}, 10); | ||
|
||
await UIHelper.startMonitoringWheelEvents(); | ||
|
||
setTimeout(() => { | ||
window.scrollTo({ top: 520, behavior: 'smooth' }); | ||
}, 60); | ||
|
||
await UIHelper.waitForScrollCompletion(); | ||
finishJSTest(); | ||
|
||
}, false); | ||
</script> | ||
</head> | ||
<body> | ||
<div class="scroller"> | ||
<div class="content"></div> | ||
</div> | ||
<div id="console"></div> | ||
<script src="../../resources/js-test-post.js"></script> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters