-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[UnifiedPDF] Use the scrolling tree for UnifiedPDFPlugin
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
1 parent
227e9bc
commit 34b37bd
Showing
59 changed files
with
1,611 additions
and
45 deletions.
There are no files selected for viewing
56 changes: 56 additions & 0 deletions
56
LayoutTests/compositing/plugins/pdf/pdf-scrolling-tree-dynamic-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
) | ||
|
||
|
50 changes: 50 additions & 0 deletions
50
LayoutTests/compositing/plugins/pdf/pdf-scrolling-tree-dynamic.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
18 changes: 18 additions & 0 deletions
18
LayoutTests/compositing/plugins/pdf/pdf-scrolling-tree-expected.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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
30
LayoutTests/compositing/plugins/pdf/pdf-scrolling-tree.html
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.