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

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

Issue 48803004: Have Document::nodeWillBeRemoved() take a reference (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
« no previous file with comments | « Source/core/dom/Range.h ('k') | Source/core/dom/RangeBoundaryPoint.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/Range.cpp
diff --git a/Source/core/dom/Range.cpp b/Source/core/dom/Range.cpp
index 74a0ca9c74d11c1373c0be183ac9570688cb9474..5b2d161cce657891427440ca83e038f4aaf3e6df 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -1035,7 +1035,7 @@ void Range::insertNode(PassRefPtr<Node> prpNewNode, ExceptionState& es)
return;
if (collapsed)
- m_end.setToBeforeChild(newText.get());
+ m_end.setToBeforeChild(*newText);
} else {
RefPtr<Node> lastChild = (newNodeType == Node::DOCUMENT_FRAGMENT_NODE) ? newNode->lastChild() : newNode;
if (lastChild && lastChild == m_start.childBefore()) {
@@ -1043,7 +1043,7 @@ void Range::insertNode(PassRefPtr<Node> prpNewNode, ExceptionState& es)
// the inserted nodes.
Node* firstChild = (newNodeType == Node::DOCUMENT_FRAGMENT_NODE) ? newNode->firstChild() : newNode.get();
ASSERT(firstChild);
- m_start.setToBeforeChild(firstChild);
+ m_start.setToBeforeChild(*firstChild);
return;
}
@@ -1694,7 +1694,7 @@ void Range::nodeChildrenWillBeRemoved(ContainerNode* container)
boundaryNodeChildrenWillBeRemoved(m_end, container);
}
-static inline void boundaryNodeWillBeRemoved(RangeBoundaryPoint& boundary, Node* nodeToBeRemoved)
+static inline void boundaryNodeWillBeRemoved(RangeBoundaryPoint& boundary, Node& nodeToBeRemoved)
{
if (boundary.childBefore() == nodeToBeRemoved) {
boundary.childBeforeWillBeRemoved();
@@ -1709,15 +1709,14 @@ static inline void boundaryNodeWillBeRemoved(RangeBoundaryPoint& boundary, Node*
}
}
-void Range::nodeWillBeRemoved(Node* node)
+void Range::nodeWillBeRemoved(Node& node)
{
- ASSERT(node);
- ASSERT(node->document() == m_ownerDocument);
+ ASSERT(node.document() == m_ownerDocument);
ASSERT(node != m_ownerDocument);
// FIXME: Once DOMNodeRemovedFromDocument mutation event removed, we
// should change following if-statement to ASSERT(!node->parentNode).
- if (!node->parentNode())
+ if (!node.parentNode())
return;
boundaryNodeWillBeRemoved(m_start, node);
boundaryNodeWillBeRemoved(m_end, node);
« no previous file with comments | « Source/core/dom/Range.h ('k') | Source/core/dom/RangeBoundaryPoint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698