| Differences between
and this patch
- a/Source/WebCore/ChangeLog +41 lines
Lines 1-3 a/Source/WebCore/ChangeLog_sec1
1
2018-12-04  Simon Fraser  <simon.fraser@apple.com>
2
3
        Allow control over child order when adding nodes to the scrolling tree
4
        https://bugs.webkit.org/show_bug.cgi?id=192395
5
6
        Reviewed by NOBODY (OOPS!).
7
        
8
        Previously ScrollingCoordinator just allowed nodes to be "attached" with a given parent,
9
        but with no control over sibling order. To allow for correct hit-testing overflow and
10
        frame scrolling nodes, we have to build the scrolling tree in z-order.
11
12
        This patch adds a 'childIndex' parameter to attachNode() which gives control over
13
        sibling order, but doesn't use it yet.
14
15
        * page/scrolling/AsyncScrollingCoordinator.cpp:
16
        (WebCore::AsyncScrollingCoordinator::attachToStateTree):
17
        (WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView):
18
        * page/scrolling/AsyncScrollingCoordinator.h:
19
        * page/scrolling/ScrollingCoordinator.cpp:
20
        (WebCore::ScrollingCoordinator::uniqueScrollingNodeID):
21
        (WebCore::ScrollingCoordinator::uniqueScrollLayerID): Deleted.
22
        * page/scrolling/ScrollingCoordinator.h:
23
        (WebCore::ScrollingCoordinator::attachToStateTree):
24
        * page/scrolling/ScrollingStateNode.cpp:
25
        (WebCore::ScrollingStateNode::ScrollingStateNode):
26
        (WebCore::ScrollingStateNode::insertChild):
27
        (WebCore::ScrollingStateNode::indexOfChild const):
28
        * page/scrolling/ScrollingStateNode.h:
29
        (WebCore::ScrollingStateNode::scrollingNodeID const):
30
        * page/scrolling/ScrollingStateTree.cpp:
31
        (WebCore::ScrollingStateTree::nodeTypeAndParentMatch const):
32
        (WebCore::ScrollingStateTree::attachNode):
33
        (WebCore::ScrollingStateTree::setRootStateNode):
34
        (WebCore::ScrollingStateTree::addNode):
35
        * page/scrolling/ScrollingStateTree.h:
36
        (WebCore::ScrollingStateTree::setRootStateNode): Deleted.
37
        * page/scrolling/ScrollingTree.cpp:
38
        * page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h:
39
        * rendering/RenderLayerCompositor.cpp:
40
        (WebCore::RenderLayerCompositor::attachScrollingNode):
41
1
2018-12-04  Frederic Wang  <fwang@igalia.com>
42
2018-12-04  Frederic Wang  <fwang@igalia.com>
2
43
3
        Always pass scrollingGeometry to update*ScrollingNode functions
44
        Always pass scrollingGeometry to update*ScrollingNode functions
- a/Source/WebKit/ChangeLog +10 lines
Lines 1-3 a/Source/WebKit/ChangeLog_sec1
1
2018-12-04  Simon Fraser  <simon.fraser@apple.com>
2
3
        Allow control over child order when adding nodes to the scrolling tree
4
        https://bugs.webkit.org/show_bug.cgi?id=192395
5
6
        Reviewed by NOBODY (OOPS!).
7
8
        * Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
9
        (WebKit::RemoteScrollingCoordinatorTransaction::decode):
10
1
2018-12-04  Youenn Fablet  <youenn@apple.com>
11
2018-12-04  Youenn Fablet  <youenn@apple.com>
2
12
3
        Calling getUserMedia in a link that was opened with target="_blank" does not work the second time
13
        Calling getUserMedia in a link that was opened with target="_blank" does not work the second time
