Commit Graph
76 Commits
Author SHA1 Message Date
Ting-Yu Lin 76523f97b1 Bug 1896516 Part 6 - Remove nsIScrollableFrame usages in nsLayoutUtils. r=layout-reviewers,emilio
Convert `nsIScrollableFrame` to `ScrollContainerFrame` for all the APIs in
nsLayoutUtils, and then adapt other callers until everything compiles.

In `nsLayoutUtils::CalculateBasicFrameMetrics()`'s documentation,
s/ComputeFrameMetrics/ComputeScrollMetadata/ because the method was renamed in
https://hg.mozilla.org/mozilla-central/rev/cb2023f50288

Differential Revision: https://phabricator.services.mozilla.com/D211493
2024-05-30 06:32:20 +00:00
Sebastian Hengst bf4dfe53f8 Backed out 15 changesets (bug 1896516) for causing scrolling crashes on macOS. a=backout
Backed out changeset fd6904338812 (bug 1896516)
Backed out changeset 2977ff81a23e (bug 1896516)
Backed out changeset c8a6b0e526d6 (bug 1896516)
Backed out changeset 3c06f22da72b (bug 1896516)
Backed out changeset f63b0c4335fe (bug 1896516)
Backed out changeset 6f7ab8adfa6e (bug 1896516)
Backed out changeset 997c9249dbed (bug 1896516)
Backed out changeset c964fccd5180 (bug 1896516)
Backed out changeset 7b481b747b7a (bug 1896516)
Backed out changeset 42e1bbe0ecb6 (bug 1896516)
Backed out changeset 717dac08b607 (bug 1896516)
Backed out changeset 2f0817331dbe (bug 1896516)
Backed out changeset b765169a7a8f (bug 1896516)
Backed out changeset a2d37b98273c (bug 1896516)
Backed out changeset ea9ecb543e66 (bug 1896516)
2024-05-29 11:22:52 +02:00
Ting-Yu Lin 16b24f6c41 Bug 1896516 Part 6 - Remove nsIScrollableFrame usages in nsLayoutUtils. r=layout-reviewers,emilio
Convert `nsIScrollableFrame` to `ScrollContainerFrame` for all the APIs in
nsLayoutUtils, and then adapt other callers until everything compiles.

In `nsLayoutUtils::CalculateBasicFrameMetrics()`'s documentation,
s/ComputeFrameMetrics/ComputeScrollMetadata/ because the method was renamed in
https://hg.mozilla.org/mozilla-central/rev/cb2023f50288

Differential Revision: https://phabricator.services.mozilla.com/D211493
2024-05-28 04:46:18 +00:00
Hiroyuki Ikezoe b817697873 Bug 1768393 - Filter out snap candidates if snapping to the point makes the snap area outside of the snapport. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D184342
2023-09-12 01:33:19 +00:00
Hiroyuki Ikezoe 9053d93cc3 Bug 1768393 - Make SnapPosition inherit from ScrollSnapInfo::SnapTarget. r=botond
We will need the snap area, (i.e. SnapTarget::mSnapArea) in SnapPosition to tell
whether the snap area is visible or not if we snap to a candidate snap position.

Though SnapPosition::mPosition is redundant, it's equivalent to either
SnapTarget::mSnapPoint.mX or SnapTarget::mSnapPoint.mY, if we omit it, we need
another variable representing the axis of SnapPosition.

Differential Revision: https://phabricator.services.mozilla.com/D184341
2023-09-12 01:33:19 +00:00
Hiroyuki Ikezoe 961ed566fc Bug 1768393 - Support multiple SnapPositions in CandidateTracker. r=botond
It's possible that multiple snap target elements are located at the same
position in one axis but at different position in the other axis. We need to
keep track of them respectively in each CandidateTracker.

Differential Revision: https://phabricator.services.mozilla.com/D184339
2023-09-12 01:33:19 +00:00
Hiroyuki Ikezoe e3d7522940 Bug 1768393 - Drop mBestEdge initialization. r=botond
We can refer mEdgeFound whether mBestEdge has been set or not.

Differential Revision: https://phabricator.services.mozilla.com/D184338
2023-09-12 01:33:18 +00:00
Hiroyuki Ikezoe 29fa70a4b8 Bug 1768393 - Introduce SnapPoint to wrap a pair of Maybe<nscoord>. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D184337
2023-09-12 01:33:18 +00:00
Hiroyuki Ikezoe 425f5fbdce Bug 1768393 - Change mSecondBestEdge type to nscoord. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D184336
2023-09-12 01:33:18 +00:00
Hiroyuki Ikezoe 2fb362302c Bug 1768393 - Use the snap position on the axis only if the scroll snap strictness is not none to tell whether the given snap position is inside the scrollport or not. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D184335
2023-09-12 01:33:18 +00:00
Hiroyuki Ikezoe 58719ebd7f Bug 1768393 - Rename mozilla::SnapTarget to mozilla::SnapDestination. r=botond
It was confusing with ScrollSnapInfo::SnapTarget.

Differential Revision: https://phabricator.services.mozilla.com/D184334
2023-09-12 01:33:18 +00:00
Hiroyuki Ikezoe d3638ed8ac Bug 1768393 - Split out ScrollSnapInfo. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D184333
2023-09-12 01:33:17 +00:00
Hiroyuki Ikezoe 89d3983975 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
2023-08-14 06:36:35 +00:00
Cristian Tuns 6bb5937964 Backed out changeset bdeed1276a35 (bug 1766386) for causing mochitest failures in helper_scroll_snap_resnap_after_async_scroll.html CLOSED TREE 2023-08-13 21:35:49 -04:00
Hiroyuki Ikezoe 66e9a802f5 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
2023-08-14 00:25:31 +00:00
Hiroyuki Ikezoe 7e70b63cd3 Bug 1822433 - Snap to the scroll destination in the case of intended-end-position scroll operation if there's no snap target points. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D172627
2023-03-16 07:51:01 +00:00
Marian-Vasile Laza a8a6e33ea4 Backed out changeset de233af59c21 (bug 1822433) for wpt failures on scroll-snap-type-on-root-element.html. 2023-03-16 01:55:48 +02:00
Hiroyuki Ikezoe 6385d14e21 Bug 1822433 - Snap to the scroll destination in the case of intended-end-position scroll operation if there's no snap target points. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D172627
2023-03-15 21:12:59 +00:00
Hiroyuki Ikezoe 072cdfbbd0 Bug 1791606 - Downgrade the assertion when we found multiple SnapTargets for the same focused content. r=emilio
The assertion is valid, but fixing it would be a bit of work (bug 1798240),
so now we degrade the assertion to make it harmless on fuzzers works.

Differential Revision: https://phabricator.services.mozilla.com/D160742
2022-10-31 22:58:12 +00:00
Emilio Cobos Álvarez 784307a8e2 Bug 1785310 - Remove mozilla/StaticPrefs_layout.h includes from other headers. r=dholbert
Adding layout prefs cause massive rebuilds because of this.

Differential Revision: https://phabricator.services.mozilla.com/D154928
2022-08-17 21:26:36 +00:00
Hiroyuki Ikezoe b1c8274feb Bug 1777649 - Factor out some utility functions for scroll snap. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D151334
2022-07-31 22:51:56 +00:00
Hiroyuki Ikezoe 4243f10a45 Bug 1780701 - Skip returning the snap target if the snap position is same as the scroll destination. r=botond
Depends on D152617

Differential Revision: https://phabricator.services.mozilla.com/D152618
2022-07-26 06:59:14 +00:00
Hiroyuki Ikezoe 9a83265c23 Bug 1780154 - Skip returning the snap target if the scroll-snap-type on the axis is none. r=botond
If we return the snap target in such cases, even though the target position is
unchanged from the original scroll destination, the target will be handled as a
valid last-snapped target element, thus we will try to re-snap to the element's
scroll-snap-align position rather than keeping the scroll position as it is.

Differential Revision: https://phabricator.services.mozilla.com/D152353
2022-07-25 01:27:03 +00:00
Hiroyuki Ikezoe a8cab6ca5b Bug 1530253 - Trigger resnap on scroll-snap-type or scroll-snap-align changes. r=emilio
Depends on D148863

Differential Revision: https://phabricator.services.mozilla.com/D148864
2022-07-01 01:35:33 +00:00
Hiroyuki Ikezoe d68965d0f2 Bug 1530253 - Trigger re-snap on reflows and in RecomputePosition. r=botond,emilio
The basic machinery to trigger re-snap is same as what scroll anchoring does,
queueing a triggering request and flush the queued requests after reflows
finished.

Depends on D148862

Differential Revision: https://phabricator.services.mozilla.com/D148863
2022-07-01 01:35:32 +00:00
Hiroyuki Ikezoe 281b84a80c Bug 1530253 - Implement the logic to choose the best snap point for re-snap. r=botond
Depends on D148861

Differential Revision: https://phabricator.services.mozilla.com/D148862
2022-07-01 01:35:32 +00:00
Hiroyuki Ikezoe c0eee7989e Bug 1530253 - Make GetSnapPointForDestination return the last snapped target id(s). r=botond
Depends on D148856

Differential Revision: https://phabricator.services.mozilla.com/D148857
2022-07-01 01:35:30 +00:00
Hiroyuki Ikezoe 090d071f57 Bug 1530253 - Assign an id to each scroll snap target for tracking the last snapped element. r=botond,emilio
Depends on D148855

Differential Revision: https://phabricator.services.mozilla.com/D148856
2022-07-01 01:35:29 +00:00
Hiroyuki Ikezoe eb3008253e Bug 1530253 - Introduce a new struct wrapping various varibles in CalcSnapPoints. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D148855
2022-07-01 01:35:29 +00:00
Hiroyuki Ikezoe 354ca46b0f Bug 1312165 - Honor scroll-snap-stop: always. r=botond
Depends on D145851

Differential Revision: https://phabricator.services.mozilla.com/D145852
2022-05-31 00:45:12 +00:00
Hiroyuki Ikezoe 039ffcf1fa Bug 1312165 - Rewrite CalcSnapPoints::AddEdge with switch statement. r=botond
Depends on D145850

Differential Revision: https://phabricator.services.mozilla.com/D145851
2022-05-31 00:45:12 +00:00
Hiroyuki Ikezoe 8cf60c1d97 Bug 1769897 - Ignore snap points orthogonal to the scroll snap axis. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D146656
2022-05-18 22:22:31 +00:00
Hiroyuki Ikezoe cda43af013 Bug 1766805 - Ignore snap points behind scroll direction on intended direction scroll operations. r=botond
Depends on D145191

Differential Revision: https://phabricator.services.mozilla.com/D145192
2022-05-12 12:25:16 +00:00
Hiroyuki Ikezoe 26255fd659 Bug 1766805 - Introduce intended direction and intended end position concepts. r=botond
The scroll snap spec defines the concepts [1]. There are three type of scroll
operations. 1) intended end position, 2) intended direction and end position
and 3) intended direction.

Basically our existing ScrollUnits types correspond;

1) DEVICE_PIXELS, WHOLE => intended end position
2) PAGES => intended direction and end position
3) LINES => intended direction

There are two exceptions in the `intended direction and end position` case,
scrollBy() and fling gestures (on Linux). They were defined as scroll operations
with DEVICE_PIXELS unit, but the spec cleary says they are `intended direction
and end position` operations.

Note that we will also use this information for scroll-snap-stop property since
the properly will only have effects on both 2) and 3) cases.

[1] https://drafts.csswg.org/css-scroll-snap/#scroll-types

Depends on D145190

Differential Revision: https://phabricator.services.mozilla.com/D145191
2022-05-12 12:25:15 +00:00
Hiroyuki Ikezoe d6b7be38a2 Bug 1766805 - Give the proper destination to GetSnapPointForDestination for ScrollUnit::WHOLE on the main-thread. r=botond
Now the proper destination is same as what we do for ScrollUnit::WHOLE [1].

With the proper points we no longer need special handlings in
CalcSnapPoints::AddEdge for ScrollUnit::WHOLE. In my sense the special handling
wasn't necessary though.

[1] https://searchfox.org/mozilla-central/rev/dc09246dfbfd8dafeb6d55ebee18a6294d525443/gfx/layers/apz/src/AsyncPanZoomController.cpp#2105-2112

Differential Revision: https://phabricator.services.mozilla.com/D145190
2022-05-12 12:25:15 +00:00
Norisz Fay 95a2ec09e4 Backed out 3 changesets (bug 1766805) for causing build bustage on AsyncPanZoomController.cpp CLOSED TREE
Backed out changeset e35a130f2bce (bug 1766805)
Backed out changeset 9f9e2030fbc1 (bug 1766805)
Backed out changeset 898bd12a5da8 (bug 1766805)
2022-05-12 13:42:36 +03:00
Hiroyuki Ikezoe 24bf71a76c Bug 1766805 - Ignore snap points behind scroll direction on intended direction scroll operations. r=botond
Depends on D145191

Differential Revision: https://phabricator.services.mozilla.com/D145192
2022-05-12 07:45:59 +00:00
Hiroyuki Ikezoe 91eb43f4ae Bug 1766805 - Introduce intended direction and intended end position concepts. r=botond
The scroll snap spec defines the concepts [1]. There are three type of scroll
operations. 1) intended end position, 2) intended direction and end position
and 3) intended direction.

Basically our existing ScrollUnits types correspond;

1) DEVICE_PIXELS, WHOLE => intended end position
2) PAGES => intended direction and end position
3) LINES => intended direction

There are two exceptions in the `intended direction and end position` case,
scrollBy() and fling gestures (on Linux). They were defined as scroll operations
with DEVICE_PIXELS unit, but the spec cleary says they are `intended direction
and end position` operations.

Note that we will also use this information for scroll-snap-stop property since
the properly will only have effects on both 2) and 3) cases.

[1] https://drafts.csswg.org/css-scroll-snap/#scroll-types

Depends on D145190

Differential Revision: https://phabricator.services.mozilla.com/D145191
2022-05-12 07:45:59 +00:00
Hiroyuki Ikezoe 99647df511 Bug 1766805 - Give the proper destination to GetSnapPointForDestination for ScrollUnit::WHOLE on the main-thread. r=botond
Now the proper destination is same as what we do for ScrollUnit::WHOLE [1].

With the proper points we no longer need special handlings in
CalcSnapPoints::AddEdge for ScrollUnit::WHOLE. In my sense the special handling
wasn't necessary though.

[1] https://searchfox.org/mozilla-central/rev/dc09246dfbfd8dafeb6d55ebee18a6294d525443/gfx/layers/apz/src/AsyncPanZoomController.cpp#2105-2112

Differential Revision: https://phabricator.services.mozilla.com/D145190
2022-05-12 07:45:58 +00:00
Hiroyuki Ikezoe 7377b1137e Bug 1766192 - Do snap-scope with the snapped point rather than the destination point. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D144533
2022-05-10 08:51:38 +00:00
Hiroyuki Ikezoe f089754755 Bug 1766192 - Introduce SnapTarget struct along with snap-area for each element. r=botond
In the next change we will use the snap-area to implement `snap-score`
properly.

