Add scrolling node types to distinguish main frames and subframes.
authorfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Feb 2018 10:01:43 +0000 (10:01 +0000)
committerfred.wang@free.fr <fred.wang@free.fr@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 8 Feb 2018 10:01:43 +0000 (10:01 +0000)
commite67c67f36ec18d4ffdda76aee9fd5a2e2e3b365d
tree19b3002d350a6c8d70dd5d856592928584e1ea6f
parent7d538096b5a2e91a852ac9d6670abf4bf4c0885c
Add scrolling node types to distinguish main frames and subframes.
https://bugs.webkit.org/show_bug.cgi?id=182533

Patch by Frederic Wang <fwang@igalia.com> on 2018-02-08
Reviewed by Simon Fraser.

Source/WebCore:

This patch splits FrameScrollingNode type into two types: MainFrameScrollingNode and
SubframeScrollingNode. This is needed because new places in the code are likely to
distinguish them e.g. in ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll
or when iOS frame scrolling is introduced (see bug 173833).

No new tests, behavior unchanged.

* page/scrolling/AsyncScrollingCoordinator.cpp:
(WebCore::AsyncScrollingCoordinator::ensureRootStateNodeForFrameView): This is only called
for main frames, so pass MainFrameScrollingNode.
* page/scrolling/ScrollingCoordinator.cpp:
(WebCore::operator<<): Distinguish subframe and main frame when dumping.
* page/scrolling/ScrollingCoordinator.h: Split FrameScrollingNode into two cases.
* page/scrolling/ScrollingStateFrameScrollingNode.cpp: Add node type to constructor and
ASSERT it remains of type FrameScrollingNode.
(WebCore::ScrollingStateFrameScrollingNode::create):
(WebCore::ScrollingStateFrameScrollingNode::ScrollingStateFrameScrollingNode):
* page/scrolling/ScrollingStateFrameScrollingNode.h: Add node type to constructor.
* page/scrolling/ScrollingStateNode.h:
(WebCore::ScrollingStateNode::isFrameScrollingNode const): Includes the two cases.
* page/scrolling/ScrollingStateTree.cpp:
(WebCore::ScrollingStateTree::createNode): Split FrameScrollingNode into two cases and pass
the node type.
(WebCore::ScrollingStateTree::attachNode): The first case only happens for main frames while
the second case only happens with subframes. Use the appriate node type.
* page/scrolling/ScrollingTreeFrameScrollingNode.cpp: Add node type to constructor and
ASSERT it remains of type FrameScrollingNode.
(WebCore::ScrollingTreeFrameScrollingNode::ScrollingTreeFrameScrollingNode):
* page/scrolling/ScrollingTreeFrameScrollingNode.h: Add node type to constructor.
* page/scrolling/ScrollingTreeNode.h: Includes the two cases.
(WebCore::ScrollingTreeNode::isFrameScrollingNode const):
* page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h: Add node type to constructor.
* page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm: Ditto.
(WebCore::ScrollingTreeFrameScrollingNodeIOS::create):
(WebCore::ScrollingTreeFrameScrollingNodeIOS::ScrollingTreeFrameScrollingNodeIOS):
* page/scrolling/ios/ScrollingTreeIOS.cpp: Split FrameScrollingNode into two cases.
(WebCore::ScrollingTreeIOS::createScrollingTreeNode):
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h: Add node type to constructor.
* page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm: Ditto.
(WebCore::ScrollingTreeFrameScrollingNodeMac::create):
(WebCore::ScrollingTreeFrameScrollingNodeMac::ScrollingTreeFrameScrollingNodeMac):
* page/scrolling/mac/ScrollingTreeMac.cpp: Split FrameScrollingNode into two cases.
(ScrollingTreeMac::createScrollingTreeNode):
* rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::reattachSubframeScrollLayers): Distinguish the cases of
main frames and subframes.
(WebCore::scrollCoordinationRoleForNodeType): Split FrameScrollingNode into two cases.
(WebCore::RenderLayerCompositor::updateScrollCoordinationForThisFrame): Distinguish the cases
of main frames and subframes.
(WebCore::RenderLayerCompositor::updateScrollCoordinatedLayer): Split FrameScrollingNode into
two cases.

Source/WebKit:

* Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp: Replace the case of
FrameScrollingNode with MainFrameScrollingNode and SubframeScrollingNode.
(WebKit::encodeNodeAndDescendants):
(WebKit::RemoteScrollingCoordinatorTransaction::decode):
(WebKit::dump):
* UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp: Ditto.
(WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
* UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp: Ditto and pass the node type to the
constructor of the frame scrolling node.
(WebKit::RemoteScrollingTree::createScrollingTreeNode):
* UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm: Replace the case of
FrameScrollingNode with MainFrameScrollingNode and SubframeScrollingNode.
(WebKit::RemoteScrollingCoordinatorProxy::connectStateNodeLayers):
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: In order to
determine whether the node is a main frame or subframe, use the node type instead of checking
whether the node as a parent.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@228264 268f45cc-cd09-0410-ab3c-d52691b4dbfc
24 files changed:
Source/WebCore/ChangeLog
Source/WebCore/page/scrolling/AsyncScrollingCoordinator.cpp
Source/WebCore/page/scrolling/ScrollingCoordinator.cpp
Source/WebCore/page/scrolling/ScrollingCoordinator.h
Source/WebCore/page/scrolling/ScrollingStateFrameScrollingNode.cpp
Source/WebCore/page/scrolling/ScrollingStateFrameScrollingNode.h
Source/WebCore/page/scrolling/ScrollingStateNode.h
Source/WebCore/page/scrolling/ScrollingStateTree.cpp
Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.cpp
Source/WebCore/page/scrolling/ScrollingTreeFrameScrollingNode.h
Source/WebCore/page/scrolling/ScrollingTreeNode.h
Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.h
Source/WebCore/page/scrolling/ios/ScrollingTreeFrameScrollingNodeIOS.mm
Source/WebCore/page/scrolling/ios/ScrollingTreeIOS.cpp
Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.h
Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm
Source/WebCore/page/scrolling/mac/ScrollingTreeMac.cpp
Source/WebCore/rendering/RenderLayerCompositor.cpp
Source/WebKit/ChangeLog
Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp
Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp
Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp
Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm