Diff
Modified: trunk/Source/WebCore/ChangeLog (161275 => 161276)
--- trunk/Source/WebCore/ChangeLog 2014-01-03 19:52:17 UTC (rev 161275)
+++ trunk/Source/WebCore/ChangeLog 2014-01-03 20:05:48 UTC (rev 161276)
@@ -1,3 +1,35 @@
+2014-01-03 Simon Fraser <[email protected]>
+
+ Allow different types of ScrollingTrees to have different types of ScrollingTreeNode subclasses
+ https://bugs.webkit.org/show_bug.cgi?id=126445
+
+ Reviewed by Tim Horton.
+
+ Make it possible to have ScrollingTree subclasses with different subclasses of ScrollingTreeNodes,
+ by giving ScrollingTree a pure virtual createNode() function. ThreadedScrollingTree implements
+ this, and then delegates node creation to its AsyncScrollingCoordinator (since we have
+ a ScrollingCoordinatorMac but no real need for a ThreadedScrollingTreeMac).
+
+ Also made ThreadedScrollingTree's m_scrollingCoordinator an AsyncScrollingCoordinator,
+ since by definition a threaded scrolling tree uses an async coordinator.
+
+ * page/scrolling/AsyncScrollingCoordinator.h:
+ * page/scrolling/ScrollingTree.cpp:
+ (WebCore::ScrollingTree::updateTreeFromStateNode):
+ * page/scrolling/ScrollingTree.h:
+ * page/scrolling/ScrollingTreeScrollingNode.h:
+ * page/scrolling/ThreadedScrollingTree.cpp:
+ (WebCore::ThreadedScrollingTree::create):
+ (WebCore::ThreadedScrollingTree::ThreadedScrollingTree):
+ (WebCore::ThreadedScrollingTree::createNode):
+ * page/scrolling/ThreadedScrollingTree.h:
+ * page/scrolling/mac/ScrollingCoordinatorMac.h:
+ * page/scrolling/mac/ScrollingCoordinatorMac.mm:
+ (WebCore::ScrollingCoordinatorMac::createScrollingTreeNode):
+ * page/scrolling/mac/ScrollingTreeScrollingNodeMac.h:
+ * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
+ (WebCore::ScrollingTreeScrollingNodeMac::create):
+
2014-01-03 Gavin Barraclough <[email protected]>
Refactor NSActivity handling code from ChildProcess to UserActivity
Modified: trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h (161275 => 161276)
--- trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h 2014-01-03 19:52:17 UTC (rev 161275)
+++ trunk/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h 2014-01-03 20:05:48 UTC (rev 161276)
@@ -52,6 +52,8 @@
ScrollingTree* scrollingTree() const { return m_scrollingTree.get(); }
+ virtual PassOwnPtr<ScrollingTreeNode> createScrollingTreeNode(ScrollingNodeType, ScrollingNodeID) = 0;
+
protected:
AsyncScrollingCoordinator(Page*);
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp (161275 => 161276)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2014-01-03 19:52:17 UTC (rev 161275)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp 2014-01-03 20:05:48 UTC (rev 161276)
@@ -30,10 +30,8 @@
#include "PlatformWheelEvent.h"
#include "ScrollingStateTree.h"
-#include "ScrollingTreeFixedNode.h"
#include "ScrollingTreeNode.h"
#include "ScrollingTreeScrollingNode.h"
-#include "ScrollingTreeStickyNode.h"
#include <wtf/TemporaryChange.h>
namespace WebCore {
@@ -133,24 +131,12 @@
// This is the root node. Nuke the node map.
m_nodeMap.clear();
- m_rootNode = ScrollingTreeScrollingNode::create(*this, nodeID);
+ m_rootNode = static_pointer_cast<ScrollingTreeScrollingNode>(createNode(ScrollingNode, nodeID));
m_nodeMap.set(nodeID, m_rootNode.get());
m_rootNode->updateBeforeChildren(*stateNode);
node = m_rootNode.get();
} else {
- OwnPtr<ScrollingTreeNode> newNode;
- switch (stateNode->nodeType()) {
- case ScrollingNode:
- newNode = ScrollingTreeScrollingNode::create(*this, nodeID);
- break;
- case FixedNode:
- newNode = ScrollingTreeFixedNode::create(*this, nodeID);
- break;
- case StickyNode:
- newNode = ScrollingTreeStickyNode::create(*this, nodeID);
- break;
- }
-
+ OwnPtr<ScrollingTreeNode> newNode = createNode(stateNode->nodeType(), nodeID);
node = newNode.get();
m_nodeMap.set(nodeID, node);
ScrollingTreeNodeMap::const_iterator it = m_nodeMap.find(stateNode->parent()->scrollingNodeID());
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTree.h (161275 => 161276)
--- trunk/Source/WebCore/page/scrolling/ScrollingTree.h 2014-01-03 19:52:17 UTC (rev 161275)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTree.h 2014-01-03 20:05:48 UTC (rev 161276)
@@ -103,6 +103,8 @@
void removeDestroyedNodes(const ScrollingStateTree&);
void updateTreeFromStateNode(const ScrollingStateNode*);
+ virtual PassOwnPtr<ScrollingTreeNode> createNode(ScrollingNodeType, ScrollingNodeID) = 0;
+
OwnPtr<ScrollingTreeScrollingNode> m_rootNode;
typedef HashMap<ScrollingNodeID, ScrollingTreeNode*> ScrollingTreeNodeMap;
Modified: trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h (161275 => 161276)
--- trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h 2014-01-03 19:52:17 UTC (rev 161275)
+++ trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h 2014-01-03 20:05:48 UTC (rev 161276)
@@ -42,7 +42,6 @@
class ScrollingTreeScrollingNode : public ScrollingTreeNode {
public:
- static PassOwnPtr<ScrollingTreeScrollingNode> create(ScrollingTree&, ScrollingNodeID);
virtual ~ScrollingTreeScrollingNode();
virtual void updateBeforeChildren(const ScrollingStateNode&) OVERRIDE;
Modified: trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp (161275 => 161276)
--- trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp 2014-01-03 19:52:17 UTC (rev 161275)
+++ trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp 2014-01-03 20:05:48 UTC (rev 161276)
@@ -28,8 +28,8 @@
#if ENABLE(ASYNC_SCROLLING)
+#include "AsyncScrollingCoordinator.h"
#include "PlatformWheelEvent.h"
-#include "ScrollingCoordinator.h"
#include "ScrollingThread.h"
#include "ScrollingTreeFixedNode.h"
#include "ScrollingTreeNode.h"
@@ -40,12 +40,12 @@
namespace WebCore {
-RefPtr<ThreadedScrollingTree> ThreadedScrollingTree::create(ScrollingCoordinator* scrollingCoordinator)
+RefPtr<ThreadedScrollingTree> ThreadedScrollingTree::create(AsyncScrollingCoordinator* scrollingCoordinator)
{
return adoptRef(new ThreadedScrollingTree(scrollingCoordinator));
}
-ThreadedScrollingTree::ThreadedScrollingTree(ScrollingCoordinator* scrollingCoordinator)
+ThreadedScrollingTree::ThreadedScrollingTree(AsyncScrollingCoordinator* scrollingCoordinator)
: m_scrollingCoordinator(scrollingCoordinator)
{
}
@@ -120,6 +120,11 @@
}
#endif
+PassOwnPtr<ScrollingTreeNode> ThreadedScrollingTree::createNode(ScrollingNodeType nodeType, ScrollingNodeID nodeID)
+{
+ return m_scrollingCoordinator->createScrollingTreeNode(nodeType, nodeID);
+}
+
} // namespace WebCore
#endif // ENABLE(ASYNC_SCROLLING)
Modified: trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h (161275 => 161276)
--- trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h 2014-01-03 19:52:17 UTC (rev 161275)
+++ trunk/Source/WebCore/page/scrolling/ThreadedScrollingTree.h 2014-01-03 20:05:48 UTC (rev 161276)
@@ -35,13 +35,15 @@
namespace WebCore {
+class AsyncScrollingCoordinator;
+
// The ThreadedScrollingTree class lives almost exclusively on the scrolling thread and manages the
// hierarchy of scrollable regions on the page. It's also responsible for dispatching events
// to the correct scrolling tree nodes or dispatching events back to the ScrollingCoordinator
// object on the main thread if they can't be handled on the scrolling thread for various reasons.
class ThreadedScrollingTree : public ScrollingTree {
public:
- static RefPtr<ThreadedScrollingTree> create(ScrollingCoordinator*);
+ static RefPtr<ThreadedScrollingTree> create(AsyncScrollingCoordinator*);
virtual ~ThreadedScrollingTree();
@@ -59,14 +61,16 @@
virtual void invalidate() OVERRIDE;
private:
- explicit ThreadedScrollingTree(ScrollingCoordinator*);
+ explicit ThreadedScrollingTree(AsyncScrollingCoordinator*);
+ virtual PassOwnPtr<ScrollingTreeNode> createNode(ScrollingNodeType, ScrollingNodeID) OVERRIDE;
+
virtual void updateMainFrameScrollPosition(const IntPoint& scrollPosition, SetOrSyncScrollingLayerPosition = SyncScrollingLayerPosition) OVERRIDE;
#if PLATFORM(MAC)
virtual void handleWheelEventPhase(PlatformWheelEventPhase) OVERRIDE;
#endif
- RefPtr<ScrollingCoordinator> m_scrollingCoordinator;
+ RefPtr<AsyncScrollingCoordinator> m_scrollingCoordinator;
};
SCROLLING_TREE_TYPE_CASTS(ThreadedScrollingTree, isThreadedScrollingTree());
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h (161275 => 161276)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h 2014-01-03 19:52:17 UTC (rev 161275)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.h 2014-01-03 20:05:48 UTC (rev 161276)
@@ -51,6 +51,7 @@
virtual bool handleWheelEvent(FrameView*, const PlatformWheelEvent&) OVERRIDE;
private:
+ virtual PassOwnPtr<ScrollingTreeNode> createScrollingTreeNode(ScrollingNodeType, ScrollingNodeID) OVERRIDE;
virtual void scheduleTreeStateCommit() OVERRIDE;
void scrollingStateTreeCommitterTimerFired(Timer<ScrollingCoordinatorMac>*);
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm (161275 => 161276)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm 2014-01-03 19:52:17 UTC (rev 161275)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm 2014-01-03 20:05:48 UTC (rev 161276)
@@ -36,6 +36,9 @@
#include "Region.h"
#include "ScrollingStateTree.h"
#include "ScrollingThread.h"
+#include "ScrollingTreeFixedNode.h"
+#include "ScrollingTreeScrollingNodeMac.h"
+#include "ScrollingTreeStickyNode.h"
#include "ThreadedScrollingTree.h"
#include "TiledBacking.h"
#include <wtf/Functional.h>
@@ -135,6 +138,22 @@
tiledBacking->setScrollingModeIndication(indicatorMode);
}
+PassOwnPtr<ScrollingTreeNode> ScrollingCoordinatorMac::createScrollingTreeNode(ScrollingNodeType nodeType, ScrollingNodeID nodeID)
+{
+ ASSERT(scrollingTree());
+
+ switch (nodeType) {
+ case ScrollingNode:
+ return ScrollingTreeScrollingNodeMac::create(*scrollingTree(), nodeID);
+ case FixedNode:
+ return ScrollingTreeFixedNode::create(*scrollingTree(), nodeID);
+ case StickyNode:
+ return ScrollingTreeStickyNode::create(*scrollingTree(), nodeID);
+ }
+ return nullptr;
+}
+
+
} // namespace WebCore
#endif // ENABLE(ASYNC_SCROLLING)
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h (161275 => 161276)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h 2014-01-03 19:52:17 UTC (rev 161275)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h 2014-01-03 20:05:48 UTC (rev 161276)
@@ -39,10 +39,12 @@
class ScrollingTreeScrollingNodeMac : public ScrollingTreeScrollingNode, private ScrollElasticityControllerClient {
public:
- ScrollingTreeScrollingNodeMac(ScrollingTree&, ScrollingNodeID);
+ static PassOwnPtr<ScrollingTreeScrollingNode> create(ScrollingTree&, ScrollingNodeID);
virtual ~ScrollingTreeScrollingNodeMac();
private:
+ ScrollingTreeScrollingNodeMac(ScrollingTree&, ScrollingNodeID);
+
// ScrollingTreeNode member functions.
virtual void updateBeforeChildren(const ScrollingStateNode&) OVERRIDE;
virtual void updateAfterChildren(const ScrollingStateNode&) OVERRIDE;
Modified: trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm (161275 => 161276)
--- trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm 2014-01-03 19:52:17 UTC (rev 161275)
+++ trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm 2014-01-03 20:05:48 UTC (rev 161276)
@@ -50,7 +50,7 @@
static void logWheelEventHandlerCountChanged(unsigned);
-PassOwnPtr<ScrollingTreeScrollingNode> ScrollingTreeScrollingNode::create(ScrollingTree& scrollingTree, ScrollingNodeID nodeID)
+PassOwnPtr<ScrollingTreeScrollingNode> ScrollingTreeScrollingNodeMac::create(ScrollingTree& scrollingTree, ScrollingNodeID nodeID)
{
return adoptPtr(new ScrollingTreeScrollingNodeMac(scrollingTree, nodeID));
}