New issue
Advanced search Search tips

Issue 842317 link

Starred by 4 users

Issue metadata

Status: Started
Owner:
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 3
Type: Bug

Blocking:
issue 497851


Participants' hotlists:
Snap-Points-Post-Ship-Tasks


Sign in to add a comment

[css-scroll-snap] ScrollIntoView should always snap

Project Member Reported by majidvp@chromium.org, May 11 2018

Issue description

According to current decision, scrollIntoView should always snap regardless of whether it has alignment specific or not. [1]


High level, I think the behavior should do something like this:

1. run scrollIntoView algorithm to find out the destination scroll offset for each scroller involved in the operation ave satisfies the scroll into view alignments
2. run snap algorithm given on each snap container in that chain assuming the above offset and then decide the final offset
3. scroll to the final offset


I don't think this needs to be part of our Phase 1 roll out.

[1] https://github.com/w3c/csswg-drafts/issues/2593#issuecomment-386154394
 
Our current behavior is to ignore snapping altogether and satisfy the alignment requested by scrollIntoView
Cc: sunyunjia@chromium.org
 Issue 842311  has been merged into this issue.
BTW according to the specification Ua *may* even decide to snap even if the
snapping is not enabled. I am not so sure about this. Let's start with the
case where container has snap enabled and we can expand from there.


[1] https://drafts.csswg.org/css-scroll-snap/#choosing 
"The user agent may also do this even when the scroll container has scroll-snap-type: none." 

Status: Started (was: Assigned)
Project Member

Comment 5 by bugdroid1@chromium.org, Nov 9

The following revision refers to this bug:
  https://chromium.googlesource.com/chromium/src.git/+/5d46b77a0cba98e9f0c579d95d6a863045427f5e

commit 5d46b77a0cba98e9f0c579d95d6a863045427f5e
Author: Sandra Sun <sunyunjia@chromium.org>
Date: Fri Nov 09 23:15:00 2018

Snap at ScrollIntoView.

According to the spec,
https://github.com/w3c/csswg-drafts/issues/2593#issuecomment-386154394
scrollIntoView should
1) Always snap to the target element's snap alignment, and
2) All the affected scrollers should also land on a snap position if
one exists.

This patch does part 2). Before a scrollable_area is added to
the smoothScrollSequencer with its new scroll_offset, we will check if
it has a valid snap offset around, and update the final offset
accordingly.

We'll implement part 1) in a separate patch.

Bug: 842317
Cq-Include-Trybots: luci.chromium.try:linux_layout_tests_slimming_paint_v2;master.tryserver.blink:linux_trusty_blink_rel
Change-Id: Ica22134ed0b1f9d36f5a017c8dd0be54e907dd3d
Reviewed-on: https://chromium-review.googlesource.com/c/1188746
Reviewed-by: David Bokan <bokan@chromium.org>
Reviewed-by: Majid Valipour <majidvp@chromium.org>
Commit-Queue: Sandra Sun <sunyunjia@chromium.org>
Cr-Commit-Position: refs/heads/master@{#607019}
[add] https://crrev.com/5d46b77a0cba98e9f0c579d95d6a863045427f5e/third_party/WebKit/LayoutTests/external/wpt/css/css-scroll-snap/nested-scrollIntoView-snaps.html
[modify] https://crrev.com/5d46b77a0cba98e9f0c579d95d6a863045427f5e/third_party/blink/renderer/core/frame/root_frame_viewport.cc
[modify] https://crrev.com/5d46b77a0cba98e9f0c579d95d6a863045427f5e/third_party/blink/renderer/core/paint/paint_layer_scrollable_area.cc

Sign in to add a comment