TextBreakIterator's should support Latin-1 for all iterator types (Part 3)
authorweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Jan 2014 06:22:46 +0000 (06:22 +0000)
committerweinig@apple.com <weinig@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 17 Jan 2014 06:22:46 +0000 (06:22 +0000)
https://bugs.webkit.org/show_bug.cgi?id=126856

Reviewed by Ryosuke Niwa.

Change all the TextBreakIterator creation functions to take StringViews. Remove a few
now unnecessary up-conversions to UTF-16 in the process.

../WebCore:

* dom/CharacterData.cpp:
* editing/TextCheckingHelper.cpp:
* editing/VisibleUnits.cpp:
* platform/graphics/StringTruncator.cpp:
* platform/graphics/mac/ComplexTextController.cpp:
* platform/text/TextBoundaries.cpp:
* platform/text/TextBreakIterator.cpp:
* platform/text/TextBreakIterator.h:
* rendering/RenderText.cpp:

../WebKit/ios:

* Misc/WebNSStringDrawing.mm:

../WebKit2:

* UIProcess/efl/TextCheckerEfl.cpp:
(WebKit::nextWordOffset):
(WebKit::TextChecker::checkTextOfParagraph):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@162184 268f45cc-cd09-0410-ab3c-d52691b4dbfc

15 files changed:
Source/WebCore/ChangeLog
Source/WebCore/dom/CharacterData.cpp
Source/WebCore/editing/TextCheckingHelper.cpp
Source/WebCore/editing/VisibleUnits.cpp
Source/WebCore/platform/graphics/StringTruncator.cpp
Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
Source/WebCore/platform/text/TextBoundaries.cpp
Source/WebCore/platform/text/TextBreakIterator.cpp
Source/WebCore/platform/text/TextBreakIterator.h
Source/WebCore/platform/text/enchant/TextCheckerEnchant.cpp
Source/WebCore/rendering/RenderText.cpp
Source/WebKit/ios/ChangeLog
Source/WebKit/ios/Misc/WebNSStringDrawing.mm
Source/WebKit2/ChangeLog
Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp

index 046bb96..2c86d57 100644 (file)
@@ -1,3 +1,23 @@
+2014-01-15  Sam Weinig  <sam@webkit.org>
+
+        TextBreakIterator's should support Latin-1 for all iterator types (Part 3)
+        https://bugs.webkit.org/show_bug.cgi?id=126856
+
+        Reviewed by Ryosuke Niwa.
+
+        Change all the TextBreakIterator creation functions to take StringViews. Remove a few
+        now unnecessary up-conversions to UTF-16 in the process.
+
+        * dom/CharacterData.cpp:
+        * editing/TextCheckingHelper.cpp:
+        * editing/VisibleUnits.cpp:
+        * platform/graphics/StringTruncator.cpp:
+        * platform/graphics/mac/ComplexTextController.cpp:
+        * platform/text/TextBoundaries.cpp:
+        * platform/text/TextBreakIterator.cpp:
+        * platform/text/TextBreakIterator.h:
+        * rendering/RenderText.cpp:
+
 2014-01-16  Anders Carlsson  <andersca@apple.com>
 
         Run clang-modernize and let it add a bunch of missing overrides.
index e58b383..7ac273f 100644 (file)
@@ -74,7 +74,7 @@ unsigned CharacterData::parserAppendData(const String& string, unsigned offset,
     // see <https://bugs.webkit.org/show_bug.cgi?id=29092>.
     // We need at least two characters look-ahead to account for UTF-16 surrogates.
     if (characterLengthLimit < characterLength) {
-        NonSharedCharacterBreakIterator it(string.deprecatedCharacters() + offset, (characterLengthLimit + 2 > characterLength) ? characterLength : characterLengthLimit + 2);
+        NonSharedCharacterBreakIterator it(StringView(string).substring(offset, (characterLengthLimit + 2 > characterLength) ? characterLength : characterLengthLimit + 2));
         if (!isTextBreak(it, characterLengthLimit))
             characterLengthLimit = textBreakPreceding(it, characterLengthLimit);
     }
index 132c93b..0e89cfc 100644 (file)
@@ -70,9 +70,9 @@ static void findBadGrammars(TextCheckerClient* client, const UChar* text, int st
 }
 #endif
 
-static void findMisspellings(TextCheckerClient* client, const UChar* text, int start, int length, Vector<TextCheckingResult>& results)
+static void findMisspellings(TextCheckerClient* client, const UChar* text, int length, Vector<TextCheckingResult>& results)
 {
-    TextBreakIterator* iterator = wordBreakIterator(text + start, length);
+    TextBreakIterator* iterator = wordBreakIterator(StringView(text, length));
     if (!iterator)
         return;
     int wordStart = textBreakCurrent(iterator);
@@ -83,13 +83,13 @@ static void findMisspellings(TextCheckerClient* client, const UChar* text, int s
         int wordLength = wordEnd - wordStart;
         int misspellingLocation = -1;
         int misspellingLength = 0;
-        client->checkSpellingOfString(text + start + wordStart, wordLength, &misspellingLocation, &misspellingLength);
+        client->checkSpellingOfString(text + wordStart, wordLength, &misspellingLocation, &misspellingLength);
         if (0 < misspellingLength) {
             ASSERT(0 <= misspellingLocation && misspellingLocation <= wordLength);
             ASSERT(0 < misspellingLength && misspellingLocation + misspellingLength <= wordLength);
             TextCheckingResult misspelling;
             misspelling.type = TextCheckingTypeSpelling;
-            misspelling.location = start + wordStart + misspellingLocation;
+            misspelling.location = wordStart + misspellingLocation;
             misspelling.length = misspellingLength;
             misspelling.replacement = client->getAutoCorrectSuggestionForMisspelledWord(String(text + misspelling.location, misspelling.length));
             results.append(misspelling);
@@ -648,7 +648,7 @@ void checkTextOfParagraph(TextCheckerClient* client, const UChar* text, int leng
 #else
     Vector<TextCheckingResult> spellingResult;
     if (checkingTypes & TextCheckingTypeSpelling)
-        findMisspellings(client, text, 0, length, spellingResult);
+        findMisspellings(client, text, length, spellingResult);
 
 #if USE(GRAMMAR_CHECKING)
     Vector<TextCheckingResult> grammarResult;
index a048901..dd05d3e 100644 (file)
@@ -301,8 +301,8 @@ static TextBreakIterator* wordBreakIteratorForMinOffsetBoundary(const VisiblePos
     string.append(textBox->renderer().text()->deprecatedCharacters() + textBox->start(), textBox->len());
     len += textBox->len();
 
-    return wordBreakIterator(string.data(), len);
-} 
+    return wordBreakIterator(StringView(string.data(), len));
+}
 
 static TextBreakIterator* wordBreakIteratorForMaxOffsetBoundary(const VisiblePosition& visiblePosition, const InlineTextBox* textBox,
     bool& nextBoxInDifferentBlock, Vector<UChar, 1024>& string, CachedLogicallyOrderedLeafBoxes& leafBoxes)
@@ -322,8 +322,8 @@ static TextBreakIterator* wordBreakIteratorForMaxOffsetBoundary(const VisiblePos
         len += nextTextBox->len();
     }
 
-    return wordBreakIterator(string.data(), len);
-} 
+    return wordBreakIterator(StringView(string.data(), len));
+}
 
 static bool isLogicalStartOfWord(TextBreakIterator* iter, int position, bool hardLineBreak)
 {
@@ -385,7 +385,7 @@ static VisiblePosition visualWordPosition(const VisiblePosition& visiblePosition
         else if (offsetInBox == box->caretMaxOffset())
             iter = wordBreakIteratorForMaxOffsetBoundary(visiblePosition, textBox, nextBoxInDifferentBlock, string, leafBoxes);
         else if (movingIntoNewBox) {
-            iter = wordBreakIterator(textBox->renderer().text()->deprecatedCharacters() + textBox->start(), textBox->len());
+            iter = wordBreakIterator(StringView(textBox->renderer().text()).substring(textBox->start(), textBox->len()));
             previouslyVisitedBox = box;
         }
 
@@ -1046,7 +1046,7 @@ VisiblePosition nextLinePosition(const VisiblePosition &visiblePosition, int lin
 
 static unsigned startSentenceBoundary(const UChar* characters, unsigned length, unsigned, BoundarySearchContextAvailability, bool&)
 {
-    TextBreakIterator* iterator = sentenceBreakIterator(characters, length);
+    TextBreakIterator* iterator = sentenceBreakIterator(StringView(characters, length));
     // FIXME: The following function can return -1; we don't handle that.
     return textBreakPreceding(iterator, length);
 }
@@ -1058,7 +1058,7 @@ VisiblePosition startOfSentence(const VisiblePosition &c)
 
 static unsigned endSentenceBoundary(const UChar* characters, unsigned length, unsigned, BoundarySearchContextAvailability, bool&)
 {
-    TextBreakIterator* iterator = sentenceBreakIterator(characters, length);
+    TextBreakIterator* iterator = sentenceBreakIterator(StringView(characters, length));
     return textBreakNext(iterator);
 }
 
@@ -1071,7 +1071,7 @@ VisiblePosition endOfSentence(const VisiblePosition &c)
 static unsigned previousSentencePositionBoundary(const UChar* characters, unsigned length, unsigned, BoundarySearchContextAvailability, bool&)
 {
     // FIXME: This is identical to startSentenceBoundary. I'm pretty sure that's not right.
-    TextBreakIterator* iterator = sentenceBreakIterator(characters, length);
+    TextBreakIterator* iterator = sentenceBreakIterator(StringView(characters, length));
     // FIXME: The following function can return -1; we don't handle that.
     return textBreakPreceding(iterator, length);
 }
@@ -1086,7 +1086,7 @@ static unsigned nextSentencePositionBoundary(const UChar* characters, unsigned l
 {
     // FIXME: This is identical to endSentenceBoundary. This isn't right, it needs to 
     // move to the equivlant position in the following sentence.
-    TextBreakIterator* iterator = sentenceBreakIterator(characters, length);
+    TextBreakIterator* iterator = sentenceBreakIterator(StringView(characters, length));
     return textBreakFollowing(iterator, 0);
 }
 
index 45b8dbd..72f80c0 100644 (file)
@@ -63,7 +63,7 @@ static unsigned centerTruncateToBuffer(const String& string, unsigned length, un
     ASSERT_WITH_SECURITY_IMPLICATION(keepCount < STRING_BUFFER_SIZE);
     
     unsigned omitStart = (keepCount + 1) / 2;
-    NonSharedCharacterBreakIterator it(string.deprecatedCharacters(), length);
+    NonSharedCharacterBreakIterator it(StringView(string).substring(0, length));
     unsigned omitEnd = boundedTextBreakFollowing(it, omitStart + (length - keepCount) - 1, length);
     omitStart = textBreakAtOrPreceding(it, omitStart);
 
@@ -115,7 +115,7 @@ static unsigned rightTruncateToBuffer(const String& string, unsigned length, uns
         --keepCount;
 #endif
 
-    NonSharedCharacterBreakIterator it(string.deprecatedCharacters(), length);
+    NonSharedCharacterBreakIterator it(StringView(string).substring(0, length));
     unsigned keepLength = textBreakAtOrPreceding(it, keepCount);
     unsigned truncatedLength = shouldInsertEllipsis ? keepLength + 1 : keepLength;
 
@@ -131,7 +131,7 @@ static unsigned rightClipToCharacterBuffer(const String& string, unsigned length
     ASSERT(keepCount < length);
     ASSERT(keepCount < STRING_BUFFER_SIZE);
 
-    NonSharedCharacterBreakIterator it(string.deprecatedCharacters(), length);
+    NonSharedCharacterBreakIterator it(StringView(string).substring(0, length));
     unsigned keepLength = textBreakAtOrPreceding(it, keepCount);
     memcpy(buffer, string.deprecatedCharacters(), sizeof(UChar) * keepLength);
 
@@ -143,7 +143,7 @@ static unsigned rightClipToWordBuffer(const String& string, unsigned length, uns
     ASSERT(keepCount < length);
     ASSERT(keepCount < STRING_BUFFER_SIZE);
 
-    TextBreakIterator* it = wordBreakIterator(string.deprecatedCharacters(), length);
+    TextBreakIterator* it = wordBreakIterator(StringView(string).substring(0, length));
     unsigned keepLength = textBreakAtOrPreceding(it, keepCount);
     memcpy(buffer, string.deprecatedCharacters(), sizeof(UChar) * keepLength);
 
@@ -163,7 +163,7 @@ static unsigned leftTruncateToBuffer(const String& string, unsigned length, unsi
 
     unsigned startIndex = length - keepCount;
 
-    NonSharedCharacterBreakIterator it(string.deprecatedCharacters(), length);
+    NonSharedCharacterBreakIterator it(string);
     unsigned adjustedStartIndex = startIndex;
     startIndex = boundedTextBreakFollowing(it, startIndex, length - startIndex);
 
index 603919f..c1ecd8d 100644 (file)
@@ -209,7 +209,7 @@ int ComplexTextController::offsetForPosition(float h, bool includePartialGlyphs)
                 // ligature carets.
                 CFIndex hitIndex = hitGlyphStart + (hitGlyphEnd - hitGlyphStart) * (m_run.ltr() ? x / adjustedAdvance : 1 - x / adjustedAdvance);
                 int stringLength = complexTextRun.stringLength();
-                TextBreakIterator* cursorPositionIterator = cursorMovementIterator(complexTextRun.characters(), stringLength);
+                TextBreakIterator* cursorPositionIterator = cursorMovementIterator(StringView(complexTextRun.characters(), stringLength));
                 int clusterStart;
                 if (isTextBreak(cursorPositionIterator, hitIndex))
                     clusterStart = hitIndex;
index b2eec1c..f5676e2 100644 (file)
@@ -61,7 +61,7 @@ int startOfLastWordBoundaryContext(const UChar* characters, int length)
 
 int findNextWordFromIndex(const UChar* chars, int len, int position, bool forward)
 {
-    TextBreakIterator* it = wordBreakIterator(chars, len);
+    TextBreakIterator* it = wordBreakIterator(StringView(chars, len));
 
     if (forward) {
         position = textBreakFollowing(it, position);
@@ -90,7 +90,7 @@ int findNextWordFromIndex(const UChar* chars, int len, int position, bool forwar
 
 void findWordBoundary(const UChar* chars, int len, int position, int* start, int* end)
 {
-    TextBreakIterator* it = wordBreakIterator(chars, len);
+    TextBreakIterator* it = wordBreakIterator(StringView(chars, len));
     *end = textBreakFollowing(it, position);
     if (*end < 0)
         *end = textBreakLast(it);
@@ -99,7 +99,7 @@ void findWordBoundary(const UChar* chars, int len, int position, int* start, int
 
 void findEndWordBoundary(const UChar* chars, int len, int position, int* end)
 {
-    TextBreakIterator* it = wordBreakIterator(chars, len);
+    TextBreakIterator* it = wordBreakIterator(StringView(chars, len));
     *end = textBreakFollowing(it, position);
     if (*end < 0)
         *end = textBreakLast(it);
index 5399c37..b0ef917 100644 (file)
@@ -138,25 +138,25 @@ static TextBreakIterator* setContextAwareTextForIterator(TextBreakIterator& iter
 
 // Static iterators
 
-TextBreakIterator* wordBreakIterator(const UChar* buffer, int length)
+TextBreakIterator* wordBreakIterator(StringView string)
 {
     static TextBreakIterator* staticWordBreakIterator = initializeIterator(UBRK_WORD);
     if (!staticWordBreakIterator)
         return nullptr;
 
-    return setTextForIterator(*staticWordBreakIterator, StringView(buffer, length));
+    return setTextForIterator(*staticWordBreakIterator, string);
 }
 
-TextBreakIterator* sentenceBreakIterator(const UChar* buffer, int length)
+TextBreakIterator* sentenceBreakIterator(StringView string)
 {
     static TextBreakIterator* staticSentenceBreakIterator = initializeIterator(UBRK_SENTENCE);
     if (!staticSentenceBreakIterator)
         return nullptr;
 
-    return setTextForIterator(*staticSentenceBreakIterator, StringView(buffer, length));
+    return setTextForIterator(*staticSentenceBreakIterator, string);
 }
 
-TextBreakIterator* cursorMovementIterator(const UChar* buffer, int length)
+TextBreakIterator* cursorMovementIterator(StringView string)
 {
 #if !PLATFORM(IOS)
     // This rule set is based on character-break iterator rules of ICU 4.0
@@ -250,7 +250,7 @@ TextBreakIterator* cursorMovementIterator(const UChar* buffer, int length)
     if (!staticCursorMovementIterator)
         return nullptr;
 
-    return setTextForIterator(*staticCursorMovementIterator, StringView(buffer, length));
+    return setTextForIterator(*staticCursorMovementIterator, string);
 }
 
 TextBreakIterator* acquireLineBreakIterator(StringView string, const AtomicString& locale, const UChar* priorContext, unsigned priorContextLength)
@@ -285,7 +285,7 @@ static inline bool compareAndSwapNonSharedCharacterBreakIterator(TextBreakIterat
 #endif
 }
 
-NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator(const UChar* buffer, int length)
+NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator(StringView string)
 {
     m_iterator = nonSharedCharacterBreakIterator;
 
@@ -295,7 +295,7 @@ NonSharedCharacterBreakIterator::NonSharedCharacterBreakIterator(const UChar* bu
     if (!m_iterator)
         return;
 
-    m_iterator = setTextForIterator(*m_iterator, StringView(buffer, length));
+    m_iterator = setTextForIterator(*m_iterator, string);
 }
 
 NonSharedCharacterBreakIterator::~NonSharedCharacterBreakIterator()
@@ -364,7 +364,7 @@ unsigned numGraphemeClusters(const String& s)
     if (s.is8Bit() && !s.contains('\r'))
         return stringLength;
 
-    NonSharedCharacterBreakIterator it(s.deprecatedCharacters(), stringLength);
+    NonSharedCharacterBreakIterator it(s);
     if (!it)
         return stringLength;
 
@@ -385,7 +385,7 @@ unsigned numCharactersInGraphemeClusters(const String& s, unsigned numGraphemeCl
     if (s.is8Bit() && !s.contains('\r'))
         return std::min(stringLength, numGraphemeClusters);
 
-    NonSharedCharacterBreakIterator it(s.deprecatedCharacters(), stringLength);
+    NonSharedCharacterBreakIterator it(s);
     if (!it)
         return std::min(stringLength, numGraphemeClusters);
 
index 1ae6719..eaf00ec 100644 (file)
@@ -36,10 +36,10 @@ class TextBreakIterator;
 // platform UI conventions. One notable example where this can be different
 // from character break iterator is Thai prepend characters, see bug 24342.
 // Use this for insertion point and selection manipulations.
-TextBreakIterator* cursorMovementIterator(const UChar*, int length);
+TextBreakIterator* cursorMovementIterator(StringView);
 
-TextBreakIterator* wordBreakIterator(const UChar*, int length);
-TextBreakIterator* sentenceBreakIterator(const UChar*, int length);
+TextBreakIterator* wordBreakIterator(StringView);
+TextBreakIterator* sentenceBreakIterator(StringView);
 
 TextBreakIterator* acquireLineBreakIterator(StringView, const AtomicString& locale, const UChar* priorContext, unsigned priorContextLength);
 void releaseLineBreakIterator(TextBreakIterator*);
@@ -169,7 +169,7 @@ private:
 class NonSharedCharacterBreakIterator {
     WTF_MAKE_NONCOPYABLE(NonSharedCharacterBreakIterator);
 public:
-    NonSharedCharacterBreakIterator(const UChar*, int length);
+    NonSharedCharacterBreakIterator(StringView);
     ~NonSharedCharacterBreakIterator();
 
     operator TextBreakIterator*() const { return m_iterator; }
index 98c5f2b..d2d2c6f 100644 (file)
@@ -91,7 +91,7 @@ void TextCheckerEnchant::checkSpellingOfString(const String& string, int& misspe
     if (!hasDictionary())
         return;
 
-    TextBreakIterator* iter = wordBreakIterator(string.characters(), string.length());
+    TextBreakIterator* iter = wordBreakIterator(string);
     if (!iter)
         return;
 
index 3899c0d..e276a27 100644 (file)
@@ -134,7 +134,7 @@ static void makeCapitalized(String* string, UChar previous)
             stringWithPrevious[i] = stringImpl[i - 1];
     }
 
-    TextBreakIterator* boundary = wordBreakIterator(stringWithPrevious.characters(), length + 1);
+    TextBreakIterator* boundary = wordBreakIterator(StringView(stringWithPrevious.characters(), length + 1));
     if (!boundary)
         return;
 
@@ -1340,7 +1340,7 @@ int RenderText::previousOffset(int current) const
         return current - 1;
 
     StringImpl* textImpl = m_text.impl();
-    TextBreakIterator* iterator = cursorMovementIterator(textImpl->characters16(), textImpl->length());
+    TextBreakIterator* iterator = cursorMovementIterator(StringView(textImpl->characters16(), textImpl->length()));
     if (!iterator)
         return current - 1;
 
@@ -1493,7 +1493,7 @@ int RenderText::nextOffset(int current) const
         return current + 1;
 
     StringImpl* textImpl = m_text.impl();
-    TextBreakIterator* iterator = cursorMovementIterator(textImpl->characters16(), textImpl->length());
+    TextBreakIterator* iterator = cursorMovementIterator(StringView(textImpl->characters16(), textImpl->length()));
     if (!iterator)
         return current + 1;
 
index 6c15363..ecec821 100644 (file)
@@ -1,3 +1,15 @@
+2014-01-15  Sam Weinig  <sam@webkit.org>
+
+        TextBreakIterator's should support Latin-1 for all iterator types (Part 3)
+        https://bugs.webkit.org/show_bug.cgi?id=126856
+
+        Reviewed by Ryosuke Niwa.
+
+        Change all the TextBreakIterator creation functions to take StringViews. Remove a few
+        now unnecessary up-conversions to UTF-16 in the process.
+
+        * Misc/WebNSStringDrawing.mm:
+
 2014-01-16  Anders Carlsson  <andersca@apple.com>
 
         Change all uses of FINAL to final now that all our compilers support it
index 5db0d4d..a8725e0 100644 (file)
@@ -456,7 +456,7 @@ static bool needsBidiLayout(const UChar *characters, unsigned length, UCharDirec
                         if (ellipsisStyle == WebEllipsisStyleCharacterWrap) {
                             // We can break on characters. We should do something smarter, like split the length of the entire line 
                             // Don't, however, break in the middle of a character.
-                            NonSharedCharacterBreakIterator it(pos, lengthRemaining);
+                            NonSharedCharacterBreakIterator it(StringView(pos, lengthRemaining));
                             breakPos = boundedTextBreakFollowing(it, 0, lengthRemaining);
                         }                        
                         break;
@@ -537,7 +537,7 @@ static bool needsBidiLayout(const UChar *characters, unsigned length, UCharDirec
                     // This must be a long word that doesn't fit inside the entire width
                     // Fit it on a line one character at a time and break when no more characters fit
                     // Force at least one character to avoid the edge case where a single glyph doesn't fit within width
-                    NonSharedCharacterBreakIterator it(pos, lengthRemaining);
+                    NonSharedCharacterBreakIterator it(StringView(pos, lengthRemaining));
                     int offset = 0;
                     int nextCharBreak = boundedTextBreakFollowing(it, offset, lengthRemaining);
                     TextRun textRun(pos, nextCharBreak);
index 3eb977a..0d2c219 100644 (file)
@@ -1,3 +1,17 @@
+2014-01-15  Sam Weinig  <sam@webkit.org>
+
+        TextBreakIterator's should support Latin-1 for all iterator types (Part 3)
+        https://bugs.webkit.org/show_bug.cgi?id=126856
+
+        Reviewed by Ryosuke Niwa.
+
+        Change all the TextBreakIterator creation functions to take StringViews. Remove a few
+        now unnecessary up-conversions to UTF-16 in the process.
+
+        * UIProcess/efl/TextCheckerEfl.cpp:
+        (WebKit::nextWordOffset):
+        (WebKit::TextChecker::checkTextOfParagraph):
+
 2014-01-16  Eunmi Lee  <eunmi15.lee@samsung.com>
 
         [EFL][WK2] EwkView can not be shown without re-sizing once it is hidden.
index 86a7d6c..7dcc05d 100644 (file)
@@ -127,7 +127,7 @@ static int nextWordOffset(const UChar* text, int length, int currentOffset)
     //        or after "offset" (ubrk_isBoundary side effect).
     //        For many word separators, the method doesn't properly determine the boundaries
     //        without resetting the iterator.
-    TextBreakIterator* textIterator = wordBreakIterator(text, length);
+    TextBreakIterator* textIterator = wordBreakIterator(StringView(text, length));
     if (!textIterator)
         return currentOffset;
 
@@ -153,7 +153,7 @@ Vector<TextCheckingResult> TextChecker::checkTextOfParagraph(int64_t spellDocume
     Vector<TextCheckingResult> paragraphCheckingResult;
 #if ENABLE(SPELLCHECK)
     if (checkingTypes & TextCheckingTypeSpelling) {
-        TextBreakIterator* textIterator = wordBreakIterator(text, length);
+        TextBreakIterator* textIterator = wordBreakIterator(StringView(text, length));
         if (!textIterator)
             return paragraphCheckingResult;