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

Unified Diff: Source/core/dom/shadow/ElementShadow.cpp

Issue 49153006: Have ContainerNodeAlgorithms deal with references instead of pointers (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Created 7 years, 2 months 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
Index: Source/core/dom/shadow/ElementShadow.cpp
diff --git a/Source/core/dom/shadow/ElementShadow.cpp b/Source/core/dom/shadow/ElementShadow.cpp
index 757e80840d7e5b6652c478fa6f034a1221b3aca3..5aff43ad7dfdf33dd9d75ea95d708427bfc998e7 100644
--- a/Source/core/dom/shadow/ElementShadow.cpp
+++ b/Source/core/dom/shadow/ElementShadow.cpp
@@ -131,23 +131,23 @@ 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);
+ RefPtr<ShadowRoot> shadowRoot = ShadowRoot::create(&shadowHost.document(), type);
- shadowRoot->setParentOrShadowHostNode(shadowHost);
- shadowRoot->setParentTreeScope(&shadowHost->treeScope());
+ shadowRoot->setParentOrShadowHostNode(&shadowHost);
+ shadowRoot->setParentTreeScope(&shadowHost.treeScope());
m_shadowRoots.push(shadowRoot.get());
- ChildNodeInsertionNotifier(shadowHost).notify(shadowRoot.get());
+ ChildNodeInsertionNotifier(shadowHost).notify(*shadowRoot);
setNeedsDistributionRecalc();
- shadowHost->lazyReattachIfAttached();
+ shadowHost.lazyReattachIfAttached();
// addShadowRoot() affects apply-author-styles. However, we know that the youngest shadow root has not had any children yet.
// The youngest shadow root's apply-author-styles is default (false). So we can just set m_applyAuthorStyles false.
m_applyAuthorStyles = false;
- shadowHost->didAddShadowRoot(*shadowRoot);
- InspectorInstrumentation::didPushShadowRoot(shadowHost, shadowRoot.get());
+ shadowHost.didAddShadowRoot(*shadowRoot);
+ InspectorInstrumentation::didPushShadowRoot(&shadowHost, shadowRoot.get());
return shadowRoot.get();
}
@@ -156,6 +156,7 @@ void ElementShadow::removeAllShadowRoots()
{
// Dont protect this ref count.
Element* shadowHost = host();
+ ASSERT(shadowHost);
while (RefPtr<ShadowRoot> oldRoot = m_shadowRoots.head()) {
InspectorInstrumentation::willPopShadowRoot(shadowHost, oldRoot.get());
@@ -169,7 +170,7 @@ void ElementShadow::removeAllShadowRoots()
oldRoot->setParentTreeScope(&shadowHost->document());
oldRoot->setPrev(0);
oldRoot->setNext(0);
- ChildNodeRemovalNotifier(shadowHost).notify(oldRoot.get());
+ ChildNodeRemovalNotifier(*shadowHost).notify(*oldRoot);
}
}

Powered by Google App Engine
This is Rietveld 408576698