New issue
Advanced search Search tips

Issue 803606 link

Starred by 1 user

Issue metadata

Status: Fixed
Owner:
Closed: Mar 2018
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: ----
Pri: 2
Type: Bug

Blocking:
issue 497851



Sign in to add a comment

Programmatic scrolls should take ScrollSnapPoints properties into account.

Project Member Reported by sunyunjia@chromium.org, Jan 18 2018

Issue description

According to the spec, https://www.w3.org/TR/css-scroll-snap-1/, :target/scrollIntoView()/etc should take scroll-margin, scroll-padding into account,
and if that element defines some snap positions, the user agent must snap to one of that element’s snap positions if its nearest scroll container is a scroll snap container.


 
Help
Summary: Programmatic scrolls should take ScrollSnapPoints properties into account. (was: ScrollIntoView should take ScrollSnapPoints properties into account.)
Project Member

Comment 3 by bugdroid1@chromium.org, Jan 29 2018

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

commit af66ebcd045e4ea75e4cb09de214dee9cab73563
Author: Sandra Sun <sunyunjia@chromium.org>
Date: Mon Jan 29 21:08:43 2018

ScrollIntoView() should take scroll-margin into account.

According to the spec, https://www.w3.org/TR/css-scroll-snap-1/,
:target/scrollIntoView()/etc should take scroll-margin, into account.

Currently in ContainerNode, BoundingBox() is calculated from its
UpperLeftCorner and LowerRightCorner. This patch move the logic to
LayoutObject and keeps the wrapper in ContainerNode.

When the rect is needed for ScrollIntoView, these two points might be
generated from different LayoutBoxes, and we should apply the
scroll-margin accordingly. We put these together into a new method -
LayoutObject::AbsoluteBoundingBoxRectForScrollIntoView() and wrap it as
Node::BoundingBoxForScrollIntoView().

Bug:  803606 
Change-Id: I9002d6148fe8ed8f0851fa213431bd6260b993bb
Reviewed-on: https://chromium-review.googlesource.com/877444
Commit-Queue: Sandra Sun <sunyunjia@chromium.org>
Reviewed-by: David Bokan <bokan@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532589}
[add] https://crrev.com/af66ebcd045e4ea75e4cb09de214dee9cab73563/third_party/WebKit/LayoutTests/external/wpt/css/cssom-view/scrollIntoView-scrollMargin.html
[modify] https://crrev.com/af66ebcd045e4ea75e4cb09de214dee9cab73563/third_party/WebKit/Source/core/dom/ContainerNode.cpp
[modify] https://crrev.com/af66ebcd045e4ea75e4cb09de214dee9cab73563/third_party/WebKit/Source/core/dom/ContainerNode.h
[modify] https://crrev.com/af66ebcd045e4ea75e4cb09de214dee9cab73563/third_party/WebKit/Source/core/dom/Element.cpp
[modify] https://crrev.com/af66ebcd045e4ea75e4cb09de214dee9cab73563/third_party/WebKit/Source/core/dom/Node.cpp
[modify] https://crrev.com/af66ebcd045e4ea75e4cb09de214dee9cab73563/third_party/WebKit/Source/core/dom/Node.h
[modify] https://crrev.com/af66ebcd045e4ea75e4cb09de214dee9cab73563/third_party/WebKit/Source/core/exported/WebViewImpl.cpp
[modify] https://crrev.com/af66ebcd045e4ea75e4cb09de214dee9cab73563/third_party/WebKit/Source/core/frame/LocalFrameView.cpp
[modify] https://crrev.com/af66ebcd045e4ea75e4cb09de214dee9cab73563/third_party/WebKit/Source/core/html/forms/HTMLInputElement.cpp
[modify] https://crrev.com/af66ebcd045e4ea75e4cb09de214dee9cab73563/third_party/WebKit/Source/core/html/forms/HTMLSelectElement.cpp
[modify] https://crrev.com/af66ebcd045e4ea75e4cb09de214dee9cab73563/third_party/WebKit/Source/core/layout/LayoutObject.cpp
[modify] https://crrev.com/af66ebcd045e4ea75e4cb09de214dee9cab73563/third_party/WebKit/Source/core/layout/LayoutObject.h

Project Member

Comment 4 by bugdroid1@chromium.org, Jan 29 2018

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

commit 7f9b9c152595c29f78d1f502d221f056f1ff6b82
Author: Sandra Sun <sunyunjia@chromium.org>
Date: Mon Jan 29 23:40:14 2018

ScrollIntoView() should take scroll-padding into account

According to the spec, https://www.w3.org/TR/css-scroll-snap-1/,
:target/scrollIntoView()/etc should take scroll-margin, into account.

This patch also unifies the logic of ScrollIntoView() in PaintLayerScrollableArea,
LocalFrameView and RootFrameViewport, so that the new_scroll_offset is calcultated
directly by ScrollAlignment::GetScrollOffsetToExpose()


