Title: [208662] trunk
Revision
208662
Author
[email protected]
Date
2016-11-12 19:24:27 -0800 (Sat, 12 Nov 2016)

Log Message

[iOS WK2] Share some code with Mac for post-async-scroll state reconciliation
https://bugs.webkit.org/show_bug.cgi?id=164694

Reviewed by Zalan Bujtas.

Source/WebCore:

When an async scroll notifications get back to the main thread in
AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(), we call
syncViewportConstrainedLayerPositions() to poke the new layer positions on the
GraphicsLayers to match the changes made on the scrolling thread.

However, this was not done on iOS, which will be problematic for a future patch
where we require GraphicsLayer positions and the current fixedPositionViewport rect
to have been computed when in a consistent state.

Fix by factoring some code into reconcileScrollingState(), which is called on iOS/WK2
from WebPage::updateVisibleContentRects() rather than setting the FrameView's scroll offset
directly.

Test: scrollingcoordinator/ios/sync-layer-positions-after-scroll.html

* page/WheelEventDeltaFilter.cpp:
(WebCore::WheelEventDeltaFilter::filteredDelta):
* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
(WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
(WebCore::AsyncScrollingCoordinator::syncViewportConstrainedLayerPositions):
(WebCore::AsyncScrollingCoordinator::syncChildPositions): Deleted.
* page/scrolling/AsyncScrollingCoordinator.h:
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::reconcileScrollingState):
(WebCore::ScrollingCoordinator::syncViewportConstrainedLayerPositions):
(WebCore::ScrollingCoordinator::syncChildPositions): Deleted.
* page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
(WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition):
* platform/Logging.h:
* platform/ScrollView.cpp:
(WebCore::ScrollView::setScrollOffset):
* platform/graphics/ca/TileController.cpp:
(WebCore::TileController::adjustTileCoverageRect):
* rendering/RenderLayer.cpp:
(WebCore::RenderLayer::updateLayerPositionsAfterDocumentScroll):

Source/WebKit2:

Rather than calling FrameView directly, call reconcileScrollingState() on the scrolling
coordinator.

* WebProcess/WebPage/ios/WebPageIOS.mm:
(WebKit::WebPage::updateVisibleContentRects):

LayoutTests:

Test that pans the page, and dumps GraphicsLayers before letting go.

* TestExpectations:
* platform/ios-simulator-wk2/TestExpectations:
* scrollingcoordinator/ios/sync-layer-positions-after-scroll-expected.txt: Added.
* scrollingcoordinator/ios/sync-layer-positions-after-scroll.html: Added.

Modified Paths

Added Paths

Diff

Modified: trunk/LayoutTests/ChangeLog (208661 => 208662)


--- trunk/LayoutTests/ChangeLog	2016-11-13 03:08:52 UTC (rev 208661)
+++ trunk/LayoutTests/ChangeLog	2016-11-13 03:24:27 UTC (rev 208662)
@@ -1,3 +1,17 @@
+2016-11-12  Simon Fraser  <[email protected]>
+
+        [iOS WK2] Share some code with Mac for post-async-scroll state reconciliation
+        https://bugs.webkit.org/show_bug.cgi?id=164694
+
+        Reviewed by Zalan Bujtas.
+
+        Test that pans the page, and dumps GraphicsLayers before letting go.
+
+        * TestExpectations:
+        * platform/ios-simulator-wk2/TestExpectations:
+        * scrollingcoordinator/ios/sync-layer-positions-after-scroll-expected.txt: Added.
+        * scrollingcoordinator/ios/sync-layer-positions-after-scroll.html: Added.
+
 2016-11-12  Frederic Wang  <[email protected]>
 
         Ensure MathML render tree are clean by the end of FrameView::layout().

Modified: trunk/LayoutTests/TestExpectations (208661 => 208662)


--- trunk/LayoutTests/TestExpectations	2016-11-13 03:08:52 UTC (rev 208661)
+++ trunk/LayoutTests/TestExpectations	2016-11-13 03:24:27 UTC (rev 208662)
@@ -23,6 +23,7 @@
 fast/events/ios [ Skip ]
 fast/events/touch/ios [ Skip ]
 fast/scrolling/ios [ Skip ]
+scrollingcoordinator/ios [ Skip ]
 fast/content-observation [ Skip ]
 media/mac [ Skip ]
 media/controls/ipad [ Skip ]

Modified: trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations (208661 => 208662)


--- trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2016-11-13 03:08:52 UTC (rev 208661)
+++ trunk/LayoutTests/platform/ios-simulator-wk2/TestExpectations	2016-11-13 03:24:27 UTC (rev 208662)
@@ -8,6 +8,7 @@
 
 fast/scrolling/ios [ Pass ]
 fast/viewport/ios [ Pass ]
+scrollingcoordinator/ios [ Pass ]
 editing/selection/character-granularity-rect.html [ Pass ]
 
 #//////////////////////////////////////////////////////////////////////////////////////////

Added: trunk/LayoutTests/scrollingcoordinator/ios/sync-layer-positions-after-scroll-expected.txt (0 => 208662)


--- trunk/LayoutTests/scrollingcoordinator/ios/sync-layer-positions-after-scroll-expected.txt	                        (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/ios/sync-layer-positions-after-scroll-expected.txt	2016-11-13 03:24:27 UTC (rev 208662)
@@ -0,0 +1,19 @@
+visibleRectAfterScroll: {"left":0,"top":156.5,"width":800,"height":600}
+(GraphicsLayer
+  (anchor 0.00 0.00)
+  (bounds 1308.00 2021.00)
+  (children 1
+    (GraphicsLayer
+      (bounds 1308.00 2021.00)
+      (contentsOpaque 1)
+      (children 1
+        (GraphicsLayer
+          (position 12.00 10.00)
+          (bounds 100.00 100.00)
+          (contentsOpaque 1)
+        )
+      )
+    )
+  )
+)
+

Added: trunk/LayoutTests/scrollingcoordinator/ios/sync-layer-positions-after-scroll.html (0 => 208662)


--- trunk/LayoutTests/scrollingcoordinator/ios/sync-layer-positions-after-scroll.html	                        (rev 0)
+++ trunk/LayoutTests/scrollingcoordinator/ios/sync-layer-positions-after-scroll.html	2016-11-13 03:24:27 UTC (rev 208662)
@@ -0,0 +1,120 @@
+<!DOCTYPE html>
+
+<html>
+<head>
+    <style>
+        body {
+            width: 1300px;
+            height: 2000px;
+        }
+        
+        .fixed {
+            position: fixed;
+            top: 10px;
+            left: 12px;
+            height: 100px;
+            width: 100px;
+            background-color: blue;
+        }
+    </style>
+    <script>
+        if (window.testRunner) {
+            testRunner.waitUntilDone();
+            testRunner.dumpAsText();
+        }
+
+        function getDragUIScript(startX, startY, endX, endY)
+        {
+            return `(function() {
+                var movedFingerDownStream = {
+                    events : [
+                        {
+                            inputType : "hand",
+                            timeOffset : 0,
+                            touches : [
+                                {
+                                    inputType : "finger",
+                                    phase : "began",
+                                    id : 1,
+                                    x : ${startX},
+                                    y : ${startY}
+                                }
+                            ]
+                        },
+                        {
+                            interpolate : "linear",
+                            timestep: 0.025,
+                            startEvent : {
+                                inputType : "hand",
+                                timeOffset : 0,
+                                touches : [
+                                    {
+                                        inputType : "finger",
+                                        phase : "moved",
+                                        id : 1,
+                                        x : ${startX},
+                                        y : ${startY}
+                                    }
+                                ]
+                            },
+                            endEvent : {
+                                inputType : "hand",
+                                timeOffset : 0.15,
+                                touches : [
+                                    {
+                                        inputType : "finger",
+                                        phase : "moved",
+                                        id : 1,
+                                        x : ${endX},
+                                        y : ${endY}
+                                    }
+                                ]
+                            }
+                        }
+                    ]
+                };
+
+                uiController.sendEventStream(JSON.stringify(movedFingerDownStream), function() {
+                    uiController.uiScriptComplete(JSON.stringify(uiController.contentVisibleRect));
+                });
+            })();`;
+        }
+
+        function getFingerUpUIScript(x, y)
+        {
+            return `(function() {
+                uiController.liftUpAtPoint(${x}, ${y}, 1, function() {
+                    uiController.uiScriptComplete('');
+                });
+            })();`;
+        }
+
+        function doTest()
+        {
+            if (!testRunner.runUIScript)
+                return
+
+            window.setTimeout(function() {
+                var xPos = 100;
+                var startY = 300;
+                var endY = 100;
+                // Send touch down and moves (keep the finger down).
+                testRunner.runUIScript(getDragUIScript(xPos, startY, xPos, endY), function(visibleRectAfterScroll) {
+                    var result = 'visibleRectAfterScroll: ' + visibleRectAfterScroll + '\n' + internals.layerTreeAsText(document);
+                    document.getElementById('layers').textContent = result;
+                    // Now send the finel touch up.
+                    testRunner.runUIScript(getFingerUpUIScript(xPos, endY), function() {
+                        testRunner.notifyDone();
+                    });
+                });
+            }, 0);
+        }
+        
+        window.addEventListener('load', doTest, false);
+    </script>
+</head>
+<body>
+<div class="fixed"></div>
+<pre id="layers"></pre>
+</body>
+</html>

Modified: trunk/Source/WebCore/ChangeLog (208661 => 208662)


--- trunk/Source/WebCore/ChangeLog	2016-11-13 03:08:52 UTC (rev 208661)
+++ trunk/Source/WebCore/ChangeLog	2016-11-13 03:24:27 UTC (rev 208662)
@@ -1,3 +1,47 @@
+2016-11-12  Simon Fraser  <[email protected]>
+
+        [iOS WK2] Share some code with Mac for post-async-scroll state reconciliation
+        https://bugs.webkit.org/show_bug.cgi?id=164694
+
+        Reviewed by Zalan Bujtas.
+
+        When an async scroll notifications get back to the main thread in
+        AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll(), we call 
+        syncViewportConstrainedLayerPositions() to poke the new layer positions on the
+        GraphicsLayers to match the changes made on the scrolling thread.
+
+        However, this was not done on iOS, which will be problematic for a future patch
+        where we require GraphicsLayer positions and the current fixedPositionViewport rect
+        to have been computed when in a consistent state.
+
+        Fix by factoring some code into reconcileScrollingState(), which is called on iOS/WK2
+        from WebPage::updateVisibleContentRects() rather than setting the FrameView's scroll offset
+        directly.
+
+        Test: scrollingcoordinator/ios/sync-layer-positions-after-scroll.html
+
+        * page/WheelEventDeltaFilter.cpp:
+        (WebCore::WheelEventDeltaFilter::filteredDelta):
+        * page/scrolling/AsyncScrollingCoordinator.cpp:
+        (WebCore::AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll):
+        (WebCore::AsyncScrollingCoordinator::reconcileScrollingState):
+        (WebCore::AsyncScrollingCoordinator::syncViewportConstrainedLayerPositions):
+        (WebCore::AsyncScrollingCoordinator::syncChildPositions): Deleted.
+        * page/scrolling/AsyncScrollingCoordinator.h:
+        * page/scrolling/ScrollingCoordinator.h:
+        (WebCore::ScrollingCoordinator::reconcileScrollingState):
+        (WebCore::ScrollingCoordinator::syncViewportConstrainedLayerPositions):
+        (WebCore::ScrollingCoordinator::syncChildPositions): Deleted.
+        * page/scrolling/ScrollingTreeFrameScrollingNode.cpp:
+        (WebCore::ScrollingTreeFrameScrollingNode::layoutViewportForScrollPosition):
+        * platform/Logging.h:
+        * platform/ScrollView.cpp:
+        (WebCore::ScrollView::setScrollOffset):
+        * platform/graphics/ca/TileController.cpp:
+        (WebCore::TileController::adjustTileCoverageRect):
+        * rendering/RenderLayer.cpp:
+        (WebCore::RenderLayer::updateLayerPositionsAfterDocumentScroll):
+
 2016-11-12  Zalan Bujtas  <[email protected]>
 
         RenderObject::flowThreadState should follow containing block instead of parent.

Modified: trunk/Source/WebCore/page/WheelEventDeltaFilter.cpp (208661 => 208662)


--- trunk/Source/WebCore/page/WheelEventDeltaFilter.cpp	2016-11-13 03:08:52 UTC (rev 208661)
+++ trunk/Source/WebCore/page/WheelEventDeltaFilter.cpp	2016-11-13 03:24:27 UTC (rev 208662)
@@ -60,7 +60,6 @@
 
 FloatSize WheelEventDeltaFilter::filteredDelta() const
 {
-    LOG_WITH_STREAM(Scrolling, stream << "BasicWheelEventDeltaFilter::filteredDelta returning " << m_currentFilteredDelta);
     return m_currentFilteredDelta;
 }
 

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp (208661 => 208662)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2016-11-13 03:08:52 UTC (rev 208661)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp	2016-11-13 03:24:27 UTC (rev 208662)
@@ -44,6 +44,7 @@
 #include "ScrollingStateStickyNode.h"
 #include "ScrollingStateTree.h"
 #include "Settings.h"
+#include "TextStream.h"
 #include "WheelEventTestTrigger.h"
 
 namespace WebCore {
@@ -307,75 +308,13 @@
     if (!frameViewPtr)
         return;
 
+    LOG_WITH_STREAM(Scrolling, stream << "AsyncScrollingCoordinator::updateScrollPositionAfterAsyncScroll node " << scrollingNodeID << " scrollPosition " << scrollPosition << (scrollingLayerPositionAction == SetScrollingLayerPosition ? " set" : " sync") << " layer positions");
+
     FrameView& frameView = *frameViewPtr;
 
     if (scrollingNodeID == frameView.scrollLayerID()) {
-        bool oldProgrammaticScroll = frameView.inProgrammaticScroll();
-        frameView.setInProgrammaticScroll(programmaticScroll);
+        reconcileScrollingState(frameView, scrollPosition, layoutViewportOrigin, programmaticScroll, scrollingLayerPositionAction);
 
-        if (layoutViewportOrigin)
-            frameView.setLayoutViewportOrigin(LayoutPoint(layoutViewportOrigin.value()), FrameView::TriggerLayoutOrNot::No);
-
-        frameView.setConstrainsScrollingToContentEdge(false);
-        frameView.notifyScrollPositionChanged(roundedIntPoint(scrollPosition));
-        frameView.setConstrainsScrollingToContentEdge(true);
-        frameView.setInProgrammaticScroll(oldProgrammaticScroll);
-
-        if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) {
-            GraphicsLayer* counterScrollingLayer = counterScrollingLayerForFrameView(frameView);
-            GraphicsLayer* insetClipLayer = insetClipLayerForFrameView(frameView);
-            GraphicsLayer* contentShadowLayer = contentShadowLayerForFrameView(frameView);
-            GraphicsLayer* scrolledContentsLayer = rootContentLayerForFrameView(frameView);
-            GraphicsLayer* headerLayer = headerLayerForFrameView(frameView);
-            GraphicsLayer* footerLayer = footerLayerForFrameView(frameView);
-
-            ASSERT(frameView.scrollPosition() == roundedIntPoint(scrollPosition));
-            LayoutPoint scrollPositionForFixed = visualViewportEnabled() ? frameView.layoutViewportOrigin() : frameView.scrollPositionForFixedPosition();
-            float topContentInset = frameView.topContentInset();
-
-            FloatPoint positionForInsetClipLayer;
-            if (insetClipLayer)
-                positionForInsetClipLayer = FloatPoint(insetClipLayer->position().x(), FrameView::yPositionForInsetClipLayer(scrollPosition, topContentInset));
-            FloatPoint positionForContentsLayer = frameView.positionForRootContentLayer();
-            
-            FloatPoint positionForHeaderLayer = FloatPoint(scrollPositionForFixed.x(), FrameView::yPositionForHeaderLayer(scrollPosition, topContentInset));
-            FloatPoint positionForFooterLayer = FloatPoint(scrollPositionForFixed.x(),
-                FrameView::yPositionForFooterLayer(scrollPosition, topContentInset, frameView.totalContentsSize().height(), frameView.footerHeight()));
-
-            if (programmaticScroll || scrollingLayerPositionAction == SetScrollingLayerPosition) {
-                scrollLayer->setPosition(-frameView.scrollPosition());
-                if (counterScrollingLayer)
-                    counterScrollingLayer->setPosition(scrollPositionForFixed);
-                if (insetClipLayer)
-                    insetClipLayer->setPosition(positionForInsetClipLayer);
-                if (contentShadowLayer)
-                    contentShadowLayer->setPosition(positionForContentsLayer);
-                if (scrolledContentsLayer)
-                    scrolledContentsLayer->setPosition(positionForContentsLayer);
-                if (headerLayer)
-                    headerLayer->setPosition(positionForHeaderLayer);
-                if (footerLayer)
-                    footerLayer->setPosition(positionForFooterLayer);
-            } else {
-                scrollLayer->syncPosition(-frameView.scrollPosition());
-                if (counterScrollingLayer)
-                    counterScrollingLayer->syncPosition(scrollPositionForFixed);
-                if (insetClipLayer)
-                    insetClipLayer->syncPosition(positionForInsetClipLayer);
-                if (contentShadowLayer)
-                    contentShadowLayer->syncPosition(positionForContentsLayer);
-                if (scrolledContentsLayer)
-                    scrolledContentsLayer->syncPosition(positionForContentsLayer);
-                if (headerLayer)
-                    headerLayer->syncPosition(positionForHeaderLayer);
-                if (footerLayer)
-                    footerLayer->syncPosition(positionForFooterLayer);
-
-                LayoutRect viewportRect = frameView.rectForFixedPositionLayout();
-                syncChildPositions(viewportRect);
-            }
-        }
-
 #if PLATFORM(COCOA)
         if (m_page->expectsWheelEventTriggers()) {
             frameView.scrollAnimator().setWheelEventTestTrigger(m_page->testTrigger());
@@ -405,6 +344,88 @@
     }
 }
 
+void AsyncScrollingCoordinator::reconcileScrollingState(FrameView& frameView, const FloatPoint& scrollPosition, const LayoutViewportOriginOrOverrideRect& layoutViewportOriginOrOverrideRect, bool programmaticScroll, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
+{
+    bool oldProgrammaticScroll = frameView.inProgrammaticScroll();
+    frameView.setInProgrammaticScroll(programmaticScroll);
+
+    WTF::switchOn(layoutViewportOriginOrOverrideRect,
+        [&frameView](Optional<FloatPoint> origin) {
+            if (origin)
+                frameView.setLayoutViewportOrigin(LayoutPoint(origin.value()), FrameView::TriggerLayoutOrNot::No);
+        }, [&frameView](Optional<FloatRect> overrideRect) {
+#if PLATFORM(IOS)
+            if (overrideRect)
+                frameView.setCustomFixedPositionLayoutRect(enclosingIntRect(overrideRect.value()));
+#else
+            UNUSED_PARAM(overrideRect);
+#endif
+        }
+    );
+
+    frameView.setConstrainsScrollingToContentEdge(false);
+    frameView.notifyScrollPositionChanged(roundedIntPoint(scrollPosition));
+    frameView.setConstrainsScrollingToContentEdge(true);
+    frameView.setInProgrammaticScroll(oldProgrammaticScroll);
+
+    if (!programmaticScroll && scrollingLayerPositionAction == SyncScrollingLayerPosition)
+        syncViewportConstrainedLayerPositions(frameView.rectForFixedPositionLayout());
+
+    GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView);
+    if (!scrollLayer)
+        return;
+
+    GraphicsLayer* counterScrollingLayer = counterScrollingLayerForFrameView(frameView);
+    GraphicsLayer* insetClipLayer = insetClipLayerForFrameView(frameView);
+    GraphicsLayer* contentShadowLayer = contentShadowLayerForFrameView(frameView);
+    GraphicsLayer* scrolledContentsLayer = rootContentLayerForFrameView(frameView);
+    GraphicsLayer* headerLayer = headerLayerForFrameView(frameView);
+    GraphicsLayer* footerLayer = footerLayerForFrameView(frameView);
+
+    ASSERT(frameView.scrollPosition() == roundedIntPoint(scrollPosition));
+    LayoutPoint scrollPositionForFixed = visualViewportEnabled() ? frameView.layoutViewportOrigin() : frameView.scrollPositionForFixedPosition();
+    float topContentInset = frameView.topContentInset();
+
+    FloatPoint positionForInsetClipLayer;
+    if (insetClipLayer)
+        positionForInsetClipLayer = FloatPoint(insetClipLayer->position().x(), FrameView::yPositionForInsetClipLayer(scrollPosition, topContentInset));
+    FloatPoint positionForContentsLayer = frameView.positionForRootContentLayer();
+    
+    FloatPoint positionForHeaderLayer = FloatPoint(scrollPositionForFixed.x(), FrameView::yPositionForHeaderLayer(scrollPosition, topContentInset));
+    FloatPoint positionForFooterLayer = FloatPoint(scrollPositionForFixed.x(),
+        FrameView::yPositionForFooterLayer(scrollPosition, topContentInset, frameView.totalContentsSize().height(), frameView.footerHeight()));
+
+    if (programmaticScroll || scrollingLayerPositionAction == SetScrollingLayerPosition) {
+        scrollLayer->setPosition(-frameView.scrollPosition());
+        if (counterScrollingLayer)
+            counterScrollingLayer->setPosition(scrollPositionForFixed);
+        if (insetClipLayer)
+            insetClipLayer->setPosition(positionForInsetClipLayer);
+        if (contentShadowLayer)
+            contentShadowLayer->setPosition(positionForContentsLayer);
+        if (scrolledContentsLayer)
+            scrolledContentsLayer->setPosition(positionForContentsLayer);
+        if (headerLayer)
+            headerLayer->setPosition(positionForHeaderLayer);
+        if (footerLayer)
+            footerLayer->setPosition(positionForFooterLayer);
+    } else {
+        scrollLayer->syncPosition(-frameView.scrollPosition());
+        if (counterScrollingLayer)
+            counterScrollingLayer->syncPosition(scrollPositionForFixed);
+        if (insetClipLayer)
+            insetClipLayer->syncPosition(positionForInsetClipLayer);
+        if (contentShadowLayer)
+            contentShadowLayer->syncPosition(positionForContentsLayer);
+        if (scrolledContentsLayer)
+            scrolledContentsLayer->syncPosition(positionForContentsLayer);
+        if (headerLayer)
+            headerLayer->syncPosition(positionForHeaderLayer);
+        if (footerLayer)
+            footerLayer->syncPosition(positionForFooterLayer);
+    }
+}
+
 void AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange(ScrollableArea& scrollableArea, ScrollbarOrientation orientation)
 {
     ASSERT(isMainThread());
@@ -434,7 +455,7 @@
     m_scrollingStateTree->clear();
 }
 
-void AsyncScrollingCoordinator::syncChildPositions(const LayoutRect& viewportRect)
+void AsyncScrollingCoordinator::syncViewportConstrainedLayerPositions(const LayoutRect& viewportRect)
 {
     if (!m_scrollingStateTree->rootStateNode())
         return;
@@ -443,6 +464,8 @@
     if (!children)
         return;
 
+    LOG_WITH_STREAM(Scrolling, stream << "AsyncScrollingCoordinator::syncChildPositions for viewport rect " << viewportRect);
+
     // FIXME: We'll have to traverse deeper into the tree at some point.
     for (auto& child : *children)
         child->syncLayerPositionForViewportRect(viewportRect);

Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (208661 => 208662)


--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2016-11-13 03:08:52 UTC (rev 208661)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h	2016-11-13 03:24:27 UTC (rev 208662)
@@ -103,6 +103,8 @@
     WEBCORE_EXPORT void updateFrameScrollingNode(ScrollingNodeID, GraphicsLayer* scrollLayer, GraphicsLayer* scrolledContentsLayer, GraphicsLayer* counterScrollingLayer, GraphicsLayer* insetClipLayer, const ScrollingGeometry* = nullptr) override;
     WEBCORE_EXPORT void updateOverflowScrollingNode(ScrollingNodeID, GraphicsLayer* scrollLayer, GraphicsLayer* scrolledContentsLayer, const ScrollingGeometry* = nullptr) override;
     
+    WEBCORE_EXPORT void reconcileScrollingState(FrameView&, const FloatPoint&, const LayoutViewportOriginOrOverrideRect&, bool programmaticScroll, SetOrSyncScrollingLayerPosition) override;
+
     bool isRubberBandInProgress() const override;
     void setScrollPinningBehavior(ScrollPinningBehavior) override;
 
@@ -110,7 +112,7 @@
     bool isScrollSnapInProgress() const override;
 #endif
 
-    WEBCORE_EXPORT void syncChildPositions(const LayoutRect& viewportRect) override;
+    WEBCORE_EXPORT void syncViewportConstrainedLayerPositions(const LayoutRect& viewportRect) override;
     WEBCORE_EXPORT void scrollableAreaScrollbarLayerDidChange(ScrollableArea&, ScrollbarOrientation) override;
 
     WEBCORE_EXPORT void setSynchronousScrollingReasons(SynchronousScrollingReasons) override;

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (208661 => 208662)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2016-11-13 03:08:52 UTC (rev 208661)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2016-11-13 03:24:27 UTC (rev 208662)
@@ -33,6 +33,7 @@
 #include <wtf/Forward.h>
 #include <wtf/ThreadSafeRefCounted.h>
 #include <wtf/TypeCasts.h>
+#include <wtf/Variant.h>
 
 #if ENABLE(ASYNC_SCROLLING)
 #include <wtf/HashMap.h>
@@ -117,6 +118,9 @@
     // Should be called whenever the given frame view has been laid out.
     virtual void frameViewLayoutUpdated(FrameView&) { }
 
+    using LayoutViewportOriginOrOverrideRect = WTF::Variant<Optional<FloatPoint>, Optional<FloatRect>>;
+    virtual void reconcileScrollingState(FrameView&, const FloatPoint&, const LayoutViewportOriginOrOverrideRect&, bool /* programmaticScroll */, SetOrSyncScrollingLayerPosition) { }
+
     // Should be called whenever the slow repaint objects counter changes between zero and one.
     void frameViewHasSlowRepaintObjectsDidChange(FrameView&);
 
@@ -172,7 +176,7 @@
 
     virtual void updateFrameScrollingNode(ScrollingNodeID, GraphicsLayer* /*scrollLayer*/, GraphicsLayer* /*scrolledContentsLayer*/, GraphicsLayer* /*counterScrollingLayer*/, GraphicsLayer* /*insetClipLayer*/, const ScrollingGeometry* = nullptr) { }
     virtual void updateOverflowScrollingNode(ScrollingNodeID, GraphicsLayer* /*scrollLayer*/, GraphicsLayer* /*scrolledContentsLayer*/, const ScrollingGeometry* = nullptr) { }
-    virtual void syncChildPositions(const LayoutRect&) { }
+    virtual void syncViewportConstrainedLayerPositions(const LayoutRect&) { }
     virtual String scrollingStateTreeAsText() const;
     virtual bool isRubberBandInProgress() const { return false; }
     virtual bool isScrollSnapInProgress() const { return false; }

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp (208661 => 208662)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp	2016-11-13 03:08:52 UTC (rev 208661)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp	2016-11-13 03:24:27 UTC (rev 208662)
@@ -121,8 +121,8 @@
     LayoutPoint newLocation = FrameView::computeLayoutViewportOrigin(LayoutRect(visualViewport), LayoutPoint(minLayoutViewportOrigin()), LayoutPoint(maxLayoutViewportOrigin()), layoutViewport);
 
     if (layoutViewport.location() != newLocation) {
+        layoutViewport.setLocation(newLocation);
         LOG_WITH_STREAM(Scrolling, stream << " new layoutViewport " << layoutViewport);
-        layoutViewport.setLocation(newLocation);
     }
 
     return layoutViewport;

Modified: trunk/Source/WebCore/platform/Logging.h (208661 => 208662)


--- trunk/Source/WebCore/platform/Logging.h	2016-11-13 03:08:52 UTC (rev 208661)
+++ trunk/Source/WebCore/platform/Logging.h	2016-11-13 03:24:27 UTC (rev 208662)
@@ -79,6 +79,7 @@
     M(StorageAPI) \
     M(SVG) \
     M(TextAutosizing) \
+    M(Tiling) \
     M(Threading) \
     M(URLParser) \
     M(WebAudio) \

Modified: trunk/Source/WebCore/platform/ScrollView.cpp (208661 => 208662)


--- trunk/Source/WebCore/platform/ScrollView.cpp	2016-11-13 03:08:52 UTC (rev 208661)
+++ trunk/Source/WebCore/platform/ScrollView.cpp	2016-11-13 03:24:27 UTC (rev 208662)
@@ -418,7 +418,7 @@
 
 void ScrollView::setScrollOffset(const ScrollOffset& offset)
 {
-    LOG_WITH_STREAM(Scrolling, stream << "ScrollView::setScrollOffset " << offset);
+    LOG_WITH_STREAM(Scrolling, stream << "\nScrollView::setScrollOffset " << offset);
 
     IntPoint constrainedOffset = offset;
     if (constrainsScrollingToContentEdge())

Modified: trunk/Source/WebCore/platform/graphics/ca/TileController.cpp (208661 => 208662)


--- trunk/Source/WebCore/platform/graphics/ca/TileController.cpp	2016-11-13 03:08:52 UTC (rev 208661)
+++ trunk/Source/WebCore/platform/graphics/ca/TileController.cpp	2016-11-13 03:24:27 UTC (rev 208662)
@@ -451,7 +451,7 @@
     FloatRect coverageBounds = boundsForSize(newSize);
     
     FloatRect coverage = expandRectWithinRect(visibleRect, coverageSize, coverageBounds);
-    LOG_WITH_STREAM(Scrolling, stream << "TileController::computeTileCoverageRect newSize=" << newSize << " mode " << m_tileCoverage << " expanded to " << coverageSize << " bounds with margin " << coverageBounds << " coverage " << coverage);
+    LOG_WITH_STREAM(Tiling, stream << "TileController::computeTileCoverageRect newSize=" << newSize << " mode " << m_tileCoverage << " expanded to " << coverageSize << " bounds with margin " << coverageBounds << " coverage " << coverage);
     coverageRect.unite(coverage);
 #endif
 }

Modified: trunk/Source/WebCore/rendering/RenderLayer.cpp (208661 => 208662)


--- trunk/Source/WebCore/rendering/RenderLayer.cpp	2016-11-13 03:08:52 UTC (rev 208661)
+++ trunk/Source/WebCore/rendering/RenderLayer.cpp	2016-11-13 03:24:27 UTC (rev 208662)
@@ -824,6 +824,8 @@
 {
     ASSERT(this == renderer().view().layer());
 
+    LOG(Scrolling, "RenderLayer::updateLayerPositionsAfterDocumentScroll");
+
     RenderGeometryMap geometryMap(UseTransforms);
     updateLayerPositionsAfterScroll(&geometryMap);
 }

Modified: trunk/Source/WebKit2/ChangeLog (208661 => 208662)


--- trunk/Source/WebKit2/ChangeLog	2016-11-13 03:08:52 UTC (rev 208661)
+++ trunk/Source/WebKit2/ChangeLog	2016-11-13 03:24:27 UTC (rev 208662)
@@ -1,3 +1,16 @@
+2016-11-12  Simon Fraser  <[email protected]>
+
+        [iOS WK2] Share some code with Mac for post-async-scroll state reconciliation
+        https://bugs.webkit.org/show_bug.cgi?id=164694
+
+        Reviewed by Zalan Bujtas.
+
+        Rather than calling FrameView directly, call reconcileScrollingState() on the scrolling
+        coordinator.
+
+        * WebProcess/WebPage/ios/WebPageIOS.mm:
+        (WebKit::WebPage::updateVisibleContentRects):
+
 2016-11-12  Brian Burg  <[email protected]>
 
         Web Automation: terminate the automation session if the web process crashes

Modified: trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm (208661 => 208662)


--- trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2016-11-13 03:08:52 UTC (rev 208661)
+++ trunk/Source/WebKit2/WebProcess/WebPage/ios/WebPageIOS.mm	2016-11-13 03:24:27 UTC (rev 208662)
@@ -3060,9 +3060,12 @@
     if (!visibleContentRectUpdateInfo.isChangingObscuredInsetsInteractively())
         frameView.setCustomSizeForResizeEvent(expandedIntSize(visibleContentRectUpdateInfo.unobscuredRectInScrollViewCoordinates().size()));
 
-    frameView.setConstrainsScrollingToContentEdge(false);
-    frameView.setScrollOffset(frameView.scrollOffsetFromPosition(scrollPosition));
-    frameView.setConstrainsScrollingToContentEdge(true);
+    if (ScrollingCoordinator* scrollingCoordinator = this->scrollingCoordinator()) {
+        Optional<FloatRect> customFixedPositionRect;
+        if (m_isInStableState)
+            customFixedPositionRect = visibleContentRectUpdateInfo.customFixedPositionRect();
+        scrollingCoordinator->reconcileScrollingState(frameView, scrollPosition, customFixedPositionRect, false, SetOrSyncScrollingLayerPosition::SyncScrollingLayerPosition);
+    }
 }
 
 void WebPage::willStartUserTriggeredZooming()
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to