[webkit-changes] [WebKit/WebKit] 087a80: Code outside of ScrollingTree should not access sc...

Simon Fraser noreply at github.com
Fri Mar 3 10:01:33 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 087a80ea89a521c156f820554f1298dfcb94c2aa
      https://github.com/WebKit/WebKit/commit/087a80ea89a521c156f820554f1298dfcb94c2aa
  Author: Simon Fraser <simon.fraser at apple.com>
  Date:   2023-03-03 (Fri, 03 Mar 2023)

  Changed paths:
    M Source/WebCore/page/scrolling/ScrollingTree.cpp
    M Source/WebCore/page/scrolling/ScrollingTree.h
    M Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp
    M Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp
    M Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.h
    M Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.mm

  Log Message:
  -----------
  Code outside of ScrollingTree should not access scrolling tree nodes directly
https://bugs.webkit.org/show_bug.cgi?id=253276
rdar://106168232

Reviewed by Tim Horton.

Access to the scrolling tree should be protected by locking, since on macOS with
both web-side and UI-side compositing, scrolling happens off the main thread.

So remove RemoteScrollingCoordinatorProxy::rootNode() and move the functionality
down into ScrollingTree, where we can lock.

ScrollingTree already had a field for `mainFrameScrollPosition`, protected by
a lock, so fix all ScrollingTree subclasses to correctly set that, and use it
from RemoteScrollingCoordinatorProxyMac::currentMainFrameScrollPosition().
This has "current" in the name to indicate that it's the live scroll position which
is changed by the scrolling thread.

* Source/WebCore/page/scrolling/ScrollingTree.cpp:
(WebCore::ScrollingTree::scrollingTreeNodeDidScroll):
(WebCore::ScrollingTree::mainFrameScrollPosition const):
(WebCore::ScrollingTree::mainFrameHorizontalOverscrollBehavior const):
(WebCore::ScrollingTree::mainFrameVerticalOverscrollBehavior const):
* Source/WebCore/page/scrolling/ScrollingTree.h:
* Source/WebCore/page/scrolling/ThreadedScrollingTree.cpp:
(WebCore::ThreadedScrollingTree::scrollingTreeNodeDidScroll):
* Source/WebKit/UIProcess/API/ios/WKWebViewIOS.mm:
(-[WKWebView _updateScrollViewForTransaction:]):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.cpp:
(WebKit::RemoteScrollingCoordinatorProxy::rootScrollingNodeID const):
(WebKit::RemoteScrollingCoordinatorProxy::hasScrollableMainFrame const):
(WebKit::RemoteScrollingCoordinatorProxy::mainFrameHorizontalOverscrollBehavior const):
(WebKit::RemoteScrollingCoordinatorProxy::mainFrameVerticalOverscrollBehavior const):
(WebKit::RemoteScrollingCoordinatorProxy::hasScrollableOrZoomedMainFrame const):
(WebKit::RemoteScrollingCoordinatorProxy::rootNode const): Deleted.
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingCoordinatorProxy.h:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
(WebKit::RemoteScrollingTree::scrollingTreeNodeDidScroll):
* Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
(WebKit::RemoteScrollingCoordinatorProxyIOS::setRootNodeIsInUserScroll):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteLayerTreeDrawingAreaProxyMac.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxyMac::adjustTransientZoom):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.h:
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.mm:
(WebKit::RemoteScrollingCoordinatorProxyMac::currentMainFrameScrollPosition const):

Canonical link: https://commits.webkit.org/261152@main




More information about the webkit-changes mailing list