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

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

Issue 1041463003: Remove methods of TextIterator that take Range objects (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add assertions Created 5 years, 9 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/iterators/TextIterator.h ('k') | Source/core/editing/iterators/TextIteratorTest.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/editing/iterators/TextIterator.cpp
diff --git a/Source/core/editing/iterators/TextIterator.cpp b/Source/core/editing/iterators/TextIterator.cpp
index c52c9bf67b205d2d4ce9e7d28b329920e89397f9..d91329286534dc2f8e6302278582912216401fcf 100644
--- a/Source/core/editing/iterators/TextIterator.cpp
+++ b/Source/core/editing/iterators/TextIterator.cpp
@@ -77,38 +77,6 @@ static Node* nextInPreOrderCrossingShadowBoundaries(Node* rangeEndContainer, int
// --------
-TextIterator::TextIterator(const Range* range, TextIteratorBehaviorFlags behavior)
- : m_startContainer(nullptr)
- , m_startOffset(0)
- , m_endContainer(nullptr)
- , m_endOffset(0)
- , m_positionNode(nullptr)
- , m_textLength(0)
- , m_needsAnotherNewline(false)
- , m_textBox(0)
- , m_remainingTextBox(0)
- , m_firstLetterText(nullptr)
- , m_lastTextNode(nullptr)
- , m_lastTextNodeEndedWithCollapsedSpace(false)
- , m_lastCharacter(0)
- , m_sortedTextBoxesPosition(0)
- , m_hasEmitted(false)
- , m_emitsCharactersBetweenAllVisiblePositions(behavior & TextIteratorEmitsCharactersBetweenAllVisiblePositions)
- , m_entersTextControls(behavior & TextIteratorEntersTextControls)
- , m_emitsOriginalText(behavior & TextIteratorEmitsOriginalText)
- , m_handledFirstLetter(false)
- , m_ignoresStyleVisibility(behavior & TextIteratorIgnoresStyleVisibility)
- , m_stopsOnFormControls(behavior & TextIteratorStopsOnFormControls)
- , m_shouldStop(false)
- , m_emitsImageAltText(behavior & TextIteratorEmitsImageAltText)
- , m_entersOpenShadowRoots(behavior & TextIteratorEntersOpenShadowRoots)
- , m_emitsObjectReplacementCharacter(behavior & TextIteratorEmitsObjectReplacementCharacter)
- , m_breaksAtReplacedElement(!(behavior & TextIteratorDoesNotBreakAtReplacedElement))
-{
- if (range)
- initialize(range->startPosition(), range->endPosition());
-}
-
TextIterator::TextIterator(const Position& start, const Position& end, TextIteratorBehaviorFlags behavior)
: m_startContainer(nullptr)
, m_startOffset(0)
@@ -137,6 +105,8 @@ TextIterator::TextIterator(const Position& start, const Position& end, TextItera
, m_emitsObjectReplacementCharacter(behavior & TextIteratorEmitsObjectReplacementCharacter)
, m_breaksAtReplacedElement(!(behavior & TextIteratorDoesNotBreakAtReplacedElement))
{
+ ASSERT(start.isNotNull());
+ ASSERT(end.isNotNull());
initialize(start, end);
}
@@ -1110,18 +1080,6 @@ Position TextIterator::endPosition() const
return createLegacyEditingPosition(endContainer(), endOffset());
}
-int TextIterator::rangeLength(const Range* r, bool forSelectionPreservation)
-{
- int length = 0;
- TextIteratorBehaviorFlags behaviorFlags = TextIteratorEmitsObjectReplacementCharacter;
- if (forSelectionPreservation)
- behaviorFlags |= TextIteratorEmitsCharactersBetweenAllVisiblePositions;
- for (TextIterator it(r, behaviorFlags); !it.atEnd(); it.advance())
- length += it.length();
-
- return length;
-}
-
int TextIterator::rangeLength(const Position& start, const Position& end, bool forSelectionPreservation)
{
int length = 0;
@@ -1173,7 +1131,7 @@ static String createPlainText(TextIterator& it)
String plainText(const Range* r, TextIteratorBehaviorFlags behavior)
{
- TextIterator it(r, behavior);
+ TextIterator it(r->startPosition(), r->endPosition(), behavior);
return createPlainText(it);
}
« no previous file with comments | « Source/core/editing/iterators/TextIterator.h ('k') | Source/core/editing/iterators/TextIteratorTest.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698