[webkit-changes] [WebKit/WebKit] 93cc47: Create entire frame tree in iframe processes

Alex Christensen noreply at github.com
Tue Mar 21 11:50:47 PDT 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 93cc4767ec04fbe1027cda51ccb2ad1d47fa879f
      https://github.com/WebKit/WebKit/commit/93cc4767ec04fbe1027cda51ccb2ad1d47fa879f
  Author: Alex Christensen <achristensen at apple.com>
  Date:   2023-03-21 (Tue, 21 Mar 2023)

  Changed paths:
    M LayoutTests/platform/ios/TestExpectations
    M Source/WebCore/history/CachedFrame.cpp
    M Source/WebCore/loader/FrameLoader.cpp
    M Source/WebCore/page/FocusController.cpp
    M Source/WebCore/page/Frame.cpp
    M Source/WebCore/page/Frame.h
    M Source/WebCore/page/LocalFrameView.cpp
    M Source/WebCore/page/Page.cpp
    M Source/WebCore/page/Page.h
    M Source/WebCore/rendering/RenderLayerCompositor.cpp
    M Source/WebCore/rendering/RenderLayerCompositor.h
    M Source/WebCore/rendering/RenderView.cpp
    M Source/WebKit/Shared/LoadParameters.cpp
    M Source/WebKit/Shared/LoadParameters.h
    M Source/WebKit/Shared/WebPageCreationParameters.cpp
    M Source/WebKit/Shared/WebPageCreationParameters.h
    M Source/WebKit/UIProcess/ProvisionalFrameProxy.cpp
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm
    M Source/WebKit/UIProcess/WebFrameProxy.cpp
    M Source/WebKit/UIProcess/WebFrameProxy.h
    M Source/WebKit/UIProcess/WebPageProxy.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp
    M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.cpp
    M Source/WebKit/WebProcess/WebPage/CoordinatedGraphics/DrawingAreaCoordinatedGraphics.h
    M Source/WebKit/WebProcess/WebPage/DrawingArea.h
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm
    M Source/WebKit/WebProcess/WebPage/WebFrame.cpp
    M Source/WebKit/WebProcess/WebPage/WebFrame.h
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h
    M Source/WebKit/WebProcess/WebPage/WebPage.messages.in
    M Source/WebKit/WebProcess/WebPage/ios/WebPageIOS.mm
    M Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h
    M Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm
    M Source/WebKit/WebProcess/WebPage/wc/DrawingAreaWC.cpp
    M Source/WebKit/WebProcess/WebPage/wc/DrawingAreaWC.h
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm
    M Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp

  Log Message:
  -----------
  Create entire frame tree in iframe processes
https://bugs.webkit.org/show_bug.cgi?id=254126

Reviewed by Chris Dumez.

This makes it so that in a subframe process, we make the entire frame tree with a RemoteFrame as the main frame.
The next step will be to broadcast frame tree changes to all processes when an iframe is made in one process.
In order to get the pixels from the iframe to still draw to the screen, we had to introduce the concept of
root frames, which are the topmost LocalFrames in a particular process, and those are the frames that have a root
layer that is sent to the UI process in a RemoteLayerTreeTransaction.  In places where we used to tell the main
frame to draw, we now need to iterate all the root layers and tell each of them to draw.  We currently only have
unit tests that have one root layer per process, but this is a step towards having the ability to have multiple,
such as if a.com has two iframes, each of which is showing b.com.

Instead of using the DrawingArea::UpdateGeometry message to update the size of iframes, we make a new message
WebPage::UpdateFrameSize for that purpose that does many of the same things, importantly calling FrameView::resize
to make iframes draw their content into Widgets that are the right size to composite into another process's content.

I remove a hack I introduced for WebFrameProxy::didFinishLoad to ignore about:blank when considering whether to send
WebFrame::DidFinishLoadInAnotherProcess.  The hack is no longer necessary.

The ProvisionalFrameProxy constructor sent WebPage::LoadRequest messages twice.  That was a mistake that wasn't making
any tests fail yet, but we only need to send it once.

WebKitTestRunner needed a null check to not crash in the test http/tests/site-isolation/basic-iframe.html because
WKBundlePageGetMainFrame returns a WebFrame wrapping a RemoteFrame.  It's fine to just early return because we aren't
getting render tree output in any site isolation tests yet, but we will likely need to revisit that change when we do.

