[webkit-changes] [WebKit/WebKit] 90549a: Begin drawing pixels to the screen from site isola...

Alex Christensen noreply at github.com
Mon Feb 6 22:27:05 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 90549aec61bacbaee7383e1fb2623cf34edc9273
      https://github.com/WebKit/WebKit/commit/90549aec61bacbaee7383e1fb2623cf34edc9273
  Author: Alex Christensen <achristensen at apple.com>
  Date:   2023-02-06 (Mon, 06 Feb 2023)

  Changed paths:
    A LayoutTests/http/tests/site-isolation/basic-iframe-expected.html
    A LayoutTests/http/tests/site-isolation/basic-iframe.html
    A LayoutTests/http/tests/site-isolation/resources/green-background.html
    M LayoutTests/platform/glib/TestExpectations
    M Source/WebCore/Headers.cmake
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/html/HTMLFrameOwnerElement.cpp
    M Source/WebCore/html/HTMLFrameOwnerElement.h
    M Source/WebCore/page/AbstractFrame.h
    M Source/WebCore/page/Frame.cpp
    M Source/WebCore/page/Frame.h
    M Source/WebCore/page/RemoteFrame.cpp
    M Source/WebCore/page/RemoteFrame.h
    M Source/WebCore/page/RemoteFrameClient.h
    M Source/WebCore/page/RemoteFrameView.h
    M Source/WebCore/platform/Widget.h
    M Source/WebCore/platform/graphics/GraphicsLayer.h
    A Source/WebCore/platform/graphics/LayerHostingContextIdentifier.h
    M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.cpp
    M Source/WebCore/platform/graphics/ca/GraphicsLayerCA.h
    M Source/WebCore/platform/graphics/ca/PlatformCALayer.cpp
    M Source/WebCore/platform/graphics/ca/PlatformCALayer.h
    M Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.h
    M Source/WebCore/platform/graphics/ca/cocoa/PlatformCALayerCocoa.mm
    M Source/WebCore/platform/graphics/ca/win/PlatformCALayerWin.h
    M Source/WebCore/rendering/RenderLayerBacking.cpp
    M Source/WebCore/rendering/RenderWidget.cpp
    M Source/WebCore/rendering/RenderWidget.h
    M Source/WebKit/Scripts/webkit/messages.py
    M Source/WebKit/Scripts/webkit/tests/MessageArgumentDescriptions.cpp
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerBackingStore.mm
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h
    M Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm
    M Source/WebKit/Shared/WebPageCreationParameters.cpp
    M Source/WebKit/Shared/WebPageCreationParameters.h
    M Source/WebKit/SourcesCocoa.txt
    M Source/WebKit/UIProcess/ProvisionalFrameProxy.cpp
    M Source/WebKit/UIProcess/ProvisionalFrameProxy.h
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.h
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.h
    M Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeNode.mm
    M Source/WebKit/UIProcess/RemoteLayerTree/ios/RemoteLayerTreeHostIOS.mm
    M Source/WebKit/UIProcess/SubframePageProxy.cpp
    M Source/WebKit/UIProcess/WebFrameProxy.cpp
    M Source/WebKit/UIProcess/WebFrameProxy.h
    M Source/WebKit/WebKit.xcodeproj/project.pbxproj
    M Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.cpp
    M Source/WebKit/WebProcess/WebCoreSupport/WebRemoteFrameClient.h
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.cpp
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemote.h
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteCustom.h
    A Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteHost.h
    A Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteHost.mm
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/PlatformCALayerRemoteModelHosting.h
    M Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm
    M Source/WebKit/WebProcess/WebPage/WebFrame.cpp
    M Source/WebKit/WebProcess/WebPage/WebFrame.h
    M Source/WebKit/WebProcess/WebPage/WebFrame.messages.in
    M Source/WebKit/WebProcess/WebPage/WebPage.cpp
    M Source/WebKit/WebProcess/WebPage/WebPage.h

  Log Message:
  -----------
  Begin drawing pixels to the screen from site isolated iframes
https://bugs.webkit.org/show_bug.cgi?id=251245
rdar://104726144

Reviewed by Simon Fraser.

