Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 1b4889fc81b5295780350e6310ff46eae5efdf4d
      
https://github.com/WebKit/WebKit/commit/1b4889fc81b5295780350e6310ff46eae5efdf4d
  Author: Ahmad Saleem <[email protected]>
  Date:   2026-05-22 (Fri, 22 May 2026)

  Changed paths:
    A 
LayoutTests/inspector/css/getMatchedStylesForNodeAdoptedStyleSheet-expected.txt
    A LayoutTests/inspector/css/getMatchedStylesForNodeAdoptedStyleSheet.html
    M LayoutTests/platform/mac-site-isolation/TestExpectations
    M Source/WebCore/inspector/InspectorStyleSheet.cpp
    M Source/WebCore/inspector/agents/InspectorCSSAgent.cpp

  Log Message:
  -----------
  Web Inspector: Style sheets created via CSSOM (ex: adoptedStyleSheets) are 
marked as "User Agent Style Sheet" and not editable in Styles sidebar
https://bugs.webkit.org/show_bug.cgi?id=277893
rdar://134101594

Reviewed by Devin Rousso.

Constructable CSSStyleSheets (`new CSSStyleSheet()` adopted via
`document.adoptedStyleSheets`) have no owner node and no href, so
InspectorCSSAgent::detectOrigin() misclassified them as User Agent
stylesheets. The frontend then rendered their rules as locked /
uneditable.

Even after correcting the origin to Author, clicking to edit a
property crashed in CSSStyleDeclaration._rangeAfterPropertyAtIndex
because constructable sheets have no underlying source text, so
InspectorStyleSheet::ensureText() returned false and rule source
ranges never populated.

* Source/WebCore/inspector/agents/InspectorCSSAgent.cpp:
(WebCore::InspectorCSSAgent::detectOrigin): Classify constructable
stylesheets as Author before the no-owner/no-href UA heuristic.

* Source/WebCore/inspector/InspectorStyleSheet.cpp:
(WebCore::InspectorStyleSheet::ensureText): Synthesize text by
serializing in-memory CSSRules for constructable stylesheets, the
same path already used for mutated stylesheets.

* LayoutTests/inspector/css/getMatchedStylesForNodeAdoptedStyleSheet.html: 
Added.
* 
LayoutTests/inspector/css/getMatchedStylesForNodeAdoptedStyleSheet-expected.txt:
 Added.

* LayoutTests/platform/mac-site-isolation/TestExpectations: Skip the new
test under site isolation, where inspector protocol commands return
"Not yet implemented for frame targets".

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



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

Reply via email to