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

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

Issue 23467007: Have Range constructor take a Document reference in argument (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 7 years, 3 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
Index: Source/core/editing/TextIterator.cpp
diff --git a/Source/core/editing/TextIterator.cpp b/Source/core/editing/TextIterator.cpp
index 86b9e5e5e85ca30403561e3190d8ee83769cce3d..8559b107d4861b970c9c8f88a06ddf0b5ebdcb41 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());
}
@@ -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());
@@ -2371,8 +2371,8 @@ String plainText(const Range* r, TextIteratorBehavior defaultBehavior, bool isDi
String result = builder.toString();
- if (isDisplayString && r->ownerDocument())
- r->ownerDocument()->displayStringModifiedByEncoding(result);
+ if (isDisplayString)
+ r->ownerDocument().displayStringModifiedByEncoding(result);
return result;
}
@@ -2393,7 +2393,7 @@ static size_t findPlainText(CharacterIterator& it, const String& target, FindOpt
if (buffer.needsMoreContext()) {
RefPtr<Range> startRange = it.range();
- RefPtr<Range> beforeStartRange = startRange->ownerDocument()->createRange();
+ RefPtr<Range> beforeStartRange = startRange->ownerDocument().createRange();
beforeStartRange->setEnd(startRange->startContainer(), startRange->startOffset(), IGNORE_EXCEPTION);
for (SimplifiedBackwardsTextIterator backwardsIterator(beforeStartRange.get()); !backwardsIterator.atEnd(); backwardsIterator.advance()) {
Vector<UChar, 1024> characters;
@@ -2433,7 +2433,7 @@ tryAgain:
PassRefPtr<Range> findPlainText(const Range* range, const String& target, FindOptions options)
{
// CharacterIterator requires renderers to be up-to-date
- range->ownerDocument()->updateLayout();
+ range->ownerDocument().updateLayout();
// First, find the text.
size_t matchStart;

Powered by Google App Engine
This is Rietveld 408576698