If we have a remote frame, the parent process needs to make a layer but put nothing in it.
The iframe process's root layer needs to be the contents of the empty layer.
To make this happen, the journey starts in RenderLayerBacking::updateConfiguration where
we call GraphicsLayerCA::setContentsToPlatformLayerHost, which makes this layer a host for
content that will come from another process with a given identifier generated in the UI
process.  We need the iframe process to know it has a hosting context identifier
so we do this by passing the LayerHostingContextIdentifier to the WebPage.  If this is present,
then in RemoteLayerTreeContext::buildTransaction we set the layerHostingContextIdentifier on the
RemoteLayerTreeTransaction.  When the UI process sees a transaction with a layerHostingContextIdentifier
it has some special logic in RemoteLayerTreeDrawingAreaProxy::commitLayerTree to make its
"root layer" not a root layer of the whole page, but rather it sets its "root layer" to be a
sublayer of the parent process's empty layer which was intended for this purpose.

* LayoutTests/http/tests/site-isolation/basic-iframe-expected.html: Added.
* LayoutTests/http/tests/site-isolation/basic-iframe.html: Added.
* LayoutTests/http/tests/site-isolation/resources/green-background.html: Added.
* Source/WebCore/html/HTMLFrameOwnerElement.cpp:
(WebCore::HTMLFrameOwnerElement::disconnectContentFrame):
* Source/WebCore/html/HTMLFrameOwnerElement.h:
* Source/WebCore/page/RemoteFrameView.h:
(isType):
* Source/WebCore/platform/Widget.h:
(WebCore::Widget::isRemoteFrameView const):
* Source/WebCore/platform/graphics/GraphicsLayer.h:
(WebCore::GraphicsLayer::setRemoteFrame):
* Source/WebCore/rendering/RenderLayerBacking.cpp:
(WebCore::RenderLayerBacking::updateConfiguration):
* Source/WebCore/rendering/RenderWidget.cpp:
(WebCore::RenderWidget::requiresAcceleratedCompositing const):
(WebCore::RenderWidget::remoteFrame const):
* Source/WebCore/rendering/RenderWidget.h:
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.h:
(WebKit::RemoteLayerTreeTransaction::setRemoteFrameIdentifier):
(WebKit::RemoteLayerTreeTransaction::remoteFrameIdentifier const):
* Source/WebKit/Shared/RemoteLayerTree/RemoteLayerTreeTransaction.mm:
(WebKit::RemoteLayerTreeTransaction::encode const):
(WebKit::RemoteLayerTreeTransaction::decode):
* Source/WebKit/Shared/WebPageCreationParameters.cpp:
(WebKit::WebPageCreationParameters::encode const):
(WebKit::WebPageCreationParameters::decode):
* Source/WebKit/Shared/WebPageCreationParameters.h:
* Source/WebKit/UIProcess/ProvisionalFrameProxy.cpp:
(WebKit::ProvisionalFrameProxy::ProvisionalFrameProxy):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.h:
(WebKit::RemoteLayerTreeDrawingAreaProxy::frameLayerMap):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.messages.in:
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeDrawingAreaProxy.mm:
(WebKit::RemoteLayerTreeDrawingAreaProxy::commitLayerTree):
(WebKit::RemoteLayerTreeDrawingAreaProxy::layerWillBeUsedForRemoteFrame):
* Source/WebKit/UIProcess/RemoteLayerTree/RemoteLayerTreeHost.mm:
(WebKit::RemoteLayerTreeHost::updateLayerTree):
* Source/WebKit/UIProcess/WebFrameProxy.h:
(WebKit::WebFrameProxy::parentFrame):
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.cpp:
(WebKit::GraphicsLayerCARemote::setRemoteFrame):
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/GraphicsLayerCARemote.h:
* Source/WebKit/WebProcess/WebPage/RemoteLayerTree/RemoteLayerTreeContext.mm:
(WebKit::RemoteLayerTreeContext::buildTransaction):
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::didCommitLoadInAnotherProcess):
Add a call to scheduleInvalidateStyleAndLayerComposition or the logic in
RenderWidget::requiresAcceleratedCompositing won't be called until something else
invalidates style.  I found this initially by being frustrated that
requiresAcceleratedCompositing returning true didn't do anything, then noticing that
when I plugged my computer into power it produced a layer.  This call does a similar
kick of the iframe to tell it to make a layer now, when the LocalFrame is swapped
out with a RemoteFrame.
* Source/WebKit/WebProcess/WebPage/WebPage.cpp:
* Source/WebKit/WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::parentFrameIdentifier const):

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




More information about the webkit-changes mailing list