Changeset 141703 in webkit


Ignore:
Timestamp:
Feb 2, 2013 1:03:16 PM (11 years ago)
Author:
Simon Fraser
Message:

Fixed and sticky nodes have no nodeID set
https://bugs.webkit.org/show_bug.cgi?id=108734

Reviewed by Sam Weinig.

Push ScrollingNodeIDs onto scrolling nodes at construction time, and thereafter
treat them as readonly. Previously, only the root scrolling node would have a node ID.

Node IDs aren't actually used by the scrolling tree yet, but are useful for debugging.

Not testable since we only dump the scrolling state tree, not the scrolling
node tree in tests.

  • page/scrolling/ScrollingTree.cpp:

(WebCore::ScrollingTree::ScrollingTree): No longer create the root node here;
we can only create it when we know what its ID will be.
(WebCore::ScrollingTree::updateTreeFromStateNode): Create the root node if
necessary. Pass node IDs into create methods.

  • page/scrolling/ScrollingTreeNode.cpp:

(WebCore::ScrollingTreeNode::ScrollingTreeNode):

  • page/scrolling/ScrollingTreeNode.h:
  • page/scrolling/ScrollingTreeScrollingNode.cpp:

(WebCore::ScrollingTreeScrollingNode::ScrollingTreeScrollingNode):

  • page/scrolling/ScrollingTreeScrollingNode.h:
  • page/scrolling/mac/ScrollingTreeFixedNode.h:
  • page/scrolling/mac/ScrollingTreeFixedNode.mm:

(WebCore::ScrollingTreeFixedNode::create):
(WebCore::ScrollingTreeFixedNode::ScrollingTreeFixedNode):

  • page/scrolling/mac/ScrollingTreeScrollingNodeMac.h:
  • page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:

(WebCore::ScrollingTreeScrollingNode::create):
(WebCore::ScrollingTreeScrollingNodeMac::ScrollingTreeScrollingNodeMac):

  • page/scrolling/mac/ScrollingTreeStickyNode.h:
  • page/scrolling/mac/ScrollingTreeStickyNode.mm:

(WebCore::ScrollingTreeStickyNode::create):
(WebCore::ScrollingTreeStickyNode::ScrollingTreeStickyNode):

