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

Unified Diff: third_party/WebKit/Source/core/editing/iterators/TextIterator.h

Issue 1647483003: Introduce TextBuffer as Output Type of copyTextTo() for Text Iterators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 11 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: third_party/WebKit/Source/core/editing/iterators/TextIterator.h
diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIterator.h b/third_party/WebKit/Source/core/editing/iterators/TextIterator.h
index 8bd09c39469c403d60846e96eb837ca11d69174c..b0401dcbabcb932fdde2187ec784e8f74a638a96 100644
--- a/third_party/WebKit/Source/core/editing/iterators/TextIterator.h
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIterator.h
@@ -82,16 +82,9 @@ public:
// Calculate the minimum |actualLength >= minLength| such that code units
// with offset range [position, position + actualLength) are whole code
// points. Append these code points to |output| and return |actualLength|.
- template<typename BufferType>
- int copyTextTo(BufferType& output, int position, int minLength) const
- {
- int copiedLength = isBetweenSurrogatePair(position + minLength) ? minLength + 1 : minLength;
- copyCodeUnitsTo(output, position, copiedLength);
- return copiedLength;
- }
-
- template<typename BufferType>
- int copyTextTo(BufferType& output, int position = 0) const { return copyTextTo(output, position, length() - position); }
+ int copyTextTo(ForwardsTextBuffer& output, int position, int minLength) const;
+ // TODO(xiaochengh): Avoid default parameters.
+ int copyTextTo(ForwardsTextBuffer& output, int position = 0) const;
// Computes the length of the given range using a text iterator. The default
// iteration behavior is to always emit object replacement characters for
@@ -159,8 +152,7 @@ private:
// Append code units with offset range [position, position + copyLength)
// to the output buffer.
- template<typename BufferType>
- void copyCodeUnitsTo(BufferType& output, int position, int copyLength) const { m_textState.appendTextTo(output, position, copyLength); }
+ void copyCodeUnitsTo(ForwardsTextBuffer& output, int position, int copyLength) const;
// Current position, not necessarily of the text being returned, but position
// as we walk through the DOM tree.

Powered by Google App Engine
This is Rietveld 408576698