Title: [134169] trunk/Source/WebCore
Revision
134169
Author
simon.fra...@apple.com
Date
2012-11-10 21:21:04 -0800 (Sat, 10 Nov 2012)

Log Message

Remove ScrollingCoordinatorMac::updateMainFrameScrollPositionAndScrollLayerPosition()
https://bugs.webkit.org/show_bug.cgi?id=101514

Reviewed by Tim Horton.

ScrollingCoordinatorMac::updateMainFrameScrollPositionAndScrollLayerPosition() is very similar to
ScrollingCoordinator::updateMainFrameScrollPosition(). In order to eliminate updateMainFrameScrollPositionAndScrollLayerPosition(),
we just need to plumb through a flag that says that updateMainFrameScrollPosition() should
set the layer position (rather than just doing a 'sync').

* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::ScrollingCoordinator::updateMainFrameScrollPosition):
* page/scrolling/ScrollingCoordinator.h:
* page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::updateMainFrameScrollPosition):
* page/scrolling/ScrollingTree.h:
* page/scrolling/mac/ScrollingCoordinatorMac.h:
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
* page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
(WebCore::ScrollingTreeScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (134168 => 134169)


--- trunk/Source/WebCore/ChangeLog	2012-11-11 02:56:12 UTC (rev 134168)
+++ trunk/Source/WebCore/ChangeLog	2012-11-11 05:21:04 UTC (rev 134169)
@@ -1,3 +1,26 @@
+2012-11-10  Simon Fraser  <simon.fra...@apple.com>
+
+        Remove ScrollingCoordinatorMac::updateMainFrameScrollPositionAndScrollLayerPosition()
+        https://bugs.webkit.org/show_bug.cgi?id=101514
+
+        Reviewed by Tim Horton.
+
+        ScrollingCoordinatorMac::updateMainFrameScrollPositionAndScrollLayerPosition() is very similar to
+        ScrollingCoordinator::updateMainFrameScrollPosition(). In order to eliminate updateMainFrameScrollPositionAndScrollLayerPosition(),
+        we just need to plumb through a flag that says that updateMainFrameScrollPosition() should
+        set the layer position (rather than just doing a 'sync').
+
+        * page/scrolling/ScrollingCoordinator.cpp:
+        (WebCore::ScrollingCoordinator::updateMainFrameScrollPosition):
+        * page/scrolling/ScrollingCoordinator.h:
+        * page/scrolling/ScrollingTree.cpp:
+        (WebCore::ScrollingTree::updateMainFrameScrollPosition):
+        * page/scrolling/ScrollingTree.h:
+        * page/scrolling/mac/ScrollingCoordinatorMac.h:
+        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
+        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
+        (WebCore::ScrollingTreeScrollingNodeMac::setScrollPositionWithoutContentEdgeConstraints):
+
 2012-11-10  Sheriff Bot  <webkit.review....@gmail.com>
 
         Unreviewed, rolling out r134069.

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp (134168 => 134169)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2012-11-11 02:56:12 UTC (rev 134168)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp	2012-11-11 05:21:04 UTC (rev 134169)
@@ -250,7 +250,7 @@
     updateShouldUpdateScrollLayerPositionOnMainThread();
 }
 
