Snap offsets should update when style is programmatically changed
authorwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Sep 2015 22:56:20 +0000 (22:56 +0000)
committerwenson_hsieh@apple.com <wenson_hsieh@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 29 Sep 2015 22:56:20 +0000 (22:56 +0000)
commitebeb727cab24661da8311b3fe45800770399b061
treefeab3ef9db31e467e7ede50ec9f0ea46ec5a6369
parentbf48b4a146fa0417c8683a01eaefe9dab8d2187e
Snap offsets should update when style is programmatically changed
https://bugs.webkit.org/show_bug.cgi?id=135964
<rdar://problem/18162411>

Reviewed by Darin Adler.

Source/WebCore:

Tests:  css3/scroll-snap/scroll-snap-style-changed-coordinates.html
        css3/scroll-snap/scroll-snap-style-changed-repeat.html

Updating scroll snap style properties now programmatically updates the scroll snap container. Does not yet
handle the case of reparented elements with scroll snap coordinates. Adds some plumbing the FrameView and
RenderLayerCompositor to immediately update the scrolling coordinator when updating the FrameView due to
style changes.

* page/FrameView.cpp:
(WebCore::FrameView::updateScrollingCoordinatorScrollSnapProperties): Calls on the compositor to reupdate scroll snap
    properties on the FrameView.
* page/FrameView.h:
* page/scrolling/AsyncScrollingCoordinator.cpp: Sets snap offsets to an empty vector when appropriate.
(WebCore::setStateScrollingNodeSnapOffsetsAsFloat): Ditto.
(WebCore::AsyncScrollingCoordinator::frameViewLayoutUpdated): Ditto.
(WebCore::AsyncScrollingCoordinator::updateOverflowScrollingNode): Ditto.
(WebCore::AsyncScrollingCoordinator::updateScrollSnapPropertiesWithFrameView): Updates scroll snap properties
    from a given FrameView.
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::updateScrollSnapPropertiesWithFrameView):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::updateScrollSnapPropertiesWithFrameView): Updates the scrolling coordinator's
    scroll snap properties.
* rendering/RenderLayerCompositor.h: Plumb scroll snap property updating to the FrameView.
* rendering/RenderLayerModelObject.cpp: Checks for style changes and updates snap offsets when appropriate.
(WebCore::scrollSnapContainerRequiresUpdateForStyleUpdate): Ditto.
(WebCore::RenderLayerModelObject::styleDidChange): Ditto.

LayoutTests:

Tests style updates in both cases where -points and -coordinates are used to position snap points.

* css3/scroll-snap/scroll-snap-style-changed-coordinates-expected.txt: Added.
* css3/scroll-snap/scroll-snap-style-changed-coordinates.html: Added.
* css3/scroll-snap/scroll-snap-style-changed-repeat-expected.txt: Added.
* css3/scroll-snap/scroll-snap-style-changed-repeat.html: Added.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@190330 268f45cc-cd09-0410-ab3c-d52691b4dbfc
14 files changed:
LayoutTests/ChangeLog
LayoutTests/css3/scroll-snap/scroll-snap-style-changed-coordinates-expected.txt [new file with mode: 0644]
LayoutTests/css3/scroll-snap/scroll-snap-style-changed-coordinates.html [new file with mode: 0644]
LayoutTests/css3/scroll-snap/scroll-snap-style-changed-repeat-expected.txt [new file with mode: 0644]
LayoutTests/css3/scroll-snap/scroll-snap-style-changed-repeat.html [new file with mode: 0644]
Source/WebCore/ChangeLog
Source/WebCore/page/FrameView.cpp
Source/WebCore/page/FrameView.h
Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp
Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h
Source/WebCore/page/scrolling/ScrollingCoordinator.h
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebCore/rendering/RenderLayerCompositor.h
Source/WebCore/rendering/RenderLayerModelObject.cpp