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

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

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/TextIteratorTextState.h
diff --git a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.h b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.h
index 3c9a5025520e17a060a2ecbe1ef838eef7d8c2a6..7ad675ad6e3ca8e91c82b79996d67d38c7b2e155 100644
--- a/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.h
+++ b/third_party/WebKit/Source/core/editing/iterators/TextIteratorTextState.h
@@ -28,6 +28,7 @@
#include "core/CoreExport.h"
#include "core/dom/Range.h"
+#include "core/editing/iterators/TextBuffer.h"
#include "core/layout/LayoutText.h"
#include "wtf/text/WTFString.h"
@@ -62,25 +63,7 @@ public:
m_textLength = 0;
}
- template<typename BufferType>
- void appendTextTo(BufferType& output, unsigned position, unsigned lengthToAppend) const
- {
- ASSERT_WITH_SECURITY_IMPLICATION(position + lengthToAppend <= static_cast<unsigned>(length()));
- // Make sure there's no integer overflow.
- ASSERT_WITH_SECURITY_IMPLICATION(position + lengthToAppend >= position);
- if (!lengthToAppend)
- return;
- if (m_singleCharacterBuffer) {
- ASSERT(!position);
- ASSERT(length() == 1);
- output.append(&m_singleCharacterBuffer, 1);
- } else if (positionNode()) {
- flushPositionOffsets();
- string().appendTo(output, positionStartOffset() + position, lengthToAppend);
- } else {
- ASSERT_NOT_REACHED(); // "We shouldn't be attempting to append text that doesn't exist.";
- }
- }
+ void appendTextTo(ForwardsTextBuffer& output, unsigned position, unsigned lengthToAppend) const;
private:
int m_textLength;

Powered by Google App Engine
This is Rietveld 408576698