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

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: 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..8d4379001531ae8cf7a9f36fe4318c890a6819a8 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,7 @@ ShadowRoot* ElementShadow::addShadowRoot(Element& shadowHost, ShadowRoot::Shadow
shadowHost.didAddShadowRoot(*shadowRoot);
InspectorInstrumentation::didPushShadowRoot(&shadowHost, shadowRoot.get());
- return shadowRoot.get();
+ return *shadowRoot;
eseidel 2013/11/06 20:18:39 It's generally not safe to return a reference from
adamk 2013/11/06 20:24:05 The easiest way to make this look safer would be t
Inactive 2013/11/07 16:54:28 I took another look at the code and the ownership
Inactive 2013/11/07 20:03:27 Done.
}
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