[wpt-sync] Sync PR 16395 - Snap correctly when scroll operation goes outside scroll bounds
Categories
(Core :: CSS Parsing and Computation, defect, P4)
Tracking
()
Tracking | Status | |
---|---|---|
firefox69 | --- | fixed |
People
(Reporter: mozilla.org, Unassigned)
References
()
Details
(Whiteboard: [wptsync downstream])
Sync web-platform-tests PR 16395 into mozilla-central (this bug is closed when the sync is complete).
PR: https://github.com/web-platform-tests/wpt/pull/16395
Details from upstream follow.
Majid Valipour <majidvp@chromium.org> wrote:
Snap correctly when scroll operation goes outside scroll bounds
In the current snap selection algorithm there is an inherent assumption that the
selected snap position in the other axis is inside the scroller bounds. Breaking
this invariant in snap selection algorithm causes it to not find any valid
candidate.In practice this invariant was being violated. More concretely an snap operation
with intended end and direction may have a base and intended snap positions
that are outside the bounds when for example script does
Element.scrollBy(-100,-100) or when user flings diagonally in a horizontal only
scroller.This fix updates the logic so that instead of making the assumption we actively
enforce it by clamping the out-of-bound values. An alternative approach may have
been to perhaps sanitize the input from all the various entry points into the
snap selection logic but the current approach seems simpler and more robust.Note that the problem applies to all snapping but manifested itself most
obviously when |scroll-snap-stop:always| was used because in normal snapping
even if fling didn't snap correctly we would re-snap at the end of the fling so
it was less obvious.Other minor changes:
- correct spelling mistake s/cros/cross/
- reuse base::ClampToRange to clamp
TEST:
- wpt/css/css-scroll-snap/scroll-snap-stop-always.html: cover snapping with scroll-snap-stop
- wpt/css/css-scroll-snap/scrollTo-scrollBy-snaps.html: covers basic snapping
- fast/scroll-snap/animate-fling-to-snap-points.html: cover user fling snapping
Bug: 823998
Change-Id: I85ff8b2c87518358805064375e0386606aad7b66
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1572286
Commit-Queue: Majid Valipour \<majidvp@chromium.org>
Reviewed-by: Majid Valipour \<majidvp@chromium.org>
Reviewed-by: David Bokan \<bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#652185}
Assignee | ||
Updated•5 years ago
|
Assignee | ||
Comment 1•5 years ago
|
||
Pushed to try https://treeherder.mozilla.org/#/jobs?repo=try&revision=36886cbdec4171ef46f23f7f4d86f166ab53ac5d
Assignee | ||
Comment 2•5 years ago
|
||
Pushed to try (stability) https://treeherder.mozilla.org/#/jobs?repo=try&revision=855c2b0368b6ec34f7f5b68b1446ab47ff7f0c5e
Assignee | ||
Comment 3•5 years ago
|
||
Failed to get results from try push
Comment 4•5 years ago
|
||
I've commented in the PR that is that some of test cases might not sound right. https://github.com/web-platform-tests/wpt/pull/16395/commits/1477c4c0f7627d6c20ae78b882e9734683f3c985#r285857875
Pushed by james@hoppipolla.co.uk: https://hg.mozilla.org/integration/mozilla-inbound/rev/bdd3dc94b195 [wpt PR 16395] - Snap correctly when scroll operation goes outside scroll bounds, a=testonly
Comment 6•5 years ago
|
||
bugherder |
Description
•