- Revision
- 132981
- Author
- [email protected]
- Date
- 2012-10-30 21:54:56 -0700 (Tue, 30 Oct 2012)
Log Message
https://bugs.webkit.org/show_bug.cgi?id=100809
ScrollingCoordinator::attachToStateTree() should take an enum
indicating what type of node to create
Reviewed by Simon Fraser.
New enum ScrollingNodeType will soon have other values, such as
FixedNode.
* page/scrolling/ScrollingCoordinator.h:
(WebCore::ScrollingCoordinator::attachToStateTree):
* page/scrolling/mac/ScrollingCoordinatorMac.h:
(ScrollingCoordinatorMac):
This patch generalizes this function so that it can be used to create
different types of nodes and so that it is actually ready to create
child nodes.
* page/scrolling/mac/ScrollingCoordinatorMac.mm:
(WebCore::ScrollingCoordinatorMac::attachToStateTree):
The rootStateNode is always a ScrollingNode.
(WebCore::ScrollingCoordinatorMac::ensureRootStateNodeForFrameView):
For the time being, always create a ScrollingNode.
* rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::attachToScrollingCoordinator):
Modified Paths
Diff
Modified: trunk/Source/WebCore/ChangeLog (132980 => 132981)
--- trunk/Source/WebCore/ChangeLog 2012-10-31 03:41:57 UTC (rev 132980)
+++ trunk/Source/WebCore/ChangeLog 2012-10-31 04:54:56 UTC (rev 132981)
@@ -1,3 +1,31 @@
+2012-10-30 Beth Dakin <[email protected]>
+
+ https://bugs.webkit.org/show_bug.cgi?id=100809
+ ScrollingCoordinator::attachToStateTree() should take an enum
+ indicating what type of node to create
+
+ Reviewed by Simon Fraser.
+
+ New enum ScrollingNodeType will soon have other values, such as
+ FixedNode.
+ * page/scrolling/ScrollingCoordinator.h:
+ (WebCore::ScrollingCoordinator::attachToStateTree):
+ * page/scrolling/mac/ScrollingCoordinatorMac.h:
+ (ScrollingCoordinatorMac):
+
+ This patch generalizes this function so that it can be used to create
+ different types of nodes and so that it is actually ready to create
+ child nodes.
+ * page/scrolling/mac/ScrollingCoordinatorMac.mm:
+ (WebCore::ScrollingCoordinatorMac::attachToStateTree):
+
+ The rootStateNode is always a ScrollingNode.
+ (WebCore::ScrollingCoordinatorMac::ensureRootStateNodeForFrameView):
+
+ For the time being, always create a ScrollingNode.
+ * rendering/RenderLayerBacking.cpp:
+ (WebCore::RenderLayerBacking::attachToScrollingCoordinator):
+
2012-10-30 Gregg Tavares <[email protected]>
Set the initial scissor box for WebGL
Modified: trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h (132980 => 132981)
--- trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2012-10-31 03:41:57 UTC (rev 132980)
+++ trunk/Source/WebCore/page/scrolling/ScrollingCoordinator.h 2012-10-31 04:54:56 UTC (rev 132981)
@@ -47,6 +47,11 @@
typedef unsigned MainThreadScrollingReasons;
typedef uint64_t ScrollingNodeID;
+enum ScrollingNodeType {
+ ScrollingNode
+ // FIXME: This will soon contain other types such as FixedNode.
+};
+
class Frame;
class FrameView;
class GraphicsLayer;
@@ -109,7 +114,7 @@
virtual bool requestScrollPositionUpdate(FrameView*, const IntPoint&) { return false; }
virtual bool handleWheelEvent(FrameView*, const PlatformWheelEvent&) { return true; }
virtual void updateMainFrameScrollPositionAndScrollLayerPosition() { }
- virtual ScrollingNodeID attachToStateTree(ScrollingNodeID newNodeID, ScrollingNodeID /*parentID*/) { return newNodeID; }
+ virtual ScrollingNodeID attachToStateTree(ScrollingNodeType, ScrollingNodeID newNodeID, ScrollingNodeID /*parentID*/) { return newNodeID; }
virtual void detachFromStateTree(ScrollingNodeID) { }
virtual void clearStateTree() { }
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h (132980 => 132981)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h 2012-10-31 03:41:57 UTC (rev 132980)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h 2012-10-31 04:54:56 UTC (rev 132981)
@@ -66,7 +66,7 @@
// 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(ScrollingNodeID newNodeID, ScrollingNodeID parentID);
+ virtual ScrollingNodeID attachToStateTree(ScrollingNodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID);
virtual void detachFromStateTree(ScrollingNodeID);
// This function wipes out the current tree.
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm (132980 => 132981)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm 2012-10-31 03:41:57 UTC (rev 132980)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm 2012-10-31 04:54:56 UTC (rev 132981)
@@ -234,25 +234,37 @@
scrollLayer->setPosition(-frameView->scrollPosition());
}
-ScrollingNodeID ScrollingCoordinatorMac::attachToStateTree(ScrollingNodeID newNodeID, ScrollingNodeID parentID)
+ScrollingNodeID ScrollingCoordinatorMac::attachToStateTree(ScrollingNodeType nodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID)
{
ASSERT(newNodeID);
- ScrollingStateScrollingNode* existingNode = stateNodeForID(newNodeID);
- if (existingNode && existingNode == m_scrollingStateTree->rootStateNode())
+ if (stateNodeForID(newNodeID))
return newNodeID;
- // If there is no parent, this is the root node. Right now, we only support the root node.
- // FIXME: In the future, we should append child nodes in the appropriate spot in the state
- // tree.
+ ScrollingStateNode* newNode;
if (!parentID) {
// If we're resetting the root node, we should clear the HashMap and destroy the current children.
clearStateTree();
m_scrollingStateTree->rootStateNode()->setScrollingNodeID(newNodeID);
- m_stateNodeMap.set(newNodeID, m_scrollingStateTree->rootStateNode());
+ newNode = m_scrollingStateTree->rootStateNode();
+ } else {
+ ScrollingStateNode* parent = stateNodeForID(parentID);
+ switch (nodeType) {
+ case ScrollingNode: {
+ // FIXME: We currently do not support child nodes. This assertion should be removed when we do.
+ ASSERT_NOT_REACHED();
+ PassOwnPtr<ScrollingStateScrollingNode> scrollingNode = ScrollingStateScrollingNode::create(m_scrollingStateTree.get(), newNodeID);
+ newNode = scrollingNode.get();
+ parent->appendChild(scrollingNode);
+ break;
+ }
+ default:
+ ASSERT_NOT_REACHED();
+ }
}
+ m_stateNodeMap.set(newNodeID, newNode);
return newNodeID;
}
@@ -297,7 +309,7 @@
void ScrollingCoordinatorMac::ensureRootStateNodeForFrameView(FrameView* frameView)
{
- attachToStateTree(frameView->scrollLayerID(), 0);
+ attachToStateTree(ScrollingNode, frameView->scrollLayerID(), 0);
}
void ScrollingCoordinatorMac::setScrollLayerForNode(GraphicsLayer* scrollLayer, ScrollingStateNode* node)
Modified: trunk/Source/WebCore/rendering/RenderLayerBacking.cpp (132980 => 132981)
--- trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2012-10-31 03:41:57 UTC (rev 132980)
+++ trunk/Source/WebCore/rendering/RenderLayerBacking.cpp 2012-10-31 04:54:56 UTC (rev 132981)
@@ -1012,8 +1012,9 @@
if (!scrollingCoordinator)
return;
+ ScrollingNodeType nodeType = ScrollingNode;
ScrollingNodeID parentID = parent ? parent->scrollLayerID() : 0;
- m_scrollLayerID = scrollingCoordinator->attachToStateTree(scrollingCoordinator->uniqueScrollLayerID(), parentID);
+ m_scrollLayerID = scrollingCoordinator->attachToStateTree(nodeType, scrollingCoordinator->uniqueScrollLayerID(), parentID);
}
void RenderLayerBacking::detachFromScrollingCoordinator()