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

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

Issue 23819007: Have Node::document() return a reference instead of a pointer (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Rebase on master Created 7 years, 4 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/editing/TextCheckingHelper.cpp ('k') | Source/core/editing/VisiblePosition.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/TextIterator.cpp
diff --git a/Source/core/editing/TextIterator.cpp b/Source/core/editing/TextIterator.cpp
index 837b488670ebce8b7061b4f406b5cb051976ec02..86b9e5e5e85ca30403561e3190d8ee83769cce3d 100644
--- a/Source/core/editing/TextIterator.cpp
+++ b/Source/core/editing/TextIterator.cpp
@@ -1050,12 +1050,12 @@ PassRefPtr<Range> TextIterator::range() const
m_positionEndOffset += index;
m_positionOffsetBaseNode = 0;
}
- return Range::create(m_positionNode->document(), m_positionNode, m_positionStartOffset, m_positionNode, m_positionEndOffset);
+ return Range::create(&m_positionNode->document(), m_positionNode, m_positionStartOffset, m_positionNode, m_positionEndOffset);
}
// otherwise, return the end of the overall range we were given
if (m_endContainer)
- return Range::create(m_endContainer->document(), m_endContainer, m_endOffset, m_endContainer, m_endOffset);
+ return Range::create(&m_endContainer->document(), m_endContainer, m_endOffset, m_endContainer, m_endOffset);
return 0;
}
@@ -1351,9 +1351,9 @@ bool SimplifiedBackwardsTextIterator::advanceRespectingRange(Node* next)
PassRefPtr<Range> SimplifiedBackwardsTextIterator::range() const
{
if (m_positionNode)
- return Range::create(m_positionNode->document(), m_positionNode, m_positionStartOffset, m_positionNode, m_positionEndOffset);
+ return Range::create(&m_positionNode->document(), m_positionNode, m_positionStartOffset, m_positionNode, m_positionEndOffset);
- return Range::create(m_startNode->document(), m_startNode, m_startOffset, m_startNode, m_startOffset);
+ return Range::create(&m_startNode->document(), m_startNode, m_startOffset, m_startNode, m_startOffset);
}
// --------
@@ -1452,7 +1452,7 @@ static PassRefPtr<Range> characterSubrange(CharacterIterator& it, int offset, in
it.advance(length - 1);
RefPtr<Range> end = it.range();
- return Range::create(start->startContainer()->document(),
+ return Range::create(&start->startContainer()->document(),
start->startContainer(), start->startOffset(),
end->endContainer(), end->endOffset());
}
@@ -2233,7 +2233,7 @@ PassRefPtr<Range> TextIterator::subrange(Range* entireRange, int characterOffset
PassRefPtr<Range> TextIterator::rangeFromLocationAndLength(ContainerNode* scope, int rangeLocation, int rangeLength, bool forSelectionPreservation)
{
- RefPtr<Range> resultRange = scope->document()->createRange();
+ RefPtr<Range> resultRange = scope->document().createRange();
int docTextPosition = 0;
int rangeEnd = rangeLocation + rangeLength;
@@ -2266,7 +2266,7 @@ PassRefPtr<Range> TextIterator::rangeFromLocationAndLength(ContainerNode* scope,
// FIXME: This is a workaround for the fact that the end of a run is often at the wrong
// position for emitted '\n's.
if (len == 1 && it.characterAt(0) == '\n') {
- scope->document()->updateLayoutIgnorePendingStylesheets();
+ scope->document().updateLayoutIgnorePendingStylesheets();
it.advance();
if (!it.atEnd()) {
RefPtr<Range> range = it.range();
@@ -2337,7 +2337,7 @@ bool TextIterator::getLocationAndLengthFromRange(Node* scope, const Range* range
if (range->endContainer() != scope && !range->endContainer()->isDescendantOf(scope))
return false;
- RefPtr<Range> testRange = Range::create(scope->document(), scope, 0, range->startContainer(), range->startOffset());
+ RefPtr<Range> testRange = Range::create(&scope->document(), scope, 0, range->startContainer(), range->startOffset());
ASSERT(testRange->startContainer() == scope);
location = TextIterator::rangeLength(testRange.get());
« no previous file with comments | « Source/core/editing/TextCheckingHelper.cpp ('k') | Source/core/editing/VisiblePosition.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698