From 79d2dec92caef6f7df33125ab34bd70e36c982c2 Mon Sep 17 00:00:00 2001 From: Anne van Kesteren Date: Thu, 15 Feb 2024 05:34:33 -0800 Subject: [PATCH] Add shadowrootclonable and align with declarative shadow root changes https://bugs.webkit.org/show_bug.cgi?id=269361 Reviewed by Ryosuke Niwa. This makes the following changes: - Adds the new shadowrootclonable attribute to opt into a declarative shadow root being clonable. - As a result, declarative shadow roots are no longer clonable by default. Web developers will have to explicitly opt in. - When attachShadow() is called on a shadow host with an existing declarative tree, throw if mode is a mismatch. - In attachShadow() throw first for mode being set to "user-agent" as this is to be caught by the binding layer in theory. - And finally, only attach a declarative shadow root successfully for the first template element. New tests are upstreamed here: https://github.com/web-platform-tests/wpt/pull/44568 Specification changes are here (not all have landed yet as various nits are still being addressed, but all have agreement): - https://github.com/whatwg/html/pull/10117 - https://github.com/whatwg/html/pull/10069 - https://github.com/whatwg/dom/pull/1246 * LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-name-shadow.html: * LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/view-timeline-name-shadow.html: * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-attachment-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-basic-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-repeats-2-expected.txt: Added. * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-repeats-2.html: Added. * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-repeats-expected.txt: * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-repeats.html: * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/w3c-import.log: * LayoutTests/imported/w3c/web-platform-tests/shadow-dom/shadow-root-clonable-expected.txt: * Source/WebCore/dom/Element.cpp: * Source/WebCore/dom/Element.h: * Source/WebCore/html/HTMLAttributeNames.in: * Source/WebCore/html/HTMLTemplateElement.cpp: (WebCore::HTMLTemplateElement::attachAsDeclarativeShadowRootIfNeeded): * Source/WebCore/html/parser/HTMLConstructionSite.cpp: (WebCore::HTMLConstructionSite::insertHTMLTemplateElement): Canonical link: https://commits.webkit.org/274727@main --- .../css/scroll-timeline-name-shadow.html | 13 +- .../css/view-timeline-name-shadow.html | 13 +- ...arative-shadow-dom-attachment-expected.txt | 272 +++++------------- .../declarative-shadow-dom-basic-expected.txt | 4 +- ...larative-shadow-dom-repeats-2-expected.txt | 3 + .../declarative-shadow-dom-repeats-2.html | 36 +++ ...eclarative-shadow-dom-repeats-expected.txt | 10 +- .../declarative-shadow-dom-repeats.html | 26 +- .../shadow-dom/declarative/w3c-import.log | 1 + .../shadow-root-clonable-expected.txt | 4 +- Source/WebCore/dom/Element.cpp | 12 +- Source/WebCore/dom/Element.h | 2 +- Source/WebCore/html/HTMLAttributeNames.in | 3 +- Source/WebCore/html/HTMLTemplateElement.cpp | 6 +- .../html/parser/HTMLConstructionSite.cpp | 5 +- 15 files changed, 156 insertions(+), 254 deletions(-) create mode 100644 LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-repeats-2-expected.txt create mode 100644 LayoutTests/imported/w3c/web-platform-tests/shadow-dom/declarative/declarative-shadow-dom-repeats-2.html diff --git a/LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-name-shadow.html b/LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-name-shadow.html index f2bea29dd3c87..a535b2a44fe80 100644 --- a/LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-name-shadow.html +++ b/LayoutTests/imported/w3c/web-platform-tests/scroll-animations/css/scroll-timeline-name-shadow.html @@ -6,7 +6,6 @@ -
-