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

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

Issue 1158163004: Add ShadowRootInit dictionary. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: nit fix in layout test Created 5 years, 6 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 | « Source/core/dom/Element.h ('k') | Source/core/dom/Element.idl » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index df7cfc8d14fcaeeffc9cf1d8ac3a0cde8982f163..a6b1b85232e3b8038577ec7f9c3ea8d490df99d1 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -74,6 +74,7 @@
#include "core/dom/custom/CustomElementRegistrationContext.h"
#include "core/dom/shadow/InsertionPoint.h"
#include "core/dom/shadow/ShadowRoot.h"
+#include "core/dom/shadow/ShadowRootInit.h"
#include "core/editing/FrameSelection.h"
#include "core/editing/htmlediting.h"
#include "core/editing/iterators/TextIterator.h"
@@ -1809,6 +1810,21 @@ PassRefPtrWillBeRawPtr<ShadowRoot> Element::createShadowRoot(ScriptState* script
return createShadowRoot(exceptionState);
}
+PassRefPtrWillBeRawPtr<ShadowRoot> Element::createShadowRoot(ScriptState* scriptState, ShadowRootInit& shadowRootInitDict, ExceptionState& exceptionState)
+{
+ ASSERT(RuntimeEnabledFeatures::createShadowRootWithParameterEnabled());
+ UseCounter::count(document(), UseCounter::ElementCreateShadowRootWithParameter);
+
+ OriginsUsingFeatures::count(scriptState, document(), OriginsUsingFeatures::Feature::ElementCreateShadowRoot);
+ // TODO(kochi): Add support for closed shadow root. crbug.com/459136
+ if (shadowRootInitDict.hasMode() && shadowRootInitDict.mode() == "closed") {
+ exceptionState.throwDOMException(NotSupportedError, "Closed shadow root is not implemented yet.");
+ return nullptr;
+ }
+
+ return createShadowRoot(exceptionState);
+}
+
PassRefPtrWillBeRawPtr<ShadowRoot> Element::createShadowRoot(ExceptionState& exceptionState)
{
if (alwaysCreateUserAgentShadowRoot())
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/Element.idl » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698