Commit 098d00ad authored by ktf.kim@samsung.com's avatar ktf.kim@samsung.com

Improve the find word boundary performance

In endWordBoundary case, finding start boundary in findWordBoundary is unnecessary.
So, skip it to improve the find word boundary performance.

Merge from WebKit
https://bugs.webkit.org/show_bug.cgi?id=125619

BUG= 371249

Review URL: https://codereview.chromium.org/268363016

git-svn-id: svn://svn.chromium.org/blink/trunk@178621 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 1463ca03
...@@ -653,9 +653,7 @@ static unsigned endWordBoundary(const UChar* characters, unsigned length, unsign ...@@ -653,9 +653,7 @@ static unsigned endWordBoundary(const UChar* characters, unsigned length, unsign
return length; return length;
} }
needMoreContext = false; needMoreContext = false;
int start, end; return findWordEndBoundary(characters, length, offset);
findWordBoundary(characters, length, offset, &start, &end);
return end;
} }
VisiblePosition endOfWord(const VisiblePosition &c, EWordSide side) VisiblePosition endOfWord(const VisiblePosition &c, EWordSide side)
......
...@@ -99,5 +99,11 @@ void findWordBoundary(const UChar* chars, int len, int position, int* start, int ...@@ -99,5 +99,11 @@ void findWordBoundary(const UChar* chars, int len, int position, int* start, int
*start = it->previous(); *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 } // namespace blink
...@@ -40,6 +40,7 @@ PLATFORM_EXPORT int endOfFirstWordBoundaryContext(const UChar* characters, int l ...@@ -40,6 +40,7 @@ PLATFORM_EXPORT int endOfFirstWordBoundaryContext(const UChar* characters, int l
PLATFORM_EXPORT int startOfLastWordBoundaryContext(const UChar* characters, int length); PLATFORM_EXPORT int startOfLastWordBoundaryContext(const UChar* characters, int length);
PLATFORM_EXPORT void findWordBoundary(const UChar*, int len, int position, int* start, int* end); PLATFORM_EXPORT void findWordBoundary(const UChar*, int len, int position, int* start, int* end);
PLATFORM_EXPORT int findWordEndBoundary(const UChar*, int len, int position);
PLATFORM_EXPORT int findNextWordFromIndex(const UChar*, int len, int position, bool forward); PLATFORM_EXPORT int findNextWordFromIndex(const UChar*, int len, int position, bool forward);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment