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

Unified Diff: Source/core/editing/ReplaceNodeWithSpanCommand.cpp

Issue 54273007: Use more references in ContainerNode code (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Fix crashes 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
Index: Source/core/editing/ReplaceNodeWithSpanCommand.cpp
diff --git a/Source/core/editing/ReplaceNodeWithSpanCommand.cpp b/Source/core/editing/ReplaceNodeWithSpanCommand.cpp
index 6274c07e34378a928fa9f368665b0f898bfa61c4..477177d46ac717e1044d77dafd9a0afd12b20a4e 100644
--- a/Source/core/editing/ReplaceNodeWithSpanCommand.cpp
+++ b/Source/core/editing/ReplaceNodeWithSpanCommand.cpp
@@ -48,11 +48,11 @@ ReplaceNodeWithSpanCommand::ReplaceNodeWithSpanCommand(PassRefPtr<HTMLElement> e
ASSERT(m_elementToReplace);
}
-static void swapInNodePreservingAttributesAndChildren(HTMLElement* newNode, HTMLElement* nodeToReplace)
+static void swapInNodePreservingAttributesAndChildren(HTMLElement* newNode, HTMLElement& nodeToReplace)
{
- ASSERT(nodeToReplace->inDocument());
- RefPtr<ContainerNode> parentNode = nodeToReplace->parentNode();
- parentNode->insertBefore(newNode, nodeToReplace);
+ ASSERT(nodeToReplace.inDocument());
+ RefPtr<ContainerNode> parentNode = nodeToReplace.parentNode();
+ parentNode->insertBefore(newNode, &nodeToReplace);
NodeVector children;
getChildNodes(nodeToReplace, children);
@@ -60,9 +60,9 @@ static void swapInNodePreservingAttributesAndChildren(HTMLElement* newNode, HTML
newNode->appendChild(children[i]);
// FIXME: Fix this to send the proper MutationRecords when MutationObservers are present.
- newNode->cloneDataFromElement(*nodeToReplace);
+ newNode->cloneDataFromElement(nodeToReplace);
- parentNode->removeChild(nodeToReplace, ASSERT_NO_EXCEPTION);
+ parentNode->removeChild(&nodeToReplace, ASSERT_NO_EXCEPTION);
}
void ReplaceNodeWithSpanCommand::doApply()
@@ -71,14 +71,14 @@ void ReplaceNodeWithSpanCommand::doApply()
return;
if (!m_spanElement)
m_spanElement = createHTMLElement(m_elementToReplace->document(), spanTag);
- swapInNodePreservingAttributesAndChildren(m_spanElement.get(), m_elementToReplace.get());
+ swapInNodePreservingAttributesAndChildren(m_spanElement.get(), *m_elementToReplace);
}
void ReplaceNodeWithSpanCommand::doUnapply()
{
if (!m_spanElement->inDocument())
return;
- swapInNodePreservingAttributesAndChildren(m_elementToReplace.get(), m_spanElement.get());
+ swapInNodePreservingAttributesAndChildren(m_elementToReplace.get(), *m_spanElement);
}
} // namespace WebCore

Powered by Google App Engine
This is Rietveld 408576698