- a/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp -3 / +3 lines
Lines 474-482 void AsyncScrollingCoordinator::scrollableAreaScrollbarLayerDidChange(Scrollable a/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp_sec1
474
        scrollableArea.horizontalScrollbarLayerDidChange();
474
        scrollableArea.horizontalScrollbarLayerDidChange();
475
}
475
}
476
476
477
ScrollingNodeID AsyncScrollingCoordinator::attachToStateTree(ScrollingNodeType nodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID)
477
ScrollingNodeID AsyncScrollingCoordinator::attachToStateTree(ScrollingNodeType nodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID, size_t childIndex)
478
{
478
{
479
    return m_scrollingStateTree->attachNode(nodeType, newNodeID, parentID);
479
    return m_scrollingStateTree->attachNode(nodeType, newNodeID, parentID, childIndex);
480
}
480
}
481
481
482
void AsyncScrollingCoordinator::detachFromStateTree(ScrollingNodeID nodeID)
482
void AsyncScrollingCoordinator::detachFromStateTree(ScrollingNodeID nodeID)
Lines 509-515 void AsyncScrollingCoordinator::ensureRootStateNodeForFrameView(FrameView& frame a/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp_sec2
509
    // For non-main frames, it is only possible to arrive in this function from
509
    // For non-main frames, it is only possible to arrive in this function from
510
    // RenderLayerCompositor::updateBacking where the node has already been created.
510
    // RenderLayerCompositor::updateBacking where the node has already been created.
511
    ASSERT(frameView.frame().isMainFrame());
511
    ASSERT(frameView.frame().isMainFrame());
512
    attachToStateTree(MainFrameScrollingNode, frameView.scrollLayerID(), 0);
512
    attachToStateTree(MainFrameScrollingNode, frameView.scrollLayerID(), 0, 0);
513
}
513
}
514
514
515
void AsyncScrollingCoordinator::updateFrameScrollingNode(ScrollingNodeID nodeID, GraphicsLayer* layer, GraphicsLayer* scrolledContentsLayer, GraphicsLayer* counterScrollingLayer, GraphicsLayer* insetClipLayer, const ScrollingGeometry& scrollingGeometry)
515
void AsyncScrollingCoordinator::updateFrameScrollingNode(ScrollingNodeID nodeID, GraphicsLayer* layer, GraphicsLayer* scrolledContentsLayer, GraphicsLayer* counterScrollingLayer, GraphicsLayer* insetClipLayer, const ScrollingGeometry& scrollingGeometry)
- a/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h -1 / +1 lines
Lines 97-103 private: a/Source/WebCore/page/scrolling/AsyncScrollingCoordinator.h_sec1
97
97
98
    WEBCORE_EXPORT bool requestScrollPositionUpdate(FrameView&, const IntPoint&) override;
98
    WEBCORE_EXPORT bool requestScrollPositionUpdate(FrameView&, const IntPoint&) override;
99
99
100
    WEBCORE_EXPORT ScrollingNodeID attachToStateTree(ScrollingNodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID) override;
100
    WEBCORE_EXPORT ScrollingNodeID attachToStateTree(ScrollingNodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID, size_t childIndex) override;
101
    WEBCORE_EXPORT void detachFromStateTree(ScrollingNodeID) override;
101
    WEBCORE_EXPORT void detachFromStateTree(ScrollingNodeID) override;
102
    WEBCORE_EXPORT void clearStateTree() override;
102
    WEBCORE_EXPORT void clearStateTree() override;
103
    
103
    
- a/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp -3 / +3 lines
Lines 361-370 bool ScrollingCoordinator::shouldUpdateScrollLayerPositionSynchronously(const Fr a/Source/WebCore/page/scrolling/ScrollingCoordinator.cpp_sec1
361
    return true;
361
    return true;
362
}
362
}
363
363
364
ScrollingNodeID ScrollingCoordinator::uniqueScrollLayerID()
364
ScrollingNodeID ScrollingCoordinator::uniqueScrollingNodeID()
365
{
365
{
366
    static ScrollingNodeID uniqueScrollLayerID = 1;
366
    static ScrollingNodeID uniqueScrollingNodeID = 1;
367
    return uniqueScrollLayerID++;
367
    return uniqueScrollingNodeID++;
368
}
368
}
369
369
370
String ScrollingCoordinator::scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior) const
370
String ScrollingCoordinator::scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior) const
- a/Source/WebCore/page/scrolling/ScrollingCoordinator.h -4 / +4 lines
Lines 161-171 public: a/Source/WebCore/page/scrolling/ScrollingCoordinator.h_sec1
161
    WEBCORE_EXPORT void setForceSynchronousScrollLayerPositionUpdates(bool);
