Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 2a28bec3f68717cab638b01095971d3b0a5846d9
https://github.com/WebKit/WebKit/commit/2a28bec3f68717cab638b01095971d3b0a5846d9
Author: Qianlang Chen <[email protected]>
Date: 2026-06-10 (Wed, 10 Jun 2026)
Changed paths:
M
LayoutTests/http/tests/site-isolation/inspector/css/css-stylesheet-commands-frame-target-expected.txt
M
LayoutTests/http/tests/site-isolation/inspector/css/css-stylesheet-commands-frame-target.html
M Source/JavaScriptCore/inspector/protocol/CSS.json
M Source/WebCore/inspector/InspectorInstrumentation.cpp
M Source/WebCore/inspector/InspectorInstrumentation.h
M Source/WebCore/inspector/agents/frame/FrameCSSAgent.cpp
M Source/WebCore/inspector/agents/frame/FrameCSSAgent.h
M Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js
M Source/WebInspectorUI/UserInterface/Protocol/CSSObserver.js
Log Message:
-----------
[Site Isolation] Web Inspector: Implement per-frame CSS functions without DOM
or node id support
https://bugs.webkit.org/show_bug.cgi?id=314147
Reviewed by BJ Burg.
Implement the style-sheet-related commands of the CSS domain for frame
targets: getAllStyleSheets, getStyleSheet, getStyleSheetText,
setStyleSheetText, createStyleSheet, and getSupportedCSSProperties.
These operate on stylesheets, which don't require DOM nodeId binding and
FrameDOMAgent integration. FrameCSSAgent now also manages its own style
sheet lifecycle: it fires styleSheetAdded, styleSheetRemoved, and
styleSheetChanged events.
- setStyleSheetText bypasses InspectorHistory and does not have
undo/redo support yet. The undo infrastructure is currently tightly
coupled to InspectorDOMAgent's page-level history. Address this later
separately (https://webkit.org/b/314244).
- FrameCSSAgent keeps the document-to-data mappings like in
InspectorCSSAgent, m_documentToInspectorStyleSheet and
m_documentToKnownCSSStyleSheets but for a different reason.
InspectorCSSAgent needs them because a page hosts many documents
simultaneously: the main frame plus every subframe. FrameCSSAgent
inspects only one frame, but the frame (and this agent attached to it)
outlives any single document there. Document-keyed state is still
required to scope commands to the right document across time.
The production frontend does not yet consume these frame-target CSS
events or route commands to frame targets: CSSObserver and CSSManager
explicitly ignore frame targets for now. The plan is to build out more
of FrameCSSAgent's remaining commands (node-dependent queries and rule
editing commands), then integrate the frontend in a single switchover
patch once the agent is mature enough to fully replace
InspectorCSSAgent's role under site isolation. (https://webkit.org/b/314148)
Test:
http/tests/site-isolation/inspector/css/css-stylesheet-commands-frame-target.html
Add test cases for these new commands despite the frame target's CSS
agent is not yet used by the frontend.
*
LayoutTests/http/tests/site-isolation/inspector/css/css-stylesheet-commands-frame-target-expected.txt:
*
LayoutTests/http/tests/site-isolation/inspector/css/css-stylesheet-commands-frame-target.html:
* Source/JavaScriptCore/inspector/protocol/CSS.json:
* Source/WebCore/inspector/InspectorInstrumentation.cpp:
(WebCore::InspectorInstrumentation::documentDetachedImpl):
(WebCore::InspectorInstrumentation::mediaQueryResultChangedImpl):
(WebCore::InspectorInstrumentation::activeStyleSheetsUpdatedImpl):
* Source/WebCore/inspector/InspectorInstrumentation.h:
(WebCore::InspectorInstrumentation::mediaQueryResultChanged):
* Source/WebCore/inspector/agents/frame/FrameCSSAgent.cpp:
(WebCore::FrameCSSAgent::enable):
(WebCore::FrameCSSAgent::disable):
(WebCore::FrameCSSAgent::getAllStyleSheets):
(WebCore::FrameCSSAgent::getStyleSheet):
(WebCore::FrameCSSAgent::getStyleSheetText):
(WebCore::FrameCSSAgent::setStyleSheetText):
(WebCore::FrameCSSAgent::createStyleSheet):
(WebCore::FrameCSSAgent::getSupportedCSSProperties):
(WebCore::FrameCSSAgent::styleSheetChanged):
(WebCore::FrameCSSAgent::documentDetached):
(WebCore::FrameCSSAgent::mediaQueryResultChanged):
(WebCore::FrameCSSAgent::activeStyleSheetsUpdated):
(WebCore::FrameCSSAgent::reset):
(WebCore::FrameCSSAgent::bindStyleSheet):
(WebCore::FrameCSSAgent::assertStyleSheetForId):
(WebCore::FrameCSSAgent::collectAllDocumentStyleSheets):
(WebCore::FrameCSSAgent::collectStyleSheets):
(WebCore::FrameCSSAgent::setActiveStyleSheetsForDocument):
(WebCore::FrameCSSAgent::createInspectorStyleSheetForDocument):
(WebCore::FrameCSSAgent::detectOrigin):
* Source/WebCore/inspector/agents/frame/FrameCSSAgent.h:
* Source/WebInspectorUI/UserInterface/Controllers/CSSManager.js:
(WI.CSSManager.prototype.set layoutContextTypeChangedMode):
(WI.CSSManager.prototype.styleSheetAdded):
* Source/WebInspectorUI/UserInterface/Protocol/CSSObserver.js:
(WI.CSSObserver.prototype.mediaQueryResultChanged):
(WI.CSSObserver.prototype.styleSheetChanged):
(WI.CSSObserver.prototype.styleSheetAdded):
(WI.CSSObserver.prototype.styleSheetRemoved):
Canonical link: https://commits.webkit.org/314983@main
To unsubscribe from these emails, change your notification settings at
https://github.com/WebKit/WebKit/settings/notifications