[webkit-changes] [WebKit/WebKit] 46837e: Prototype declarative shadow DOM
Ryosuke Niwa
noreply at github.com
Wed Sep 28 10:46:06 PDT 2022
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 46837e56d6f57f7e52bf92c9534cc7683909eee5
https://github.com/WebKit/WebKit/commit/46837e56d6f57f7e52bf92c9534cc7683909eee5
Author: Ryosuke Niwa <rniwa at webkit.org>
Date: 2022-09-28 (Wed, 28 Sep 2022)
Changed paths:
M LayoutTests/imported/w3c/web-platform-tests/html/semantics/popups/popup-light-dismiss.tentative-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-attachment.tentative-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic.tentative-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-opt-in.tentative-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/innerhtml-before-closing-tag.tentative-expected.txt
R LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/move-template-before-closing-tag-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/move-template-before-closing-tag.tentative-expected.txt
M LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/script-access.tentative-expected.txt
M Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml
M Source/WebCore/CMakeLists.txt
M Source/WebCore/DerivedSources-input.xcfilelist
M Source/WebCore/DerivedSources-output.xcfilelist
M Source/WebCore/DerivedSources.make
M Source/WebCore/Sources.txt
M Source/WebCore/WebCore.xcodeproj/project.pbxproj
M Source/WebCore/dom/DOMImplementation.cpp
M Source/WebCore/dom/Document.cpp
M Source/WebCore/dom/Document.h
M Source/WebCore/dom/Element.cpp
M Source/WebCore/dom/Element.h
M Source/WebCore/dom/FragmentScriptingPermission.h
M Source/WebCore/dom/ScriptableDocumentParser.h
M Source/WebCore/dom/ShadowRoot.h
M Source/WebCore/html/HTMLAttributeNames.in
M Source/WebCore/html/HTMLDocument.cpp
M Source/WebCore/html/HTMLTemplateElement.cpp
M Source/WebCore/html/HTMLTemplateElement.h
M Source/WebCore/html/parser/HTMLConstructionSite.cpp
M Source/WebCore/html/parser/HTMLConstructionSite.h
M Source/WebCore/html/parser/HTMLDocumentParser.cpp
M Source/WebCore/html/parser/HTMLDocumentParser.h
M Source/WebCore/html/parser/HTMLTreeBuilder.cpp
M Source/WebCore/xml/DOMParser.cpp
M Source/WebCore/xml/DOMParser.h
M Source/WebCore/xml/DOMParser.idl
A Source/WebCore/xml/ParseFromStringOptions.h
A Source/WebCore/xml/ParseFromStringOptions.idl
M Source/WebCore/xml/XMLHttpRequest.cpp
M Source/WebCore/xml/parser/XMLDocumentParser.h
M Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp
Log Message:
-----------
Prototype declarative shadow DOM
https://bugs.webkit.org/show_bug.cgi?id=245556
Reviewed by Chris Dumez.
Implement the declarative shadow DOM an experimental feature.
See https://github.com/whatwg/html/pull/5465 and https://github.com/whatwg/dom/pull/892
There are a few differences between what's being proposed and what we implement:
1. getInnerHTML method is not added; we've given quite a few feedback on this method, and it's nowhere near ready for implementation.
2. Declarative shadow DOMs inside another template element doesn't automatically get converted to a shadow tree,
and there is no special treatment of declarative shadow DOM when cloning Nodes.
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/popups/popup-light-dismiss.tentative-expected.txt: Rebaselined.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-attachment.tentative-expected.txt:
Rebaselined the test now that we pass more test cases.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic.tentative-expected.txt: Ditto.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-opt-in.tentative-expected.txt: Ditto.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/innerhtml-before-closing-tag.tentative-expected.txt: Ditto.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/move-template-before-closing-tag-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/move-template-before-closing-tag.tentative-expected.txt: Ditto.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/script-access.tentative-expected.txt: Rebaselined.
* Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml: Added a runtime flag.
* Source/WebCore/CMakeLists.txt:
* Source/WebCore/DerivedSources-input.xcfilelist:
* Source/WebCore/DerivedSources-output.xcfilelist:
* Source/WebCore/DerivedSources.make:
* Source/WebCore/Sources.txt:
* Source/WebCore/WebCore.xcodeproj/project.pbxproj:
* Source/WebCore/dom/DOMImplementation.cpp:
(WebCore::createXMLDocument): Disable declarative shadow DOM in a document created by DOMImplementation.createDocument.
(WebCore::DOMImplementation::createDocument): Ditto.
(WebCore::DOMImplementation::createHTMLDocument): Ditto.
* Source/WebCore/dom/Document.cpp:
(WebCore::Document::Document): Initialize newly introduced m_parserContentPolicy with DefaultParserContentPolicy.
(WebCore::Document::createParser): Specify m_parserContentPolicy as an argument to XMLDocumentParser::create.
* Source/WebCore/dom/Document.h:
(WebCore::Document::parserContentPolicy const): Added.
(WebCore::Document::setParserContentPolicy): Added.
* Source/WebCore/dom/Element.cpp:
(WebCore::Element::attachShadow): Returns the shadow root of declarative shadow DOM if one is available. This happens exactly once
since this function then clears the flag from ShadowRoot.
(WebCore::Element::attachDeclarativeShadow): Added.
* Source/WebCore/dom/Element.h:
* Source/WebCore/dom/FragmentScriptingPermission.h:
(WebCore::ParserContentPolicy): Added AllowDeclarativeShadowDOM.
* Source/WebCore/dom/ScriptableDocumentParser.h:
(WebCore::ScriptableDocumentParser::parserContentPolicy const): Made this const.
(WebCore::ScriptableDocumentParser::setParserContentPolicy): Added.
(WebCore::ScriptableDocumentParser::ScriptableDocumentParser): Added
* Source/WebCore/dom/ShadowRoot.h:
(WebCore::ShadowRoot::isDeclarativeShadowRoot): Added.
(WebCore::ShadowRoot::setIsDeclarativeShadowRoot): Added.
* Source/WebCore/html/HTMLAttributeNames.in:
* Source/WebCore/html/HTMLDocument.cpp:
(WebCore::HTMLDocument::createParser): Pass in the parser content policy.
* Source/WebCore/html/HTMLTemplateElement.cpp:
(WebCore::HTMLTemplateElement::attachAsDeclarativeShadowRootIfNeeded): Added. Implements the main logic of declarative shadow DOM.
* Source/WebCore/html/HTMLTemplateElement.h:
* Source/WebCore/html/parser/HTMLConstructionSite.cpp:
(WebCore::HTMLConstructionSite::attachDeclarativeShadowRootIfNeeded): Added.
* Source/WebCore/html/parser/HTMLConstructionSite.h:
* Source/WebCore/html/parser/HTMLDocumentParser.cpp:
(WebCore::HTMLDocumentParser::HTMLDocumentParser): Takes OptionSet<ParserContentPolicy> as an argument.
(WebCore::HTMLDocumentParser::create): Ditto.
* Source/WebCore/html/parser/HTMLDocumentParser.h:
* Source/WebCore/html/parser/HTMLTreeBuilder.cpp:
(WebCore::HTMLTreeBuilder::processTemplateEndTag): Attach the template content as the declarative shadow DOM if applicable.
* Source/WebCore/xml/DOMParser.cpp:
(WebCore::DOMParser::parseFromString): Added ParseFromStringOptions as an argument.
* Source/WebCore/xml/DOMParser.h:
* Source/WebCore/xml/DOMParser.idl:
* Source/WebCore/xml/ParseFromStringOptions.h: Added.
* Source/WebCore/xml/ParseFromStringOptions.idl: Added.
* Source/WebCore/xml/XMLHttpRequest.cpp:
(XMLHttpRequest::responseXML): Disable declarative shadow DOM in the response document.
* Source/WebCore/xml/parser/XMLDocumentParser.h:
(WebCore::XMLDocumentParser::create): Takes OptionSet<ParserContentPolicy> as an argument.
* Source/WebCore/xml/parser/XMLDocumentParserLibxml2.cpp:
(WebCore::XMLDocumentParser::XMLDocumentParser): Ditto.
Canonical link: https://commits.webkit.org/254964@main
More information about the webkit-changes
mailing list