Introduce ScrollingTreeScrollingNodeDelegateIOS to share code between overflow and...
authorcommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Sep 2017 12:42:46 +0000 (12:42 +0000)
committercommit-queue@webkit.org <commit-queue@webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Wed, 6 Sep 2017 12:42:46 +0000 (12:42 +0000)
commit4fd6265f75a3b4f671ede216ab200c0bac2d14df
tree22cec0a4eb4d942dbfd2a3ef4f00bcfdf9dec1d9
parenta87fd321017d4dcd8042a4e4addf21e42a396411
Introduce ScrollingTreeScrollingNodeDelegateIOS to share code between overflow and frame scrolling
https://bugs.webkit.org/show_bug.cgi?id=174097

Patch by Frédéric Wang <fwang@igalia.com> on 2017-09-06
Reviewed by Darin Adler.

Source/WebCore:

No new tests, behavior unchanged.

* WebCore.xcodeproj/project.pbxproj: Add ScrollingTreeScrollingNodeDelegate.
* page/scrolling/ScrollingTreeScrollingNode.h: Make ScrollingTreeScrollingNodeDelegate a
friend so that it can access private members.
* page/scrolling/ScrollingTreeScrollingNodeDelegate.cpp: Added. New delegate class for a
scrolling node, which is used by the UI process.
(WebCore::ScrollingTreeScrollingNodeDelegate::ScrollingTreeScrollingNodeDelegate):
Constructor, taking the scrolling node as a parameter.
(WebCore::ScrollingTreeScrollingNodeDelegate::~ScrollingTreeScrollingNodeDelegate):
(WebCore::ScrollingTreeScrollingNodeDelegate::scrollingTree const): Expose the scrolling
tree containing the scrolling node.
(WebCore::ScrollingTreeScrollingNodeDelegate::lastCommittedScrollPosition const): Expose
the last committed scroll position of the scrolling node.
* page/scrolling/ScrollingTreeScrollingNodeDelegate.h: Added.
(WebCore::ScrollingTreeScrollingNodeDelegate::scrollingNode): Expose the scrolling node.
(WebCore::ScrollingTreeScrollingNodeDelegate::scrollingNode const): Ditto.

Source/WebKit:

This patch introduces a new ScrollingTreeScrollingNodeDelegateIOS that can be used by
WKOverflowScrollViewDelegate to communicate to the scrolling tree and nodes. It can also be
used as a helper class by ScrollingTreeOverflowScrollingNodeIOS. For now, only the non-
overriden member functions of ScrollingTreeOverflowScrollingNodeIOS are moved to that new
class. In follow-up commits, WKOverflowScrollViewDelegate can become a generic
ScrollViewDelegate and more code can be moved into the ScrollingTreeScrollingNodeDelegateIOS
file. Frame scrolling nodes will then be able to share the same UI code as overflow:auto when
iOS frame scrolling is implemented (bug 149264).

* UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h: Move non-overriden member
functions and m_updatingFromStateNode into the delegate class. Also define a member to store
that delegate.
* UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm: Use the node delegate to
communicate to the scrolling tree and node.
(-[WKOverflowScrollViewDelegate initWithScrollingTreeNodeDelegate:]): Init with a delegate.
(-[WKOverflowScrollViewDelegate scrollViewDidScroll:]): Call the delegate function.
(-[WKOverflowScrollViewDelegate scrollViewWillBeginDragging:]): Ditto.
(-[WKOverflowScrollViewDelegate scrollViewWillEndDragging:withVelocity:targetContentOffset:]):
Use the delegate functions or pass by ScrollingTreeScrollingNodeDelegateIOS::scrollingNode().
(-[WKOverflowScrollViewDelegate scrollViewDidEndDragging:willDecelerate:]): Use the delegate
functions.
(-[WKOverflowScrollViewDelegate scrollViewDidEndDecelerating:]): Ditto.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::ScrollingTreeOverflowScrollingNodeIOS):
Init the delegate for this class.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::commitStateAfterChildren): Use the delegate.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::setScrollLayerPosition): Use the delegate
function.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateLayersAfterDelegatedScroll): Ditto.
(-[WKOverflowScrollViewDelegate initWithScrollingTreeNode:]): Deleted. This is renamed
initWithScrollingTreeNodeDelegate and accepts a delegate.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::updateChildNodesAfterScroll): Deleted. Moved
to ScrollingTreeScrollingNodeDelegateIOS.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollWillStart): Ditto.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollDidEnd): Ditto.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::overflowScrollViewWillStartPanGesture): Ditto.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::scrollViewDidScroll): Ditto.
(WebKit::ScrollingTreeOverflowScrollingNodeIOS::currentSnapPointIndicesDidChange): Ditto.
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h: Added. New delegate class
for ScrollingTreeOverflowScrollingNodeIOS. The members used by WKOverflowScrollViewDelegate
are public and the others are private. ScrollingTreeOverflowScrollingNodeIOS is a friend of
ScrollingTreeScrollingNodeDelegateIOS so that it can access private members e.g.
updateChildNodesAfterScroll() or  m_updatingFromStateNode.
* UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm: Added.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::ScrollingTreeScrollingNodeDelegateIOS):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::~ScrollingTreeScrollingNodeDelegateIOS):
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::updateChildNodesAfterScroll): Code extracted
from ScrollingTreeOverflowScrollingNodeIOS.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollWillStart): Ditto.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollDidEnd): Ditto.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewWillStartPanGesture): Ditto.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::scrollViewDidScroll): Ditto.
(WebKit::ScrollingTreeScrollingNodeDelegateIOS::currentSnapPointIndicesDidChange): Ditto.
* WebKit.xcodeproj/project.pbxproj: Add ScrollingTreeScrollingNodeDelegateIOS files to the
build system.

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@221669 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Source/WebCore/ChangeLog
Source/WebCore/WebCore.xcodeproj/project.pbxproj
Source/WebCore/page/scrolling/ScrollingTreeScrollingNode.h
Source/WebCore/page/scrolling/ScrollingTreeScrollingNodeDelegate.cpp [new file with mode: 0644]
Source/WebCore/page/scrolling/ScrollingTreeScrollingNodeDelegate.h [new file with mode: 0644]
Source/WebKit/ChangeLog
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.h
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeOverflowScrollingNodeIOS.mm
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.h [new file with mode: 0644]
Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreeScrollingNodeDelegateIOS.mm [new file with mode: 0644]
Source/WebKit/WebKit.xcodeproj/project.pbxproj