Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 9f58e494e0bb4c28f2580783a89f683e5521bf49
      
https://github.com/WebKit/WebKit/commit/9f58e494e0bb4c28f2580783a89f683e5521bf49
  Author: Chris Dumez <[email protected]>
  Date:   2026-04-12 (Sun, 12 Apr 2026)

  Changed paths:
    A 
LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-stylesheets-expected.txt
    A 
LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-stylesheets.html
    M Source/WebCore/style/StyleScope.cpp

  Log Message:
  -----------
  document.styleSheets should be accessible on DOMParser-created documents
https://bugs.webkit.org/show_bug.cgi?id=312089

Reviewed by Darin Adler and Anne van Kesteren.

Style::Scope::updateActiveStyleSheets() bails out early when the document
has no living render tree. Since DOMParser-created documents have no
frame or view, flushPendingSelfUpdate() would clear m_pendingUpdate and
then call updateActiveStyleSheets() which returned immediately, leaving
the styleSheets collection empty.

Fix this by checking hasLivingRenderTree() before attempting the flush.
When there is no render tree, collect the style sheets for the list
directly via collectActiveStyleSheets(), bypassing the full style
resolver update that requires one.

Test: 
imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-stylesheets.html

* 
LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-stylesheets-expected.txt:
 Added.
* 
LayoutTests/imported/w3c/web-platform-tests/domparsing/DOMParser-parseFromString-stylesheets.html:
 Added.
Import WPT test coverage from upstream. This test is failing in shipping
Safari but passing in both Chrome and Firefox.

* Source/WebCore/style/StyleScope.cpp:
(WebCore::Style::Scope::styleSheetsForStyleSheetList):

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



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

Reply via email to