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

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

Issue 178613003: Make Document::nodeChildrenWillBeRemoved() take a reference (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Use PassRefPtr Created 6 years, 10 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 444ded90aeb24f4aca7629395e74a8e5f13038df..85906a831541882178e89be7e9c85b864e07bc3a 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -120,8 +120,8 @@ void Range::setDocument(Document& document)
ASSERT(m_ownerDocument);
m_ownerDocument->detachRange(this);
m_ownerDocument = &document;
- m_start.setToStartOfNode(&document);
- m_end.setToStartOfNode(&document);
+ m_start.setToStartOfNode(document);
+ m_end.setToStartOfNode(document);
m_ownerDocument->attachRange(this);
}
@@ -1347,8 +1347,8 @@ void Range::selectNodeContents(Node* refNode, ExceptionState& exceptionState)
if (m_ownerDocument != refNode->document())
setDocument(refNode->document());
- m_start.setToStartOfNode(refNode);
- m_end.setToEndOfNode(refNode);
+ m_start.setToStartOfNode(*refNode);
+ m_end.setToEndOfNode(*refNode);
}
void Range::surroundContents(PassRefPtr<Node> passNewParent, ExceptionState& exceptionState)
@@ -1649,9 +1649,9 @@ void Range::nodeChildrenChanged(ContainerNode* container)
boundaryNodeChildrenChanged(m_end, container);
}
-static inline void boundaryNodeChildrenWillBeRemoved(RangeBoundaryPoint& boundary, ContainerNode* container)
+static inline void boundaryNodeChildrenWillBeRemoved(RangeBoundaryPoint& boundary, ContainerNode& container)
{
- for (Node* nodeToBeRemoved = container->firstChild(); nodeToBeRemoved; nodeToBeRemoved = nodeToBeRemoved->nextSibling()) {
+ for (Node* nodeToBeRemoved = container.firstChild(); nodeToBeRemoved; nodeToBeRemoved = nodeToBeRemoved->nextSibling()) {
if (boundary.childBefore() == nodeToBeRemoved) {
boundary.setToStartOfNode(container);
return;
@@ -1666,10 +1666,9 @@ static inline void boundaryNodeChildrenWillBeRemoved(RangeBoundaryPoint& boundar
}
}
-void Range::nodeChildrenWillBeRemoved(ContainerNode* container)
+void Range::nodeChildrenWillBeRemoved(ContainerNode& container)
{
- ASSERT(container);
- ASSERT(container->document() == m_ownerDocument);
+ ASSERT(container.document() == m_ownerDocument);
boundaryNodeChildrenWillBeRemoved(m_start, container);
boundaryNodeChildrenWillBeRemoved(m_end, container);
}
« 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