Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1121)

Unified Diff: third_party/WebKit/Source/core/dom/Element.cpp

Issue 1751953003: Remove the support of multiple shadow roots with a user agent shadow root (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: fix failing tests Created 4 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/dom/custom-elements-expected.html ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: third_party/WebKit/Source/core/dom/Element.cpp
diff --git a/third_party/WebKit/Source/core/dom/Element.cpp b/third_party/WebKit/Source/core/dom/Element.cpp
index 2641196365dc0a6bc82318e49ddac52a4689f373..216f4d331bb68a070891c4864171731a2ca564f6 100644
--- a/third_party/WebKit/Source/core/dom/Element.cpp
+++ b/third_party/WebKit/Source/core/dom/Element.cpp
@@ -1902,10 +1902,15 @@ CustomElementDefinition* Element::customElementDefinition() const
PassRefPtrWillBeRawPtr<ShadowRoot> Element::createShadowRoot(const ScriptState* scriptState, ExceptionState& exceptionState)
{
OriginsUsingFeatures::countMainWorldOnly(scriptState, document(), OriginsUsingFeatures::Feature::ElementCreateShadowRoot);
- ShadowRoot* root = shadowRoot();
- if (root && (root->type() == ShadowRootType::Open || root->type() == ShadowRootType::Closed)) {
- exceptionState.throwDOMException(InvalidStateError, "Shadow root cannot be created on a host which already hosts this type of shadow tree.");
- return nullptr;
+ if (ShadowRoot* root = shadowRoot()) {
+ if (root->isV1()) {
+ exceptionState.throwDOMException(InvalidStateError, "Shadow root cannot be created on a host which already hosts a v1 shadow tree.");
+ return nullptr;
+ }
+ if (root->type() == ShadowRootType::UserAgent) {
+ exceptionState.throwDOMException(InvalidStateError, "Shadow root cannot be created on a host which already hosts an user-agent shadow tree.");
+ return nullptr;
+ }
}
return createShadowRootInternal(ShadowRootType::V0, exceptionState);
}
« no previous file with comments | « third_party/WebKit/LayoutTests/svg/dom/custom-elements-expected.html ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698