[webkit-changes] [WebKit/WebKit] 6f86bd: Add initial support for CSSStyleSheet constructor ...

Chris Dumez noreply at github.com
Mon Sep 26 20:42:20 PDT 2022


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 6f86bd6200eb4f6528757f1744f49fa653442882
      https://github.com/WebKit/WebKit/commit/6f86bd6200eb4f6528757f1744f49fa653442882
  Author: Chris Dumez <cdumez at apple.com>
  Date:   2022-09-26 (Mon, 26 Sep 2022)

  Changed paths:
    M LayoutTests/TestExpectations
    M LayoutTests/fast/dom/dom-constructors-expected.txt
    M LayoutTests/fast/dom/dom-constructors.html
    M LayoutTests/imported/w3c/web-platform-tests/css/css-cascade/layer-statement-before-import-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-constructable-baseURL.tentative-expected.txt
    R LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-constructable-concat-expected.html
    A LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-constructable-concat-expected.txt
    R LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-constructable-concat-ref.html
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-constructable-cssRules-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-constructable-disabled-regular-sheet-insertion-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-constructable-disallow-import.tentative-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-constructable-duplicate-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-constructable-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-constructable-replace-on-regular-sheet-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-modify-after-removal-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-template-adoption-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/adoptedstylesheets-observablearray-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/idlharness-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/css/cssom/insertRule-across-context-expected.txt
    A LayoutTests/platform/win/fast/dom/dom-constructors-expected.txt
    M Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml
    M Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
    M Source/WebCore/css/CSSStyleSheet.cpp
    M Source/WebCore/css/CSSStyleSheet.h
    M Source/WebCore/css/CSSStyleSheet.idl
    M Source/WebCore/css/DocumentOrShadowRoot+CSSOM.idl
    M Source/WebCore/css/MediaList.h
    M Source/WebCore/css/parser/CSSParserContext.h
    M Source/WebCore/css/parser/CSSParserImpl.cpp
    M Source/WebCore/dom/Node.cpp
    M Source/WebCore/dom/ShadowRoot.cpp
    M Source/WebCore/dom/ShadowRoot.h
    M Source/WebCore/dom/TreeScope.cpp
    M Source/WebCore/dom/TreeScope.h
    M Source/WebCore/style/StyleScope.cpp
    M Source/WebCore/style/StyleScope.h

  Log Message:
  -----------
  Add initial support for CSSStyleSheet constructor and TreeScope.adoptedStyleSheets attribute
https://bugs.webkit.org/show_bug.cgi?id=245648

Reviewed by Antti Koivisto and Brent Fulgham.

Add initial support for CSSStyleSheet constructor and TreeScope.adoptedStyleSheets attribute:
- https://w3c.github.io/csswg-drafts/cssom-1/#dom-cssstylesheet-cssstylesheet
- https://w3c.github.io/csswg-drafts/cssom-1/#extensions-to-the-document-or-shadow-root-interface

The implementation should be complete and is passing most tests. One issue that remains is that
DocumentOrShadowRoot.adoptedStyleSheets should be an ObservableArray instead of a FrozenArray.
We don't support for ObservableArray yet so this will need a follow-up patch.

The new support is behind an experimental feature flag, currently off by default.

* LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-constructable-baseURL.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-constructable-cssRules-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-constructable-disabled-regular-sheet-insertion-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-constructable-disallow-import.tentative-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-constructable-duplicate-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-constructable-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-constructable-replace-on-regular-sheet-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-modify-after-removal-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/CSSStyleSheet-template-adoption-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/adoptedstylesheets-observablearray-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/idlharness-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/css/cssom/insertRule-across-context-expected.txt:
* Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml:
* Source/WebCore/css/CSSStyleSheet.cpp:
(WebCore::CSSStyleSheet::create):
(WebCore::CSSStyleSheet::CSSStyleSheet):
(WebCore::CSSStyleSheet::didMutateRules):
(WebCore::CSSStyleSheet::didMutate):
(WebCore::CSSStyleSheet::forEachStyleScope):
(WebCore::CSSStyleSheet::setDisabled):
(WebCore::CSSStyleSheet::insertRule):
(WebCore::CSSStyleSheet::replace):
(WebCore::CSSStyleSheet::replaceSync):
(WebCore::CSSStyleSheet::constructorDocument const):
(WebCore::CSSStyleSheet::addAdoptingTreeScope):
(WebCore::CSSStyleSheet::removeAdoptingTreeScope):
* Source/WebCore/css/CSSStyleSheet.h:
* Source/WebCore/css/CSSStyleSheet.idl:
* Source/WebCore/css/DocumentOrShadowRoot+CSSOM.idl:
* Source/WebCore/css/MediaList.h:
* Source/WebCore/css/StyleSheetContents.cpp:
(WebCore::StyleSheetContents::parseString):
* Source/WebCore/css/StyleSheetContents.h:
* Source/WebCore/css/parser/CSSParser.cpp:
(WebCore::CSSParser::parseSheet):
* Source/WebCore/css/parser/CSSParser.h:
* Source/WebCore/css/parser/CSSParserImpl.cpp:
(WebCore::CSSParserImpl::parseStyleSheet):
* Source/WebCore/css/parser/CSSParserImpl.h:
* Source/WebCore/dom/Node.cpp:
(WebCore::Node::moveShadowTreeToNewDocument):
* Source/WebCore/dom/ShadowRoot.cpp:
(WebCore::ShadowRoot::insertedIntoAncestor):
(WebCore::ShadowRoot::moveShadowRootToNewParentScope):
(WebCore::ShadowRoot::moveShadowRootToNewDocument):
* Source/WebCore/dom/ShadowRoot.h:
* Source/WebCore/dom/TreeScope.cpp:
(WebCore::TreeScope::~TreeScope):
(WebCore::TreeScope::adoptedStyleSheets const):
(WebCore::TreeScope::setAdoptedStyleSheets):
* Source/WebCore/dom/TreeScope.h:
* Source/WebCore/style/StyleScope.cpp:
(WebCore::Style::Scope::collectActiveStyleSheets):
(WebCore::Style::Scope::treeScope):
* Source/WebCore/style/StyleScope.h:

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




More information about the webkit-changes mailing list