Index: Source/core/dom/Element.cpp |
diff --git a/Source/core/dom/Element.cpp b/Source/core/dom/Element.cpp |
index 1e01581554dadef226e707b0c7f001421a74bf38..201c4bd58245c97219bc983a0185e329648825f8 100644 |
--- a/Source/core/dom/Element.cpp |
+++ b/Source/core/dom/Element.cpp |
@@ -1690,7 +1690,7 @@ PassRefPtr<ShadowRoot> Element::createShadowRoot(ExceptionState& es) |
ensureUserAgentShadowRoot(); |
if (RuntimeEnabledFeatures::authorShadowDOMForAnyElementEnabled()) |
- return ensureShadow().addShadowRoot(*this, ShadowRoot::AuthorShadowRoot); |
+ return PassRefPtr<ShadowRoot>(ensureShadow().addShadowRoot(*this, ShadowRoot::AuthorShadowRoot)); |
// Since some elements recreates shadow root dynamically, multiple shadow |
// subtrees won't work well in that element. Until they are fixed, we disable |
@@ -1699,7 +1699,7 @@ PassRefPtr<ShadowRoot> Element::createShadowRoot(ExceptionState& es) |
es.throwUninformativeAndGenericDOMException(HierarchyRequestError); |
return 0; |
} |
- return ensureShadow().addShadowRoot(*this, ShadowRoot::AuthorShadowRoot); |
+ return PassRefPtr<ShadowRoot>(ensureShadow().addShadowRoot(*this, ShadowRoot::AuthorShadowRoot)); |
} |
ShadowRoot* Element::shadowRoot() const |
@@ -1729,11 +1729,11 @@ ShadowRoot* Element::userAgentShadowRoot() const |
return 0; |
} |
-ShadowRoot* Element::ensureUserAgentShadowRoot() |
+ShadowRoot& Element::ensureUserAgentShadowRoot() |
{ |
if (ShadowRoot* shadowRoot = userAgentShadowRoot()) |
- return shadowRoot; |
- ShadowRoot* shadowRoot = ensureShadow().addShadowRoot(*this, ShadowRoot::UserAgentShadowRoot); |
+ return *shadowRoot; |
+ ShadowRoot& shadowRoot = ensureShadow().addShadowRoot(*this, ShadowRoot::UserAgentShadowRoot); |
didAddUserAgentShadowRoot(shadowRoot); |
return shadowRoot; |
} |