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

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

Issue 176863009: Have NodeWithIndex deal with references instead of pointers (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase 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/Text.cpp » ('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 53a081d175f13e58a51dee60b31a953d1ef101cc..28b4b67bd18457d64bd17efde0213b555d88779a 100644
--- a/Source/core/dom/Range.cpp
+++ b/Source/core/dom/Range.cpp
@@ -1743,44 +1743,42 @@ void Range::didRemoveText(Node* text, unsigned offset, unsigned length)
boundaryTextRemoved(m_end, text, offset, length);
}
-static inline void boundaryTextNodesMerged(RangeBoundaryPoint& boundary, NodeWithIndex& oldNode, unsigned offset)
+static inline void boundaryTextNodesMerged(RangeBoundaryPoint& boundary, const NodeWithIndex& oldNode, unsigned offset)
{
if (boundary.container() == oldNode.node())
- boundary.set(oldNode.node()->previousSibling(), boundary.offset() + offset, 0);
- else if (boundary.container() == oldNode.node()->parentNode() && boundary.offset() == oldNode.index())
- boundary.set(oldNode.node()->previousSibling(), offset, 0);
+ boundary.set(oldNode.node().previousSibling(), boundary.offset() + offset, 0);
+ else if (boundary.container() == oldNode.node().parentNode() && boundary.offset() == oldNode.index())
+ boundary.set(oldNode.node().previousSibling(), offset, 0);
}
-void Range::didMergeTextNodes(NodeWithIndex& oldNode, unsigned offset)
+void Range::didMergeTextNodes(const NodeWithIndex& oldNode, unsigned offset)
{
- ASSERT(oldNode.node());
- ASSERT(oldNode.node()->document() == m_ownerDocument);
- ASSERT(oldNode.node()->parentNode());
- ASSERT(oldNode.node()->isTextNode());
- ASSERT(oldNode.node()->previousSibling());
- ASSERT(oldNode.node()->previousSibling()->isTextNode());
+ ASSERT(oldNode.node().document() == m_ownerDocument);
+ ASSERT(oldNode.node().parentNode());
+ ASSERT(oldNode.node().isTextNode());
+ ASSERT(oldNode.node().previousSibling());
+ ASSERT(oldNode.node().previousSibling()->isTextNode());
boundaryTextNodesMerged(m_start, oldNode, offset);
boundaryTextNodesMerged(m_end, oldNode, offset);
}
-static inline void boundaryTextNodeSplit(RangeBoundaryPoint& boundary, Text* oldNode)
+static inline void boundaryTextNodeSplit(RangeBoundaryPoint& boundary, Text& oldNode)
{
if (boundary.container() != oldNode)
return;
unsigned boundaryOffset = boundary.offset();
- if (boundaryOffset <= oldNode->length())
+ if (boundaryOffset <= oldNode.length())
return;
- boundary.set(oldNode->nextSibling(), boundaryOffset - oldNode->length(), 0);
+ boundary.set(oldNode.nextSibling(), boundaryOffset - oldNode.length(), 0);
}
-void Range::didSplitTextNode(Text* oldNode)
+void Range::didSplitTextNode(Text& oldNode)
{
- ASSERT(oldNode);
- ASSERT(oldNode->document() == m_ownerDocument);
- ASSERT(oldNode->parentNode());
- ASSERT(oldNode->isTextNode());
- ASSERT(oldNode->nextSibling());
- ASSERT(oldNode->nextSibling()->isTextNode());
+ ASSERT(oldNode.document() == m_ownerDocument);
+ ASSERT(oldNode.parentNode());
+ ASSERT(oldNode.isTextNode());
+ ASSERT(oldNode.nextSibling());
+ ASSERT(oldNode.nextSibling()->isTextNode());
boundaryTextNodeSplit(m_start, oldNode);
boundaryTextNodeSplit(m_end, oldNode);
}
« no previous file with comments | « Source/core/dom/Range.h ('k') | Source/core/dom/Text.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698