Title: [274853] trunk
- Revision
- 274853
- Author
- [email protected]
- Date
- 2021-03-23 01:52:12 -0700 (Tue, 23 Mar 2021)
Log Message
No scrolling momentum with 'scroll-snap-type: x mandatory' if the scroller scrolls vertically
https://bugs.webkit.org/show_bug.cgi?id=213571
<rdar://problem/64715507>
Patch by Martin Robinson <[email protected]> on 2021-03-23
Reviewed by Simon Fraser.
Source/WebCore:
When handling momentum scrolling for scroll containers that snap, use the
predicted momentum scroll destination for axes that do not snap. Using
the initial scroll offset here was causing momentum scrolling in these axes
to end prematurely.
Test: tiled-drawing/scrolling/scroll-snap/scroll-snap-momentum-in-non-snapping-axis.html
* platform/ScrollSnapAnimatorState.cpp:
(WebCore::ScrollSnapAnimatorState::targetOffsetForStartOffset const): Use the predicted
scroll offset. Even though the startOffset parameter is no longer used, do not remove
it because it will be used in the fix for https://bugs.webkit.org/show_bug.cgi?id=223406.
LayoutTests:
* tiled-drawing/scrolling/scroll-snap/scroll-snap-momentum-in-non-snapping-axis-expected.txt: Added.
* tiled-drawing/scrolling/scroll-snap/scroll-snap-momentum-in-non-snapping-axis.html: Added.
Modified Paths
Added Paths
Diff
Modified: trunk/LayoutTests/ChangeLog (274852 => 274853)
--- trunk/LayoutTests/ChangeLog 2021-03-23 07:02:33 UTC (rev 274852)
+++ trunk/LayoutTests/ChangeLog 2021-03-23 08:52:12 UTC (rev 274853)
@@ -1,3 +1,14 @@
+2021-03-23 Martin Robinson <[email protected]>
+
+ No scrolling momentum with 'scroll-snap-type: x mandatory' if the scroller scrolls vertically
+ https://bugs.webkit.org/show_bug.cgi?id=213571
+ <rdar://problem/64715507>
+
+ Reviewed by Simon Fraser.
+
+ * tiled-drawing/scrolling/scroll-snap/scroll-snap-momentum-in-non-snapping-axis-expected.txt: Added.
+ * tiled-drawing/scrolling/scroll-snap/scroll-snap-momentum-in-non-snapping-axis.html: Added.
+
2021-03-23 Said Abou-Hallawa <[email protected]>
SVG links navigate only to internal animation elements and <view> anchors
Added: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-momentum-in-non-snapping-axis-expected.txt (0 => 274853)
--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-momentum-in-non-snapping-axis-expected.txt (rev 0)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-momentum-in-non-snapping-axis-expected.txt 2021-03-23 08:52:12 UTC (rev 274853)
@@ -0,0 +1,5 @@
+PASS scrolling momentum the same in snapping and non-snapping axes.
+PASS successfullyParsed is true
+
+TEST COMPLETE
+
Added: trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-momentum-in-non-snapping-axis.html (0 => 274853)
--- trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-momentum-in-non-snapping-axis.html (rev 0)
+++ trunk/LayoutTests/tiled-drawing/scrolling/scroll-snap/scroll-snap-momentum-in-non-snapping-axis.html 2021-03-23 08:52:12 UTC (rev 274853)
@@ -0,0 +1,68 @@
+<!DOCTYPE HTML>
+<html>
+ <head>
+ <style>
+ .container {
+ width: 200px;
+ height: 200px;
+ overflow: scroll;
+ }
+ #vertical-snapping-container { scroll-snap-type: y proximity; }
+ #bidirectional-snapping-container { scroll-snap-type: both proximity; }
+ .box {
+ height: 100vh;
+ width: 100vw;
+ float: left;
+ scroll-snap-align: start;
+ }
+ </style>
+ <script src=""
+ <script src=""
+ <script src=""
+ <script>
+ window.jsTestIsAsync = true;
+
+ async function runTests()
+ {
+ try {
+ const containerNotSnappingOnAxis = document.getElementById("vertical-snapping-container");
+ await doScrollGlide(containerNotSnappingOnAxis, HORIZONTAL);
+ const containerSnappingOnAxis = document.getElementById("bidirectional-snapping-container");
+ await doScrollGlide(containerSnappingOnAxis, HORIZONTAL);
+ expectTrue(containerSnappingOnAxis.scrollLeft == containerNotSnappingOnAxis.scrollLeft, "scrolling momentum the same in snapping and non-snapping axes.");
+ } catch (e) {
+ console.log(e);
+ } finally {
+ finishJSTest();
+ }
+ }
+
+ function onLoad()
+ {
+ if (window.eventSender) {
+ internals.setPlatformMomentumScrollingPredictionEnabled(false);
+ runTests();
+ } else {
+ var messageLocation = document.getElementById('console');
+ messageLocation.innerHTML = "<p>To run this test manually, scroll the page vertically. The page should "
+ + "snap between uniform colors which fill the view.<p>";
+ }
+ }
+ </script>
+ </head>
+ <body _onload_="onLoad();">
+ <div id="console"></div>
+ <div id="vertical-snapping-container" class="container">
+ <div style="width: 200vw">
+ <div class="box"></div>
+ <div class="box"></div>
+ </div>
+ </div>
+ <div id="bidirectional-snapping-container" class="container">
+ <div style="width: 200vw">
+ <div class="box" style="float: left"></div>
+ <div class="box" style="float: left"></div>
+ </div>
+ </div>
+ </body>
+</html>
Modified: trunk/Source/WebCore/ChangeLog (274852 => 274853)
--- trunk/Source/WebCore/ChangeLog 2021-03-23 07:02:33 UTC (rev 274852)
+++ trunk/Source/WebCore/ChangeLog 2021-03-23 08:52:12 UTC (rev 274853)
@@ -1,3 +1,23 @@
+2021-03-23 Martin Robinson <[email protected]>
+
+ No scrolling momentum with 'scroll-snap-type: x mandatory' if the scroller scrolls vertically
+ https://bugs.webkit.org/show_bug.cgi?id=213571
+ <rdar://problem/64715507>
+
+ Reviewed by Simon Fraser.
+
+ When handling momentum scrolling for scroll containers that snap, use the
+ predicted momentum scroll destination for axes that do not snap. Using
+ the initial scroll offset here was causing momentum scrolling in these axes
+ to end prematurely.
+
+ Test: tiled-drawing/scrolling/scroll-snap/scroll-snap-momentum-in-non-snapping-axis.html
+
+ * platform/ScrollSnapAnimatorState.cpp:
+ (WebCore::ScrollSnapAnimatorState::targetOffsetForStartOffset const): Use the predicted
+ scroll offset. Even though the startOffset parameter is no longer used, do not remove
+ it because it will be used in the fix for https://bugs.webkit.org/show_bug.cgi?id=223406.
+
2021-03-23 Said Abou-Hallawa <[email protected]>
SVG links navigate only to internal animation elements and <view> anchors
Modified: trunk/Source/WebCore/platform/ScrollSnapAnimatorState.cpp (274852 => 274853)
--- trunk/Source/WebCore/platform/ScrollSnapAnimatorState.cpp 2021-03-23 07:02:33 UTC (rev 274852)
+++ trunk/Source/WebCore/platform/ScrollSnapAnimatorState.cpp 2021-03-23 08:52:12 UTC (rev 274853)
@@ -96,7 +96,7 @@
const auto& snapOffsets = m_snapOffsetsInfo.offsetsForAxis(axis);
if (snapOffsets.isEmpty()) {
outActiveSnapIndex = invalidSnapOffsetIndex;
- return clampTo<float>(startOffset, 0, maxScrollOffset);
+ return clampTo<float>(predictedOffset, 0, maxScrollOffset);
}
float targetOffset = m_snapOffsetsInfo.closestSnapOffset(axis, LayoutUnit(predictedOffset / pageScale), initialDelta, LayoutUnit(startOffset / pageScale)).first;
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes