Implement scroll-snap-align property
Categories
(Core :: CSS Parsing and Computation, enhancement, P3)
Tracking
()
People
(Reporter: sebo, Assigned: hiro)
References
(Blocks 1 open bug, )
Details
(Keywords: dev-doc-complete)
Attachments
(10 files, 1 obsolete file)
|
47 bytes,
text/x-phabricator-request
|
Details | |
|
47 bytes,
text/x-phabricator-request
|
Details | |
|
47 bytes,
text/x-phabricator-request
|
Details | |
|
47 bytes,
text/x-phabricator-request
|
Details | |
|
47 bytes,
text/x-phabricator-request
|
Details | |
|
47 bytes,
text/x-phabricator-request
|
Details | |
|
47 bytes,
text/x-phabricator-request
|
Details | |
|
47 bytes,
text/x-phabricator-request
|
Details | |
|
47 bytes,
text/x-phabricator-request
|
Details | |
|
47 bytes,
text/x-phabricator-request
|
Details |
Updated•8 years ago
|
Updated•8 years ago
|
| Assignee | ||
Updated•7 years ago
|
| Assignee | ||
Comment 1•7 years ago
|
||
The right top element is positioned at left:1000px and its width is 600px and
the width of the largest element in the content is 2100px. So if the browser
window width (precisely documentElement clientWidth) is greater than 1100px, the
right top element is not suitable for scroll-snap-align:start, thus some test
cases fail.
| Assignee | ||
Comment 2•7 years ago
|
||
Given the test description is mentioning scrollBy, scrollBy should be used
there.
Depends on D21623
| Assignee | ||
Comment 3•7 years ago
|
||
From the spec [1];
Using the scroll-snap-type property on the relevant scroll container, the
author can request a particular bias for the scrollport to land on a snap
position after scrolling operations (including programmatic scrolls such
as the scrollTo() method).
The target here are functions exposed in web contents other than
Element.scrollIntoView which will be changed in the next commit.
[1] https://drafts.csswg.org/css-scroll-snap-1/#overview
Depends on D21624
| Assignee | ||
Comment 4•7 years ago
|
||
Depends on D21625
| Assignee | ||
Comment 5•7 years ago
|
||
Depends on D21626
| Assignee | ||
Comment 6•7 years ago
|
||
https://drafts.csswg.org/css-scroll-snap-1/#scroll-snap-align
The main logic here is basically same as the old scroll snap implementation,
just iterating over all descendant elements in the scroll container and collect
snap positions. The differences are;
- the snap positions are specified based on descendant elements instead of
points - the snap positions are able to be specified by
blockorinlinekeywords
so that we also need to care the element flow.
more test cases for this are coming in the next commit - the target rect is calculated by nsLayoutUtils::TransformFrameRectToAncestor
which means transform is already taken account into it (we have a bug for
the old scroll snap, it's bug 1218745)
some of web platform tests will be added in a subsequent commit
Some of test cases in overflowing-snap-areas.html that accidentally have
passed start failing with this change, all of them will be passed with
subsequent changes in these commit series.
Depends on D21627
| Assignee | ||
Comment 7•7 years ago
|
||
Depends on D21628
| Assignee | ||
Comment 8•7 years ago
|
||
Depends on D21629
| Assignee | ||
Comment 9•7 years ago
|
||
The snap alignment position of the target element is the top left of the target
and the position is located out of scroll port (top: -100px, left: -100px).
Even so we try to snap a position as much as possible.
From the spec [1];
If a snap position is unreachable as specified, such that aligning to it would
require scrolling the scroll container’s viewport past the edge of its
scrollable overflow region, the used snap position for this snap area is the
position resulting from scrolling as much as possible in each relevant axis
toward the desired snap position.
[1] https://drafts.csswg.org/css-scroll-snap-1/#unreachabLe
Depends on D21630
| Assignee | ||
Comment 10•7 years ago
|
||
https://drafts.csswg.org/css-scroll-snap-1/#snap-overflow
Depends on D21631
| Assignee | ||
Comment 11•7 years ago
|
||
As for scrolling on the compositor we don't cull out them since we don't know
the final snapport rect at the time when we send the information about
snapping to the compositor. And we will handle it for APZ in bug 1531589.
https://drafts.csswg.org/css-scroll-snap-1/#snap-scope
Depends on D21632
| Assignee | ||
Comment 12•7 years ago
|
||
Jonathan, would you mind taking a look at attachment 9047570 [details] and attachment 9047571 [details] in terms of RTL? Especially about https://phabricator.services.mozilla.com/D21628#612388 .
Updated•7 years ago
|
Updated•7 years ago
|
Comment 13•7 years ago
|
||
Comment 14•7 years ago
|
||
| bugherder | ||
https://hg.mozilla.org/mozilla-central/rev/a85948af4c36
https://hg.mozilla.org/mozilla-central/rev/9d201f2c3279
https://hg.mozilla.org/mozilla-central/rev/ab5811341092
https://hg.mozilla.org/mozilla-central/rev/2e7cebd9ed56
https://hg.mozilla.org/mozilla-central/rev/15f5d6a74247
https://hg.mozilla.org/mozilla-central/rev/bd7f3fa1efbd
https://hg.mozilla.org/mozilla-central/rev/d4682a804eba
https://hg.mozilla.org/mozilla-central/rev/29466eb6ee25
https://hg.mozilla.org/mozilla-central/rev/335307e3cca3
https://hg.mozilla.org/mozilla-central/rev/11ce2cf9d66c
Updated•6 years ago
|
Comment 17•6 years ago
|
||
This is documented and a note added to the 68 release notes https://developer.mozilla.org/en-US/docs/Web/CSS/scroll-snap-align
Description
•