Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: d8e1779cc82b74f6663e2014b4e499238c553694
https://github.com/WebKit/WebKit/commit/d8e1779cc82b74f6663e2014b4e499238c553694
Author: Anuj Panta <[email protected]>
Date: 2026-08-10 (Mon, 10 Aug 2026)
Changed paths:
A
LayoutTests/http/tests/site-isolation/inspector/page/resources/paint-rects-frame.html
A
LayoutTests/http/tests/site-isolation/inspector/page/set-show-paint-rects-cross-origin-iframe-disabled-expected.txt
A
LayoutTests/http/tests/site-isolation/inspector/page/set-show-paint-rects-cross-origin-iframe-disabled.html
A
LayoutTests/http/tests/site-isolation/inspector/page/set-show-paint-rects-cross-origin-iframe-expected.txt
A
LayoutTests/http/tests/site-isolation/inspector/page/set-show-paint-rects-cross-origin-iframe.html
M Source/WebCore/inspector/InspectorBackendClient.h
M Source/WebCore/inspector/InspectorInstrumentation.cpp
M Source/WebCore/page/Page.cpp
M Source/WebCore/page/Page.h
M Source/WebCore/page/PageOverlay.cpp
M Source/WebCore/page/PageOverlay.h
M Source/WebCore/page/PageOverlayController.cpp
M Source/WebCore/page/PageOverlayController.h
M Source/WebCore/rendering/RenderLayerCompositor.cpp
M Source/WebKit/UIProcess/Inspector/Agents/ProxyingPageAgent.cpp
M Source/WebKit/UIProcess/Inspector/Agents/ProxyingPageAgent.h
M Source/WebKit/UIProcess/Inspector/WebInspectorBackendProxy.cpp
M Source/WebKit/UIProcess/Inspector/WebInspectorBackendProxy.h
M Source/WebKit/UIProcess/Inspector/WebInspectorBackendProxy.messages.in
M Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.cpp
M Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.h
M Source/WebKit/UIProcess/Inspector/WebPageInspectorController.cpp
M Source/WebKit/UIProcess/Inspector/WebPageInspectorController.h
M Source/WebKit/WebProcess/Inspector/PageAgentProxy.cpp
M Source/WebKit/WebProcess/Inspector/PageAgentProxy.h
M Source/WebKit/WebProcess/Inspector/WebInspectorBackend.cpp
M Source/WebKit/WebProcess/Inspector/WebInspectorBackend.h
M Source/WebKit/WebProcess/Inspector/WebInspectorBackend.messages.in
M Source/WebKit/WebProcess/Inspector/WebInspectorBackendClient.cpp
M Source/WebKit/WebProcess/Inspector/WebInspectorBackendClient.h
M Source/WebKit/WebProcess/WebPage/WebFrame.cpp
Log Message:
-----------
Web Inspector: [Site Isolation] Show Paint Rects does not draw in
cross-origin iframes
https://bugs.webkit.org/show_bug.cgi?id=308899
rdar://171780810
Reviewed by Qianlang Chen.
Under Site Isolation a cross-origin iframe runs in its own WebContent process,
which has no enabled InspectorPageAgent -- the frontend's Page domain only
reaches
the main-frame process. So Page.setShowPaintRects enabled the overlay in the
main-frame process only, and paints in a cross-origin subframe drew nothing.
Fan the toggle out and draw locally per process:
- The main-frame process notifies the UIProcess (ShowPaintRectsChanged), whose
ProxyingPageAgent sends SetShowPaintRects to every WebContent process and
remembers the state to replay to any process that registers later (e.g. a
cross-origin navigation spawns a new one).
- Each process's WebInspectorBackend drives the flag on every per-frame
PageAgentProxy it hosts, and seeds proxies that commit later. The proxy's
didPaint draws in the frame's own contents coordinate space via the frame-aware
InspectorBackendClient::showPaintRect(LocalFrame&, ...); it bails when an
enabled
InspectorPageAgent is present (the main-frame process, which already drew) to
avoid a double-flash.
Draw a Document overlay per local root frame. One process can host several local
roots (same-site sibling cross-origin iframes), and a GraphicsLayer has a single
parent, so a shared overlay root would only appear under whichever frame
composited last. PageOverlay gains an associated frame; PageOverlayController
hosts each associated overlay in that frame's own compositing tree, and
RenderLayerCompositor gates the overlay host on isRootFrameCompositor() rather
than isMainFrame() so it is not orphaned across a root-layer re-attach. Overlay
geometry resolves from the process's local main-or-root frame, since the main
frame can be a RemoteFrame here.
Tear down a frame's overlay when it detaches. The overlay is held by
PageOverlayController, so it (and its per-frame container GraphicsLayer) would
otherwise outlive the frame and, once its associated-frame weak reference
cleared,
be re-parented under the main frame's overlay root and draw stale layers.
Rulers (setShowRulers) are left unimplemented cross-process (they render via
InspectorOverlay, which subframe processes lack, and need page-wide geometry);
tracked as a follow-up. A local subframe nested under a local root, or reached
through a remote ancestor, is positioned by frame-local coordinates only and can
draw at the wrong offset; documented as a FIXME.
Test:
http/tests/site-isolation/inspector/page/set-show-paint-rects-cross-origin-iframe.html
*
LayoutTests/http/tests/site-isolation/inspector/page/resources/paint-rects-frame.html:
Added.
*
LayoutTests/http/tests/site-isolation/inspector/page/set-show-paint-rects-cross-origin-iframe-disabled-expected.txt:
Added.
*
LayoutTests/http/tests/site-isolation/inspector/page/set-show-paint-rects-cross-origin-iframe-disabled.html:
Added.
*
LayoutTests/http/tests/site-isolation/inspector/page/set-show-paint-rects-cross-origin-iframe-expected.txt:
Added.
*
LayoutTests/http/tests/site-isolation/inspector/page/set-show-paint-rects-cross-origin-iframe.html:
Added.
* Source/WebCore/inspector/InspectorBackendClient.h:
(WebCore::InspectorBackendClient::showPaintRect):
(WebCore::InspectorBackendClient::willDestroyFrameOverlays):
* Source/WebCore/inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::didPaintImpl):
* Source/WebCore/page/Page.cpp:
(WebCore::Page::localMainOrRootFrame const):
* Source/WebCore/page/Page.h:
* Source/WebCore/page/PageOverlay.cpp:
(WebCore::PageOverlay::setAssociatedFrame):
(WebCore::PageOverlay::associatedFrame const):
(WebCore::PageOverlay::frameForGeometry const):
(WebCore::PageOverlay::bounds const):
(WebCore::PageOverlay::viewToOverlayOffset const):
(WebCore::PageOverlay::drawRect):
(WebCore::PageOverlay::mouseEvent):
* Source/WebCore/page/PageOverlay.h:
* Source/WebCore/page/PageOverlayController.cpp:
(WebCore::PageOverlayController::installedPageOverlaysChanged):
(WebCore::PageOverlayController::documentOverlayRootLayerForFrame):
(WebCore::PageOverlayController::layerWithDocumentOverlaysForFrame):
(WebCore::PageOverlayController::willDestroyRootFrameOverlayContainer):
(WebCore::PageOverlayController::installPageOverlay):
(WebCore::PageOverlayController::layerWithDocumentOverlays): Deleted.
* Source/WebCore/page/PageOverlayController.h:
* Source/WebCore/rendering/RenderLayerCompositor.cpp:
(WebCore::RenderLayerCompositor::appendDocumentOverlayLayers):
(WebCore::RenderLayerCompositor::rootLayerAttachmentChanged):
* Source/WebKit/UIProcess/Inspector/Agents/ProxyingPageAgent.cpp:
(Inspector::ProxyingPageAgent::enableInstrumentationForProcess):
(Inspector::ProxyingPageAgent::disable):
(Inspector::ProxyingPageAgent::setShowPaintRects):
* Source/WebKit/UIProcess/Inspector/Agents/ProxyingPageAgent.h:
* Source/WebKit/UIProcess/Inspector/WebInspectorBackendProxy.cpp:
(WebKit::WebInspectorBackendProxy::showPaintRectsChanged):
* Source/WebKit/UIProcess/Inspector/WebInspectorBackendProxy.h:
* Source/WebKit/UIProcess/Inspector/WebInspectorBackendProxy.messages.in:
* Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.cpp:
(WebKit::WebInspectorUIProxy::showPaintRectsChanged):
* Source/WebKit/UIProcess/Inspector/WebInspectorUIProxy.h:
* Source/WebKit/UIProcess/Inspector/WebPageInspectorController.cpp:
(WebKit::WebPageInspectorController::setShowPaintRects):
* Source/WebKit/UIProcess/Inspector/WebPageInspectorController.h:
* Source/WebKit/WebProcess/Inspector/PageAgentProxy.cpp:
(WebKit::PageAgentProxy::didPaint):
* Source/WebKit/WebProcess/Inspector/PageAgentProxy.h:
(WebKit::PageAgentProxy::setShowPaintRects):
* Source/WebKit/WebProcess/Inspector/WebInspectorBackend.cpp:
(WebKit::WebInspectorBackend::showPaintRectsChanged):
(WebKit::WebInspectorBackend::removeInstrumentationForFrame):
(WebKit::WebInspectorBackend::ensurePageInstrumentationForFrame):
(WebKit::WebInspectorBackend::disablePageInstrumentation):
(WebKit::WebInspectorBackend::setShowPaintRects):
* Source/WebKit/WebProcess/Inspector/WebInspectorBackend.h:
* Source/WebKit/WebProcess/Inspector/WebInspectorBackend.messages.in:
* Source/WebKit/WebProcess/Inspector/WebInspectorBackendClient.cpp:
(WebKit::WebInspectorBackendClient::~WebInspectorBackendClient):
(WebKit::WebInspectorBackendClient::ensurePaintRectOverlayForFrame):
(WebKit::WebInspectorBackendClient::showPaintRect):
(WebKit::WebInspectorBackendClient::paintRectCount const):
(WebKit::WebInspectorBackendClient::animationEndedForLayer):
(WebKit::WebInspectorBackendClient::willDestroyFrameOverlays):
(WebKit::WebInspectorBackendClient::setShowPaintRects):
* Source/WebKit/WebProcess/Inspector/WebInspectorBackendClient.h:
* Source/WebKit/WebProcess/WebPage/WebFrame.cpp:
(WebKit::WebFrame::removeFromTree):
Canonical link: https://commits.webkit.org/318947@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications