Commit 98a502c4 authored by Mason Freed's avatar Mason Freed Committed by Commit Bot

Explicitly set "available to element internals" for declarative

Per some recent spec discussions/changes, declarative shadow
roots should manually set the "available to element internals"
flag, rather than assuming that in the check. See [1].

[1] https://github.com/whatwg/html/pull/5912#discussion_r489750553

Bug: 1042130
Change-Id: If50fa8bff4cddb566edf95cbd1b1a8f1afe11b49
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2429852
Commit-Queue: Kouhei Ueno <kouhei@chromium.org>
Auto-Submit: Mason Freed <masonfreed@chromium.org>
Reviewed-by: default avatarKouhei Ueno <kouhei@chromium.org>
Cr-Commit-Position: refs/heads/master@{#810930}
parent 3a38d447
...@@ -3560,6 +3560,10 @@ void Element::AttachDeclarativeShadowRoot(HTMLTemplateElement* template_element, ...@@ -3560,6 +3560,10 @@ void Element::AttachDeclarativeShadowRoot(HTMLTemplateElement* template_element,
// 13.1. Set declarative shadow host element's shadow host's "is declarative // 13.1. Set declarative shadow host element's shadow host's "is declarative
// shadow root" property to true. // shadow root" property to true.
shadow_root.SetIsDeclarativeShadowRoot(true); shadow_root.SetIsDeclarativeShadowRoot(true);
// 13.NEW. Set declarative shadow host element's shadow host's "available
// to element internals" to true.
shadow_root.SetAvailableToElementInternals(true);
// 13.2. Append the declarative template element's DocumentFragment to the // 13.2. Append the declarative template element's DocumentFragment to the
// newly-created shadow root. // newly-created shadow root.
shadow_root.appendChild(template_element->DeclarativeShadowContent()); shadow_root.appendChild(template_element->DeclarativeShadowContent());
......
...@@ -169,7 +169,7 @@ class CORE_EXPORT ShadowRoot final : public DocumentFragment, public TreeScope { ...@@ -169,7 +169,7 @@ class CORE_EXPORT ShadowRoot final : public DocumentFragment, public TreeScope {
available_to_element_internals_ = flag; available_to_element_internals_ = flag;
} }
bool IsAvailableToElementInternals() const { bool IsAvailableToElementInternals() const {
return available_to_element_internals_ || is_declarative_shadow_root_; return available_to_element_internals_;
} }
bool ContainsShadowRoots() const { return child_shadow_root_count_; } bool ContainsShadowRoots() const { return child_shadow_root_count_; }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment