Changeset 131221 in webkit


Ignore:
Timestamp:
Oct 12, 2012 1:50:36 PM (12 years ago)
Author:
Beth Dakin
Message:

https://bugs.webkit.org/show_bug.cgi?id=99204
ScrollingStateNodes should keep track of their IDs

Reviewed by Simon Fraser.

There is a HashMap in ScrollingCoordinatorMac that maps
ScrollingNodeIDs to ScrollingStateNodes. The nodes themselves should
keep track of this id. Then the id can be used to make sure
ScrollingStateNodes remove themselves from the HashMap when they are
destroyed, and it will also be useful for associating
ScrollingStateNodes with ScrollingTreeNodes over on the scrolling
thread.

This patch only has the ScrollingStateNodes cache the id. I will
actually make use of the id in follow-up patches.

  • page/scrolling/ScrollingStateNode.cpp:

(WebCore::ScrollingStateNode::ScrollingStateNode):

  • page/scrolling/ScrollingStateNode.h:

(ScrollingStateNode):
(WebCore::ScrollingStateNode::scrollingNodeID):

  • page/scrolling/ScrollingStateScrollingNode.cpp:

(WebCore::ScrollingStateScrollingNode::create):
(WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):

  • page/scrolling/ScrollingStateScrollingNode.h:

(ScrollingStateScrollingNode):

  • page/scrolling/mac/ScrollingCoordinatorMac.mm:

(WebCore::ScrollingCoordinatorMac::attachToStateTree):

Location:
trunk/Source/WebCore
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r131220 r131221  
     12012-10-12  Beth Dakin  <bdakin@apple.com>
     2
     3        https://bugs.webkit.org/show_bug.cgi?id=99204
     4        ScrollingStateNodes should keep track of their IDs
     5
     6        Reviewed by Simon Fraser.
     7
     8        There is a HashMap in ScrollingCoordinatorMac that maps
     9        ScrollingNodeIDs to ScrollingStateNodes. The nodes themselves should
     10        keep track of this id. Then the id can be used to make sure
     11        ScrollingStateNodes remove themselves from the HashMap when they are
     12        destroyed, and it will also be useful for associating
     13        ScrollingStateNodes with ScrollingTreeNodes over on the scrolling
     14        thread.
     15 
     16        This patch only has the ScrollingStateNodes cache the id. I will
     17        actually make use of the id in follow-up patches.
     18
     19        * page/scrolling/ScrollingStateNode.cpp:
     20        (WebCore::ScrollingStateNode::ScrollingStateNode):
     21        * page/scrolling/ScrollingStateNode.h:
     22        (ScrollingStateNode):
     23        (WebCore::ScrollingStateNode::scrollingNodeID):
     24        * page/scrolling/ScrollingStateScrollingNode.cpp:
     25        (WebCore::ScrollingStateScrollingNode::create):
     26        (WebCore::ScrollingStateScrollingNode::ScrollingStateScrollingNode):
     27        * page/scrolling/ScrollingStateScrollingNode.h:
     28        (ScrollingStateScrollingNode):
     29        * page/scrolling/mac/ScrollingCoordinatorMac.mm:
     30        (WebCore::ScrollingCoordinatorMac::attachToStateTree):
     31
    1322012-10-01  Jer Noble  <jer.noble@apple.com>
    233
  • trunk/Source/WebCore/page/scrolling/ScrollingStateNode.cpp

    r131112 r131221  
    3333namespace WebCore {
    3434
    35 ScrollingStateNode::ScrollingStateNode(ScrollingStateTree* scrollingStateTree)
     35ScrollingStateNode::ScrollingStateNode(ScrollingStateTree* scrollingStateTree, ScrollingNodeID nodeID)
    3636    : m_scrollingStateTree(scrollingStateTree)
     37    , m_nodeID(nodeID)
    3738    , m_parent(0)
    3839    , m_scrollLayerDidChange(false)
     
    4546ScrollingStateNode::ScrollingStateNode(ScrollingStateNode* stateNode)
    4647    : m_scrollingStateTree(0)
     48    , m_nodeID(stateNode->scrollingNodeID())
    4749    , m_parent(0)
    4850    , m_scrollLayerDidChange(stateNode->scrollLayerDidChange())
  • trunk/Source/WebCore/page/scrolling/ScrollingStateNode.h

    r131112 r131221  
    3030
    3131#include "GraphicsLayer.h"
     32#include "ScrollingCoordinator.h"
    3233#include <wtf/OwnPtr.h>
    3334#include <wtf/PassOwnPtr.h>
     
    4647
    4748public:
    48     ScrollingStateNode(ScrollingStateTree*);
     49    ScrollingStateNode(ScrollingStateTree*, ScrollingNodeID);
    4950    virtual ~ScrollingStateNode();
    5051
     
    6970    void setScrollingStateTree(ScrollingStateTree* tree) { m_scrollingStateTree = tree; }
    7071
     72    ScrollingNodeID scrollingNodeID() const { return m_nodeID; }
     73
    7174    ScrollingStateNode* parent() const { return m_parent; }
    7275    void setParent(ScrollingStateNode* parent) { m_parent = parent; }
     
    8285
    8386private:
     87    ScrollingNodeID m_nodeID;
     88
    8489    ScrollingStateNode* m_parent;
    85 
    8690    OwnPtr<Vector<OwnPtr<ScrollingStateNode> > > m_children;
    8791
  • trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.cpp

    r130989 r131221  
    3434namespace WebCore {
    3535
    36 PassOwnPtr<ScrollingStateScrollingNode> ScrollingStateScrollingNode::create(ScrollingStateTree* stateTree)
    37 {
    38     return adoptPtr(new ScrollingStateScrollingNode(stateTree));
    39 }
    40 
    41 ScrollingStateScrollingNode::ScrollingStateScrollingNode(ScrollingStateTree* stateTree)
    42     : ScrollingStateNode(stateTree)
     36PassOwnPtr<ScrollingStateScrollingNode> ScrollingStateScrollingNode::create(ScrollingStateTree* stateTree, ScrollingNodeID nodeID)
     37{
     38    return adoptPtr(new ScrollingStateScrollingNode(stateTree, nodeID));
     39}
     40
     41ScrollingStateScrollingNode::ScrollingStateScrollingNode(ScrollingStateTree* stateTree, ScrollingNodeID nodeID)
     42    : ScrollingStateNode(stateTree, nodeID)
    4343    , m_changedProperties(0)
    4444    , m_wheelEventHandlerCount(0)
  • trunk/Source/WebCore/page/scrolling/ScrollingStateScrollingNode.h

    r130989 r131221  
    4040class ScrollingStateScrollingNode : public ScrollingStateNode {
    4141public:
    42     static PassOwnPtr<ScrollingStateScrollingNode> create(ScrollingStateTree*);
     42    static PassOwnPtr<ScrollingStateScrollingNode> create(ScrollingStateTree*, ScrollingNodeID);
    4343    virtual ~ScrollingStateScrollingNode();
    4444
     
    111111
    112112private:
    113     ScrollingStateScrollingNode(ScrollingStateTree*);
     113    ScrollingStateScrollingNode(ScrollingStateTree*, ScrollingNodeID);
    114114    ScrollingStateScrollingNode(ScrollingStateScrollingNode*);
    115115
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingCoordinatorMac.mm

    r131137 r131221  
    248248    // append the node in the appropriate spot in the state tree. For now we always assume
    249249    // this is the root node.
    250     m_scrollingStateTree->setRootStateNode(ScrollingStateScrollingNode::create(m_scrollingStateTree.get()));
     250    m_scrollingStateTree->setRootStateNode(ScrollingStateScrollingNode::create(m_scrollingStateTree.get(), scrollLayerID));
    251251    m_stateNodeMap.set(scrollLayerID, m_scrollingStateTree->rootStateNode());
    252252    return scrollLayerID;
Note: See TracChangeset for help on using the changeset viewer.