[carousel] Pin the selected scroll-marker for targeted scrolls #49802
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The CSS working group resolved[1] that when a scroll operation is aimed
at an element, i.e. Element.scrollIntoView, the associated
scroll-marker-group should select the active scroll-marker based on the
element which the operation is intending to scroll to. In such cases,
the scroll-marker that should be selected is the scroll-marker
associated with the first scroll target (a scroll target is an element
which generates a scroll-marker) found through a search starting from
the target of the scrollIntoView itself and backwards in tree-order.
As soon as some other type of scroll occurs, e.g. Element.scrollTo, or
a user gesture scroll, the scroll-marker-group should no longer
consider its active marker pinned, i.e. it should be based on the
scroll position.
This patch implements this for elements in general, but not for
::column pseudo elements which may also act as scroll targets since
::column::scroll-marker is allowed. The ::column case needs to be
handled specially as ::column pseudos are not parents of the elements
which are flowed into them in the DOM tree. This will be done in a
follow-up patch.
[1] w3c/csswg-drafts#10738 (comment)
Bug: 380062280
Change-Id: I363e0f055f9791ead0b35f4bbe037db91f299624
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/6089232
Reviewed-by: Steve Kobes <[email protected]>
Commit-Queue: David Awogbemila <[email protected]>
Cr-Commit-Position: refs/heads/main@{#1399197}