Skip to content

Commit

Permalink
[UnifiedPDF] Use the scrolling tree for UnifiedPDFPlugin
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=265007
rdar://118154855

Reviewed by Simon Fraser.

Adopt async scrolling for Unified PDF plugin, improving scrolling performance,
getting scrolling working for the first time on iOS, and paving the way towards
UI-side scrollbars on macOS.

* Source/WebCore/Sources.txt:
* Source/WebCore/SourcesCocoa.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::scrollableAreaForScrollingNodeID const):
* Source/WebCore/page/LocalFrameView.h:
Make it possible to install a non-RenderLayer-owned ScrollableArea as associated
with a ScrollingNodeID.

* Source/WebCore/plugins/PluginViewBase.h:
(WebCore::PluginViewBase::usesAsyncScrolling):
(WebCore::PluginViewBase::scrollingNodeID):
* Source/WebCore/rendering/RenderEmbeddedObject.cpp:
(WebCore::RenderEmbeddedObject::usesAsyncScrolling):
(WebCore::RenderEmbeddedObject::scrollingNodeID):
* Source/WebCore/rendering/RenderEmbeddedObject.h:
* Source/WebKit/WebProcess/Plugins/PluginView.cpp:
(WebKit::PluginView::usesAsyncScrolling):
(WebKit::PluginView::scrollingNodeID):
* Source/WebKit/WebProcess/Plugins/PluginView.h:
Make it possible to ask a plugin if it wants to host a coordinated scroller,
and to retrieve the scroller's ScrollingNodeID.

* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::attachWidgetContentLayers):
Connect the plugin scrolling node as a child of the plugin hosting node.

(WebCore::RenderLayerCompositor::isLayerForPluginWithScrollCoordinatedContents const):
(WebCore::scrollCoordinationRoleForNodeType):
(WebCore::RenderLayerCompositor::detachScrollCoordinatedLayer):
(WebCore::RenderLayerCompositor::coordinatedScrollingRolesForLayer const):
(WebCore::RenderLayerCompositor::updateScrollCoordinationForLayer):
(WebCore::RenderLayerCompositor::updateScrollingNodeForPluginHostingRole):
Create a plugin hosting node if the plugin wants to host a coordinated scroller.

(WebCore::RenderLayerCompositor::updateScrollingNodeLayers):
(WebCore::RenderLayerCompositor::updateScrollingNodeForScrollingRole):
Avoid some irrelevant work which would stomp UnifiedPDFPlugin's scrolling node layers and geometry.

* Source/WebKit/WebProcess/Plugins/PDF/PDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.h:
(WebKit::PDFPluginBase::wantsWheelEvents const): Deleted.
De-hoist wantsWheelEvents, since we don't want them in UnifiedPDFPlugin anymore.

* Source/WebKit/WebProcess/Plugins/PDF/PDFPluginBase.mm:
(WebKit::PDFPluginBase::PDFPluginBase):
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.h:
* Source/WebKit/WebProcess/Plugins/PDF/UnifiedPDF/UnifiedPDFPlugin.mm:
(WebKit::UnifiedPDFPlugin::UnifiedPDFPlugin):
Turn on rubber-banding.

(WebKit::UnifiedPDFPlugin::teardown):
(WebKit::UnifiedPDFPlugin::updateLayerHierarchy):
Create a plugin scrolling node, which RenderLayerCompositor will plug into the hosting node.

(WebKit::UnifiedPDFPlugin::didChangeSettings):
(WebKit::UnifiedPDFPlugin::didChangeScrollOffset):
Use boundsOrigin instead of position to scroll, matching what the UI-side scrolling code will do.

(WebKit::UnifiedPDFPlugin::updateScrollbars):
Push plugin geometry changes down to both the scrolling tree and event regions.

(WebKit::UnifiedPDFPlugin::handleWheelEvent): Deleted.

