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

Unified Diff: third_party/WebKit/Source/core/editing/iterators/SearchBuffer.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/SearchBuffer.cpp
diff --git a/third_party/WebKit/Source/core/editing/iterators/SearchBuffer.cpp b/third_party/WebKit/Source/core/editing/iterators/SearchBuffer.cpp
index 11ee7e096e9eb7a9c8bc6a28c2e87b1bc1d4f6c2..fbed1318f04bebb57d8434df9e332629a995a972 100644
--- a/third_party/WebKit/Source/core/editing/iterators/SearchBuffer.cpp
+++ b/third_party/WebKit/Source/core/editing/iterators/SearchBuffer.cpp
@@ -380,7 +380,7 @@ static size_t findPlainTextInternal(CharacterIteratorAlgorithm<Strategy>& it, co
if (buffer.needsMoreContext()) {
for (SimplifiedBackwardsTextIteratorAlgorithm<Strategy> backwardsIterator(PositionTemplate<Strategy>::firstPositionInNode(it.ownerDocument()), PositionTemplate<Strategy>(it.currentContainer(), it.startOffset())); !backwardsIterator.atEnd(); backwardsIterator.advance()) {
- Vector<UChar, 1024> characters;
+ BackwardsTextBuffer characters;
backwardsIterator.copyTextTo(characters);
buffer.prependContext(characters.data(), characters.size());
if (!buffer.needsMoreContext())
@@ -389,7 +389,10 @@ static size_t findPlainTextInternal(CharacterIteratorAlgorithm<Strategy>& it, co
}
while (!it.atEnd()) {
- it.appendTextTo(buffer);
+ // TODO(xiaochengh): Should allow copying text to SearchBuffer directly
+ ForwardsTextBuffer characters;
+ it.copyTextTo(characters);
+ buffer.append(characters.data(), characters.size());
it.advance(buffer.numberOfCharactersJustAppended());
tryAgain:
size_t matchStartOffset;

Powered by Google App Engine
This is Rietveld 408576698