Bug:  803606 
Cq-Include-Trybots: master.tryserver.blink:linux_trusty_blink_rel;master.tryserver.chromium.linux:linux_layout_tests_slimming_paint_v2
Change-Id: Ie790bc58f7dcc0a2744768ddca0d07b24bbf6681
Reviewed-on: https://chromium-review.googlesource.com/875008
Reviewed-by: Jeremy Roman <jbroman@chromium.org>
Reviewed-by: David Bokan <bokan@chromium.org>
Commit-Queue: Sandra Sun <sunyunjia@chromium.org>
Cr-Commit-Position: refs/heads/master@{#532660}
[add] https://crrev.com/7f9b9c152595c29f78d1f502d221f056f1ff6b82/third_party/WebKit/LayoutTests/external/wpt/css/cssom-view/scrollIntoView-scrollPadding.html
[modify] https://crrev.com/7f9b9c152595c29f78d1f502d221f056f1ff6b82/third_party/WebKit/Source/core/BUILD.gn
[modify] https://crrev.com/7f9b9c152595c29f78d1f502d221f056f1ff6b82/third_party/WebKit/Source/core/dom/Document.cpp
[modify] https://crrev.com/7f9b9c152595c29f78d1f502d221f056f1ff6b82/third_party/WebKit/Source/core/frame/LocalFrameView.cpp
[modify] https://crrev.com/7f9b9c152595c29f78d1f502d221f056f1ff6b82/third_party/WebKit/Source/core/frame/LocalFrameView.h
[modify] https://crrev.com/7f9b9c152595c29f78d1f502d221f056f1ff6b82/third_party/WebKit/Source/core/frame/RootFrameViewport.cpp
[modify] https://crrev.com/7f9b9c152595c29f78d1f502d221f056f1ff6b82/third_party/WebKit/Source/core/frame/RootFrameViewport.h
[rename] https://crrev.com/7f9b9c152595c29f78d1f502d221f056f1ff6b82/third_party/WebKit/Source/core/page/scrolling/ScrollIntoViewTest.cpp
[modify] https://crrev.com/7f9b9c152595c29f78d1f502d221f056f1ff6b82/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.cpp
[modify] https://crrev.com/7f9b9c152595c29f78d1f502d221f056f1ff6b82/third_party/WebKit/Source/core/paint/PaintLayerScrollableArea.h
[modify] https://crrev.com/7f9b9c152595c29f78d1f502d221f056f1ff6b82/third_party/WebKit/Source/platform/scroll/ScrollAlignment.cpp
[modify] https://crrev.com/7f9b9c152595c29f78d1f502d221f056f1ff6b82/third_party/WebKit/Source/platform/scroll/ScrollAlignment.h
[modify] https://crrev.com/7f9b9c152595c29f78d1f502d221f056f1ff6b82/third_party/WebKit/Source/platform/scroll/ScrollableArea.h

Project Member

Comment 5 by bugdroid1@chromium.org, Mar 1 2018

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

commit 44a35a8862518bf15dee815406690dac477d1db6
Author: Sandra Sun <sunyunjia@chromium.org>
Date: Thu Mar 01 15:54:17 2018

scrollTo and scrollBy should land on snap points.

According to spec,
https://drafts.csswg.org/css-scroll-snap-1/#scroll-types,
programmatically scrolling such as scrollTo and scrollBy should land on
snap points.

Bug:  803606 
Change-Id: I1e70d88f31a2b2f93c92cc063adf653ed923adeb
Reviewed-on: https://chromium-review.googlesource.com/889936
Reviewed-by: David Bokan <bokan@chromium.org>
Commit-Queue: Sandra Sun <sunyunjia@chromium.org>
Cr-Commit-Position: refs/heads/master@{#540166}
[add] https://crrev.com/44a35a8862518bf15dee815406690dac477d1db6/third_party/WebKit/LayoutTests/external/wpt/css/css-scroll-snap/scrollTo-scrollBy-snaps.html
[modify] https://crrev.com/44a35a8862518bf15dee815406690dac477d1db6/third_party/WebKit/Source/core/dom/Element.cpp
[modify] https://crrev.com/44a35a8862518bf15dee815406690dac477d1db6/third_party/WebKit/Source/core/frame/LocalDOMWindow.cpp
[modify] https://crrev.com/44a35a8862518bf15dee815406690dac477d1db6/third_party/WebKit/Source/core/frame/LocalDOMWindow.h
[modify] https://crrev.com/44a35a8862518bf15dee815406690dac477d1db6/third_party/WebKit/Source/core/input/ScrollSnapTest.cpp
[modify] https://crrev.com/44a35a8862518bf15dee815406690dac477d1db6/third_party/WebKit/Source/core/page/scrolling/SnapCoordinator.cpp
[modify] https://crrev.com/44a35a8862518bf15dee815406690dac477d1db6/third_party/WebKit/Source/core/page/scrolling/SnapCoordinator.h
[modify] https://crrev.com/44a35a8862518bf15dee815406690dac477d1db6/third_party/WebKit/Source/core/page/scrolling/SnapCoordinatorTest.cpp

Blocking: 497851
Status: Fixed (was: Started)
I believe this is fixed. sunyunjia@ please re-open if anywork is left here.

Sign in to add a comment