* Source/WebCore/page/scrolling/ScrollingStatePluginHostingNode.cpp: Added.
* Source/WebCore/page/scrolling/ScrollingStatePluginHostingNode.h: Added.
* Source/WebCore/page/scrolling/ScrollingStatePluginScrollingNode.cpp: Added.
* Source/WebCore/page/scrolling/ScrollingStatePluginScrollingNode.h: Added.
* Source/WebCore/page/scrolling/ScrollingTreePluginHostingNode.cpp: Added.
* Source/WebCore/page/scrolling/ScrollingTreePluginHostingNode.h: Added.
* Source/WebCore/page/scrolling/ScrollingTreePluginScrollingNode.cpp: Added.
* Source/WebCore/page/scrolling/ScrollingTreePluginScrollingNode.h: Added.
* Source/WebCore/page/scrolling/mac/ScrollingTreePluginScrollingNodeMac.h: Added.
* Source/WebCore/page/scrolling/mac/ScrollingTreePluginScrollingNodeMac.mm: Added.
* Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreePluginScrollingNodeIOS.h: Added.
* Source/WebKit/UIProcess/RemoteLayerTree/ios/ScrollingTreePluginScrollingNodeIOS.mm: Added.
* Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreePluginScrollingNodeRemoteMac.cpp: Added.
* Source/WebKit/UIProcess/RemoteLayerTree/mac/ScrollingTreePluginScrollingNodeRemoteMac.h: Added.
Add plugin-scrolling-specific scrolling tree nodes.

* Source/WebCore/page/scrolling/ScrollingCoordinator.h:
* Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.cpp:
(WebCore::operator<<):
* Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.h:
* Source/WebCore/page/scrolling/ScrollingStateNode.h:
(WebCore::ScrollingStateNode::isScrollingNode const):
(WebCore::ScrollingStateNode::isPluginScrollingNode const):
(WebCore::ScrollingStateNode::isPluginHostingNode const):
* Source/WebCore/page/scrolling/ScrollingStateTree.cpp:
(WebCore::ScrollingStateTree::createNode):
(WebCore::ScrollingStateTree::isValid const):
* Source/WebCore/page/scrolling/ScrollingTreeNode.h:
(WebCore::ScrollingTreeNode::isScrollingNode const):
(WebCore::ScrollingTreeNode::isPluginScrollingNode const):
(WebCore::ScrollingTreeNode::isPluginHostingNode const):
* Source/WebCore/page/scrolling/mac/ScrollingTreeMac.mm:
(ScrollingTreeMac::createScrollingTreeNode):
* Source/WebCore/rendering/RenderLayer.cpp:
(WebCore::outputPaintOrderTreeRecursive):
* Source/WebCore/rendering/RenderLayer.h:
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::~RenderLayerBacking):
(WebCore::RenderLayerBacking::detachFromScrollingCoordinator):
(WebCore::RenderLayerBacking::setScrollingNodeIDForRole):
(WebCore::operator<<):
* Source/WebCore/rendering/RenderLayerBacking.h:
* Source/WebCore/rendering/RenderLayerCompositor.h:
(WebCore::allScrollCoordinationRoles):
* Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.cpp:
(WebKit::dump):
* Source/WebKit/Shared/RemoteLayerTree/RemoteScrollingCoordinatorTransaction.serialization.in:
* Source/WebKit/SourcesCocoa.txt:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteScrollingTree.cpp:
(WebKit::RemoteScrollingTree::createScrollingTreeNode):
* Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingCoordinatorProxyIOS.mm:
(WebKit::RemoteScrollingCoordinatorProxyIOS::scrollViewForScrollingNodeID const):
(WebKit::RemoteScrollingCoordinatorProxyIOS::connectStateNodeLayers):
* Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteScrollingTreeIOS.cpp:
(WebKit::RemoteScrollingTreeIOS::createScrollingTreeNode):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingCoordinatorProxyMac.mm:
(WebKit::RemoteScrollingCoordinatorProxyMac::connectStateNodeLayers):
* Source/WebKit/UIProcess/RemoteLayerTree/mac/RemoteScrollingTreeMac.mm:
(WebKit::RemoteScrollingTreeMac::createScrollingTreeNode):
* Source/WebKit/WebKit.xcodeproj/project.pbxproj:
Plumbing for plugin-scrolling-specific scrolling tree nodes.

