Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
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 whatwg/html#5465 and whatwg/dom#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
- Loading branch information
Showing
40 changed files
with
295 additions
and
121 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
|
||
FAIL Declarative Shadow DOM: innerHTML should work while parsing declarative shadow root <template> assert_true: Declarative shadow template should not be left over expected true got false | ||
PASS Declarative Shadow DOM: innerHTML should work while parsing declarative shadow root <template> | ||
|
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
|
||
FAIL Moving the template node during parsing should attach to initial parent (content before observer) assert_true: Declarative shadow template should not be left over expected true got false | ||
FAIL Moving the template node during parsing should attach to initial parent (content after observer) assert_true: Declarative shadow template should not be left over expected true got false | ||
PASS Moving the template node during parsing should attach to initial parent (content before observer) | ||
PASS Moving the template node during parsing should attach to initial parent (content after observer) | ||
PASS Moving the template node from invalid parent to valid parent should still not attach | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.