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

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

Issue 544083002: Avoid allocating temporary ranges in connection with text and character iterators. (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Created 6 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.h
diff --git a/Source/core/editing/TextIterator.h b/Source/core/editing/TextIterator.h
index 783d45ddc7c3d05f02bad4eae33d0b8b6e2dcbab..f58621b7eadc856af825fdb0983ca093220448c7 100644
--- a/Source/core/editing/TextIterator.h
+++ b/Source/core/editing/TextIterator.h
@@ -110,6 +110,12 @@ public:
PassRefPtrWillBeRawPtr<Range> range() const;
Node* node() const;
+ int startOffset() const;
+ int endOffset() const;
+ Node* startContainer() const;
+ Position startPosition() const;
+ Position endPosition() const;
+
// Computes the length of the given range using a text iterator. The default
// iteration behavior is to always emit object replacement characters for
// replaced elements. When |forSelectionPreservation| is set to true, it
@@ -129,7 +135,8 @@ private:
void initialize(const Position& start, const Position& end);
- int startOffset() const { return m_positionStartOffset; }
+ void flushPositionOffsets() const;
+ int positionStartOffset() const { return m_positionStartOffset; }
const String& string() const { return m_text; }
void exitNode();
bool shouldRepresentNodeOffsetZero();
@@ -246,6 +253,10 @@ public:
PassRefPtrWillBeRawPtr<Range> range() const;
+ Node* startContainer() const;
+ int endOffset() const;
+ Position startPosition() const;
+
private:
void exitNode();
bool handleTextNode();
@@ -324,6 +335,11 @@ public:
int characterOffset() const { return m_offset; }
PassRefPtrWillBeRawPtr<Range> range() const;
+ Node* startContainer() const;
+ int startOffset() const;
+ Position startPosition() const;
+ Position endPosition() const;
+
private:
void initialize();
@@ -345,6 +361,8 @@ public:
PassRefPtrWillBeRawPtr<Range> range() const;
+ Position endPosition() const;
+
private:
int m_offset;
int m_runOffset;
@@ -372,7 +390,6 @@ private:
Vector<UChar> m_buffer;
// Did we have to look ahead in the textIterator to confirm the current chunk?
bool m_didLookAhead;
- RefPtrWillBeMember<Range> m_range;
TextIterator m_textIterator;
};

Powered by Google App Engine
This is Rietveld 408576698