* Source/WebCore/rendering/EventRegion.h:
Extra exports!

Canonical link: https://commits.webkit.org/270917@main
  • Loading branch information
hortont424 committed Nov 17, 2023
1 parent 227e9bc commit 34b37bd
Show file tree
Hide file tree
Showing 59 changed files with 1,611 additions and 45 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
PASS internals.numberOfScrollableAreas() became 1
PASS internals.numberOfScrollableAreas() became 0
PASS successfullyParsed is true

TEST COMPLETE
Before installing PDF:

(Frame scrolling node
(scrollable area size 800 600)
(contents size 800 600)
(scrollable area parameters
(horizontal scroll elasticity 2)
(vertical scroll elasticity 2)
(horizontal scrollbar mode 0)
(vertical scrollbar mode 0))
(layout viewport at (0,0) size 800x600)
(min layout viewport origin (0,0))
(max layout viewport origin (0,0))
(behavior for fixed 1)
)

After installing PDF:

(Frame scrolling node
(scrollable area size 800 600)
(contents size 800 600)
(scrollable area parameters
(horizontal scroll elasticity 2)
(vertical scroll elasticity 2)
(horizontal scrollbar mode 0)
(vertical scrollbar mode 0))
(layout viewport at (0,0) size 800x600)
(min layout viewport origin (0,0))
(max layout viewport origin (0,0))
(synchronous event dispatch region for event wheel
at (8,23) size 300x300)
(behavior for fixed 1)
)

After removing PDF:

(Frame scrolling node
(scrollable area size 800 600)
(contents size 800 600)
(scrollable area parameters
(horizontal scroll elasticity 2)
(vertical scroll elasticity 2)
(horizontal scrollbar mode 0)
(vertical scrollbar mode 0))
(layout viewport at (0,0) size 800x600)
(min layout viewport origin (0,0))
(max layout viewport origin (0,0))
(behavior for fixed 1)
)


Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
<!DOCTYPE html> <!-- webkit-test-runner [ UnifiedPDFEnabled=true ] -->
<html>
<head>
<script src="../../../resources/js-test-pre.js"></script>
<style>
embed {
width: 300px;
height: 300px;
}
</style>
<script src="../../../resources/ui-helper.js"></script>
<script>
window.jsTestIsAsync = true;

if (window.testRunner)
testRunner.dumpAsText();

window.addEventListener('load', async () => {
await UIHelper.renderingUpdate();

if (!window.internals)
return;

const pdf = document.getElementById("pdf");

document.getElementById('scrollingtree').textContent = "Before installing PDF:\n" + internals.scrollingStateTreeAsText() + "\n";

pdf.src = "../../../fast/images/resources/green_rectangle.pdf";

shouldBecomeEqual("internals.numberOfScrollableAreas()", "1", function () {
document.getElementById('scrollingtree').textContent += "After installing PDF:\n" + internals.scrollingStateTreeAsText() + "\n";

pdf.parentElement.removeChild(pdf);

shouldBecomeEqual("internals.numberOfScrollableAreas()", "0", function () {

document.getElementById('scrollingtree').textContent += "After removing PDF:\n" + internals.scrollingStateTreeAsText() + "\n";

finishJSTest();
});
});
}, false);
</script>
</head>
<body>
<embed id="pdf">
<pre id="scrollingtree"></pre>
<script src="../../../resources/js-test-post.js"></script>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@


