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

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

Issue 1651263003: Detemplatize TextIterator::copyTextTo with ForwardsTextBuffer (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@text_buffers
Patch Set: Change ref parameters to ptrs 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.cpp
diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
index 0bd2c59c69a47d009ac9805730df94b9cc459c25..38481de5481ccac1eddc67332c9dacc7b5af21eb 100644
--- a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
@@ -1112,6 +1112,26 @@ bool TextIteratorAlgorithm<Strategy>::isBetweenSurrogatePair(int position) const
return position > 0 && position < length() && U16_IS_LEAD(characterAt(position - 1)) && U16_IS_TRAIL(characterAt(position));
}
+template <typename Strategy>
+int TextIteratorAlgorithm<Strategy>::copyTextTo(ForwardsTextBuffer* output, int position, int minLength) const
+{
+ int copiedLength = isBetweenSurrogatePair(position + minLength) ? minLength + 1 : minLength;
+ copyCodeUnitsTo(output, position, copiedLength);
+ return copiedLength;
+}
+
+template <typename Strategy>
+int TextIteratorAlgorithm<Strategy>::copyTextTo(ForwardsTextBuffer* output, int position) const
+{
+ return copyTextTo(output, position, length() - position);
+}
+
+template <typename Strategy>
+void TextIteratorAlgorithm<Strategy>::copyCodeUnitsTo(ForwardsTextBuffer* output, int position, int copyLength) const
+{
+ m_textState.appendTextTo(output, position, copyLength);
+}
+
// --------
template <typename Strategy>

Powered by Google App Engine
This is Rietveld 408576698