Diff
Modified: trunk/Source/WebCore/ChangeLog (161190 => 161191)
--- trunk/Source/WebCore/ChangeLog 2014-01-01 18:14:27 UTC (rev 161190)
+++ trunk/Source/WebCore/ChangeLog 2014-01-01 18:26:29 UTC (rev 161191)
@@ -1,5 +1,68 @@
2013-12-31 Simon Fraser <[email protected]>
+ ScrollingStateNodes should have a reference to the ScrollingStateTree
+ https://bugs.webkit.org/show_bug.cgi?id=126348
+
+ Reviewed by Sam Weinig.
+
+ Make ScrollingStateNodes always belong to a ScrollingStateTree, and thus
+ have a reference to the tree rather than a pointer. When cloning nodes,
+ they are adopted by a new ScrollingStateTree, which adds them to its
+ node map (which didn't happen before).
+
+ In subclasses access the ScrollingStateTree through a member function.
+
+ * page/scrolling/ScrollingStateFixedNode.cpp:
+ (WebCore::ScrollingStateFixedNode::create):
+ (WebCore::ScrollingStateFixedNode::ScrollingStateFixedNode):
+ (WebCore::ScrollingStateFixedNode::clone):
+ (WebCore::ScrollingStateFixedNode::updateConstraints):
+ * page/scrolling/ScrollingStateFixedNode.h:
+ * page/scrolling/ScrollingStateNode.cpp:
+ (WebCore::ScrollingStateNode::ScrollingStateNode):
+ (WebCore::ScrollingStateNode::cloneAndReset):
+ (WebCore::ScrollingStateNode::cloneAndResetChildren):
+ (WebCore::ScrollingStateNode::willBeRemovedFromStateTree):
+ * page/scrolling/ScrollingStateNode.h:
+ (WebCore::ScrollingStateNode::scrollingStateTree):
+ * page/scrolling/ScrollingStateScrollingNode.cpp:
+ (WebCore::ScrollingStateScrollingNode::create):
+ (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
+ (WebCore::ScrollingStateScrollingNode::clone):
+ (WebCore::ScrollingStateScrollingNode::setViewportRect):
+ (WebCore::ScrollingStateScrollingNode::setTotalContentsSize):
+ (WebCore::ScrollingStateScrollingNode::setScrollOrigin):
+ (WebCore::ScrollingStateScrollingNode::setScrollableAreaParameters):
+ (WebCore::ScrollingStateScrollingNode::setFrameScaleFactor):
+ (WebCore::ScrollingStateScrollingNode::setNonFastScrollableRegion):
+ (WebCore::ScrollingStateScrollingNode::setWheelEventHandlerCount):
+ (WebCore::ScrollingStateScrollingNode::setSynchronousScrollingReasons):
+ (WebCore::ScrollingStateScrollingNode::setScrollBehaviorForFixedElements):
+ (WebCore::ScrollingStateScrollingNode::setRequestedScrollPosition):
+ (WebCore::ScrollingStateScrollingNode::setHeaderHeight):
+ (WebCore::ScrollingStateScrollingNode::setFooterHeight):
+ * page/scrolling/ScrollingStateScrollingNode.h:
+ * page/scrolling/ScrollingStateStickyNode.cpp:
+ (WebCore::ScrollingStateStickyNode::create):
+ (WebCore::ScrollingStateStickyNode::ScrollingStateStickyNode):
+ (WebCore::ScrollingStateStickyNode::clone):
+ (WebCore::ScrollingStateStickyNode::updateConstraints):
+ * page/scrolling/ScrollingStateStickyNode.h:
+ * page/scrolling/ScrollingStateTree.cpp:
+ (WebCore::ScrollingStateTree::attachNode):
+ (WebCore::ScrollingStateTree::commit):
+ (WebCore::ScrollingStateTree::addNode):
+ * page/scrolling/ScrollingStateTree.h:
+ * page/scrolling/mac/ScrollingStateNodeMac.mm:
+ (WebCore::ScrollingStateNode::setScrollLayer):
+ * page/scrolling/mac/ScrollingStateScrollingNodeMac.mm:
+ (WebCore::ScrollingStateScrollingNode::setCounterScrollingLayer):
+ (WebCore::ScrollingStateScrollingNode::setHeaderLayer):
+ (WebCore::ScrollingStateScrollingNode::setFooterLayer):
+ (WebCore::ScrollingStateScrollingNode::setScrollbarPaintersFromScrollbars):
+
+2013-12-31 Simon Fraser <[email protected]>
+
Give ScrollingStateNodes a nodeType()
https://bugs.webkit.org/show_bug.cgi?id=126347
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp (161190 => 161191)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp 2014-01-01 18:14:27 UTC (rev 161190)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.cpp 2014-01-01 18:26:29 UTC (rev 161191)
@@ -35,18 +35,18 @@
namespace WebCore {
-PassOwnPtr<ScrollingStateFixedNode> ScrollingStateFixedNode::create(ScrollingStateTree* stateTree, ScrollingNodeID nodeID)
+PassOwnPtr<ScrollingStateFixedNode> ScrollingStateFixedNode::create(ScrollingStateTree& stateTree, ScrollingNodeID nodeID)
{
return adoptPtr(new ScrollingStateFixedNode(stateTree, nodeID));
}
-ScrollingStateFixedNode::ScrollingStateFixedNode(ScrollingStateTree* tree, ScrollingNodeID nodeID)
+ScrollingStateFixedNode::ScrollingStateFixedNode(ScrollingStateTree& tree, ScrollingNodeID nodeID)
: ScrollingStateNode(FixedNode, tree, nodeID)
{
}
-ScrollingStateFixedNode::ScrollingStateFixedNode(const ScrollingStateFixedNode& node)
- : ScrollingStateNode(node)
+ScrollingStateFixedNode::ScrollingStateFixedNode(const ScrollingStateFixedNode& node, ScrollingStateTree& adoptiveTree)
+ : ScrollingStateNode(node, adoptiveTree)
, m_constraints(FixedPositionViewportConstraints(node.viewportConstraints()))
{
}
@@ -55,9 +55,9 @@
{
}
-PassOwnPtr<ScrollingStateNode> ScrollingStateFixedNode::clone()
+PassOwnPtr<ScrollingStateNode> ScrollingStateFixedNode::clone(ScrollingStateTree& adoptiveTree)
{
- return adoptPtr(new ScrollingStateFixedNode(*this));
+ return adoptPtr(new ScrollingStateFixedNode(*this, adoptiveTree));
}
void ScrollingStateFixedNode::updateConstraints(const FixedPositionViewportConstraints& constraints)
@@ -67,7 +67,7 @@
m_constraints = constraints;
setPropertyChanged(ViewportConstraints);
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
void ScrollingStateFixedNode::syncLayerPositionForViewportRect(const LayoutRect& viewportRect)
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.h (161190 => 161191)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.h 2014-01-01 18:14:27 UTC (rev 161190)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateFixedNode.h 2014-01-01 18:26:29 UTC (rev 161191)
@@ -39,9 +39,9 @@
class ScrollingStateFixedNode FINAL : public ScrollingStateNode {
public:
- static PassOwnPtr<ScrollingStateFixedNode> create(ScrollingStateTree*, ScrollingNodeID);
+ static PassOwnPtr<ScrollingStateFixedNode> create(ScrollingStateTree&, ScrollingNodeID);
- virtual PassOwnPtr<ScrollingStateNode> clone();
+ virtual PassOwnPtr<ScrollingStateNode> clone(ScrollingStateTree&);
virtual ~ScrollingStateFixedNode();
@@ -53,8 +53,8 @@
const FixedPositionViewportConstraints& viewportConstraints() const { return m_constraints; }
private:
- ScrollingStateFixedNode(ScrollingStateTree*, ScrollingNodeID);
- ScrollingStateFixedNode(const ScrollingStateFixedNode&);
+ ScrollingStateFixedNode(ScrollingStateTree&, ScrollingNodeID);
+ ScrollingStateFixedNode(const ScrollingStateFixedNode&, ScrollingStateTree&);
virtual void syncLayerPositionForViewportRect(const LayoutRect& viewportRect) OVERRIDE;
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp (161190 => 161191)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp 2014-01-01 18:14:27 UTC (rev 161190)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp 2014-01-01 18:26:29 UTC (rev 161191)
@@ -36,7 +36,7 @@
namespace WebCore {
-ScrollingStateNode::ScrollingStateNode(ScrollingNodeType nodeType, ScrollingStateTree* scrollingStateTree, ScrollingNodeID nodeID)
+ScrollingStateNode::ScrollingStateNode(ScrollingNodeType nodeType, ScrollingStateTree& scrollingStateTree, ScrollingNodeID nodeID)
: m_nodeType(nodeType)
, m_nodeID(nodeID)
, m_changedProperties(0)
@@ -48,40 +48,41 @@
// This copy constructor is used for cloning nodes in the tree, and it doesn't make sense
// to clone the relationship pointers, so don't copy that information from the original
// node.
-ScrollingStateNode::ScrollingStateNode(const ScrollingStateNode& stateNode)
+ScrollingStateNode::ScrollingStateNode(const ScrollingStateNode& stateNode, ScrollingStateTree& adoptiveTree)
: m_nodeType(stateNode.nodeType())
, m_nodeID(stateNode.scrollingNodeID())
, m_changedProperties(stateNode.changedProperties())
- , m_scrollingStateTree(0)
+ , m_scrollingStateTree(adoptiveTree)
, m_parent(0)
{
// FIXME: why doesn't this set the GraphicsLayer?
setScrollPlatformLayer(stateNode.platformScrollLayer());
+ scrollingStateTree().addNode(this);
}
ScrollingStateNode::~ScrollingStateNode()
{
}
-PassOwnPtr<ScrollingStateNode> ScrollingStateNode::cloneAndReset()
+PassOwnPtr<ScrollingStateNode> ScrollingStateNode::cloneAndReset(ScrollingStateTree& adoptiveTree)
{
- OwnPtr<ScrollingStateNode> clone = this->clone();
+ OwnPtr<ScrollingStateNode> clone = this->clone(adoptiveTree);
// Now that this node is cloned, reset our change properties.
resetChangedProperties();
- cloneAndResetChildren(clone.get());
+ cloneAndResetChildren(*clone, adoptiveTree);
return clone.release();
}
-void ScrollingStateNode::cloneAndResetChildren(ScrollingStateNode* clone)
+void ScrollingStateNode::cloneAndResetChildren(ScrollingStateNode& clone, ScrollingStateTree& adoptiveTree)
{
if (!m_children)
return;
size_t size = m_children->size();
for (size_t i = 0; i < size; ++i)
- clone->appendChild(m_children->at(i)->cloneAndReset());
+ clone.appendChild(m_children->at(i)->cloneAndReset(adoptiveTree));
}
void ScrollingStateNode::appendChild(PassOwnPtr<ScrollingStateNode> childNode)
@@ -116,10 +117,8 @@
void ScrollingStateNode::willBeRemovedFromStateTree()
{
- ASSERT(m_scrollingStateTree);
+ scrollingStateTree().didRemoveNode(scrollingNodeID());
- m_scrollingStateTree->didRemoveNode(scrollingNodeID());
-
if (!m_children)
return;
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h (161190 => 161191)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h 2014-01-01 18:14:27 UTC (rev 161190)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h 2014-01-01 18:26:29 UTC (rev 161191)
@@ -46,14 +46,14 @@
class ScrollingStateNode {
public:
- ScrollingStateNode(ScrollingNodeType, ScrollingStateTree*, ScrollingNodeID);
+ ScrollingStateNode(ScrollingNodeType, ScrollingStateTree&, ScrollingNodeID);
virtual ~ScrollingStateNode();
ScrollingNodeType nodeType() const { return m_nodeType; }
- virtual PassOwnPtr<ScrollingStateNode> clone() = 0;
- PassOwnPtr<ScrollingStateNode> cloneAndReset();
- void cloneAndResetChildren(ScrollingStateNode*);
+ virtual PassOwnPtr<ScrollingStateNode> clone(ScrollingStateTree& adoptiveTree) = 0;
+ PassOwnPtr<ScrollingStateNode> cloneAndReset(ScrollingStateTree& adoptiveTree);
+ void cloneAndResetChildren(ScrollingStateNode&, ScrollingStateTree& adoptiveTree);
enum {
ScrollLayer = 0,
@@ -73,8 +73,7 @@
void setScrollLayer(GraphicsLayer*);
void setScrollPlatformLayer(PlatformLayer*);
- ScrollingStateTree* scrollingStateTree() const { return m_scrollingStateTree; }
- void setScrollingStateTree(ScrollingStateTree* tree) { m_scrollingStateTree = tree; }
+ ScrollingStateTree& scrollingStateTree() const { return m_scrollingStateTree; }
ScrollingNodeID scrollingNodeID() const { return m_nodeID; }
@@ -89,7 +88,7 @@
String scrollingStateTreeAsText() const;
protected:
- ScrollingStateNode(const ScrollingStateNode&);
+ ScrollingStateNode(const ScrollingStateNode&, ScrollingStateTree&);
private:
void dump(TextStream&, int indent) const;
@@ -102,10 +101,8 @@
ScrollingNodeID m_nodeID;
ChangedProperties m_changedProperties;
-protected:
- ScrollingStateTree* m_scrollingStateTree; // FIXME: this should be a reference.
+ ScrollingStateTree& m_scrollingStateTree;
-private:
ScrollingStateNode* m_parent;
OwnPtr<Vector<OwnPtr<ScrollingStateNode>>> m_children;
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp (161190 => 161191)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp 2014-01-01 18:14:27 UTC (rev 161190)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp 2014-01-01 18:26:29 UTC (rev 161191)
@@ -34,12 +34,12 @@
namespace WebCore {
-PassOwnPtr<ScrollingStateScrollingNode> ScrollingStateScrollingNode::create(ScrollingStateTree* stateTree, ScrollingNodeID nodeID)
+PassOwnPtr<ScrollingStateScrollingNode> ScrollingStateScrollingNode::create(ScrollingStateTree& stateTree, ScrollingNodeID nodeID)
{
return adoptPtr(new ScrollingStateScrollingNode(stateTree, nodeID));
}
-ScrollingStateScrollingNode::ScrollingStateScrollingNode(ScrollingStateTree* stateTree, ScrollingNodeID nodeID)
+ScrollingStateScrollingNode::ScrollingStateScrollingNode(ScrollingStateTree& stateTree, ScrollingNodeID nodeID)
: ScrollingStateNode(ScrollingNode, stateTree, nodeID)
, m_counterScrollingLayer(0)
, m_headerLayer(0)
@@ -58,8 +58,8 @@
{
}
-ScrollingStateScrollingNode::ScrollingStateScrollingNode(const ScrollingStateScrollingNode& stateNode)
- : ScrollingStateNode(stateNode)
+ScrollingStateScrollingNode::ScrollingStateScrollingNode(const ScrollingStateScrollingNode& stateNode, ScrollingStateTree& adoptiveTree)
+ : ScrollingStateNode(stateNode, adoptiveTree)
#if PLATFORM(MAC)
, m_verticalScrollbarPainter(stateNode.verticalScrollbarPainter())
, m_horizontalScrollbarPainter(stateNode.horizontalScrollbarPainter())
@@ -87,9 +87,9 @@
{
}
-PassOwnPtr<ScrollingStateNode> ScrollingStateScrollingNode::clone()
+PassOwnPtr<ScrollingStateNode> ScrollingStateScrollingNode::clone(ScrollingStateTree& adoptiveTree)
{
- return adoptPtr(new ScrollingStateScrollingNode(*this));
+ return adoptPtr(new ScrollingStateScrollingNode(*this, adoptiveTree));
}
void ScrollingStateScrollingNode::setViewportRect(const IntRect& viewportRect)
@@ -99,7 +99,7 @@
m_viewportRect = viewportRect;
setPropertyChanged(ViewportRect);
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
void ScrollingStateScrollingNode::setTotalContentsSize(const IntSize& totalContentsSize)
@@ -109,7 +109,7 @@
m_totalContentsSize = totalContentsSize;
setPropertyChanged(TotalContentsSize);
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
void ScrollingStateScrollingNode::setScrollOrigin(const IntPoint& scrollOrigin)
@@ -119,7 +119,7 @@
m_scrollOrigin = scrollOrigin;
setPropertyChanged(ScrollOrigin);
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
void ScrollingStateScrollingNode::setScrollableAreaParameters(const ScrollableAreaParameters& parameters)
@@ -129,7 +129,7 @@
m_scrollableAreaParameters = parameters;
setPropertyChanged(ScrollableAreaParams);
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
void ScrollingStateScrollingNode::setFrameScaleFactor(float scaleFactor)
@@ -140,7 +140,7 @@
m_frameScaleFactor = scaleFactor;
setPropertyChanged(FrameScaleFactor);
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
void ScrollingStateScrollingNode::setNonFastScrollableRegion(const Region& nonFastScrollableRegion)
@@ -150,7 +150,7 @@
m_nonFastScrollableRegion = nonFastScrollableRegion;
setPropertyChanged(NonFastScrollableRegion);
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
void ScrollingStateScrollingNode::setWheelEventHandlerCount(unsigned wheelEventHandlerCount)
@@ -160,7 +160,7 @@
m_wheelEventHandlerCount = wheelEventHandlerCount;
setPropertyChanged(WheelEventHandlerCount);
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
void ScrollingStateScrollingNode::setSynchronousScrollingReasons(SynchronousScrollingReasons reasons)
@@ -170,7 +170,7 @@
m_synchronousScrollingReasons = reasons;
setPropertyChanged(ReasonsForSynchronousScrolling);
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
void ScrollingStateScrollingNode::setScrollBehaviorForFixedElements(ScrollBehaviorForFixedElements behaviorForFixed)
@@ -180,7 +180,7 @@
m_behaviorForFixed = behaviorForFixed;
setPropertyChanged(BehaviorForFixedElements);
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
void ScrollingStateScrollingNode::setRequestedScrollPosition(const IntPoint& requestedScrollPosition, bool representsProgrammaticScroll)
@@ -188,7 +188,7 @@
m_requestedScrollPosition = requestedScrollPosition;
m_requestedScrollPositionRepresentsProgrammaticScroll = representsProgrammaticScroll;
setPropertyChanged(RequestedScrollPosition);
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
void ScrollingStateScrollingNode::setHeaderHeight(int headerHeight)
@@ -198,7 +198,7 @@
m_headerHeight = headerHeight;
setPropertyChanged(HeaderHeight);
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
void ScrollingStateScrollingNode::setFooterHeight(int footerHeight)
@@ -208,7 +208,7 @@
m_footerHeight = footerHeight;
setPropertyChanged(FooterHeight);
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
void ScrollingStateScrollingNode::dumpProperties(TextStream& ts, int indent) const
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h (161190 => 161191)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h 2014-01-01 18:14:27 UTC (rev 161190)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h 2014-01-01 18:26:29 UTC (rev 161191)
@@ -42,9 +42,9 @@
class ScrollingStateScrollingNode FINAL : public ScrollingStateNode {
public:
- static PassOwnPtr<ScrollingStateScrollingNode> create(ScrollingStateTree*, ScrollingNodeID);
+ static PassOwnPtr<ScrollingStateScrollingNode> create(ScrollingStateTree&, ScrollingNodeID);
- virtual PassOwnPtr<ScrollingStateNode> clone();
+ virtual PassOwnPtr<ScrollingStateNode> clone(ScrollingStateTree&);
virtual ~ScrollingStateScrollingNode();
@@ -129,8 +129,8 @@
virtual void dumpProperties(TextStream&, int indent) const OVERRIDE;
private:
- ScrollingStateScrollingNode(ScrollingStateTree*, ScrollingNodeID);
- ScrollingStateScrollingNode(const ScrollingStateScrollingNode&);
+ ScrollingStateScrollingNode(ScrollingStateTree&, ScrollingNodeID);
+ ScrollingStateScrollingNode(const ScrollingStateScrollingNode&, ScrollingStateTree&);
GraphicsLayer* m_counterScrollingLayer;
GraphicsLayer* m_headerLayer;
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.cpp (161190 => 161191)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.cpp 2014-01-01 18:14:27 UTC (rev 161190)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.cpp 2014-01-01 18:26:29 UTC (rev 161191)
@@ -35,18 +35,18 @@
namespace WebCore {
-PassOwnPtr<ScrollingStateStickyNode> ScrollingStateStickyNode::create(ScrollingStateTree* stateTree, ScrollingNodeID nodeID)
+PassOwnPtr<ScrollingStateStickyNode> ScrollingStateStickyNode::create(ScrollingStateTree& stateTree, ScrollingNodeID nodeID)
{
return adoptPtr(new ScrollingStateStickyNode(stateTree, nodeID));
}
-ScrollingStateStickyNode::ScrollingStateStickyNode(ScrollingStateTree* tree, ScrollingNodeID nodeID)
+ScrollingStateStickyNode::ScrollingStateStickyNode(ScrollingStateTree& tree, ScrollingNodeID nodeID)
: ScrollingStateNode(StickyNode, tree, nodeID)
{
}
-ScrollingStateStickyNode::ScrollingStateStickyNode(const ScrollingStateStickyNode& node)
- : ScrollingStateNode(node)
+ScrollingStateStickyNode::ScrollingStateStickyNode(const ScrollingStateStickyNode& node, ScrollingStateTree& adoptiveTree)
+ : ScrollingStateNode(node, adoptiveTree)
, m_constraints(StickyPositionViewportConstraints(node.viewportConstraints()))
{
}
@@ -55,9 +55,9 @@
{
}
-PassOwnPtr<ScrollingStateNode> ScrollingStateStickyNode::clone()
+PassOwnPtr<ScrollingStateNode> ScrollingStateStickyNode::clone(ScrollingStateTree& adoptiveTree)
{
- return adoptPtr(new ScrollingStateStickyNode(*this));
+ return adoptPtr(new ScrollingStateStickyNode(*this, adoptiveTree));
}
void ScrollingStateStickyNode::updateConstraints(const StickyPositionViewportConstraints& constraints)
@@ -67,7 +67,7 @@
m_constraints = constraints;
setPropertyChanged(ViewportConstraints);
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
void ScrollingStateStickyNode::syncLayerPositionForViewportRect(const LayoutRect& viewportRect)
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.h (161190 => 161191)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.h 2014-01-01 18:14:27 UTC (rev 161190)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateStickyNode.h 2014-01-01 18:26:29 UTC (rev 161191)
@@ -39,9 +39,9 @@
class ScrollingStateStickyNode FINAL : public ScrollingStateNode {
public:
- static PassOwnPtr<ScrollingStateStickyNode> create(ScrollingStateTree*, ScrollingNodeID);
+ static PassOwnPtr<ScrollingStateStickyNode> create(ScrollingStateTree&, ScrollingNodeID);
- virtual PassOwnPtr<ScrollingStateNode> clone();
+ virtual PassOwnPtr<ScrollingStateNode> clone(ScrollingStateTree&);
virtual ~ScrollingStateStickyNode();
@@ -53,8 +53,8 @@
const StickyPositionViewportConstraints& viewportConstraints() const { return m_constraints; }
private:
- ScrollingStateStickyNode(ScrollingStateTree*, ScrollingNodeID);
- ScrollingStateStickyNode(const ScrollingStateStickyNode&);
+ ScrollingStateStickyNode(ScrollingStateTree&, ScrollingNodeID);
+ ScrollingStateStickyNode(const ScrollingStateStickyNode&, ScrollingStateTree&);
virtual void syncLayerPositionForViewportRect(const LayoutRect& viewportRect) OVERRIDE;
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp (161190 => 161191)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp 2014-01-01 18:14:27 UTC (rev 161190)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateTree.cpp 2014-01-01 18:26:29 UTC (rev 161191)
@@ -69,7 +69,7 @@
// If we're resetting the root node, we should clear the HashMap and destroy the current children.
clear();
- setRootStateNode(ScrollingStateScrollingNode::create(this, newNodeID));
+ setRootStateNode(ScrollingStateScrollingNode::create(*this, newNodeID));
newNode = rootStateNode();
m_hasNewRootStateNode = true;
} else {
@@ -79,13 +79,13 @@
switch (nodeType) {
case FixedNode: {
- OwnPtr<ScrollingStateFixedNode> fixedNode = ScrollingStateFixedNode::create(this, newNodeID);
+ OwnPtr<ScrollingStateFixedNode> fixedNode = ScrollingStateFixedNode::create(*this, newNodeID);
newNode = fixedNode.get();
parent->appendChild(fixedNode.release());
break;
}
case StickyNode: {
- OwnPtr<ScrollingStateStickyNode> stickyNode = ScrollingStateStickyNode::create(this, newNodeID);
+ OwnPtr<ScrollingStateStickyNode> stickyNode = ScrollingStateStickyNode::create(*this, newNodeID);
newNode = stickyNode.get();
parent->appendChild(stickyNode.release());
break;
@@ -93,7 +93,7 @@
case ScrollingNode: {
// FIXME: We currently only support child nodes that are fixed.
ASSERT_NOT_REACHED();
- OwnPtr<ScrollingStateScrollingNode> scrollingNode = ScrollingStateScrollingNode::create(this, newNodeID);
+ OwnPtr<ScrollingStateScrollingNode> scrollingNode = ScrollingStateScrollingNode::create(*this, newNodeID);
newNode = scrollingNode.get();
parent->appendChild(scrollingNode.release());
break;
@@ -129,7 +129,7 @@
// This function clones and resets the current state tree, but leaves the tree structure intact.
OwnPtr<ScrollingStateTree> treeStateClone = ScrollingStateTree::create();
if (m_rootStateNode)
- treeStateClone->setRootStateNode(static_pointer_cast<ScrollingStateScrollingNode>(m_rootStateNode->cloneAndReset()));
+ treeStateClone->setRootStateNode(static_pointer_cast<ScrollingStateScrollingNode>(m_rootStateNode->cloneAndReset(*treeStateClone)));
// Copy the IDs of the nodes that have been removed since the last commit into the clone.
treeStateClone->m_nodesRemovedSinceLastCommit.swap(m_nodesRemovedSinceLastCommit);
@@ -144,6 +144,11 @@
return treeStateClone.release();
}
+void ScrollingStateTree::addNode(ScrollingStateNode* node)
+{
+ m_stateNodeMap.add(node->scrollingNodeID(), node);
+}
+
void ScrollingStateTree::removeNode(ScrollingStateNode* node)
{
if (!node)
Modified: trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h (161190 => 161191)
--- trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h 2014-01-01 18:14:27 UTC (rev 161190)
+++ trunk/Source/WebCore/page/scrolling/ScrollingStateTree.h 2014-01-01 18:26:29 UTC (rev 161191)
@@ -68,6 +68,7 @@
ScrollingStateTree();
void setRootStateNode(PassOwnPtr<ScrollingStateScrollingNode> rootStateNode) { m_rootStateNode = rootStateNode; }
+ void addNode(ScrollingStateNode*);
void removeNode(ScrollingStateNode*);
void didRemoveNode(ScrollingNodeID);
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingStateNodeMac.mm (161190 => 161191)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingStateNodeMac.mm 2014-01-01 18:14:27 UTC (rev 161190)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingStateNodeMac.mm 2014-01-01 18:26:29 UTC (rev 161191)
@@ -54,7 +54,7 @@
m_graphicsLayer = graphicsLayer;
setPropertyChanged(ScrollLayer);
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
} // namespace WebCore
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingStateScrollingNodeMac.mm (161190 => 161191)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingStateScrollingNodeMac.mm 2014-01-01 18:14:27 UTC (rev 161190)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingStateScrollingNodeMac.mm 2014-01-01 18:26:29 UTC (rev 161191)
@@ -50,8 +50,7 @@
m_counterScrollingLayer = graphicsLayer;
setPropertyChanged(CounterScrollingLayer);
- if (m_scrollingStateTree)
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
PlatformLayer* ScrollingStateScrollingNode::headerPlatformLayer() const
@@ -69,8 +68,7 @@
m_headerLayer = graphicsLayer;
setPropertyChanged(HeaderLayer);
- if (m_scrollingStateTree)
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
PlatformLayer* ScrollingStateScrollingNode::footerPlatformLayer() const
@@ -88,8 +86,7 @@
m_footerLayer = graphicsLayer;
setPropertyChanged(FooterLayer);
- if (m_scrollingStateTree)
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
void ScrollingStateScrollingNode::setScrollbarPaintersFromScrollbars(Scrollbar* verticalScrollbar, Scrollbar* horizontalScrollbar)
@@ -111,8 +108,7 @@
m_horizontalScrollbarPainter = horizontalPainter;
setPropertyChanged(PainterForScrollbar);
- if (m_scrollingStateTree)
- m_scrollingStateTree->setHasChangedProperties(true);
+ scrollingStateTree().setHasChangedProperties(true);
}
} // namespace WebCore