Differential Revision: https://phabricator.services.mozilla.com/D144532
2022-05-10 08:51:37 +00:00
Hiroyuki Ikezoe 963a50d0dc Bug 1766192 - Choose the second best edge on the opposite side of the best edge. r=botond
The second best edge is used for `snap-overflow` feature [1]. The
`snap-overflow` is applied when the following conditions are met.
 1) A scroll snap target element is larger than the snapport (e.g. scrollport)
    in an axis
 2) The distance between the best edge and the second best edge (on the opposite
    side of the best edge) is later than the snapport size in the axis

There was a problem in our implementation. For example, in below diagram, D is
the original destination of the given scroll operation, 1 is the best edge, 2 is
the second best in our original implementation and 3 is of of the other snap
points. In this case if there's an element larger than the distance between 1
and 3 and if the snapport size is larger than the distance between 1 and 2 but
smaller than the distance between 1 and 3, we should apply `snap-overflow`.

2 1   D     3
|-|---|-----|

There are a couple of test cases in wpt for this condition, for example there's
one of them in oveflowing-snap-area.html [2]. That test case have been passed
incorrectly due to our incorrect `snap-scope` implementation which will be fixed
a subsequent change in this commit series.

[1] https://drafts.csswg.org/css-scroll-snap-1/#snap-overflow
[2] https://searchfox.org/mozilla-central/rev/13d69189a8abfc5064fe44944550b9b6eb4544f5/testing/web-platform/tests/css/css-scroll-snap/overflowing-snap-areas.html#131-137

Differential Revision: https://phabricator.services.mozilla.com/D144531
2022-05-10 08:51:37 +00:00
Hiroyuki Ikezoe 7928816636 Bug 1766192 - Drop CalcSnapPoints::AddEdgeInterval. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D144530
2022-05-10 08:51:37 +00:00
Kousuke Takaki 0aadd29347 Bug 1602088 - Move nsIScrollableFrame::ScrollUnit to namespace scope. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D61140
2020-01-30 09:13:19 +00:00
Cosmin Sabou 6294b7eab1 Backed out changeset 69fded25adc2 (bug 1602088) for causing several box-shadow reftest failures.
CLOSED TREE
2020-01-30 13:23:10 +02:00
Kousuke Takaki 6c93165901 Bug 1602088 - Move nsIScrollableFrame::ScrollUnit to namespace scope. r=botond
Differential Revision: https://phabricator.services.mozilla.com/D61140
2020-01-30 09:13:19 +00:00
Daniel Holbert bee0f244b9 Bug 1590639 part 1: Fix non-unified build issues in layout/generic. r=TYLin
The issues fall into these categories:
 - Files that used StaticPrefs::layout_XYZ() API or gfxVars::XYZ that needed an
   include. (Addressed by adding the missing include.)
 - Files that use mozilla::dom::XYZ or mozilla::gfx::XYZ without qualifying the
   namespace & without a 'using' decl. (Addressed by adding "using".)
 - A few other includes for types/inlines that were used without their header.

Depends on D50162

Differential Revision: https://phabricator.services.mozilla.com/D50163
2019-10-23 22:05:22 +00:00
Emilio Cobos Álvarez 8497cbfc10 Bug 1588743 - Remove old scroll-snap implementation, and scroll snapping prefs. r=hiro
Differential Revision: https://phabricator.services.mozilla.com/D49267
2019-10-15 12:40:14 +00:00
Coroiu Cristina 184ecf8f59 Backed out changeset 1a951477dca5 (bug 1588743) for xpcshell failures at devtools/shared/tests/unit/test_css-properties-db.js on a CLOSED TREE 2019-10-15 15:35:50 +03:00
Emilio Cobos Álvarez 66cf00147c Bug 1588743 - Remove old scroll-snap implementation, and scroll snapping prefs. r=hiro
Differential Revision: https://phabricator.services.mozilla.com/D49267
2019-10-15 11:39:30 +00:00