Bug 1766386 - Make scroll snap proximity threshold based on the snapport size rather...
commit6278442cf20f1d8459accc36bc39536d98847a29
authorHiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
Mon, 14 Aug 2023 00:25:31 +0000 (14 00:25 +0000)
committerHiroyuki Ikezoe <hikezoe.birchill@mozilla.com>
Mon, 14 Aug 2023 00:25:31 +0000 (14 00:25 +0000)
tree5619651a149d6c22e226866d42e1789d4ba51e91
parentc5251a97151271c3bc15a11d36a18e742e51d549
Bug 1766386 - Make scroll snap proximity threshold based on the snapport size rather than using a fixed preference value. r=dlrobertson

Now the threshold is `0.3*snapport size`, it's mostly same as WebKit [1].
A difference is WebKit's threshold is based on the scrollport size. Given that
if `scroll-padding` was specified due to a `position: fixed` element or some
such, using snapport size (i.e. offsetted by the scroll-padding) is more
reasonable than using scrollport size.

Note that Chrome uses 1/3 of the snapport size [2]. It will result scroll
positions having fractional parts. Once after we fixed our pixel alignment
issues (e.g., bug 1774315), we will change it in bug 1848574.

[1] https://searchfox.org/wubkat/rev/d1911bf073cc55fc8ca76bcee8b4783539e43c2e/Source/WebCore/page/scrolling/ScrollSnapOffsetsInfo.cpp#207-208
[2] https://source.chromium.org/chromium/chromium/src/+/main:third_party/blink/renderer/core/page/scrolling/snap_coordinator.cc;l=23;drc=b678d9f0da19257d872a19e6291e3ae4bb2c404f

Differential Revision: https://phabricator.services.mozilla.com/D185873
gfx/layers/apz/test/mochitest/helper_scroll_snap_resnap_after_async_scroll.html
gfx/layers/apz/test/mochitest/helper_scroll_snap_resnap_after_async_scrollBy.html
layout/generic/ScrollSnap.cpp
modules/libpref/init/StaticPrefList.yaml
testing/web-platform/meta/css/css-scroll-snap/snap-after-initial-layout/scroll-snap-initial-layout-000.html.ini [deleted file]