(Frame scrolling node
(scrollable area size 800 600)
(contents size 800 600)
(scrollable area parameters
(horizontal scroll elasticity 2)
(vertical scroll elasticity 2)
(horizontal scrollbar mode 0)
(vertical scrollbar mode 0))
(layout viewport at (0,0) size 800x600)
(min layout viewport origin (0,0))
(max layout viewport origin (0,0))
(synchronous event dispatch region for event wheel
at (8,8) size 300x300)
(behavior for fixed 1)
)

30 changes: 30 additions & 0 deletions LayoutTests/compositing/plugins/pdf/pdf-scrolling-tree.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
<!DOCTYPE html> <!-- webkit-test-runner [ UnifiedPDFEnabled=true ] -->
<html>
<head>
<style>
embed {
width: 300px;
height: 300px;
}
</style>
<script src="../../../resources/ui-helper.js"></script>
<script>
if (window.testRunner) {
testRunner.waitUntilDone();
testRunner.dumpAsText();
}
window.addEventListener('load', async () => {
await UIHelper.renderingUpdate();

if (window.internals)
document.getElementById('scrollingtree').textContent = internals.scrollingStateTreeAsText();

testRunner.notifyDone();
}, false);
</script>
</head>
<body>
<embed src="../../../fast/images/resources/green_rectangle.pdf">
<pre id="scrollingtree"></pre>
</body>
</html>
4 changes: 4 additions & 0 deletions Source/WebCore/Sources.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2039,6 +2039,8 @@ page/scrolling/ScrollingStateFrameScrollingNode.cpp
page/scrolling/ScrollingStateNode.cpp
page/scrolling/ScrollingStateOverflowScrollProxyNode.cpp
page/scrolling/ScrollingStateOverflowScrollingNode.cpp
page/scrolling/ScrollingStatePluginHostingNode.cpp
page/scrolling/ScrollingStatePluginScrollingNode.cpp
page/scrolling/ScrollingStatePositionedNode.cpp
page/scrolling/ScrollingStateScrollingNode.cpp
page/scrolling/ScrollingStateStickyNode.cpp
Expand All @@ -2053,6 +2055,8 @@ page/scrolling/ScrollingTreeLatchingController.cpp
page/scrolling/ScrollingTreeNode.cpp
page/scrolling/ScrollingTreeOverflowScrollProxyNode.cpp
page/scrolling/ScrollingTreeOverflowScrollingNode.cpp
page/scrolling/ScrollingTreePluginHostingNode.cpp
page/scrolling/ScrollingTreePluginScrollingNode.cpp
page/scrolling/ScrollingTreePositionedNode.cpp
page/scrolling/ScrollingTreeScrollingNode.cpp
page/scrolling/ScrollingTreeScrollingNodeDelegate.cpp
Expand Down
1 change: 1 addition & 0 deletions Source/WebCore/SourcesCocoa.txt
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,7 @@ page/scrolling/mac/ScrollingStateScrollingNodeMac.mm
page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm
page/scrolling/mac/ScrollingTreeMac.mm
page/scrolling/mac/ScrollingTreeOverflowScrollingNodeMac.mm
page/scrolling/mac/ScrollingTreePluginScrollingNodeMac.mm
page/scrolling/mac/ScrollingTreeScrollingNodeDelegateMac.mm
platform/VideoFrame.mm
platform/animation/AcceleratedEffectStack.mm @no-unify
Expand Down
30 changes: 30 additions & 0 deletions Source/WebCore/WebCore.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -950,6 +950,10 @@
2D0621511DA63A9F00A7FB26 /* WebKitMediaKeyNeededEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D0621481DA63A7900A7FB26 /* WebKitMediaKeyNeededEvent.h */; };
2D0621521DA63AA200A7FB26 /* WebKitMediaKeyNeededEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D0621471DA63A7900A7FB26 /* WebKitMediaKeyNeededEvent.cpp */; };
2D0B4AAB18DA1CCD00434DE1 /* IOSurface.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D0B4AA918DA1CCD00434DE1 /* IOSurface.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D222D332B03FB3B009F4ADD /* ScrollingStatePluginHostingNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D222D2F2B03FB3A009F4ADD /* ScrollingStatePluginHostingNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D222D352B03FB3B009F4ADD /* ScrollingStatePluginScrollingNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D222D312B03FB3B009F4ADD /* ScrollingStatePluginScrollingNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D222D3A2B03FB6B009F4ADD /* ScrollingTreePluginHostingNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D222D362B03FB69009F4ADD /* ScrollingTreePluginHostingNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D222D3C2B03FB6B009F4ADD /* ScrollingTreePluginScrollingNode.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D222D382B03FB6A009F4ADD /* ScrollingTreePluginScrollingNode.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D22830323A8470700364B7E /* CursorMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = F58784F002DE375901EA4122 /* CursorMac.mm */; };
2D29386B235F6B6900C7F3B2 /* ExceptionDetails.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D293869235F6B6800C7F3B2 /* ExceptionDetails.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D29ECC6192ECC8300984B78 /* DisplayRefreshMonitorClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D29ECC2192ECC8300984B78 /* DisplayRefreshMonitorClient.h */; settings = {ATTRIBUTES = (Private, ); }; };
Expand Down Expand Up @@ -979,6 +983,7 @@
2D673E4A2A9CF37300E2B4F0 /* CryptoAlgorithmX25519.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D673E492A9CF2B100E2B4F0 /* CryptoAlgorithmX25519.h */; };
2D6F3E901C1ECB270061DBD4 /* MockPageOverlay.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 2D6F3E8A1C1ECB1C0061DBD4 /* MockPageOverlay.cpp */; };
2D6F3E911C1ECB2F0061DBD4 /* MockPageOverlay.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D6F3E8B1C1ECB1C0061DBD4 /* MockPageOverlay.h */; };
2D6FC8102B05E7F000C87B49 /* ScrollingTreePluginScrollingNodeMac.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D222D402B05587F009F4ADD /* ScrollingTreePluginScrollingNodeMac.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D70BA1318074DDF0001908A /* PlatformCALayerCocoa.h in Headers */ = {isa = PBXBuildFile; fileRef = 2D70BA1218074DDF0001908A /* PlatformCALayerCocoa.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D7705C7255276CD001D0C94 /* ImageBufferPlatformBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = 72BAC3A623E17328008D741C /* ImageBufferPlatformBackend.h */; settings = {ATTRIBUTES = (Private, ); }; };
2D7705C925528D34001D0C94 /* ImageBufferCGBitmapBackend.h in Headers */ = {isa = PBXBuildFile; fileRef = 72BAC3AA23E1E544008D741C /* ImageBufferCGBitmapBackend.h */; settings = {ATTRIBUTES = (Private, ); }; };
Expand Down Expand Up @@ -9078,6 +9083,16 @@
2D0B4AAA18DA1CCD00434DE1 /* IOSurface.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = IOSurface.mm; sourceTree = "<group>"; };
2D1932171DA64E1900A54A08 /* WebKitMediaKeyError.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WebKitMediaKeyError.h; sourceTree = "<group>"; };
2D1932181DA64E1900A54A08 /* WebKitMediaKeyError.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = WebKitMediaKeyError.idl; sourceTree = "<group>"; };
2D222D2E2B03FB3A009F4ADD /* ScrollingStatePluginHostingNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingStatePluginHostingNode.cpp; sourceTree = "<group>"; };
2D222D2F2B03FB3A009F4ADD /* ScrollingStatePluginHostingNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollingStatePluginHostingNode.h; sourceTree = "<group>"; };
2D222D302B03FB3B009F4ADD /* ScrollingStatePluginScrollingNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingStatePluginScrollingNode.cpp; sourceTree = "<group>"; };
2D222D312B03FB3B009F4ADD /* ScrollingStatePluginScrollingNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollingStatePluginScrollingNode.h; sourceTree = "<group>"; };
2D222D362B03FB69009F4ADD /* ScrollingTreePluginHostingNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollingTreePluginHostingNode.h; sourceTree = "<group>"; };
2D222D372B03FB69009F4ADD /* ScrollingTreePluginHostingNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingTreePluginHostingNode.cpp; sourceTree = "<group>"; };
2D222D382B03FB6A009F4ADD /* ScrollingTreePluginScrollingNode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollingTreePluginScrollingNode.h; sourceTree = "<group>"; };
2D222D392B03FB6A009F4ADD /* ScrollingTreePluginScrollingNode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ScrollingTreePluginScrollingNode.cpp; sourceTree = "<group>"; };
2D222D402B05587F009F4ADD /* ScrollingTreePluginScrollingNodeMac.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ScrollingTreePluginScrollingNodeMac.h; sourceTree = "<group>"; };
2D222D412B05587F009F4ADD /* ScrollingTreePluginScrollingNodeMac.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = ScrollingTreePluginScrollingNodeMac.mm; sourceTree = "<group>"; };
2D293869235F6B6800C7F3B2 /* ExceptionDetails.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ExceptionDetails.h; sourceTree = "<group>"; };
2D29ECC1192ECC8300984B78 /* DisplayRefreshMonitorClient.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DisplayRefreshMonitorClient.cpp; sourceTree = "<group>"; };
2D29ECC2192ECC8300984B78 /* DisplayRefreshMonitorClient.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DisplayRefreshMonitorClient.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -22168,6 +22183,10 @@
0FEA3E82191B31BF000F1B55 /* ScrollingStateOverflowScrollingNode.h */,
0F9B547622B4A773007B5E8A /* ScrollingStateOverflowScrollProxyNode.cpp */,
0F9B547522B4A772007B5E8A /* ScrollingStateOverflowScrollProxyNode.h */,
2D222D2E2B03FB3A009F4ADD /* ScrollingStatePluginHostingNode.cpp */,
2D222D2F2B03FB3A009F4ADD /* ScrollingStatePluginHostingNode.h */,
2D222D302B03FB3B009F4ADD /* ScrollingStatePluginScrollingNode.cpp */,
2D222D312B03FB3B009F4ADD /* ScrollingStatePluginScrollingNode.h */,
0F94B64F220914FE00157014 /* ScrollingStatePositionedNode.cpp */,
0F94B651220914FF00157014 /* ScrollingStatePositionedNode.h */,
931CBD08161A44E900E4C874 /* ScrollingStateScrollingNode.cpp */,
Expand Down Expand Up @@ -22196,6 +22215,10 @@
0FEA3E7E191B3169000F1B55 /* ScrollingTreeOverflowScrollingNode.h */,
7AEAD8AD290289C9008B5675 /* ScrollingTreeOverflowScrollProxyNode.cpp */,
7AEAD8AE290289E1008B5675 /* ScrollingTreeOverflowScrollProxyNode.h */,
2D222D372B03FB69009F4ADD /* ScrollingTreePluginHostingNode.cpp */,
2D222D362B03FB69009F4ADD /* ScrollingTreePluginHostingNode.h */,
2D222D392B03FB6A009F4ADD /* ScrollingTreePluginScrollingNode.cpp */,
2D222D382B03FB6A009F4ADD /* ScrollingTreePluginScrollingNode.h */,
7A81DB9728F82C4800F66898 /* ScrollingTreePositionedNode.cpp */,
7A81DB9828F82C5E00F66898 /* ScrollingTreePositionedNode.h */,
9391A99A1629D6FF00297330 /* ScrollingTreeScrollingNode.cpp */,
Expand Down Expand Up @@ -22234,6 +22257,8 @@
0FE5806119327A6200DE32EB /* ScrollingTreeMac.mm */,
0FC0516A219B5EBE0031C39E /* ScrollingTreeOverflowScrollingNodeMac.h */,
0FC05168219B5EBE0031C39E /* ScrollingTreeOverflowScrollingNodeMac.mm */,
2D222D402B05587F009F4ADD /* ScrollingTreePluginScrollingNodeMac.h */,
2D222D412B05587F009F4ADD /* ScrollingTreePluginScrollingNodeMac.mm */,
0F37F0842202ACB700A89C0B /* ScrollingTreeScrollingNodeDelegateMac.h */,
0F37F0832202AC8F00A89C0B /* ScrollingTreeScrollingNodeDelegateMac.mm */,
);
Expand Down Expand Up @@ -41444,6 +41469,8 @@
931CBD0D161A44E900E4C874 /* ScrollingStateNode.h in Headers */,
0FEA3E84191B31BF000F1B55 /* ScrollingStateOverflowScrollingNode.h in Headers */,
0F5DA8B122B8563900C266FA /* ScrollingStateOverflowScrollProxyNode.h in Headers */,
2D222D332B03FB3B009F4ADD /* ScrollingStatePluginHostingNode.h in Headers */,
2D222D352B03FB3B009F4ADD /* ScrollingStatePluginScrollingNode.h in Headers */,
0F94B6522209150600157014 /* ScrollingStatePositionedNode.h in Headers */,
931CBD0F161A44E900E4C874 /* ScrollingStateScrollingNode.h in Headers */,
0FB8890F167D30160010CDA5 /* ScrollingStateStickyNode.h in Headers */,
Expand All @@ -41463,6 +41490,9 @@
0F73B769222B3A0C00805316 /* ScrollingTreeOverflowScrollingNodeMac.h in Headers */,
7AEAD8AF290289E6008B5675 /* ScrollingTreeOverflowScrollProxyNode.h in Headers */,
7AEAD8AC2902899A008B5675 /* ScrollingTreeOverflowScrollProxyNodeCocoa.h in Headers */,
2D222D3A2B03FB6B009F4ADD /* ScrollingTreePluginHostingNode.h in Headers */,
2D222D3C2B03FB6B009F4ADD /* ScrollingTreePluginScrollingNode.h in Headers */,
2D6FC8102B05E7F000C87B49 /* ScrollingTreePluginScrollingNodeMac.h in Headers */,
7A81DB9928F82C8000F66898 /* ScrollingTreePositionedNode.h in Headers */,
7A81DB9C28F82CDA00F66898 /* ScrollingTreePositionedNodeCocoa.h in Headers */,
9391A99D1629D70000297330 /* ScrollingTreeScrollingNode.h in Headers */,
Expand Down
3 changes: 3 additions & 0 deletions Source/WebCore/page/LocalFrameView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -886,6 +886,9 @@ ScrollableArea* LocalFrameView::scrollableAreaForScrollingNodeID(ScrollingNodeID
if (!renderView)
return nullptr;

if (auto area = m_scrollingNodeIDToPluginScrollableAreaMap.get(nodeID))
return area.get();

return renderView->compositor().scrollableAreaForScrollingNodeID(nodeID);
}

Expand Down
4 changes: 4 additions & 0 deletions Source/WebCore/page/LocalFrameView.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,6 +183,8 @@ class LocalFrameView final : public FrameView {

WEBCORE_EXPORT ScrollingNodeID scrollingNodeID() const override;
WEBCORE_EXPORT ScrollableArea* scrollableAreaForScrollingNodeID(ScrollingNodeID) const;
void setPluginScrollableAreaForScrollingNodeID(ScrollingNodeID nodeID, ScrollableArea& area) { m_scrollingNodeIDToPluginScrollableAreaMap.add(nodeID, &area); }
void removePluginScrollableAreaForScrollingNodeID(ScrollingNodeID nodeID) { m_scrollingNodeIDToPluginScrollableAreaMap.remove(nodeID); }
bool usesAsyncScrolling() const final;

WEBCORE_EXPORT void enterCompositingMode();
Expand Down Expand Up @@ -950,6 +952,8 @@ class LocalFrameView final : public FrameView {
std::unique_ptr<ListHashSet<CheckedPtr<RenderEmbeddedObject>>> m_embeddedObjectsToUpdate;
std::unique_ptr<WeakHashSet<RenderElement>> m_slowRepaintObjects;

HashMap<ScrollingNodeID, WeakPtr<ScrollableArea>> m_scrollingNodeIDToPluginScrollableAreaMap;

RefPtr<ContainerNode> m_maintainScrollPositionAnchor;
RefPtr<ContainerNode> m_scheduledMaintainScrollPositionAnchor;
RefPtr<Node> m_nodeToDraw;
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/page/scrolling/ScrollingCoordinator.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class ScrollingCoordinator : public ThreadSafeRefCountedAndCanMakeThreadSafeWeak
virtual bool hasSubscrollers() const { return false; }

// Generated a unique id for scrolling nodes.
ScrollingNodeID uniqueScrollingNodeID();
WEBCORE_EXPORT ScrollingNodeID uniqueScrollingNodeID();

bool shouldUpdateScrollLayerPositionSynchronously(const LocalFrameView&) const;

Expand Down
6 changes: 6 additions & 0 deletions Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,12 @@ TextStream& operator<<(TextStream& ts, ScrollingNodeType nodeType)
case ScrollingNodeType::FrameHosting:
ts << "frame-hosting";
break;
case ScrollingNodeType::PluginScrolling:
ts << "plugin-scrolling";
break;
case ScrollingNodeType::PluginHosting:
ts << "plugin-hosting";
break;
case ScrollingNodeType::Overflow:
ts << "overflow-scrolling";
break;
Expand Down
2 changes: 2 additions & 0 deletions Source/WebCore/page/scrolling/ScrollingCoordinatorTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ enum class ScrollingNodeType : uint8_t {
MainFrame,
Subframe,
FrameHosting,
PluginScrolling,
PluginHosting,
Overflow,
OverflowProxy,
Fixed,
Expand Down
4 changes: 3 additions & 1 deletion Source/WebCore/page/scrolling/ScrollingStateNode.h
Original file line number Diff line number Diff line change
Expand Up @@ -279,9 +279,11 @@ class ScrollingStateNode : public ThreadSafeRefCountedAndCanMakeThreadSafeWeakPt
bool isFixedNode() const { return m_nodeType == ScrollingNodeType::Fixed; }
bool isStickyNode() const { return m_nodeType == ScrollingNodeType::Sticky; }
bool isPositionedNode() const { return m_nodeType == ScrollingNodeType::Positioned; }
bool isScrollingNode() const { return isFrameScrollingNode() || isOverflowScrollingNode(); }
bool isScrollingNode() const { return isFrameScrollingNode() || isOverflowScrollingNode() || isPluginScrollingNode(); }
bool isFrameScrollingNode() const { return m_nodeType == ScrollingNodeType::MainFrame || m_nodeType == ScrollingNodeType::Subframe; }
bool isFrameHostingNode() const { return m_nodeType == ScrollingNodeType::FrameHosting; }
bool isPluginScrollingNode() const { return m_nodeType == ScrollingNodeType::PluginScrolling; }
bool isPluginHostingNode() const { return m_nodeType == ScrollingNodeType::PluginHosting; }
bool isOverflowScrollingNode() const { return m_nodeType == ScrollingNodeType::Overflow; }
bool isOverflowScrollProxyNode() const { return m_nodeType == ScrollingNodeType::OverflowProxy; }

Expand Down
Loading

0 comments on commit 34b37bd

Please sign in to comment.