161
    WEBCORE_EXPORT void setForceSynchronousScrollLayerPositionUpdates(bool);
162
162
163
    // These virtual functions are currently unique to the threaded scrolling architecture. 
163
    // These virtual functions are currently unique to the threaded scrolling architecture. 
164
    // Their meaningful implementations are in ScrollingCoordinatorMac.
165
    virtual void commitTreeStateIfNeeded() { }
164
    virtual void commitTreeStateIfNeeded() { }
166
    virtual bool requestScrollPositionUpdate(FrameView&, const IntPoint&) { return false; }
165
    virtual bool requestScrollPositionUpdate(FrameView&, const IntPoint&) { return false; }
167
    virtual bool handleWheelEvent(FrameView&, const PlatformWheelEvent&) { return true; }
166
    virtual bool handleWheelEvent(FrameView&, const PlatformWheelEvent&) { return true; }
168
    virtual ScrollingNodeID attachToStateTree(ScrollingNodeType, ScrollingNodeID newNodeID, ScrollingNodeID /*parentID*/) { return newNodeID; }
167
    virtual ScrollingNodeID attachToStateTree(ScrollingNodeType, ScrollingNodeID newNodeID, ScrollingNodeID /*parentID*/, size_t /*childIndex*/ = notFound) { return newNodeID; }
168
169
    virtual void detachFromStateTree(ScrollingNodeID) { }
169
    virtual void detachFromStateTree(ScrollingNodeID) { }
170
    virtual void clearStateTree() { }
170
    virtual void clearStateTree() { }
171
171
Lines 198-205 public: a/Source/WebCore/page/scrolling/ScrollingCoordinator.h_sec2
198
    virtual void updateScrollSnapPropertiesWithFrameView(const FrameView&) { }
198
    virtual void updateScrollSnapPropertiesWithFrameView(const FrameView&) { }
199
    virtual void setScrollPinningBehavior(ScrollPinningBehavior) { }
199
    virtual void setScrollPinningBehavior(ScrollPinningBehavior) { }
200
200
201
    // Generated a unique id for scroll layers.
201
    // Generated a unique id for scrolling nodes.
202
    ScrollingNodeID uniqueScrollLayerID();
202
    ScrollingNodeID uniqueScrollingNodeID();
