Title: [158893] trunk/Source/WebCore

Diff

Modified: trunk/Source/WebCore/ChangeLog (158892 => 158893)


--- trunk/Source/WebCore/ChangeLog	2013-11-08 02:22:40 UTC (rev 158892)
+++ trunk/Source/WebCore/ChangeLog	2013-11-08 02:41:19 UTC (rev 158893)
@@ -1,3 +1,13 @@
+2013-11-07  Andreas Kling  <[email protected]>
+
+        CTTE: Scrolling tree nodes should always have a ScrollingTree&.
+        <https://webkit.org/b/124022>
+
+        Let ScrollingTreeNode and subclasses store the backpointer to the
+        tree as a ScrollingTree& reference.
+
+        Reviewed by Anders Carlsson.
+
 2013-11-07  Simon Fraser  <[email protected]>
 
         Lots of layers get solid color but transparent contents layers now

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (158892 => 158893)


--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp	2013-11-08 02:22:40 UTC (rev 158892)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp	2013-11-08 02:41:19 UTC (rev 158893)
@@ -174,18 +174,18 @@
             // This is the root node. Nuke the node map.
             m_nodeMap.clear();
 
-            m_rootNode = ScrollingTreeScrollingNode::create(this, nodeID);
+            m_rootNode = ScrollingTreeScrollingNode::create(*this, nodeID);
             m_nodeMap.set(nodeID, m_rootNode.get());
             m_rootNode->updateBeforeChildren(stateNode);
             node = m_rootNode.get();
         } else {
             OwnPtr<ScrollingTreeNode> newNode;
             if (stateNode->isScrollingNode())
-                newNode = ScrollingTreeScrollingNode::create(this, nodeID);
+                newNode = ScrollingTreeScrollingNode::create(*this, nodeID);
             else if (stateNode->isFixedNode())
-                newNode = ScrollingTreeFixedNode::create(this, nodeID);
+                newNode = ScrollingTreeFixedNode::create(*this, nodeID);
             else if (stateNode->isStickyNode())
-                newNode = ScrollingTreeStickyNode::create(this, nodeID);
+                newNode = ScrollingTreeStickyNode::create(*this, nodeID);
             else
                 ASSERT_NOT_REACHED();
 

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp (158892 => 158893)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp	2013-11-08 02:22:40 UTC (rev 158892)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp	2013-11-08 02:41:19 UTC (rev 158893)
@@ -32,7 +32,7 @@
 
 namespace WebCore {
 
-ScrollingTreeNode::ScrollingTreeNode(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
+ScrollingTreeNode::ScrollingTreeNode(ScrollingTree& scrollingTree, ScrollingNodeID nodeID)
     : m_scrollingTree(scrollingTree)
     , m_nodeID(nodeID)
     , m_parent(0)

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h (158892 => 158893)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h	2013-11-08 02:22:40 UTC (rev 158892)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h	2013-11-08 02:41:19 UTC (rev 158893)
@@ -41,7 +41,6 @@
 
 class ScrollingTreeNode {
 public:
-    explicit ScrollingTreeNode(ScrollingTree*, ScrollingNodeID);
     virtual ~ScrollingTreeNode();
 
     virtual void updateBeforeChildren(ScrollingStateNode*) = 0;
@@ -58,13 +57,14 @@
     void removeChild(ScrollingTreeNode*);
 
 protected:
-    ScrollingTree* scrollingTree() const { return m_scrollingTree; }
+    ScrollingTreeNode(ScrollingTree&, ScrollingNodeID);
+    ScrollingTree& scrollingTree() const { return m_scrollingTree; }
 
     typedef Vector<OwnPtr<ScrollingTreeNode>> ScrollingTreeChildrenVector;
     OwnPtr<ScrollingTreeChildrenVector> m_children;
 
 private:
-    ScrollingTree* m_scrollingTree;
+    ScrollingTree& m_scrollingTree;
 
     ScrollingNodeID m_nodeID;
 

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp (158892 => 158893)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp	2013-11-08 02:22:40 UTC (rev 158892)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp	2013-11-08 02:41:19 UTC (rev 158893)
@@ -33,7 +33,7 @@
 
 namespace WebCore {
 
-ScrollingTreeScrollingNode::ScrollingTreeScrollingNode(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
+ScrollingTreeScrollingNode::ScrollingTreeScrollingNode(ScrollingTree& scrollingTree, ScrollingNodeID nodeID)
     : ScrollingTreeNode(scrollingTree, nodeID)
     , m_frameScaleFactor(1)
     , m_shouldUpdateScrollLayerPositionOnMainThread(0)
@@ -60,7 +60,7 @@
         m_viewportRect = state->viewportRect();
 
     if (state->hasChangedProperty(ScrollingStateScrollingNode::TotalContentsSize)) {
-        if (scrollingTree()->isRubberBandInProgress())
+        if (scrollingTree().isRubberBandInProgress())
             m_totalContentsSizeForRubberBand = m_totalContentsSize;
         else
             m_totalContentsSizeForRubberBand = state->totalContentsSize();

Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (158892 => 158893)


--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h	2013-11-08 02:22:40 UTC (rev 158892)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h	2013-11-08 02:41:19 UTC (rev 158893)
@@ -42,7 +42,7 @@
 
 class ScrollingTreeScrollingNode : public ScrollingTreeNode {
 public:
-    static PassOwnPtr<ScrollingTreeScrollingNode> create(ScrollingTree*, ScrollingNodeID);
+    static PassOwnPtr<ScrollingTreeScrollingNode> create(ScrollingTree&, ScrollingNodeID);
     virtual ~ScrollingTreeScrollingNode();
 
     virtual void updateBeforeChildren(ScrollingStateNode*) OVERRIDE;
@@ -56,7 +56,7 @@
     MainThreadScrollingReasons shouldUpdateScrollLayerPositionOnMainThread() const { return m_shouldUpdateScrollLayerPositionOnMainThread; }
 
 protected:
-    explicit ScrollingTreeScrollingNode(ScrollingTree*, ScrollingNodeID);
+    ScrollingTreeScrollingNode(ScrollingTree&, ScrollingNodeID);
 
     const IntRect& viewportRect() const { return m_viewportRect; }
     const IntSize& totalContentsSize() const { return m_totalContentsSize; }

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.h (158892 => 158893)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.h	2013-11-08 02:22:40 UTC (rev 158892)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.h	2013-11-08 02:41:19 UTC (rev 158893)
@@ -40,12 +40,12 @@
 
 class ScrollingTreeFixedNode : public ScrollingTreeNode {
 public:
-    static PassOwnPtr<ScrollingTreeFixedNode> create(ScrollingTree*, ScrollingNodeID);
+    static PassOwnPtr<ScrollingTreeFixedNode> create(ScrollingTree&, ScrollingNodeID);
 
     virtual ~ScrollingTreeFixedNode();
 
 private:
-    ScrollingTreeFixedNode(ScrollingTree*, ScrollingNodeID);
+    ScrollingTreeFixedNode(ScrollingTree&, ScrollingNodeID);
 
     virtual void updateBeforeChildren(ScrollingStateNode*) OVERRIDE;
     virtual void parentScrollPositionDidChange(const IntRect& viewportRect, const FloatSize& cumulativeDelta) OVERRIDE;

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.mm (158892 => 158893)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.mm	2013-11-08 02:22:40 UTC (rev 158892)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.mm	2013-11-08 02:41:19 UTC (rev 158893)
@@ -33,12 +33,12 @@
 
 namespace WebCore {
 
-PassOwnPtr<ScrollingTreeFixedNode> ScrollingTreeFixedNode::create(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
+PassOwnPtr<ScrollingTreeFixedNode> ScrollingTreeFixedNode::create(ScrollingTree& scrollingTree, ScrollingNodeID nodeID)
 {
     return adoptPtr(new ScrollingTreeFixedNode(scrollingTree, nodeID));
 }
 
-ScrollingTreeFixedNode::ScrollingTreeFixedNode(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
+ScrollingTreeFixedNode::ScrollingTreeFixedNode(ScrollingTree& scrollingTree, ScrollingNodeID nodeID)
     : ScrollingTreeNode(scrollingTree, nodeID)
 {
 }

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h (158892 => 158893)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h	2013-11-08 02:22:40 UTC (rev 158892)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h	2013-11-08 02:41:19 UTC (rev 158893)
@@ -39,7 +39,7 @@
 
 class ScrollingTreeScrollingNodeMac : public ScrollingTreeScrollingNode, private ScrollElasticityControllerClient {
 public:
-    explicit ScrollingTreeScrollingNodeMac(ScrollingTree*, ScrollingNodeID);
+    ScrollingTreeScrollingNodeMac(ScrollingTree&, ScrollingNodeID);
     virtual ~ScrollingTreeScrollingNodeMac();
 
 private:

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


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm	2013-11-08 02:22:40 UTC (rev 158892)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm	2013-11-08 02:41:19 UTC (rev 158893)
@@ -50,12 +50,12 @@
 static void logWheelEventHandlerCountChanged(unsigned);
 
 
-PassOwnPtr<ScrollingTreeScrollingNode> ScrollingTreeScrollingNode::create(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
+PassOwnPtr<ScrollingTreeScrollingNode> ScrollingTreeScrollingNode::create(ScrollingTree& scrollingTree, ScrollingNodeID nodeID)
 {
     return adoptPtr(new ScrollingTreeScrollingNodeMac(scrollingTree, nodeID));
 }
 
-ScrollingTreeScrollingNodeMac::ScrollingTreeScrollingNodeMac(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
+ScrollingTreeScrollingNodeMac::ScrollingTreeScrollingNodeMac(ScrollingTree& scrollingTree, ScrollingNodeID nodeID)
     : ScrollingTreeScrollingNode(scrollingTree, nodeID)
     , m_scrollElasticityController(this)
     , m_verticalScrollbarPainter(0)
@@ -106,12 +106,12 @@
             }
         }
 
-        if (scrollingTree()->scrollingPerformanceLoggingEnabled())
+        if (scrollingTree().scrollingPerformanceLoggingEnabled())
             logThreadedScrollingMode(mainThreadScrollingReasons);
     }
 
     if (scrollingStateNode->hasChangedProperty(ScrollingStateScrollingNode::WheelEventHandlerCount)) {
-        if (scrollingTree()->scrollingPerformanceLoggingEnabled())
+        if (scrollingTree().scrollingPerformanceLoggingEnabled())
             logWheelEventHandlerCountChanged(scrollingStateNode->wheelEventHandlerCount());
     }
 }
@@ -136,7 +136,7 @@
         return;
 
     m_scrollElasticityController.handleWheelEvent(wheelEvent);
-    scrollingTree()->handleWheelEventPhase(wheelEvent.phase());
+    scrollingTree().handleWheelEventPhase(wheelEvent.phase());
 }
 
 bool ScrollingTreeScrollingNodeMac::allowsHorizontalStretching()
@@ -183,11 +183,11 @@
     else if (scrollPosition().x() > maximumScrollPosition().x())
         stretch.setWidth(scrollPosition().x() - maximumScrollPosition().x());
 
-    if (scrollingTree()->rootNode() == this) {
+    if (scrollingTree().rootNode() == this) {
         if (stretch.isZero())
-            scrollingTree()->setMainFrameIsRubberBanding(false);
+            scrollingTree().setMainFrameIsRubberBanding(false);
         else
-            scrollingTree()->setMainFrameIsRubberBanding(true);
+            scrollingTree().setMainFrameIsRubberBanding(true);
     }
 
     return stretch;
@@ -268,7 +268,7 @@
     if (!m_snapRubberbandTimer)
         return;
 
-    scrollingTree()->setMainFrameIsRubberBanding(false);
+    scrollingTree().setMainFrameIsRubberBanding(false);
 
     // Since the rubberband timer has stopped, totalContentsSizeForRubberBand can be synchronized with totalContentsSize.
     setTotalContentsSizeForRubberBand(totalContentsSize());
@@ -294,7 +294,7 @@
 
     setScrollPositionWithoutContentEdgeConstraints(newScrollPosition);
 
-    if (scrollingTree()->scrollingPerformanceLoggingEnabled())
+    if (scrollingTree().scrollingPerformanceLoggingEnabled())
         logExposedUnfilledArea();
 }
 
@@ -304,12 +304,12 @@
 
     if (shouldUpdateScrollLayerPositionOnMainThread()) {
         m_probableMainThreadScrollPosition = scrollPosition;
-        scrollingTree()->updateMainFrameScrollPosition(scrollPosition, SetScrollingLayerPosition);
+        scrollingTree().updateMainFrameScrollPosition(scrollPosition, SetScrollingLayerPosition);
         return;
     }
 
     setScrollLayerPosition(scrollPosition);
-    scrollingTree()->updateMainFrameScrollPosition(scrollPosition);
+    scrollingTree().updateMainFrameScrollPosition(scrollPosition);
 }
 
 void ScrollingTreeScrollingNodeMac::setScrollLayerPosition(const IntPoint& position)
@@ -374,7 +374,7 @@
 {
     IntPoint position;
     
-    if (scrollingTree()->rootNode() == this && scrollingTree()->scrollPinningBehavior() == PinToBottom)
+    if (scrollingTree().rootNode() == this && scrollingTree().scrollPinningBehavior() == PinToBottom)
         position.setY(maximumScrollPosition().y());
 
     return position;
@@ -387,7 +387,7 @@
 
     position.clampNegativeToZero();
 
-    if (scrollingTree()->rootNode() == this && scrollingTree()->scrollPinningBehavior() == PinToTop)
+    if (scrollingTree().rootNode() == this && scrollingTree().scrollPinningBehavior() == PinToTop)
         position.setY(minimumScrollPosition().y());
 
     return position;
@@ -410,7 +410,7 @@
     bool pinnedToTheTop = scrollPosition.y() <= minimumScrollPosition().y();
     bool pinnedToTheBottom = scrollPosition.y() >= maximumScrollPosition().y();
 
-    scrollingTree()->setMainFramePinState(pinnedToTheLeft, pinnedToTheRight, pinnedToTheTop, pinnedToTheBottom);
+    scrollingTree().setMainFramePinState(pinnedToTheLeft, pinnedToTheRight, pinnedToTheTop, pinnedToTheBottom);
 }
 
 void ScrollingTreeScrollingNodeMac::logExposedUnfilledArea()

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.h (158892 => 158893)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.h	2013-11-08 02:22:40 UTC (rev 158892)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.h	2013-11-08 02:41:19 UTC (rev 158893)
@@ -40,12 +40,12 @@
 
 class ScrollingTreeStickyNode : public ScrollingTreeNode {
 public:
-    static PassOwnPtr<ScrollingTreeStickyNode> create(ScrollingTree*, ScrollingNodeID);
+    static PassOwnPtr<ScrollingTreeStickyNode> create(ScrollingTree&, ScrollingNodeID);
 
     virtual ~ScrollingTreeStickyNode();
 
 private:
-    ScrollingTreeStickyNode(ScrollingTree*, ScrollingNodeID);
+    ScrollingTreeStickyNode(ScrollingTree&, ScrollingNodeID);
 
     virtual void updateBeforeChildren(ScrollingStateNode*) OVERRIDE;
     virtual void parentScrollPositionDidChange(const IntRect& viewportRect, const FloatSize& cumulativeDelta) OVERRIDE;

Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.mm (158892 => 158893)


--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.mm	2013-11-08 02:22:40 UTC (rev 158892)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.mm	2013-11-08 02:41:19 UTC (rev 158893)
@@ -33,12 +33,12 @@
 
 namespace WebCore {
 
-PassOwnPtr<ScrollingTreeStickyNode> ScrollingTreeStickyNode::create(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
+PassOwnPtr<ScrollingTreeStickyNode> ScrollingTreeStickyNode::create(ScrollingTree& scrollingTree, ScrollingNodeID nodeID)
 {
     return adoptPtr(new ScrollingTreeStickyNode(scrollingTree, nodeID));
 }
 
-ScrollingTreeStickyNode::ScrollingTreeStickyNode(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
+ScrollingTreeStickyNode::ScrollingTreeStickyNode(ScrollingTree& scrollingTree, ScrollingNodeID nodeID)
     : ScrollingTreeNode(scrollingTree, nodeID)
 {
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to