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

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

Issue 1604783002: ALL-IN-ONE: Optimization to previousBoundary() and nextBoundary() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@progressive_accumulator
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.cpp
diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp b/third_party/WebKit/Source/core/editing/iterators/TextIterator.cpp
index 3688dde7c1d952dfdd182ba5a18e16b7d2875745..31669e0b23177843578ea9f96dbae812a9b12075 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