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

Unified Diff: Source/core/dom/shadow/ElementShadow.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/shadow/ElementShadow.h ('k') | Source/core/html/HTMLDetailsElement.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/shadow/ElementShadow.cpp
diff --git a/Source/core/dom/shadow/ElementShadow.cpp b/Source/core/dom/shadow/ElementShadow.cpp
index 158addd3d0da4180463f8863a020789d291d6a10..94343c5c99181b7d2af2a4ea0ec823cd4a82241d 100644
--- a/Source/core/dom/shadow/ElementShadow.cpp
+++ b/Source/core/dom/shadow/ElementShadow.cpp
@@ -131,7 +131,7 @@ ElementShadow::~ElementShadow()
removeAllShadowRoots();
}
-ShadowRoot* ElementShadow::addShadowRoot(Element& shadowHost, ShadowRoot::ShadowRootType type)
+ShadowRoot& ElementShadow::addShadowRoot(Element& shadowHost, ShadowRoot::ShadowRootType type)
{
RefPtr<ShadowRoot> shadowRoot = ShadowRoot::create(&shadowHost.document(), type);
@@ -149,7 +149,9 @@ ShadowRoot* ElementShadow::addShadowRoot(Element& shadowHost, ShadowRoot::Shadow
shadowHost.didAddShadowRoot(*shadowRoot);
InspectorInstrumentation::didPushShadowRoot(&shadowHost, shadowRoot.get());
- return shadowRoot.get();
+ ASSERT(m_shadowRoots.head());
+ ASSERT(shadowRoot.get() == m_shadowRoots.head());
+ return *m_shadowRoots.head();
}
void ElementShadow::removeAllShadowRoots()
« no previous file with comments | « Source/core/dom/shadow/ElementShadow.h ('k') | Source/core/html/HTMLDetailsElement.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698