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

Unified Diff: Source/platform/text/TextBoundaries.cpp

Issue 268363016: Improve the find word boundary performance (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: Add findWordEndBoundary Created 6 years, 5 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
« no previous file with comments | « Source/platform/text/TextBoundaries.h ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/platform/text/TextBoundaries.cpp
diff --git a/Source/platform/text/TextBoundaries.cpp b/Source/platform/text/TextBoundaries.cpp
index ccf3c8bada303ec92e38d65c445697dff93b842d..1b295ca90614f4ceba09d16764f9f541415515b0 100644
--- a/Source/platform/text/TextBoundaries.cpp
+++ b/Source/platform/text/TextBoundaries.cpp
@@ -99,5 +99,11 @@ void findWordBoundary(const UChar* chars, int len, int position, int* start, int
*start = it->previous();
}
+int findWordEndBoundary(const UChar* chars, int len, int position)
+{
+ TextBreakIterator* it = wordBreakIterator(chars, len);
+ int end = it->following(position);
+ return end < 0 ? it->last() : end;
+}
} // namespace blink
« no previous file with comments | « Source/platform/text/TextBoundaries.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698