-void ScrollingCoordinator::updateMainFrameScrollPosition(const IntPoint& scrollPosition, bool programmaticScroll)
+void ScrollingCoordinator::updateMainFrameScrollPosition(const IntPoint& scrollPosition, bool programmaticScroll, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
 {
     ASSERT(isMainThread());
 
@@ -272,7 +272,7 @@
 
 #if USE(ACCELERATED_COMPOSITING)
     if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView)) {
-        if (programmaticScroll)
+        if (programmaticScroll || scrollingLayerPositionAction == SetScrollingLayerPosition)
             scrollLayer->setPosition(-frameView->scrollPosition());
         else {
             scrollLayer->syncPosition(-frameView->scrollPosition());

Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (134168 => 134169)


--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2012-11-11 02:56:12 UTC (rev 134168)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h	2012-11-11 05:21:04 UTC (rev 134169)
@@ -65,6 +65,11 @@
 IntSize scrollOffsetForFixedPosition(const IntRect& visibleContentRect, const IntSize& contentsSize, const IntPoint& scrollPosition,
     const IntPoint& scrollOrigin, float frameScaleFactor, bool fixedElementsLayoutRelativeToFrame);
 
+enum SetOrSyncScrollingLayerPosition {
+    SetScrollingLayerPosition,
+    SyncScrollingLayerPosition
+};
+
 class ScrollingCoordinator : public ThreadSafeRefCounted<ScrollingCoordinator> {
 public:
     static PassRefPtr<ScrollingCoordinator> create(Page*);
@@ -112,7 +117,6 @@
     virtual void commitTreeStateIfNeeded() { }
     virtual bool requestScrollPositionUpdate(FrameView*, const IntPoint&) { return false; }
     virtual bool handleWheelEvent(FrameView*, const PlatformWheelEvent&) { return true; }
-    virtual void updateMainFrameScrollPositionAndScrollLayerPosition() { }
     virtual ScrollingNodeID attachToStateTree(ScrollingNodeType, ScrollingNodeID newNodeID, ScrollingNodeID /*parentID*/) { return newNodeID; }
     virtual void detachFromStateTree(ScrollingNodeID) { }
     virtual void clearStateTree() { }
@@ -124,7 +128,7 @@
     ScrollingNodeID uniqueScrollLayerID();
 
     // Dispatched by the scrolling tree whenever the main frame scroll position changes.
-    void updateMainFrameScrollPosition(const IntPoint&, bool programmaticScroll);
+    void updateMainFrameScrollPosition(const IntPoint&, bool programmaticScroll, SetOrSyncScrollingLayerPosition);
 
     enum MainThreadScrollingReasonFlags {
         ForcedOnMainThread = 1 << 0,

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (134168 => 134169)


--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp	2012-11-11 02:56:12 UTC (rev 134168)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp	2012-11-11 05:21:04 UTC (rev 134169)
@@ -214,7 +214,7 @@
     m_mainFramePinnedToTheRight = pinnedToTheRight;
 }
 
-void ScrollingTree::updateMainFrameScrollPosition(const IntPoint& scrollPosition)
+void ScrollingTree::updateMainFrameScrollPosition(const IntPoint& scrollPosition, SetOrSyncScrollingLayerPosition scrollingLayerPositionAction)
 {
     if (!m_scrollingCoordinator)
         return;
@@ -224,7 +224,7 @@
         m_mainFrameScrollPosition = scrollPosition;
     }
 
-    callOnMainThread(bind(&ScrollingCoordinator::updateMainFrameScrollPosition, m_scrollingCoordinator.get(), scrollPosition, m_isHandlingProgrammaticScroll));
+    callOnMainThread(bind(&ScrollingCoordinator::updateMainFrameScrollPosition, m_scrollingCoordinator.get(), scrollPosition, m_isHandlingProgrammaticScroll, scrollingLayerPositionAction));
 }
 
 IntPoint ScrollingTree::mainFrameScrollPosition()
@@ -233,19 +233,6 @@
     return m_mainFrameScrollPosition;
 }
 
-void ScrollingTree::updateMainFrameScrollPositionAndScrollLayerPosition(const IntPoint& scrollPosition)
-{
-    if (!m_scrollingCoordinator)
-        return;
-
-    {
-        MutexLocker lock(m_mutex);
-        m_mainFrameScrollPosition = scrollPosition;
-    }
-
-    callOnMainThread(bind(&ScrollingCoordinator::updateMainFrameScrollPositionAndScrollLayerPosition, m_scrollingCoordinator.get()));
-}
-
 #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN))
 void ScrollingTree::handleWheelEventPhase(PlatformWheelEventPhase phase)
 {

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (134168 => 134169)


--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h	2012-11-11 02:56:12 UTC (rev 134168)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h	2012-11-11 05:21:04 UTC (rev 134169)
@@ -83,8 +83,7 @@
 
     void setMainFramePinState(bool pinnedToTheLeft, bool pinnedToTheRight);
 
-    void updateMainFrameScrollPosition(const IntPoint& scrollPosition);
-    void updateMainFrameScrollPositionAndScrollLayerPosition(const IntPoint& scrollPosition);
+    void updateMainFrameScrollPosition(const IntPoint& scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition);
     IntPoint mainFrameScrollPosition();
 
 #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN))

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h (134168 => 134169)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h	2012-11-11 02:56:12 UTC (rev 134168)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h	2012-11-11 05:21:04 UTC (rev 134169)
@@ -65,9 +65,6 @@
     // Handle the wheel event on the scrolling thread. Returns whether the event was handled or not.
     virtual bool handleWheelEvent(FrameView*, const PlatformWheelEvent&);
 
-    // Dispatched by the scrolling tree whenever the main frame scroll position changes and the scroll layer position needs to be updated as well.
-    virtual void updateMainFrameScrollPositionAndScrollLayerPosition();
-
     // These functions are used to indicate that a layer should be (or should not longer be) represented by a node
     // in the scrolling tree.
     virtual ScrollingNodeID attachToStateTree(ScrollingNodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID);

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm (134168 => 134169)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm	2012-11-11 02:56:12 UTC (rev 134168)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm	2012-11-11 05:21:04 UTC (rev 134169)
@@ -186,7 +186,7 @@
         return false;
 
     if (frameView->inProgrammaticScroll() || frameView->frame()->document()->inPageCache())
-        updateMainFrameScrollPosition(scrollPosition, frameView->inProgrammaticScroll());
+        updateMainFrameScrollPosition(scrollPosition, frameView->inProgrammaticScroll(), SetScrollingLayerPosition);
 
     // If this frame view's document is being put into the page cache, we don't want to update our
     // main frame scroll position. Just let the FrameView think that we did.
@@ -215,27 +215,6 @@
     return true;
 }
 
-void ScrollingCoordinatorMac::updateMainFrameScrollPositionAndScrollLayerPosition()
-{
-    ASSERT(isMainThread());
-
-    if (!m_page)
-        return;
-
-    FrameView* frameView = m_page->mainFrame()->view();
-    if (!frameView)
-        return;
-
-    IntPoint scrollPosition = m_scrollingTree->mainFrameScrollPosition();
-
-    frameView->setConstrainsScrollingToContentEdge(false);
-    frameView->notifyScrollPositionChanged(scrollPosition);
-    frameView->setConstrainsScrollingToContentEdge(true);
-
-    if (GraphicsLayer* scrollLayer = scrollLayerForFrameView(frameView))
-        scrollLayer->setPosition(-frameView->scrollPosition());
-}
-
 ScrollingNodeID ScrollingCoordinatorMac::attachToStateTree(ScrollingNodeType nodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID)
 {
     ASSERT(newNodeID);

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm (134168 => 134169)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm	2012-11-11 02:56:12 UTC (rev 134168)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm	2012-11-11 05:21:04 UTC (rev 134169)
@@ -263,7 +263,7 @@
 
     if (shouldUpdateScrollLayerPositionOnMainThread()) {
         m_probableMainThreadScrollPosition = scrollPosition;
-        scrollingTree()->updateMainFrameScrollPositionAndScrollLayerPosition(scrollPosition);
+        scrollingTree()->updateMainFrameScrollPosition(scrollPosition, SetScrollingLayerPosition);
         return;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
http://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to