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

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

Issue 59463007: Have Element::ensureUserAgentShadowRoot() return a reference (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add extra assertion Created 7 years, 1 month 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/shadow/ElementShadow.h » ('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 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;
}
« no previous file with comments | « Source/core/dom/Element.h ('k') | Source/core/dom/shadow/ElementShadow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698