* Source/WebCore/loader/FrameLoader.cpp:
(WebCore::FrameLoader::didReachVisuallyNonEmptyState):
* Source/WebCore/page/Frame.cpp:
(WebCore::Frame::isRootFrame const):
* Source/WebCore/page/Frame.h:
* Source/WebCore/page/LocalFrameView.cpp:
(WebCore::LocalFrameView::checkAndDispatchDidReachVisuallyNonEmptyState):
* Source/WebCore/page/Page.cpp:
(WebCore::createMainFrame):
(WebCore::Page::finalizeRenderingUpdate):
(WebCore::Page::finalizeRenderingUpdateForRootFrame):
* Source/WebCore/page/Page.h:
(WebCore::Page::rootFrames const):
(WebCore::Page::addRootFrame):
* Source/WebCore/page/scrolling/ScrollingStateNode.h:
(WebCore::LayerRepresentation::operator PlatformLayer* const):
* Source/WebCore/page/scrolling/mac/ScrollingTreeFrameScrollingNodeMac.mm:
(WebCore::ScrollingTreeFrameScrollingNodeMac::repositionScrollingLayers):
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::isMainFrameCompositor const):
* Source/WebCore/rendering/RenderObject.cpp:
(WebCore::RenderObject::~RenderObject):
* Source/WebCore/rendering/RenderView.cpp:
(WebCore::RenderView::flushAccumulatedRepaintRegion const):
* Source/WebKit/Shared/LoadParameters.cpp:
(WebKit::LoadParameters::encode const):
(WebKit::LoadParameters::decode):
* Source/WebKit/Shared/LoadParameters.h:
* Source/WebKit/Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
(WebKit::WebPageCreationParameters::SubframeProcessFrameTreeInitializationParameters::encode const):
(WebKit::WebPageCreationParameters::SubframeProcessFrameTreeInitializationParameters::decode):
* Source/WebKit/Shared/WebPageCreationParameters.h:
* Source/WebKit/UIProcess/ProvisionalFrameProxy.cpp:
(WebKit::ProvisionalFrameProxy::ProvisionalFrameProxy):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTreeTransaction):
* Source/WebKit/UIProcess/WebFrameProxy.cpp:
(WebKit::WebFrameProxy::didFinishLoad):
(WebKit::WebFrameProxy::updateRemoteFrameSize):
* Source/WebKit/WebProcess/WebCoreSupport/WebChromeClient.cpp:
(WebKit::WebChromeClient::attachRootGraphicsLayer):
* Source/WebKit/WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidReachVisuallyNonEmptyState):
* Source/WebKit/WebProcess/WebPage/DrawingArea.h:
(WebKit::DrawingArea::attachToInitialRootFrame):
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.h:
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
(WebKit::RemoteLayerTreeContext::buildTransaction):
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.h:
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeDrawingArea.mm:
(WebKit::initialRootFrame):
(WebKit::RemoteLayerTreeDrawingArea::RemoteLayerTreeDrawingArea):
(WebKit::m_updateRenderingTimer):
(WebKit::RemoteLayerTreeDrawingArea::updateRootLayers):
(WebKit::RemoteLayerTreeDrawingArea::attachViewOverlayGraphicsLayer):
(WebKit::RemoteLayerTreeDrawingArea::attachToInitialRootFrame):
(WebKit::RemoteLayerTreeDrawingArea::setRootCompositingLayer):
(WebKit::RemoteLayerTreeDrawingArea::shouldUseTiledBackingForFrameView const):
(WebKit::RemoteLayerTreeDrawingArea::updatePreferences):
(WebKit::RemoteLayerTreeDrawingArea::updateRendering):
(WebKit::RemoteLayerTreeDrawingArea::mainFrameContentSizeChanged):
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::createLocalSubframeHostedInAnotherProcess):
(WebKit::WebFrame::createRemoteSubframe):
(WebKit::WebFrame::coreAbstractFrame const):
(WebKit::WebFrame::didCommitLoadInAnotherProcess):
(WebKit::WebFrame::isRootFrame const):
* Source/WebKit/WebProcess/WebPage/WebFrame.h:
(WebKit::WebFrame::layerHostingContextIdentifier):
(WebKit::WebFrame::setLayerHostingContextIdentifier):
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
(WebKit::clientForMainFrame):
(WebKit::m_appHighlightsVisible):
(WebKit::WebPage::constructFrameTree):
(WebKit::WebPage::enterAcceleratedCompositingMode):
(WebKit::WebPage::exitAcceleratedCompositingMode):
(WebKit::WebPage::loadRequest):
(WebKit::WebPage::updateFrameSize):
(WebKit::WebPage::willCommitLayerTree):
(WebKit::WebPage::SandboxExtensionTracker::beginLoad):
(WebKit::WebPage::didCommitLoad):
* Source/WebKit/WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::layerHostingContextIdentifier const): Deleted.
* Source/WebKit/WebProcess/WebPage/WebPage.messages.in:
* Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.h:
* Source/WebKit/WebProcess/WebPage/mac/TiledCoreAnimationDrawingArea.mm:
(WebKit::TiledCoreAnimationDrawingArea::setRootCompositingLayer):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::TEST):
* Tools/WebKitTestRunner/InjectedBundle/InjectedBundlePage.cpp:
(WTR::InjectedBundlePage::dump):

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




More information about the webkit-changes mailing list