Chromium Code Reviews

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

Issue 456323002: [WIP] Re-implement MediaControls in Blink-in-JS (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Index: Source/core/dom/Element.cpp
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp
index 290f998146c07346171f9e3a57a6e38c9eda8ce4..35d1ec67935b893be57c6b966e3e3bde8ae2842f 100644
--- a/Source/core/dom/Element.cpp
+++ b/Source/core/dom/Element.cpp
@@ -1697,6 +1697,21 @@ PassRefPtrWillBeRawPtr<ShadowRoot> Element::createShadowRoot(ExceptionState& exc
return PassRefPtrWillBeRawPtr<ShadowRoot>(ensureShadow().addShadowRoot(*this, ShadowRoot::AuthorShadowRoot));
}
+PassRefPtrWillBeRawPtr<ShadowRoot> Element::createUserAgentShadowRoot(ExceptionState& exceptionState)
haraken 2014/08/11 11:09:33 As discussed offline, we won't need this.
+{
+ ensureUserAgentShadowRoot();
+
+ // Some elements make assumptions about what kind of renderers they allow
+ // as children so we can't allow author shadows on them for now. An override
+ // flag is provided for testing how author shadows interact on these elements.
+ if (!areAuthorShadowsAllowed() && !RuntimeEnabledFeatures::authorShadowDOMForAnyElementEnabled()) {
+ exceptionState.throwDOMException(HierarchyRequestError, "Author-created shadow roots are disabled for this element.");
+ return nullptr;
+ }
+
+ return PassRefPtrWillBeRawPtr<ShadowRoot>(ensureShadow().addShadowRoot(*this, ShadowRoot::AuthorShadowRoot));
+}
+
ShadowRoot* Element::shadowRoot() const
{
ElementShadow* elementShadow = shadow();

Powered by Google App Engine