diff options
Diffstat (limited to 'WebCore/platform/text/TextBoundaries.cpp')
-rw-r--r-- | WebCore/platform/text/TextBoundaries.cpp | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/WebCore/platform/text/TextBoundaries.cpp b/WebCore/platform/text/TextBoundaries.cpp index 8eaffca..fbb261b 100644 --- a/WebCore/platform/text/TextBoundaries.cpp +++ b/WebCore/platform/text/TextBoundaries.cpp @@ -36,6 +36,32 @@ using namespace Unicode; namespace WebCore { +int endOfFirstWordBoundaryContext(const UChar* characters, int length) +{ + for (int i = 0; i < length; ) { + int first = i; + UChar32 ch; + U16_NEXT(characters, i, length, ch); + if (!requiresContextForWordBoundary(ch)) + return first; + } + return length; +} + +int startOfLastWordBoundaryContext(const UChar* characters, int length) +{ + for (int i = length; i > 0; ) { + int last = i; + UChar32 ch; + U16_PREV(characters, 0, i, ch); + if (!requiresContextForWordBoundary(ch)) + return last; + } + return 0; +} + +#if !PLATFORM(BREWMP) && !PLATFORM(MAC) && !PLATFORM(QT) + int findNextWordFromIndex(const UChar* chars, int len, int position, bool forward) { TextBreakIterator* it = wordBreakIterator(chars, len); @@ -76,4 +102,6 @@ void findWordBoundary(const UChar* chars, int len, int position, int* start, int *start = textBreakPrevious(it); } +#endif // !PLATFORM(BREWMP) && !PLATFORM(MAC) && !PLATFORM(QT) + } // namespace WebCore |