Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: e86e35f4d9dd5a31171ce08b7bd893bbf29bb08d
      
https://github.com/WebKit/WebKit/commit/e86e35f4d9dd5a31171ce08b7bd893bbf29bb08d
  Author: Anuj Panta <[email protected]>
  Date:   2026-10-07 (Wed, 07 Oct 2026)

  Changed paths:
    A 
LayoutTests/http/tests/site-isolation/inspector/dom/layout-overlays-frame-target-expected.txt
    A 
LayoutTests/http/tests/site-isolation/inspector/dom/layout-overlays-frame-target.html
    A 
LayoutTests/http/tests/site-isolation/inspector/dom/resources/flex-overlay-frame.html
    A 
LayoutTests/http/tests/site-isolation/inspector/dom/resources/grid-overlay-frame.html
    M Source/JavaScriptCore/inspector/protocol/DOM.json
    M Source/WebCore/inspector/FrameInspectorController.cpp
    M Source/WebCore/inspector/FrameInspectorController.h
    M Source/WebCore/inspector/InspectorInstrumentation.cpp
    M Source/WebCore/inspector/InspectorOverlay.h
    M Source/WebCore/inspector/agents/frame/FrameDOMAgent.cpp
    M Source/WebCore/inspector/agents/frame/FrameDOMAgent.h
    M Source/WebCore/inspector/agents/frame/FrameDOMAgentStubs.cpp
    M Source/WebInspectorUI/UserInterface/Models/DOMNode.js

  Log Message:
  -----------
  Implement DOM layout overlay commands for FrameDOMAgent
https://bugs.webkit.org/show_bug.cgi?id=316140
rdar://185999129

Reviewed by BJ Burg.

Implements showGridOverlay, hideGridOverlay, showFlexOverlay and hideFlexOverlay
for FrameDOMAgent, replacing the stubs that returned "Not supported for frame
targets", so grid and flex overlays work on nodes inside a cross-origin iframe.
The four commands widen their targetTypes from ["page"] to ["frame", "page"],
as the earlier frame-target DOM commands did.

On the frontend, showLayoutOverlay() and hideLayoutOverlay() no longer reject
frame-target nodes outright. Both now pick the node's owning target and send its
raw backend node ID, the same routing the highlight commands use.

Flex line separators need the line-wrap positions recorded during layout. That
cache and its three accessors move onto FrameDOMAgent, and
FrameInspectorController::overlayOwnerFlexLineStarts() returns it instead of an
empty vector. The controller had no handle on the agent, since it only appended
it into m_agents, so it now keeps a non-owning CheckedPtr.

FrameDOMAgent also gains relayoutDocument(), called from
didCreateFrontendAndBackend() and setDocument() just as the page agent does. The
cache is only filled by layouts that run while a frontend is attached, so 
without
forcing one, a frame laid out before inspection reported no line starts and
showFlexOverlay drew no separators on first show, and stale entries survived a
navigation.

The two layout hooks that fill the cache, flexibleBoxRendererBeganLayout and
flexibleBoxRendererWrappedToNextLine, now notify the frame agent as well as the
page agent instead of only the first one found. Either agent may own the overlay
that later reads the cache: a frame overlay reads its own FrameDOMAgent, while a
node highlighted from the page target draws through the page overlay and reads
InspectorDOMAgent. Under Site Isolation even the main frame has a FrameDOMAgent,
so notifying only one would have starved the other. The caches are weak and 
keyed
by renderer, so the extra entry costs nothing.

highlightSelector, highlightFrame, focus and getMediaStats stay stubbed and
page-only.

Tests: http/tests/site-isolation/inspector/dom/layout-overlays-frame-target.html

* 
LayoutTests/http/tests/site-isolation/inspector/dom/layout-overlays-frame-target-expected.txt:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/dom/layout-overlays-frame-target.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/dom/resources/flex-overlay-frame.html:
 Added.
* 
LayoutTests/http/tests/site-isolation/inspector/dom/resources/grid-overlay-frame.html:
 Added.
* Source/JavaScriptCore/inspector/protocol/DOM.json:
* Source/WebCore/inspector/FrameInspectorController.cpp:
(WebCore::FrameInspectorController::overlayOwnerFlexLineStarts const):
(WebCore::FrameInspectorController::createLazyAgents):
* Source/WebCore/inspector/FrameInspectorController.h:
* Source/WebCore/inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::flexibleBoxRendererBeganLayoutImpl):
(WebCore::InspectorInstrumentation::flexibleBoxRendererWrappedToNextLineImpl):
* Source/WebCore/inspector/InspectorOverlay.h:
* Source/WebCore/inspector/agents/frame/FrameDOMAgent.cpp:
(WebCore::FrameDOMAgent::didCreateFrontendAndBackend):
(WebCore::FrameDOMAgent::relayoutDocument):
(WebCore::FrameDOMAgent::setDocument):
(WebCore::FrameDOMAgent::flexibleBoxRendererBeganLayout):
(WebCore::FrameDOMAgent::flexibleBoxRendererWrappedToNextLine):
(WebCore::FrameDOMAgent::flexibleBoxRendererCachedItemsAtStartOfLine const):
(WebCore::FrameDOMAgent::showGridOverlay):
(WebCore::FrameDOMAgent::hideGridOverlay):
(WebCore::FrameDOMAgent::showFlexOverlay):
(WebCore::FrameDOMAgent::hideFlexOverlay):
* Source/WebCore/inspector/agents/frame/FrameDOMAgent.h:
* Source/WebCore/inspector/agents/frame/FrameDOMAgentStubs.cpp:
(WebCore::FrameDOMAgent::showGridOverlay): Deleted.
(WebCore::FrameDOMAgent::hideGridOverlay): Deleted.
(WebCore::FrameDOMAgent::showFlexOverlay): Deleted.
(WebCore::FrameDOMAgent::hideFlexOverlay): Deleted.
* Source/WebInspectorUI/UserInterface/Models/DOMNode.js:
(WI.DOMNode.prototype.showLayoutOverlay):
(WI.DOMNode.prototype.hideLayoutOverlay):

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



To unsubscribe from these emails, change your notification settings at 
https://github.com/WebKit/WebKit/settings/notifications

Reply via email to