Skip to content

Commit

Permalink
Account for latest declarative shadow trees changes
Browse files Browse the repository at this point in the history
https://bugs.webkit.org/show_bug.cgi?id=263852
rdar://117655691

Reviewed by Ryosuke Niwa.

As discussed in whatwg/html#5465 shadowRootMode
is to be reflected as DOMString, not DOMString?.

DOMParser will also no longer be extended to have a dictionary
argument.

The tests have been synchronized with web-platform-tests up until and
including web-platform-tests/wpt#42833 which
upstreamed a couple minor adjustments.

* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-after-attachshadow-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-after-attachshadow.tentative-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-after-attachshadow.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-after-attachshadow.tentative.html.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-parser-interaction-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-parser-interaction.tentative-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-parser-interaction.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-parser-interaction.tentative.html.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-attachment-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-attachment.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-attachment.tentative.html.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-attachment.tentative-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic.tentative.html.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic.tentative-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-opt-in-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-opt-in.tentative-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-opt-in.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-opt-in.tentative.html.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-with-disabled-shadow-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-with-disabled-shadow.tentative-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-with-disabled-shadow.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-with-disabled-shadow.tentative.html.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/innerhtml-before-closing-tag-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/innerhtml-before-closing-tag.tentative-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/innerhtml-before-closing-tag.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/innerhtml-before-closing-tag.tentative.html.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/innerhtml-on-ordinary-template.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/innerhtml-on-ordinary-template.tentative.html.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/innerhtml-on-ordinary-template.tentative-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/move-template-before-closing-tag-expected.txt: Renamed from LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/move-template-before-closing-tag.tentative-expected.txt.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/move-template-before-closing-tag.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/move-template-before-closing-tag.tentative.html.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/script-access-expected.txt: Added.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/script-access.html: Renamed from LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/script-access.tentative.html.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/script-access.tentative-expected.txt: Removed.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/support/helpers.js: Removed.
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/support/w3c-import.log:
* LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/w3c-import.log:
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml:
* 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/html/HTMLTemplateElement.cpp:
(WebCore::HTMLTemplateElement::shadowRootMode const):
(WebCore::HTMLTemplateElement::setShadowRootMode):
* Source/WebCore/html/HTMLTemplateElement.idl:
* Source/WebCore/xml/DOMParser.cpp:
(WebCore::DOMParser::parseFromString):
* Source/WebCore/xml/DOMParser.h:
* Source/WebCore/xml/DOMParser.idl:
* Source/WebCore/xml/ParseFromStringOptions.h: Removed.
* Source/WebCore/xml/ParseFromStringOptions.idl: Removed.

Canonical link: https://commits.webkit.org/269976@main
  • Loading branch information
annevk committed Oct 30, 2023
1 parent f997f0d commit 30f0742
Show file tree
Hide file tree
Showing 40 changed files with 732 additions and 796 deletions.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
const declarativeString = `<${elementType} id=theelement>${getDeclarativeContent(mode, delegatesFocus)}
<span class='lightdom'>${lightDomTextContent}</span></${elementType}>`;
const wrapper = document.createElement('div');
setInnerHTML(wrapper, declarativeString);
wrapper.setHTMLUnsafe(declarativeString);
const element = wrapper.querySelector('#theelement');
return {wrapper: wrapper, element: element};
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@

PASS Declarative Shadow DOM: Basic test
PASS Declarative Shadow DOM: Feature detection
PASS Shadowrootmode reflection
PASS Shadowrootmode reflection, setter
FAIL Declarative Shadow DOM: Fragment parser basic test undefined is not a function (near '...div.setHTMLUnsafe...')
FAIL Declarative Shadow DOM: Invalid shadow root attribute div.setHTMLUnsafe is not a function. (In 'div.setHTMLUnsafe(`
<div id="host">
<template shadowrootmode="invalid">
</template>
</div>
`)', 'div.setHTMLUnsafe' is undefined)
FAIL Declarative Shadow DOM: Closed shadow root attribute div.setHTMLUnsafe is not a function. (In 'div.setHTMLUnsafe(`
<div id="host">
<template shadowrootmode="closed">
</template>
</div>
`)', 'div.setHTMLUnsafe' is undefined)
FAIL Declarative Shadow DOM: Missing closing tag div.setHTMLUnsafe is not a function. (In 'div.setHTMLUnsafe(`
<div id="host">
<template shadowrootmode="open">
<slot id="s1" name="slot1"></slot>
</div>
`)', 'div.setHTMLUnsafe' is undefined)
FAIL Declarative Shadow DOM: delegates focus attribute div.setHTMLUnsafe is not a function. (In 'div.setHTMLUnsafe(`
<div id="host">
<template shadowrootmode="open" shadowrootdelegatesfocus>
</template>
</div>
`)', 'div.setHTMLUnsafe' is undefined)
PASS Declarative Shadow DOM: Multiple roots
PASS Declarative Shadow DOM: template containing declarative shadow root
PASS Declarative Shadow DOM: template containing (deeply nested) declarative shadow root
PASS Declarative Shadow DOM: template containing a template containing declarative shadow root
PASS Declarative Shadow DOM: template containing declarative shadow root and UA shadow root
PASS Declarative Shadow DOM: template containing closed declarative shadow root and UA shadow root
PASS Declarative Shadow DOM: template root element

Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
<link rel="help" href="https://github.com/whatwg/dom/issues/831">
<script src="/resources/testharness.js"></script>
<script src="/resources/testharnessreport.js"></script>
<script src="support/helpers.js"></script>

<div id="host" style="display:none">
<template shadowrootmode="open">
Expand Down Expand Up @@ -40,14 +39,24 @@
t.setAttribute('shadowrootmode','OpEn');
assert_equals(t.shadowRootMode,'open','Case insensitive');
t.setAttribute('shadowrootmode','INVALID');
assert_equals(t.shadowRootMode,null,'Invalid values map to null');
assert_equals(t.shadowRootMode,'','Invalid values map to empty string');
t.removeAttribute('shadowrootmode');
assert_equals(t.shadowRootMode,null,'No shadowrootmode attribute maps to null');
assert_equals(t.shadowRootMode,'','No shadowrootmode attribute maps to empty string');
}, 'Shadowrootmode reflection');

test(() => {
const t = document.createElement('template');
t.shadowRootMode = 'blah';
assert_equals(t.shadowRootMode, '');
t.getAttribute('shadowrootmode', 'blah');
t.shadowRootMode = 'CLOSED';
assert_equals(t.shadowRootMode, 'closed');
t.getAttribute('shadowrootmode', 'CLOSED');
}, 'Shadowrootmode reflection, setter');

test(() => {
const div = document.createElement('div');
setInnerHTML(div,`
div.setHTMLUnsafe(`
<div id="host">
<template shadowrootmode="open">
<slot id="s1" name="slot1"></slot>
Expand All @@ -68,7 +77,7 @@

test(() => {
const div = document.createElement('div');
setInnerHTML(div,`
div.setHTMLUnsafe(`
<div id="host">
<template shadowrootmode="invalid">
</template>
Expand All @@ -84,7 +93,7 @@

test(() => {
const div = document.createElement('div');
setInnerHTML(div,`
div.setHTMLUnsafe(`
<div id="host">
<template shadowrootmode="closed">
</template>
Expand All @@ -97,7 +106,7 @@

test(() => {
const div = document.createElement('div');
setInnerHTML(div,`
div.setHTMLUnsafe(`
<div id="host">
<template shadowrootmode="open">
<slot id="s1" name="slot1"></slot>
Expand All @@ -113,7 +122,7 @@

test(() => {
const div = document.createElement('div');
setInnerHTML(div,`
div.setHTMLUnsafe(`
<div id="host">
<template shadowrootmode="open" shadowrootdelegatesfocus>
</template>
Expand All @@ -122,7 +131,7 @@
var host = div.querySelector('#host');
assert_true(!!host.shadowRoot,"No shadow root found");
assert_true(host.shadowRoot.delegatesFocus,"delegatesFocus should be true");
setInnerHTML(div,`
div.setHTMLUnsafe(`
<div id="host">
<template shadowrootmode="open">
</template>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ PASS innerHTML on a <wbr>
PASS innerHTML on template
PASS innerHTML on template, with nested template content
PASS innerHTML on shadowRoot
PASS DOMParser
PASS DOMParser (includingShadowRoots is historical)
PASS createHTMLDocument with innerHTML - not supported
PASS createContextualFragment - not supported
PASS XMLHttpRequest - not supported
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@
fragment = parser.parseFromString(content, 'text/html', {includeShadowRoots: false});
assert_dsd(fragment.body,false);
fragment = parser.parseFromString(content, 'text/html', {includeShadowRoots: true});
assert_dsd(fragment.body,true);
}, 'DOMParser');
assert_dsd(fragment.body,false);
}, 'DOMParser (includingShadowRoots is historical)');

test(() => {
const doc = document.implementation.createHTMLDocument('');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
</script>

<shadow-disabled>
<template shadowrootmode="open"><span id=inside/></template>
<template shadowrootmode="open"><span id=inside></span></template>
</shadow-disabled>

<script>
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@

PASS Streaming Declarative Shadow DOM: template .content() should be null
PASS Synchronous mutation events should not be fired during streaming declarative shadow DOM parsing

Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@
template.setAttribute('shadowrootmode','open');
assert_not_equals(template.content, null, 'Regular template should have content, even after adding shadowrootmode attribute');
assert_not_equals(template.innerHTML, "", 'Regular template should have innerHTML, even after adding shadowrootmode attribute');
assert_not_equals(template.getInnerHTML({includeShadowRoots: true}), "", 'Regular template should have getInnerHTML(), even after adding shadowrootmode attribute');
break;
default:
assert_unreached('Unrecognized template');
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,3 @@ None
------------------------------------------------------------------------
List of files:
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/support/declarative-child-frame.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/support/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,14 @@ Property values requiring vendor prefixes:
None
------------------------------------------------------------------------
List of files:
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-after-attachshadow.tentative.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-parser-interaction.tentative.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-attachment.tentative.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic.tentative.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-opt-in.tentative.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-with-disabled-shadow.tentative.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-after-attachshadow.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-parser-interaction.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-attachment.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-opt-in.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-with-disabled-shadow.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/getinnerhtml.tentative.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/innerhtml-before-closing-tag.tentative.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/innerhtml-on-ordinary-template.tentative.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/move-template-before-closing-tag.tentative.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/script-access.tentative.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/innerhtml-before-closing-tag.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/innerhtml-on-ordinary-template.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/move-template-before-closing-tag.html
/LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/script-access.html
14 changes: 0 additions & 14 deletions Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2176,20 +2176,6 @@ DeclarativeShadowDOMEnabled:
WebCore:
default: true

DeclarativeShadowDOMInDOMParserEnabled:
type: bool
status: testable
category: dom
humanReadableName: "DOMParser support for Declarative Shadow DOM"
humanReadableDescription: "Enable Declarative Shadow DOM in DOMParser"
defaultValue:
WebKitLegacy:
default: false
WebKit:
default: false
WebCore:
default: false

DeclarativeWebPush:
type: bool
status: unstable
Expand Down
1 change: 0 additions & 1 deletion Source/WebCore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,6 @@ set(WebCore_NON_SVG_IDL_FILES

xml/CustomXPathNSResolver.idl
xml/DOMParser.idl
xml/ParseFromStringOptions.idl
xml/XMLHttpRequest.idl
xml/XMLHttpRequestEventTarget.idl
xml/XMLHttpRequestProgressEvent.idl
Expand Down
1 change: 0 additions & 1 deletion Source/WebCore/DerivedSources-input.xcfilelist
Original file line number Diff line number Diff line change
Expand Up @@ -2034,7 +2034,6 @@ $(PROJECT_DIR)/worklets/WorkletGlobalScope.idl
$(PROJECT_DIR)/worklets/WorkletOptions.idl
$(PROJECT_DIR)/xml/CustomXPathNSResolver.idl
$(PROJECT_DIR)/xml/DOMParser.idl
$(PROJECT_DIR)/xml/ParseFromStringOptions.idl
$(PROJECT_DIR)/xml/XMLHttpRequest.idl
$(PROJECT_DIR)/xml/XMLHttpRequestEventTarget.idl
$(PROJECT_DIR)/xml/XMLHttpRequestProgressEvent.idl
Expand Down
2 changes: 0 additions & 2 deletions Source/WebCore/DerivedSources-output.xcfilelist
Original file line number Diff line number Diff line change
Expand Up @@ -2084,8 +2084,6 @@ $(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPanningModelType.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPanningModelType.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSParentNode.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSParentNode.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSParseFromStringOptions.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSParseFromStringOptions.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPath2D.cpp
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPath2D.h
$(BUILT_PRODUCTS_DIR)/DerivedSources/WebCore/JSPayerErrorFields.cpp
Expand Down
1 change: 0 additions & 1 deletion Source/WebCore/DerivedSources.make
Original file line number Diff line number Diff line change
Expand Up @@ -1684,7 +1684,6 @@ JS_BINDING_IDLS := \
$(WebCore)/worklets/WorkletOptions.idl \
$(WebCore)/xml/CustomXPathNSResolver.idl \
$(WebCore)/xml/DOMParser.idl \
$(WebCore)/xml/ParseFromStringOptions.idl \
$(WebCore)/xml/XMLHttpRequest.idl \
$(WebCore)/xml/XMLHttpRequestEventTarget.idl \
$(WebCore)/xml/XMLHttpRequestProgressEvent.idl \
Expand Down
1 change: 0 additions & 1 deletion Source/WebCore/Sources.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3941,7 +3941,6 @@ JSPannerNode.cpp
JSPannerOptions.cpp
JSPanningModelType.cpp
JSParentNode.cpp
JSParseFromStringOptions.cpp
JSPath2D.cpp
JSPayerErrorFields.cpp
JSPaymentAddress.cpp
Expand Down
6 changes: 0 additions & 6 deletions Source/WebCore/WebCore.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -3811,7 +3811,6 @@
9B2D8A7914997CCF00ECEF3E /* UndoStep.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B2D8A7814997CCF00ECEF3E /* UndoStep.h */; settings = {ATTRIBUTES = (Private, ); }; };
9B32CDA913DF7FA900F34D13 /* RenderedPosition.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B32CDA713DF7FA900F34D13 /* RenderedPosition.h */; };
9B417064125662B3006B28FC /* ApplyBlockElementCommand.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B417062125662B3006B28FC /* ApplyBlockElementCommand.h */; };
9B43D54F28E132FF0095509C /* ParseFromStringOptions.h in Headers */ = {isa = PBXBuildFile; fileRef = 9BB892FA28E12FFD00E7408F /* ParseFromStringOptions.h */; settings = {ATTRIBUTES = (Private, ); }; };
9B4F0636289F3882007831DB /* SlotAssignmentMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B4F0630289F2F08007831DB /* SlotAssignmentMode.h */; settings = {ATTRIBUTES = (Private, ); }; };
9B50B1DE17CD4C0F0087F63C /* FormAssociatedElement.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B50B1DC17CD4C0F0087F63C /* FormAssociatedElement.h */; settings = {ATTRIBUTES = (Private, ); }; };
9B532EA41BA928570038A827 /* SlotAssignment.h in Headers */ = {isa = PBXBuildFile; fileRef = 9B532EA21BA928570038A827 /* SlotAssignment.h */; };
Expand Down Expand Up @@ -15298,8 +15297,6 @@
9BAB6C6A12550631001626D4 /* EditingStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EditingStyle.h; sourceTree = "<group>"; };
9BAB6C6B12550631001626D4 /* EditingStyle.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EditingStyle.cpp; sourceTree = "<group>"; };
9BAF3B2312C1A39800014BF1 /* WritingDirection.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = WritingDirection.h; sourceTree = "<group>"; };
9BB892FA28E12FFD00E7408F /* ParseFromStringOptions.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ParseFromStringOptions.h; sourceTree = "<group>"; };
9BB892FB28E12FFE00E7408F /* ParseFromStringOptions.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = ParseFromStringOptions.idl; sourceTree = "<group>"; };
9BC5F9DE1D5AAD5D002B749D /* CustomElementRegistry.idl */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = CustomElementRegistry.idl; sourceTree = "<group>"; };
9BC5F9DF1D5AAF6A002B749D /* JSCustomElementRegistryCustom.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = JSCustomElementRegistryCustom.cpp; sourceTree = "<group>"; };
9BC6C21913CCC97B008E0337 /* HTMLTextFormControlElement.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = HTMLTextFormControlElement.h; sourceTree = "<group>"; };
Expand Down Expand Up @@ -34767,8 +34764,6 @@
1ACE53E30A8D18E70022947D /* DOMParser.idl */,
E10B9B6B0B747599003ED890 /* NativeXPathNSResolver.cpp */,
E10B9B6A0B747599003ED890 /* NativeXPathNSResolver.h */,
9BB892FA28E12FFD00E7408F /* ParseFromStringOptions.h */,
9BB892FB28E12FFE00E7408F /* ParseFromStringOptions.idl */,
A833C7F60A2CF1D800D57664 /* xmlattrs.in */,
59C28043138DC2410079B7E2 /* XMLErrors.cpp */,
59C28044138DC2410079B7E2 /* XMLErrors.h */,
Expand Down Expand Up @@ -40652,7 +40647,6 @@
CDCD41E81C3DDB0A00965D99 /* ParsedContentRange.h in Headers */,
447958041643B49A001E0A7F /* ParsedContentType.h in Headers */,
5C4A0FDA25C3449A00D9EE97 /* ParsedRequestRange.h in Headers */,
9B43D54F28E132FF0095509C /* ParseFromStringOptions.h in Headers */,
536D5A23193E8E0C00CE4CAB /* ParsingUtilities.h in Headers */,
46893B8427E8D74C002CC13D /* PartitionedSecurityOrigin.h in Headers */,
F55B3DCA1251F12D003EF269 /* PasswordInputType.h in Headers */,
Expand Down
7 changes: 2 additions & 5 deletions Source/WebCore/html/HTMLTemplateElement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -96,15 +96,12 @@ const AtomString& HTMLTemplateElement::shadowRootMode() const
return closed;
if (equalLettersIgnoringASCIICase(modeString, "open"_s))
return open;
return nullAtom();
return emptyAtom();
}

void HTMLTemplateElement::setShadowRootMode(const AtomString& value)
{
if (value.isNull())
removeAttribute(HTMLNames::shadowrootmodeAttr);
else
setAttribute(HTMLNames::shadowrootmodeAttr, value);
setAttribute(HTMLNames::shadowrootmodeAttr, value);
}

void HTMLTemplateElement::setDeclarativeShadowRoot(ShadowRoot& shadowRoot)
Expand Down
2 changes: 1 addition & 1 deletion Source/WebCore/html/HTMLTemplateElement.idl
Original file line number Diff line number Diff line change
Expand Up @@ -33,5 +33,5 @@
Exposed=Window
] interface HTMLTemplateElement : HTMLElement {
readonly attribute DocumentFragment content;
[CEReactions=NotNeeded, EnabledBySetting=DeclarativeShadowDOMEnabled] attribute [AtomString] DOMString? shadowRootMode;
[CEReactions=NotNeeded, EnabledBySetting=DeclarativeShadowDOMEnabled] attribute [AtomString] DOMString shadowRootMode;
};
8 changes: 2 additions & 6 deletions Source/WebCore/xml/DOMParser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,14 @@ Ref<DOMParser> DOMParser::create(Document& contextDocument)
return adoptRef(*new DOMParser(contextDocument));
}

ExceptionOr<Ref<Document>> DOMParser::parseFromString(const String& string, const String& contentType, ParseFromStringOptions options)
ExceptionOr<Ref<Document>> DOMParser::parseFromString(const String& string, const String& contentType)
{
if (contentType != "text/html"_s && contentType != "text/xml"_s && contentType != "application/xml"_s && contentType != "application/xhtml+xml"_s && contentType != "image/svg+xml"_s)
return Exception { TypeError };
auto document = DOMImplementation::createDocument(contentType, nullptr, m_settings, URL { });
if (m_contextDocument)
document->setContextDocument(*m_contextDocument.get());
OptionSet<ParserContentPolicy> parsingOptions;
if (options.includeShadowRoots && document->settings().declarativeShadowDOMInDOMParserEnabled())
parsingOptions = { ParserContentPolicy::AllowScriptingContent, ParserContentPolicy::AllowPluginContent, ParserContentPolicy::AllowDeclarativeShadowDOM };
else
parsingOptions = { ParserContentPolicy::AllowScriptingContent, ParserContentPolicy::AllowPluginContent };
OptionSet<ParserContentPolicy> parsingOptions = { ParserContentPolicy::AllowScriptingContent, ParserContentPolicy::AllowPluginContent };
document->setParserContentPolicy(parsingOptions);
bool usedFastPath = false;
if (contentType == "text/html"_s) {
Expand Down
Loading

0 comments on commit 30f0742

Please sign in to comment.