Location:
trunk/Source/WebCore
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r141701 r141703  
     12013-02-02  Simon Fraser  <simon.fraser@apple.com>
     2
     3        Fixed and sticky nodes have no nodeID set
     4        https://bugs.webkit.org/show_bug.cgi?id=108734
     5
     6        Reviewed by Sam Weinig.
     7       
     8        Push ScrollingNodeIDs onto scrolling nodes at construction time, and thereafter
     9        treat them as readonly. Previously, only the root scrolling node would have a node ID.
     10       
     11        Node IDs aren't actually used by the scrolling tree yet, but are useful for debugging.
     12
     13        Not testable since we only dump the scrolling state tree, not the scrolling
     14        node tree in tests.
     15
     16        * page/scrolling/ScrollingTree.cpp:
     17        (WebCore::ScrollingTree::ScrollingTree): No longer create the root node here;
     18        we can only create it when we know what its ID will be.
     19        (WebCore::ScrollingTree::updateTreeFromStateNode): Create the root node if
     20        necessary. Pass node IDs into create methods.
     21        * page/scrolling/ScrollingTreeNode.cpp:
     22        (WebCore::ScrollingTreeNode::ScrollingTreeNode):
     23        * page/scrolling/ScrollingTreeNode.h:
     24        * page/scrolling/ScrollingTreeScrollingNode.cpp:
     25        (WebCore::ScrollingTreeScrollingNode::ScrollingTreeScrollingNode):
     26        * page/scrolling/ScrollingTreeScrollingNode.h:
     27        * page/scrolling/mac/ScrollingTreeFixedNode.h:
     28        * page/scrolling/mac/ScrollingTreeFixedNode.mm:
     29        (WebCore::ScrollingTreeFixedNode::create):
     30        (WebCore::ScrollingTreeFixedNode::ScrollingTreeFixedNode):
     31        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.h:
     32        * page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm:
     33        (WebCore::ScrollingTreeScrollingNode::create):
     34        (WebCore::ScrollingTreeScrollingNodeMac::ScrollingTreeScrollingNodeMac):
     35        * page/scrolling/mac/ScrollingTreeStickyNode.h:
     36        * page/scrolling/mac/ScrollingTreeStickyNode.mm:
     37        (WebCore::ScrollingTreeStickyNode::create):
     38        (WebCore::ScrollingTreeStickyNode::ScrollingTreeStickyNode):
     39
    1402013-02-02  Takashi Sakamoto  <tasak@google.com>
    241
  • trunk/Source/WebCore/page/scrolling/ScrollingTree.cpp

    r140571 r141703  
    4949ScrollingTree::ScrollingTree(ScrollingCoordinator* scrollingCoordinator)
    5050    : m_scrollingCoordinator(scrollingCoordinator)
    51     , m_rootNode(ScrollingTreeScrollingNode::create(this))
    5251    , m_hasWheelEventHandlers(false)
    5352    , m_canGoBack(false)
     
    158157        // If the node isn't found, it's either new and needs to be added to the tree, or there is a new ID for our
    159158        // root node.
     159        ScrollingNodeID nodeID = stateNode->scrollingNodeID();
    160160        if (!stateNode->parent()) {
    161161            // This is the root node.
    162             m_rootNode->setScrollingNodeID(stateNode->scrollingNodeID());
    163             m_nodeMap.set(stateNode->scrollingNodeID(), m_rootNode.get());
     162            if (!m_rootNode)
     163                m_rootNode = ScrollingTreeScrollingNode::create(this, nodeID);
     164
     165            m_nodeMap.set(nodeID, m_rootNode.get());
    164166            m_rootNode->update(stateNode);
    165167        } else {
    166168            OwnPtr<ScrollingTreeNode> newNode;
    167169            if (stateNode->isScrollingNode())
    168                 newNode = ScrollingTreeScrollingNode::create(this);
     170                newNode = ScrollingTreeScrollingNode::create(this, nodeID);
    169171            else if (stateNode->isFixedNode())
    170                 newNode = ScrollingTreeFixedNode::create(this);
     172                newNode = ScrollingTreeFixedNode::create(this, nodeID);
    171173            else if (stateNode->isStickyNode())
    172                 newNode = ScrollingTreeStickyNode::create(this);
     174                newNode = ScrollingTreeStickyNode::create(this, nodeID);
    173175            else
    174176                ASSERT_NOT_REACHED();
    175177
    176178            ScrollingTreeNode* newNodeRawPtr = newNode.get();
    177             m_nodeMap.set(stateNode->scrollingNodeID(), newNodeRawPtr);
     179            m_nodeMap.set(nodeID, newNodeRawPtr);
    178180            ScrollingTreeNodeMap::const_iterator it = m_nodeMap.find(stateNode->parent()->scrollingNodeID());
    179181            ASSERT(it != m_nodeMap.end());
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.cpp

    r138758 r141703  
    3333namespace WebCore {
    3434
    35 ScrollingTreeNode::ScrollingTreeNode(ScrollingTree* scrollingTree)
     35ScrollingTreeNode::ScrollingTreeNode(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
    3636    : m_scrollingTree(scrollingTree)
    37     , m_nodeID(0)
     37    , m_nodeID(nodeID)
    3838    , m_parent(0)
    3939{
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeNode.h

    r138758 r141703  
    4242class ScrollingTreeNode {
    4343public:
    44     explicit ScrollingTreeNode(ScrollingTree*);
     44    explicit ScrollingTreeNode(ScrollingTree*, ScrollingNodeID);
    4545    virtual ~ScrollingTreeNode();
    4646
     
    5050
    5151    ScrollingNodeID scrollingNodeID() const { return m_nodeID; }
    52     void setScrollingNodeID(ScrollingNodeID nodeID) { m_nodeID = nodeID; }
    5352
    5453    ScrollingTreeNode* parent() const { return m_parent; }
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.cpp

    r137957 r141703  
    3333namespace WebCore {
    3434
    35 ScrollingTreeScrollingNode::ScrollingTreeScrollingNode(ScrollingTree* scrollingTree)
    36     : ScrollingTreeNode(scrollingTree)
     35ScrollingTreeScrollingNode::ScrollingTreeScrollingNode(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
     36    : ScrollingTreeNode(scrollingTree, nodeID)
    3737    , m_frameScaleFactor(1)
    3838    , m_shouldUpdateScrollLayerPositionOnMainThread(0)
  • trunk/Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h

    r138758 r141703  
    4343class ScrollingTreeScrollingNode : public ScrollingTreeNode {
    4444public:
    45     static PassOwnPtr<ScrollingTreeScrollingNode> create(ScrollingTree*);
     45    static PassOwnPtr<ScrollingTreeScrollingNode> create(ScrollingTree*, ScrollingNodeID);
    4646    virtual ~ScrollingTreeScrollingNode();
    4747
     
    5757
    5858protected:
    59     explicit ScrollingTreeScrollingNode(ScrollingTree*);
     59    explicit ScrollingTreeScrollingNode(ScrollingTree*, ScrollingNodeID);
    6060
    6161    const IntRect& viewportRect() const { return m_viewportRect; }
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.h

    r138758 r141703  
    4141class ScrollingTreeFixedNode : public ScrollingTreeNode {
    4242public:
    43     static PassOwnPtr<ScrollingTreeFixedNode> create(ScrollingTree*);
     43    static PassOwnPtr<ScrollingTreeFixedNode> create(ScrollingTree*, ScrollingNodeID);
    4444
    4545    virtual ~ScrollingTreeFixedNode();
    4646
    4747private:
    48     ScrollingTreeFixedNode(ScrollingTree*);
     48    ScrollingTreeFixedNode(ScrollingTree*, ScrollingNodeID);
    4949
    5050    virtual void update(ScrollingStateNode*) OVERRIDE;
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeFixedNode.mm

    r138758 r141703  
    3434namespace WebCore {
    3535
    36 PassOwnPtr<ScrollingTreeFixedNode> ScrollingTreeFixedNode::create(ScrollingTree* scrollingTree)
     36PassOwnPtr<ScrollingTreeFixedNode> ScrollingTreeFixedNode::create(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
    3737{
    38     return adoptPtr(new ScrollingTreeFixedNode(scrollingTree));
     38    return adoptPtr(new ScrollingTreeFixedNode(scrollingTree, nodeID));
    3939}
    4040
    41 ScrollingTreeFixedNode::ScrollingTreeFixedNode(ScrollingTree* scrollingTree)
    42     : ScrollingTreeNode(scrollingTree)
     41ScrollingTreeFixedNode::ScrollingTreeFixedNode(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
     42    : ScrollingTreeNode(scrollingTree, nodeID)
    4343{
    4444}
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.h

    r140475 r141703  
    3939class ScrollingTreeScrollingNodeMac : public ScrollingTreeScrollingNode, private ScrollElasticityControllerClient {
    4040public:
    41     explicit ScrollingTreeScrollingNodeMac(ScrollingTree*);
     41    explicit ScrollingTreeScrollingNodeMac(ScrollingTree*, ScrollingNodeID);
    4242    virtual ~ScrollingTreeScrollingNodeMac();
    4343
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeScrollingNodeMac.mm

    r140617 r141703  
    4848
    4949
    50 PassOwnPtr<ScrollingTreeScrollingNode> ScrollingTreeScrollingNode::create(ScrollingTree* scrollingTree)
    51 {
    52     return adoptPtr(new ScrollingTreeScrollingNodeMac(scrollingTree));
    53 }
    54 
    55 ScrollingTreeScrollingNodeMac::ScrollingTreeScrollingNodeMac(ScrollingTree* scrollingTree)
    56     : ScrollingTreeScrollingNode(scrollingTree)
     50PassOwnPtr<ScrollingTreeScrollingNode> ScrollingTreeScrollingNode::create(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
     51{
     52    return adoptPtr(new ScrollingTreeScrollingNodeMac(scrollingTree, nodeID));
     53}
     54
     55ScrollingTreeScrollingNodeMac::ScrollingTreeScrollingNodeMac(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
     56    : ScrollingTreeScrollingNode(scrollingTree, nodeID)
    5757    , m_scrollElasticityController(this)
    5858    , m_lastScrollHadUnfilledPixels(false)
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.h

    r138758 r141703  
    4141class ScrollingTreeStickyNode : public ScrollingTreeNode {
    4242public:
    43     static PassOwnPtr<ScrollingTreeStickyNode> create(ScrollingTree*);
     43    static PassOwnPtr<ScrollingTreeStickyNode> create(ScrollingTree*, ScrollingNodeID);
    4444
    4545    virtual ~ScrollingTreeStickyNode();
    4646
    4747private:
    48     ScrollingTreeStickyNode(ScrollingTree*);
     48    ScrollingTreeStickyNode(ScrollingTree*, ScrollingNodeID);
    4949
    5050    virtual void update(ScrollingStateNode*) OVERRIDE;
  • trunk/Source/WebCore/page/scrolling/mac/ScrollingTreeStickyNode.mm

    r138758 r141703  
    3434namespace WebCore {
    3535
    36 PassOwnPtr<ScrollingTreeStickyNode> ScrollingTreeStickyNode::create(ScrollingTree* scrollingTree)
     36PassOwnPtr<ScrollingTreeStickyNode> ScrollingTreeStickyNode::create(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
    3737{
    38     return adoptPtr(new ScrollingTreeStickyNode(scrollingTree));
     38    return adoptPtr(new ScrollingTreeStickyNode(scrollingTree, nodeID));
    3939}
    4040
    41 ScrollingTreeStickyNode::ScrollingTreeStickyNode(ScrollingTree* scrollingTree)
    42     : ScrollingTreeNode(scrollingTree)
     41ScrollingTreeStickyNode::ScrollingTreeStickyNode(ScrollingTree* scrollingTree, ScrollingNodeID nodeID)
     42    : ScrollingTreeNode(scrollingTree, nodeID)
    4343{
    4444}
Note: See TracChangeset for help on using the changeset viewer.