203
203
204
    enum MainThreadScrollingReasonFlags {
204
    enum MainThreadScrollingReasonFlags {
205
        ForcedOnMainThread                                          = 1 << 0,
205
        ForcedOnMainThread                                          = 1 << 0,
- a/Source/WebCore/page/scrolling/ScrollingStateNode.cpp -4 / +21 lines
Lines 39-47 namespace WebCore { a/Source/WebCore/page/scrolling/ScrollingStateNode.cpp_sec1
39
ScrollingStateNode::ScrollingStateNode(ScrollingNodeType nodeType, ScrollingStateTree& scrollingStateTree, ScrollingNodeID nodeID)
39
ScrollingStateNode::ScrollingStateNode(ScrollingNodeType nodeType, ScrollingStateTree& scrollingStateTree, ScrollingNodeID nodeID)
40
    : m_nodeType(nodeType)
40
    : m_nodeType(nodeType)
41
    , m_nodeID(nodeID)
41
    , m_nodeID(nodeID)
42
    , m_changedProperties(0)
43
    , m_scrollingStateTree(scrollingStateTree)
42
    , m_scrollingStateTree(scrollingStateTree)
44
    , m_parent(nullptr)
45
{
43
{
46
}
44
}
47
45
Lines 52-62 ScrollingStateNode::ScrollingStateNode(const ScrollingStateNode& stateNode, Scro a/Source/WebCore/page/scrolling/ScrollingStateNode.cpp_sec2
52
    , m_nodeID(stateNode.scrollingNodeID())
50
    , m_nodeID(stateNode.scrollingNodeID())
53
    , m_changedProperties(stateNode.changedProperties())
51
    , m_changedProperties(stateNode.changedProperties())
54
    , m_scrollingStateTree(adoptiveTree)
52
    , m_scrollingStateTree(adoptiveTree)
55
    , m_parent(nullptr)
56
{
53
{
57
    if (hasChangedProperty(ScrollLayer))
54
    if (hasChangedProperty(ScrollLayer))
58
        setLayer(stateNode.layer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
55
        setLayer(stateNode.layer().toRepresentation(adoptiveTree.preferredLayerRepresentation()));
59
    scrollingStateTree().addNode(this);
56
    scrollingStateTree().addNode(*this);
60
}
57
}
61
58
62
ScrollingStateNode::~ScrollingStateNode() = default;
59
ScrollingStateNode::~ScrollingStateNode() = default;
Lines 100-105 void ScrollingStateNode::appendChild(Ref<ScrollingStateNode>&& childNode) a/Source/WebCore/page/scrolling/ScrollingStateNode.cpp_sec3
100
    m_children->append(WTFMove(childNode));
97
    m_children->append(WTFMove(childNode));
101
}
98
}
102
99
100
void ScrollingStateNode::insertChild(Ref<ScrollingStateNode>&& childNode, size_t index)
101
{
102
    childNode->setParent(this);
103
104
    if (!m_children) {
105
        ASSERT(!index);
106
        m_children = std::make_unique<Vector<RefPtr<ScrollingStateNode>>>();
107
    }
108
109
    m_children->insert(index, WTFMove(childNode));
110
}
111
112
size_t ScrollingStateNode::indexOfChild(ScrollingStateNode& childNode) const
113
{
114
    if (!m_children)
115
        return notFound;
116
117
    return m_children->find(&childNode);
118
}
119
103
void ScrollingStateNode::reconcileLayerPositionForViewportRect(const LayoutRect& viewportRect, ScrollingLayerPositionAction action)
120
void ScrollingStateNode::reconcileLayerPositionForViewportRect(const LayoutRect& viewportRect, ScrollingLayerPositionAction action)
104
{
121
{
105
    if (!m_children)
122
    if (!m_children)
- a/Source/WebCore/page/scrolling/ScrollingStateNode.h -5 / +7 lines
Lines 195-200 public: a/Source/WebCore/page/scrolling/ScrollingStateNode.h_sec1
195
    virtual ~ScrollingStateNode();
195
    virtual ~ScrollingStateNode();
196
    
196
    
197
    ScrollingNodeType nodeType() const { return m_nodeType; }
197
    ScrollingNodeType nodeType() const { return m_nodeType; }
198
    ScrollingNodeID scrollingNodeID() const { return m_nodeID; }
198
199
199
    bool isFixedNode() const { return m_nodeType == FixedNode; }
200
    bool isFixedNode() const { return m_nodeType == FixedNode; }
200
    bool isStickyNode() const { return m_nodeType == StickyNode; }
201
    bool isStickyNode() const { return m_nodeType == StickyNode; }
Lines 227-234 public: a/Source/WebCore/page/scrolling/ScrollingStateNode.h_sec2
227
228
228
    ScrollingStateTree& scrollingStateTree() const { return m_scrollingStateTree; }
229
    ScrollingStateTree& scrollingStateTree() const { return m_scrollingStateTree; }
229
230
230
    ScrollingNodeID scrollingNodeID() const { return m_nodeID; }
231
232
    ScrollingStateNode* parent() const { return m_parent; }
231
    ScrollingStateNode* parent() const { return m_parent; }
233
    void setParent(ScrollingStateNode* parent) { m_parent = parent; }
232
    void setParent(ScrollingStateNode* parent) { m_parent = parent; }
234
    ScrollingNodeID parentNodeID() const { return m_parent ? m_parent->scrollingNodeID() : 0; }
233
    ScrollingNodeID parentNodeID() const { return m_parent ? m_parent->scrollingNodeID() : 0; }
Lines 236-241 public: a/Source/WebCore/page/scrolling/ScrollingStateNode.h_sec3
236
    Vector<RefPtr<ScrollingStateNode>>* children() const { return m_children.get(); }
235
    Vector<RefPtr<ScrollingStateNode>>* children() const { return m_children.get(); }
237
236
238
    void appendChild(Ref<ScrollingStateNode>&&);
237
    void appendChild(Ref<ScrollingStateNode>&&);
238
    void insertChild(Ref<ScrollingStateNode>&&, size_t index);
239
    
240
    size_t indexOfChild(ScrollingStateNode&) const;
239
241
240
    String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const;
242
    String scrollingStateTreeAsText(ScrollingStateTreeAsTextBehavior = ScrollingStateTreeAsTextBehaviorNormal) const;
241
243
Lines 248-259 private: a/Source/WebCore/page/scrolling/ScrollingStateNode.h_sec4
248
    void dump(WTF::TextStream&, ScrollingStateTreeAsTextBehavior) const;
250
    void dump(WTF::TextStream&, ScrollingStateTreeAsTextBehavior) const;
249
251
250
    const ScrollingNodeType m_nodeType;
252
    const ScrollingNodeType m_nodeType;
251
    ScrollingNodeID m_nodeID;
253
    const ScrollingNodeID m_nodeID;
252
    ChangedProperties m_changedProperties;
254
    ChangedProperties m_changedProperties { 0 };
253
255
254
    ScrollingStateTree& m_scrollingStateTree;
256
    ScrollingStateTree& m_scrollingStateTree;
255
257
256
    ScrollingStateNode* m_parent;
258
    ScrollingStateNode* m_parent { nullptr };
257
    std::unique_ptr<Vector<RefPtr<ScrollingStateNode>>> m_children;
259
    std::unique_ptr<Vector<RefPtr<ScrollingStateNode>>> m_children;
258
260
259
    LayerRepresentation m_layer;
261
    LayerRepresentation m_layer;
- a/Source/WebCore/page/scrolling/ScrollingStateTree.cpp -14 / +41 lines
Lines 82-111 Ref<ScrollingStateNode> ScrollingStateTree::createNode(ScrollingNodeType nodeTyp a/Source/WebCore/page/scrolling/ScrollingStateTree.cpp_sec1
82
    return ScrollingStateFixedNode::create(*this, nodeID);
82
    return ScrollingStateFixedNode::create(*this, nodeID);
83
}
83
}
84
84
85
bool ScrollingStateTree::nodeTypeAndParentMatch(ScrollingStateNode& node, ScrollingNodeType nodeType, ScrollingNodeID parentID) const
85
bool ScrollingStateTree::nodeTypeAndParentMatch(ScrollingStateNode& node, ScrollingNodeType nodeType, ScrollingStateNode* parentNode) const
86
{
86
{
87
    if (node.nodeType() != nodeType)
87
    if (node.nodeType() != nodeType)
88
        return false;
88
        return false;
89
89
90
    auto* parent = stateNodeForID(parentID);
90
    return node.parent() == parentNode;
91
    if (!parent)
92
        return true;
93
94
    return node.parent() == parent;
95
}
91
}
96
92
97
ScrollingNodeID ScrollingStateTree::attachNode(ScrollingNodeType nodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID)
93
ScrollingNodeID ScrollingStateTree::attachNode(ScrollingNodeType nodeType, ScrollingNodeID newNodeID, ScrollingNodeID parentID, size_t childIndex)
98
{
94
{
99
    ASSERT(newNodeID);
95
    ASSERT(newNodeID);
100
96
101
    if (auto* node = stateNodeForID(newNodeID)) {
97
    if (auto* node = stateNodeForID(newNodeID)) {
102
        if (nodeTypeAndParentMatch(*node, nodeType, parentID))
98
        auto* parent = stateNodeForID(parentID);
99
        if (nodeTypeAndParentMatch(*node, nodeType, parent)) {
100
            if (!parentID)
101
                return newNodeID;
102
103
            size_t currentIndex = parent->indexOfChild(*node);
104
            if (currentIndex == childIndex)
105
                return newNodeID;
106
107
            ASSERT(currentIndex != notFound);
108
            Ref<ScrollingStateNode> protectedNode(*node);
109
            parent->children()->remove(currentIndex);
110
111
            if (childIndex == notFound)
112
                parent->appendChild(WTFMove(protectedNode));
113
            else
114
                parent->insertChild(WTFMove(protectedNode), childIndex);
115
103
            return newNodeID;
116
            return newNodeID;
117
        }
104
118
105
#if ENABLE(ASYNC_SCROLLING)
119
#if ENABLE(ASYNC_SCROLLING)
106
        // If the type has changed, we need to destroy and recreate the node with a new ID.
120
        // If the type has changed, we need to destroy and recreate the node with a new ID.
107
        if (nodeType != node->nodeType())
121
        if (nodeType != node->nodeType())
108
            newNodeID = m_scrollingCoordinator->uniqueScrollLayerID();
122
            newNodeID = m_scrollingCoordinator->uniqueScrollingNodeID();
109
#endif
123
#endif
110
124
111
        // The node is being re-parented. To do that, we'll remove it, and then create a new node.
125
        // The node is being re-parented. To do that, we'll remove it, and then create a new node.
Lines 114-119 ScrollingNodeID ScrollingStateTree::attachNode(ScrollingNodeType nodeType, Scrol a/Source/WebCore/page/scrolling/ScrollingStateTree.cpp_sec2
114
128
115
    ScrollingStateNode* newNode = nullptr;
129
    ScrollingStateNode* newNode = nullptr;
116
    if (!parentID) {
130
    if (!parentID) {
131
        ASSERT(!childIndex || childIndex == notFound);
117
        // If we're resetting the root node, we should clear the HashMap and destroy the current children.
132
        // If we're resetting the root node, we should clear the HashMap and destroy the current children.
118
        clear();
133
        clear();
119
134
Lines 122-133 ScrollingNodeID ScrollingStateTree::attachNode(ScrollingNodeType nodeType, Scrol a/Source/WebCore/page/scrolling/ScrollingStateTree.cpp_sec3
122
        m_hasNewRootStateNode = true;
137
        m_hasNewRootStateNode = true;
123
    } else {
138
    } else {
124
        auto* parent = stateNodeForID(parentID);
139
        auto* parent = stateNodeForID(parentID);
125
        if (!parent)
140
        if (!parent) {
141
            ASSERT_NOT_REACHED();
126
            return 0;
142
            return 0;
143
        }
127
144
128
        if (nodeType == SubframeScrollingNode && parentID) {
145
        if (nodeType == SubframeScrollingNode && parentID) {
129
            if (auto orphanedNode = m_orphanedSubframeNodes.take(newNodeID)) {
146
            if (auto orphanedNode = m_orphanedSubframeNodes.take(newNodeID)) {
130
                newNode = orphanedNode.get();
147
                newNode = orphanedNode.get();
148
                // FIXME: use childIndex
131
                parent->appendChild(orphanedNode.releaseNonNull());
149
                parent->appendChild(orphanedNode.releaseNonNull());
132
            }
150
            }
133
        }
151
        }
Lines 135-145 ScrollingNodeID ScrollingStateTree::attachNode(ScrollingNodeType nodeType, Scrol a/Source/WebCore/page/scrolling/ScrollingStateTree.cpp_sec4
135
        if (!newNode) {
153
        if (!newNode) {
136
            auto stateNode = createNode(nodeType, newNodeID);
154
            auto stateNode = createNode(nodeType, newNodeID);
137
            newNode = stateNode.ptr();
155
            newNode = stateNode.ptr();
138
            parent->appendChild(WTFMove(stateNode));
156
            
157
            if (childIndex == notFound)
158
                parent->appendChild(WTFMove(stateNode));
159
            else
160
                parent->insertChild(WTFMove(stateNode), childIndex);
139
        }
161
        }
140
    }
162
    }
141
163
142
    m_stateNodeMap.set(newNodeID, newNode);
164
    addNode(*newNode);
143
    m_nodesRemovedSinceLastCommit.remove(newNodeID);
165
    m_nodesRemovedSinceLastCommit.remove(newNodeID);
144
    return newNodeID;
166
    return newNodeID;
145
}
167
}
Lines 196-204 std::unique_ptr<ScrollingStateTree> ScrollingStateTree::commit(LayerRepresentati a/Source/WebCore/page/scrolling/ScrollingStateTree.cpp_sec5
196
    return treeStateClone;
218
    return treeStateClone;
197
}
219
}
198
220
199
void ScrollingStateTree::addNode(ScrollingStateNode* node)
221
void ScrollingStateTree::setRootStateNode(Ref<ScrollingStateFrameScrollingNode>&& rootStateNode)
222
{
223
    m_rootStateNode = WTFMove(rootStateNode);
224
}
225
226
void ScrollingStateTree::addNode(ScrollingStateNode& node)
200
{
227
{
201
    m_stateNodeMap.add(node->scrollingNodeID(), node);
228
    m_stateNodeMap.add(node.scrollingNodeID(), &node);
202
}
229
}
203
230
204
void ScrollingStateTree::removeNodeAndAllDescendants(ScrollingStateNode* node, SubframeNodeRemoval subframeNodeRemoval)
231
void ScrollingStateTree::removeNodeAndAllDescendants(ScrollingStateNode* node, SubframeNodeRemoval subframeNodeRemoval)
- a/Source/WebCore/page/scrolling/ScrollingStateTree.h -5 / +7 lines
Lines 27-38 a/Source/WebCore/page/scrolling/ScrollingStateTree.h_sec1
27
27
28
#if ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS)
28
#if ENABLE(ASYNC_SCROLLING) || USE(COORDINATED_GRAPHICS)
29
29
30
#include "ScrollingStateFrameScrollingNode.h"
30
#include "ScrollingCoordinator.h"
31
#include "ScrollingStateNode.h"
31
#include <wtf/RefPtr.h>
32
#include <wtf/RefPtr.h>
32
 
33
 
33
namespace WebCore {
34
namespace WebCore {
34
35
35
class AsyncScrollingCoordinator;
36
class AsyncScrollingCoordinator;
37
class ScrollingStateFrameScrollingNode;
36
38
37
// The ScrollingStateTree is a tree that managed ScrollingStateNodes. The nodes keep track of the current
39
// The ScrollingStateTree is a tree that managed ScrollingStateNodes. The nodes keep track of the current
38
// state of scrolling related properties. Whenever any properties change, the scrolling coordinator
40
// state of scrolling related properties. Whenever any properties change, the scrolling coordinator
Lines 49-55 public: a/Source/WebCore/page/scrolling/ScrollingStateTree.h_sec2
49
    ScrollingStateFrameScrollingNode* rootStateNode() const { return m_rootStateNode.get(); }
51
    ScrollingStateFrameScrollingNode* rootStateNode() const { return m_rootStateNode.get(); }
50
    WEBCORE_EXPORT ScrollingStateNode* stateNodeForID(ScrollingNodeID) const;
52
    WEBCORE_EXPORT ScrollingStateNode* stateNodeForID(ScrollingNodeID) const;
51
53
52
    WEBCORE_EXPORT ScrollingNodeID attachNode(ScrollingNodeType, ScrollingNodeID, ScrollingNodeID parentID);
54
    WEBCORE_EXPORT ScrollingNodeID attachNode(ScrollingNodeType, ScrollingNodeID, ScrollingNodeID parentID, size_t childIndex);
53
    void detachNode(ScrollingNodeID);
55
    void detachNode(ScrollingNodeID);
54
    void clear();
56
    void clear();
55
    
57
    
Lines 74-85 public: a/Source/WebCore/page/scrolling/ScrollingStateTree.h_sec3
74
    void setPreferredLayerRepresentation(LayerRepresentation::Type representation) { m_preferredLayerRepresentation = representation; }
76
    void setPreferredLayerRepresentation(LayerRepresentation::Type representation) { m_preferredLayerRepresentation = representation; }
75
77
76
private:
78
private:
77
    void setRootStateNode(Ref<ScrollingStateFrameScrollingNode>&& rootStateNode) { m_rootStateNode = WTFMove(rootStateNode); }
79
    void setRootStateNode(Ref<ScrollingStateFrameScrollingNode>&&);
78
    void addNode(ScrollingStateNode*);
80
    void addNode(ScrollingStateNode&);
79
81
80
    Ref<ScrollingStateNode> createNode(ScrollingNodeType, ScrollingNodeID);
82
    Ref<ScrollingStateNode> createNode(ScrollingNodeType, ScrollingNodeID);
81
83
82
    bool nodeTypeAndParentMatch(ScrollingStateNode&, ScrollingNodeType, ScrollingNodeID parentID) const;
84
    bool nodeTypeAndParentMatch(ScrollingStateNode&, ScrollingNodeType, ScrollingStateNode* parentNode) const;
83
85
84
    enum class SubframeNodeRemoval { Delete, Orphan };
86
    enum class SubframeNodeRemoval { Delete, Orphan };
85
    void removeNodeAndAllDescendants(ScrollingStateNode*, SubframeNodeRemoval = SubframeNodeRemoval::Delete);
87
    void removeNodeAndAllDescendants(ScrollingStateNode*, SubframeNodeRemoval = SubframeNodeRemoval::Delete);
- a/Source/WebCore/page/scrolling/ScrollingTree.cpp +1 lines
Lines 31-36 a/Source/WebCore/page/scrolling/ScrollingTree.cpp_sec1
31
#include "EventNames.h"
31
#include "EventNames.h"
32
#include "Logging.h"
32
#include "Logging.h"
33
#include "PlatformWheelEvent.h"
33
#include "PlatformWheelEvent.h"
34
#include "ScrollingStateFrameScrollingNode.h"
34
#include "ScrollingStateTree.h"
35
#include "ScrollingStateTree.h"
35
#include "ScrollingTreeFrameScrollingNode.h"
36
#include "ScrollingTreeFrameScrollingNode.h"
36
#include "ScrollingTreeNode.h"
37
#include "ScrollingTreeNode.h"
- a/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h +1 lines
Lines 29-34 a/Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h_sec1
29
29
30
#include "ScrollController.h"
30
#include "ScrollController.h"
31
#include "ScrollbarThemeMac.h"
31
#include "ScrollbarThemeMac.h"
32
#include "ScrollingStateFrameScrollingNode.h"
32
#include "ScrollingTreeFrameScrollingNode.h"
33
#include "ScrollingTreeFrameScrollingNode.h"
33
#include <wtf/RetainPtr.h>
34
#include <wtf/RetainPtr.h>
34
35
- a/Source/WebCore/rendering/RenderLayerCompositor.cpp -1 / +1 lines
Lines 3835-3841 ScrollingNodeID RenderLayerCompositor::attachScrollingNode(RenderLayer& layer, S a/Source/WebCore/rendering/RenderLayerCompositor.cpp_sec1
3835
    LayerScrollCoordinationRole role = scrollCoordinationRoleForNodeType(nodeType);
3835
    LayerScrollCoordinationRole role = scrollCoordinationRoleForNodeType(nodeType);
3836
    ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(role);
3836
    ScrollingNodeID nodeID = backing->scrollingNodeIDForRole(role);
3837
    if (!nodeID)
3837
    if (!nodeID)
3838
        nodeID = scrollingCoordinator->uniqueScrollLayerID();
3838
        nodeID = scrollingCoordinator->uniqueScrollingNodeID();
3839
3839
3840
    nodeID = scrollingCoordinator->attachToStateTree(nodeType, nodeID, parentNodeID);
3840
    nodeID = scrollingCoordinator->attachToStateTree(nodeType, nodeID, parentNodeID);
3841
    if (!nodeID)
3841
    if (!nodeID)
- a/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp -1 / +1 lines
Lines 413-419 bool RemoteScrollingCoordinatorTransaction::decode(IPC::Decoder& decoder) a/Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp_sec1
413
        if (!decoder.decode(parentNodeID))
413
        if (!decoder.decode(parentNodeID))
414
            return false;
414
            return false;
415
415
416
        m_scrollingStateTree->attachNode(nodeType, nodeID, parentNodeID);
416
        m_scrollingStateTree->attachNode(nodeType, nodeID, parentNodeID, i);
417
        ScrollingStateNode* newNode = m_scrollingStateTree->stateNodeForID(nodeID);
417
        ScrollingStateNode* newNode = m_scrollingStateTree->stateNodeForID(nodeID);
418
        ASSERT(newNode);
418
        ASSERT(newNode);
419
        ASSERT(!parentNodeID || newNode->parent());
419
        ASSERT(!parentNodeID || newNode->parent());

Return to Bug 192395