Changeset 209907 in webkit
- Timestamp:
- Dec 15, 2016 9:19:32 PM (7 years ago)
- Location:
- trunk/Source
- Files:
-
- 29 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WTF/ChangeLog
r209896 r209907 1 2016-12-15 Myles C. Maxfield <mmaxfield@apple.com> 2 3 Stop reinterpret_casting UBreakIterators to the undefined type TextBreakIterator 4 https://bugs.webkit.org/show_bug.cgi?id=165931 5 6 We have a class declaration for TextBreakIterator but no definition for it. When we 7 create an ICU UBreakIterator, we immediately reinterpret_cast it to this undefined 8 type, and pass it around our code inside WebCore. Then, whenever we want to actually 9 use this iterator, we reinterpret_cast it back to UBreakIterator. This is likely due 10 to some ports historically implementing breaking interators on top of other libraries 11 other than ICU; however, now, all ports use ICU. Because this internal type is not 12 helpful and just adds confusion, we should just call our breaking iterators what 13 they are: UBreakIterators. 14 15 This patch is a mechanical replacement of TextBreakIterator to UBreakIterator and 16 removes the functions we were calling which pass through directly to ubrk_*(). 17 18 Reviewed by Alex Christensen. 19 20 * wtf/text/LineBreakIteratorPoolICU.h: 21 (WTF::LineBreakIteratorPool::take): 22 (WTF::LineBreakIteratorPool::put): 23 * wtf/text/StringView.cpp: 24 (WTF::StringView::GraphemeClusters::Iterator::Impl::computeIndexEnd): 25 * wtf/text/TextBreakIterator.cpp: 26 (WTF::initializeIterator): 27 (WTF::initializeIteratorWithRules): 28 (WTF::setTextForIterator): 29 (WTF::setContextAwareTextForIterator): 30 (WTF::wordBreakIterator): 31 (WTF::sentenceBreakIterator): 32 (WTF::cursorMovementIterator): 33 (WTF::acquireLineBreakIterator): 34 (WTF::releaseLineBreakIterator): 35 (WTF::openLineBreakIterator): 36 (WTF::closeLineBreakIterator): 37 (WTF::getNonSharedCharacterBreakIterator): 38 (WTF::cacheNonSharedCharacterBreakIterator): 39 (WTF::isWordTextBreak): 40 (WTF::numGraphemeClusters): 41 (WTF::numCharactersInGraphemeClusters): 42 (WTF::textBreakFirst): Deleted. 43 (WTF::textBreakLast): Deleted. 44 (WTF::textBreakNext): Deleted. 45 (WTF::textBreakPrevious): Deleted. 46 (WTF::textBreakPreceding): Deleted. 47 (WTF::textBreakFollowing): Deleted. 48 (WTF::textBreakCurrent): Deleted. 49 (WTF::isTextBreak): Deleted. 50 * wtf/text/TextBreakIterator.h: 51 (WTF::LazyLineBreakIterator::lastCharacter): 52 (WTF::LazyLineBreakIterator::secondToLastCharacter): 53 (WTF::LazyLineBreakIterator::setPriorContext): 54 (WTF::LazyLineBreakIterator::updatePriorContext): 55 (WTF::LazyLineBreakIterator::resetPriorContext): 56 (WTF::LazyLineBreakIterator::priorContextLength): 57 (WTF::LazyLineBreakIterator::get): 58 (WTF::NonSharedCharacterBreakIterator::operator UBreakIterator*): 59 (WTF::NonSharedCharacterBreakIterator::operator TextBreakIterator*): Deleted. 60 1 61 2016-12-15 Myles C. Maxfield <mmaxfield@apple.com> 2 62 -
trunk/Source/WTF/wtf/Platform.h
r209764 r209907 1209 1209 1210 1210 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 101201 && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101200 1211 #define HAVE_TOUCH_BAR 11211 #define HAVE_TOUCH_BAR 0 1212 1212 #define HAVE_ADVANCED_SPELL_CHECKING 1 1213 1213 -
trunk/Source/WTF/wtf/text/LineBreakIteratorPoolICU.h
r208963 r209907 61 61 } 62 62 63 TextBreakIterator* take(const AtomicString& locale, LineBreakIteratorMode mode, bool isCJK)63 UBreakIterator* take(const AtomicString& locale, LineBreakIteratorMode mode, bool isCJK) 64 64 { 65 65 auto localeWithOptionalBreakKeyword = makeLocaleWithBreakKeyword(locale, mode); 66 66 67 TextBreakIterator* iterator = nullptr;67 UBreakIterator* iterator = nullptr; 68 68 for (size_t i = 0; i < m_pool.size(); ++i) { 69 69 if (m_pool[i].first == localeWithOptionalBreakKeyword) { … … 85 85 } 86 86 87 void put( TextBreakIterator* iterator)87 void put(UBreakIterator* iterator) 88 88 { 89 89 ASSERT(m_vendedIterators.contains(iterator)); … … 98 98 static constexpr size_t capacity = 4; 99 99 100 Vector<std::pair<AtomicString, TextBreakIterator*>, capacity> m_pool;101 HashMap< TextBreakIterator*, AtomicString> m_vendedIterators;100 Vector<std::pair<AtomicString, UBreakIterator*>, capacity> m_pool; 101 HashMap<UBreakIterator*, AtomicString> m_vendedIterators; 102 102 103 103 friend WTF::ThreadSpecific<LineBreakIteratorPool>::operator LineBreakIteratorPool*(); -
trunk/Source/WTF/wtf/text/StringView.cpp
r208985 r209907 29 29 30 30 #include <mutex> 31 #include <unicode/ubrk.h> 31 32 #include <wtf/HashMap.h> 32 33 #include <wtf/Lock.h> … … 132 133 if (m_index == m_stringView.length()) 133 134 return m_index; 134 return textBreakFollowing(m_iterator.value(), m_index);135 return ubrk_following(m_iterator.value(), m_index); 135 136 } 136 137 -
trunk/Source/WTF/wtf/text/TextBreakIterator.cpp
r208965 r209907 39 39 // Iterator initialization 40 40 41 static TextBreakIterator* initializeIterator(UBreakIteratorType type, const char* locale = currentTextBreakLocaleID())41 static UBreakIterator* initializeIterator(UBreakIteratorType type, const char* locale = currentTextBreakLocaleID()) 42 42 { 43 43 UErrorCode openStatus = U_ZERO_ERROR; 44 TextBreakIterator* iterator = reinterpret_cast<TextBreakIterator*>(ubrk_open(type, locale, 0, 0, &openStatus));44 UBreakIterator* iterator = ubrk_open(type, locale, 0, 0, &openStatus); 45 45 ASSERT_WITH_MESSAGE(U_SUCCESS(openStatus), "ICU could not open a break iterator: %s (%d)", u_errorName(openStatus), openStatus); 46 46 return iterator; … … 49 49 #if !PLATFORM(IOS) 50 50 51 static TextBreakIterator* initializeIteratorWithRules(const char* breakRules)51 static UBreakIterator* initializeIteratorWithRules(const char* breakRules) 52 52 { 53 53 UParseError parseStatus; … … 55 55 unsigned length = strlen(breakRules); 56 56 auto upconvertedCharacters = StringView(reinterpret_cast<const LChar*>(breakRules), length).upconvertedCharacters(); 57 TextBreakIterator* iterator = reinterpret_cast<TextBreakIterator*>(ubrk_openRules(upconvertedCharacters, length, 0, 0, &parseStatus, &openStatus));57 UBreakIterator* iterator = ubrk_openRules(upconvertedCharacters, length, 0, 0, &parseStatus, &openStatus); 58 58 ASSERT_WITH_MESSAGE(U_SUCCESS(openStatus), "ICU could not open a break iterator: %s (%d)", u_errorName(openStatus), openStatus); 59 59 return iterator; … … 65 65 // Iterator text setting 66 66 67 static TextBreakIterator* setTextForIterator(TextBreakIterator& iterator, StringView string)67 static UBreakIterator* setTextForIterator(UBreakIterator& iterator, StringView string) 68 68 { 69 69 if (string.is8Bit()) { … … 81 81 82 82 UErrorCode setTextStatus = U_ZERO_ERROR; 83 ubrk_setUText( reinterpret_cast<UBreakIterator*>(&iterator), text, &setTextStatus);83 ubrk_setUText(&iterator, text, &setTextStatus); 84 84 if (U_FAILURE(setTextStatus)) { 85 85 LOG_ERROR("ubrk_setUText failed with status %d", setTextStatus); … … 90 90 } else { 91 91 UErrorCode setTextStatus = U_ZERO_ERROR; 92 ubrk_setText( reinterpret_cast<UBreakIterator*>(&iterator), string.characters16(), string.length(), &setTextStatus);92 ubrk_setText(&iterator, string.characters16(), string.length(), &setTextStatus); 93 93 if (U_FAILURE(setTextStatus)) 94 94 return nullptr; … … 98 98 } 99 99 100 static TextBreakIterator* setContextAwareTextForIterator(TextBreakIterator& iterator, StringView string, const UChar* priorContext, unsigned priorContextLength)100 static UBreakIterator* setContextAwareTextForIterator(UBreakIterator& iterator, StringView string, const UChar* priorContext, unsigned priorContextLength) 101 101 { 102 102 if (string.is8Bit()) { … … 114 114 115 115 UErrorCode setTextStatus = U_ZERO_ERROR; 116 ubrk_setUText( reinterpret_cast<UBreakIterator*>(&iterator), text, &setTextStatus);116 ubrk_setUText(&iterator, text, &setTextStatus); 117 117 if (U_FAILURE(setTextStatus)) { 118 118 LOG_ERROR("ubrk_setUText failed with status %d", setTextStatus); … … 132 132 133 133 UErrorCode setTextStatus = U_ZERO_ERROR; 134 ubrk_setUText( reinterpret_cast<UBreakIterator*>(&iterator), text, &setTextStatus);134 ubrk_setUText(&iterator, text, &setTextStatus); 135 135 if (U_FAILURE(setTextStatus)) { 136 136 LOG_ERROR("ubrk_setUText failed with status %d", setTextStatus); … … 147 147 // Static iterators 148 148 149 TextBreakIterator* wordBreakIterator(StringView string)150 { 151 static TextBreakIterator* staticWordBreakIterator = initializeIterator(UBRK_WORD);149 UBreakIterator* wordBreakIterator(StringView string) 150 { 151 static UBreakIterator* staticWordBreakIterator = initializeIterator(UBRK_WORD); 152 152 if (!staticWordBreakIterator) 153 153 return nullptr; … … 156 156 } 157 157 158 TextBreakIterator* sentenceBreakIterator(StringView string)159 { 160 static TextBreakIterator* staticSentenceBreakIterator = initializeIterator(UBRK_SENTENCE);158 UBreakIterator* sentenceBreakIterator(StringView string) 159 { 160 static UBreakIterator* staticSentenceBreakIterator = initializeIterator(UBRK_SENTENCE); 161 161 if (!staticSentenceBreakIterator) 162 162 return nullptr; … … 165 165 } 166 166 167 TextBreakIterator* cursorMovementIterator(StringView string)167 UBreakIterator* cursorMovementIterator(StringView string) 168 168 { 169 169 #if !PLATFORM(IOS) … … 292 292 "!!safe_forward;"; 293 293 #endif 294 static TextBreakIterator* staticCursorMovementIterator = initializeIteratorWithRules(kRules);294 static UBreakIterator* staticCursorMovementIterator = initializeIteratorWithRules(kRules); 295 295 #else // PLATFORM(IOS) 296 296 // Use the special Thai character break iterator for all locales 297 static TextBreakIterator* staticCursorMovementIterator = initializeIterator(UBRK_CHARACTER, "th");297 static UBreakIterator* staticCursorMovementIterator = initializeIterator(UBRK_CHARACTER, "th"); 298 298 #endif // !PLATFORM(IOS) 299 299 … … 304 304 } 305 305 306 TextBreakIterator* acquireLineBreakIterator(StringView string, const AtomicString& locale, const UChar* priorContext, unsigned priorContextLength, LineBreakIteratorMode mode, bool isCJK)307 { 308 TextBreakIterator* iterator = LineBreakIteratorPool::sharedPool().take(locale, mode, isCJK);306 UBreakIterator* acquireLineBreakIterator(StringView string, const AtomicString& locale, const UChar* priorContext, unsigned priorContextLength, LineBreakIteratorMode mode, bool isCJK) 307 { 308 UBreakIterator* iterator = LineBreakIteratorPool::sharedPool().take(locale, mode, isCJK); 309 309 if (!iterator) 310 310 return nullptr; … … 313 313 } 314 314 315 void releaseLineBreakIterator( TextBreakIterator* iterator)315 void releaseLineBreakIterator(UBreakIterator* iterator) 316 316 { 317 317 ASSERT_ARG(iterator, iterator); … … 781 781 } 782 782 783 TextBreakIterator* openLineBreakIterator(const AtomicString& locale, LineBreakIteratorMode mode, bool isCJK)783 UBreakIterator* openLineBreakIterator(const AtomicString& locale, LineBreakIteratorMode mode, bool isCJK) 784 784 { 785 785 UBreakIterator* ubrkIter; … … 805 805 } 806 806 807 return reinterpret_cast<TextBreakIterator*>(ubrkIter);808 } 809 810 void closeLineBreakIterator( TextBreakIterator*& iterator)811 { 812 UBreakIterator* ubrkIter = reinterpret_cast<UBreakIterator*>(iterator);807 return ubrkIter; 808 } 809 810 void closeLineBreakIterator(UBreakIterator*& iterator) 811 { 812 UBreakIterator* ubrkIter = iterator; 813 813 ASSERT(ubrkIter); 814 814 ubrk_close(ubrkIter); … … 816 816 } 817 817 818 static std::atomic< TextBreakIterator*> nonSharedCharacterBreakIterator = ATOMIC_VAR_INIT(nullptr);819 820 static inline TextBreakIterator* getNonSharedCharacterBreakIterator()818 static std::atomic<UBreakIterator*> nonSharedCharacterBreakIterator = ATOMIC_VAR_INIT(nullptr); 819 820 static inline UBreakIterator* getNonSharedCharacterBreakIterator() 821 821 { 822 822 if (auto *res = nonSharedCharacterBreakIterator.exchange(nullptr, std::memory_order_acquire)) … … 825 825 } 826 826 827 static inline void cacheNonSharedCharacterBreakIterator( TextBreakIterator* cacheMe)827 static inline void cacheNonSharedCharacterBreakIterator(UBreakIterator* cacheMe) 828 828 { 829 829 if (auto *old = nonSharedCharacterBreakIterator.exchange(cacheMe, std::memory_order_release)) 830 ubrk_close( reinterpret_cast<UBreakIterator*>(old));830 ubrk_close(old); 831 831 } 832 832 … … 849 849 } 850 850 851 852 851 // Iterator implemenation. 853 852 854 int textBreakFirst(TextBreakIterator* iterator) 855 { 856 return ubrk_first(reinterpret_cast<UBreakIterator*>(iterator)); 857 } 858 859 int textBreakLast(TextBreakIterator* iterator) 860 { 861 return ubrk_last(reinterpret_cast<UBreakIterator*>(iterator)); 862 } 863 864 int textBreakNext(TextBreakIterator* iterator) 865 { 866 return ubrk_next(reinterpret_cast<UBreakIterator*>(iterator)); 867 } 868 869 int textBreakPrevious(TextBreakIterator* iterator) 870 { 871 return ubrk_previous(reinterpret_cast<UBreakIterator*>(iterator)); 872 } 873 874 int textBreakPreceding(TextBreakIterator* iterator, int pos) 875 { 876 return ubrk_preceding(reinterpret_cast<UBreakIterator*>(iterator), pos); 877 } 878 879 int textBreakFollowing(TextBreakIterator* iterator, int pos) 880 { 881 return ubrk_following(reinterpret_cast<UBreakIterator*>(iterator), pos); 882 } 883 884 int textBreakCurrent(TextBreakIterator* iterator) 885 { 886 return ubrk_current(reinterpret_cast<UBreakIterator*>(iterator)); 887 } 888 889 bool isTextBreak(TextBreakIterator* iterator, int position) 890 { 891 return ubrk_isBoundary(reinterpret_cast<UBreakIterator*>(iterator), position); 892 } 893 894 bool isWordTextBreak(TextBreakIterator* iterator) 895 { 896 int ruleStatus = ubrk_getRuleStatus(reinterpret_cast<UBreakIterator*>(iterator)); 853 bool isWordTextBreak(UBreakIterator* iterator) 854 { 855 int ruleStatus = ubrk_getRuleStatus(iterator); 897 856 return ruleStatus != UBRK_WORD_NONE; 898 857 } … … 921 880 922 881 unsigned numGraphemeClusters = 0; 923 while ( textBreakNext(iterator) != TextBreakDone)882 while (ubrk_next(iterator) != UBRK_DONE) 924 883 ++numGraphemeClusters; 925 884 return numGraphemeClusters; … … 949 908 950 909 for (unsigned i = 0; i < numGraphemeClusters; ++i) { 951 if ( textBreakNext(iterator) == TextBreakDone)910 if (ubrk_next(iterator) == UBRK_DONE) 952 911 return stringLength; 953 912 } 954 return textBreakCurrent(iterator);913 return ubrk_current(iterator); 955 914 } 956 915 -
trunk/Source/WTF/wtf/text/TextBreakIterator.h
r208963 r209907 26 26 namespace WTF { 27 27 28 class TextBreakIterator;29 30 28 // Note: The returned iterator is good only until you get another iterator, with the exception of acquireLineBreakIterator. 31 29 … … 36 34 // from character break iterator is Thai prepend characters, see bug 24342. 37 35 // Use this for insertion point and selection manipulations. 38 WTF_EXPORT_PRIVATE TextBreakIterator* cursorMovementIterator(StringView);36 WTF_EXPORT_PRIVATE UBreakIterator* cursorMovementIterator(StringView); 39 37 40 WTF_EXPORT_PRIVATE TextBreakIterator* wordBreakIterator(StringView);41 WTF_EXPORT_PRIVATE TextBreakIterator* sentenceBreakIterator(StringView);38 WTF_EXPORT_PRIVATE UBreakIterator* wordBreakIterator(StringView); 39 WTF_EXPORT_PRIVATE UBreakIterator* sentenceBreakIterator(StringView); 42 40 43 WTF_EXPORT_PRIVATE TextBreakIterator* acquireLineBreakIterator(StringView, const AtomicString& locale, const UChar* priorContext, unsigned priorContextLength, LineBreakIteratorMode, bool isCJK);44 WTF_EXPORT_PRIVATE void releaseLineBreakIterator( TextBreakIterator*);45 TextBreakIterator* openLineBreakIterator(const AtomicString& locale, LineBreakIteratorMode, bool isCJK);46 void closeLineBreakIterator( TextBreakIterator*&);41 WTF_EXPORT_PRIVATE UBreakIterator* acquireLineBreakIterator(StringView, const AtomicString& locale, const UChar* priorContext, unsigned priorContextLength, LineBreakIteratorMode, bool isCJK); 42 WTF_EXPORT_PRIVATE void releaseLineBreakIterator(UBreakIterator*); 43 UBreakIterator* openLineBreakIterator(const AtomicString& locale, LineBreakIteratorMode, bool isCJK); 44 void closeLineBreakIterator(UBreakIterator*&); 47 45 48 WTF_EXPORT_PRIVATE int textBreakFirst(TextBreakIterator*); 49 WTF_EXPORT_PRIVATE int textBreakLast(TextBreakIterator*); 50 WTF_EXPORT_PRIVATE int textBreakNext(TextBreakIterator*); 51 WTF_EXPORT_PRIVATE int textBreakPrevious(TextBreakIterator*); 52 WTF_EXPORT_PRIVATE int textBreakCurrent(TextBreakIterator*); 53 WTF_EXPORT_PRIVATE int textBreakPreceding(TextBreakIterator*, int); 54 WTF_EXPORT_PRIVATE int textBreakFollowing(TextBreakIterator*, int); 55 WTF_EXPORT_PRIVATE bool isTextBreak(TextBreakIterator*, int); 56 WTF_EXPORT_PRIVATE bool isWordTextBreak(TextBreakIterator*); 57 58 constexpr int TextBreakDone = -1; 46 WTF_EXPORT_PRIVATE bool isWordTextBreak(UBreakIterator*); 59 47 60 48 WTF_EXPORT_PRIVATE bool isCJKLocale(const AtomicString&); … … 87 75 UChar lastCharacter() const 88 76 { 89 COMPILE_ASSERT(WTF_ARRAY_LENGTH(m_priorContext) == 2, TextBreakIterator_unexpected_prior_context_length);77 static_assert(WTF_ARRAY_LENGTH(m_priorContext) == 2, "UBreakIterator unexpected prior context length"); 90 78 return m_priorContext[1]; 91 79 } … … 93 81 UChar secondToLastCharacter() const 94 82 { 95 COMPILE_ASSERT(WTF_ARRAY_LENGTH(m_priorContext) == 2, TextBreakIterator_unexpected_prior_context_length);83 static_assert(WTF_ARRAY_LENGTH(m_priorContext) == 2, "UBreakIterator unexpected prior context length"); 96 84 return m_priorContext[0]; 97 85 } … … 99 87 void setPriorContext(UChar last, UChar secondToLast) 100 88 { 101 COMPILE_ASSERT(WTF_ARRAY_LENGTH(m_priorContext) == 2, TextBreakIterator_unexpected_prior_context_length);89 static_assert(WTF_ARRAY_LENGTH(m_priorContext) == 2, "UBreakIterator unexpected prior context length"); 102 90 m_priorContext[0] = secondToLast; 103 91 m_priorContext[1] = last; … … 106 94 void updatePriorContext(UChar last) 107 95 { 108 COMPILE_ASSERT(WTF_ARRAY_LENGTH(m_priorContext) == 2, TextBreakIterator_unexpected_prior_context_length);96 static_assert(WTF_ARRAY_LENGTH(m_priorContext) == 2, "UBreakIterator unexpected prior context length"); 109 97 m_priorContext[0] = m_priorContext[1]; 110 98 m_priorContext[1] = last; … … 113 101 void resetPriorContext() 114 102 { 115 COMPILE_ASSERT(WTF_ARRAY_LENGTH(m_priorContext) == 2, TextBreakIterator_unexpected_prior_context_length);103 static_assert(WTF_ARRAY_LENGTH(m_priorContext) == 2, "UBreakIterator unexpected prior context length"); 116 104 m_priorContext[0] = 0; 117 105 m_priorContext[1] = 0; … … 121 109 { 122 110 unsigned priorContextLength = 0; 123 COMPILE_ASSERT(WTF_ARRAY_LENGTH(m_priorContext) == 2, TextBreakIterator_unexpected_prior_context_length);111 static_assert(WTF_ARRAY_LENGTH(m_priorContext) == 2, "UBreakIterator unexpected prior context length"); 124 112 if (m_priorContext[1]) { 125 113 ++priorContextLength; … … 133 121 // initialized to use the previously stored string as the primary breaking context and using 134 122 // previously stored prior context if non-empty. 135 TextBreakIterator* get(unsigned priorContextLength)123 UBreakIterator* get(unsigned priorContextLength) 136 124 { 137 125 ASSERT(priorContextLength <= priorContextCapacity); … … 165 153 StringView m_stringView; 166 154 AtomicString m_locale; 167 TextBreakIterator* m_iterator { nullptr };155 UBreakIterator* m_iterator { nullptr }; 168 156 const UChar* m_cachedPriorContext { nullptr }; 169 157 LineBreakIteratorMode m_mode { LineBreakIteratorMode::Default }; … … 186 174 NonSharedCharacterBreakIterator(NonSharedCharacterBreakIterator&&); 187 175 188 operator TextBreakIterator*() const { return m_iterator; }176 operator UBreakIterator*() const { return m_iterator; } 189 177 190 178 private: 191 TextBreakIterator* m_iterator;179 UBreakIterator* m_iterator; 192 180 }; 193 181 … … 206 194 using WTF::LineBreakIteratorMode; 207 195 using WTF::NonSharedCharacterBreakIterator; 208 using WTF::TextBreakDone; 209 using WTF::TextBreakIterator; 196 using WTF::isWordTextBreak; -
trunk/Source/WebCore/ChangeLog
r209906 r209907 1 2016-12-15 Myles C. Maxfield <mmaxfield@apple.com> 2 3 Stop reinterpret_casting UBreakIterators to the undefined type TextBreakIterator 4 https://bugs.webkit.org/show_bug.cgi?id=165931 5 6 Reviewed by Alex Christensen. 7 8 No new tests because there is no behavior change. 9 10 * dom/CharacterData.cpp: 11 (WebCore::CharacterData::parserAppendData): 12 * editing/TextCheckingHelper.cpp: 13 (WebCore::findMisspellings): 14 * editing/VisibleUnits.cpp: 15 (WebCore::wordBreakIteratorForMinOffsetBoundary): 16 (WebCore::wordBreakIteratorForMaxOffsetBoundary): 17 (WebCore::isLogicalStartOfWord): 18 (WebCore::islogicalEndOfWord): 19 (WebCore::visualWordPosition): 20 (WebCore::startSentenceBoundary): 21 (WebCore::endSentenceBoundary): 22 (WebCore::previousSentencePositionBoundary): 23 (WebCore::nextSentencePositionBoundary): 24 * html/HTMLInputElement.cpp: 25 * html/HTMLTextAreaElement.cpp: 26 * html/InputType.cpp: 27 * html/TextFieldInputType.cpp: 28 * html/TextInputType.cpp: 29 * platform/graphics/StringTruncator.cpp: 30 (WebCore::textBreakAtOrPreceding): 31 (WebCore::boundedTextBreakFollowing): 32 (WebCore::rightClipToWordBuffer): 33 * platform/graphics/mac/ComplexTextController.cpp: 34 (WebCore::ComplexTextController::offsetForPosition): 35 * platform/text/TextBoundaries.cpp: 36 (WebCore::findNextWordFromIndex): 37 (WebCore::findWordBoundary): 38 (WebCore::findEndWordBoundary): 39 * platform/text/mac/TextBoundaries.mm: 40 (WebCore::findNextWordFromIndex): 41 * rendering/BreakLines.h: 42 (WebCore::nextBreakablePositionNonLoosely): 43 (WebCore::nextBreakablePositionLoosely): 44 * rendering/RenderBlock.cpp: 45 * rendering/RenderText.cpp: 46 (WebCore::makeCapitalized): 47 (WebCore::RenderText::previousOffset): 48 (WebCore::RenderText::previousOffsetForBackwardDeletion): 49 (WebCore::RenderText::nextOffset): 50 * rendering/SimpleLineLayoutTextFragmentIterator.h: 51 * rendering/line/LineBreaker.h: 52 1 53 2016-12-15 Darin Adler <darin@apple.com> 2 54 -
trunk/Source/WebCore/dom/CharacterData.cpp
r208603 r209907 34 34 #include "RenderText.h" 35 35 #include "StyleInheritedData.h" 36 #include <unicode/ubrk.h> 36 37 #include <wtf/Ref.h> 37 #include <wtf/text/TextBreakIterator.h>38 38 39 39 namespace WebCore { … … 87 87 if (characterLengthLimit < characterLength) { 88 88 NonSharedCharacterBreakIterator it(StringView(string).substring(offset, (characterLengthLimit + 2 > characterLength) ? characterLength : characterLengthLimit + 2)); 89 if (! isTextBreak(it, characterLengthLimit))90 characterLengthLimit = textBreakPreceding(it, characterLengthLimit);89 if (!ubrk_isBoundary(it, characterLengthLimit)) 90 characterLengthLimit = ubrk_preceding(it, characterLengthLimit); 91 91 } 92 92 -
trunk/Source/WebCore/editing/TextCheckingHelper.cpp
r208479 r209907 34 34 #include "FrameSelection.h" 35 35 #include "Settings.h" 36 #include <wtf/text/TextBreakIterator.h>37 36 #include "TextCheckerClient.h" 38 37 #include "TextIterator.h" 39 38 #include "VisiblePosition.h" 40 39 #include "VisibleUnits.h" 40 #include <unicode/ubrk.h> 41 41 #include <wtf/text/StringView.h> 42 #include <wtf/text/TextBreakIterator.h> 42 43 43 44 namespace WebCore { … … 77 78 static void findMisspellings(TextCheckerClient& client, StringView text, Vector<TextCheckingResult>& results) 78 79 { 79 TextBreakIterator* iterator = wordBreakIterator(text);80 UBreakIterator* iterator = wordBreakIterator(text); 80 81 if (!iterator) 81 82 return; 82 for (int wordStart = textBreakCurrent(iterator); wordStart >= 0; ) {83 int wordEnd = textBreakNext(iterator);83 for (int wordStart = ubrk_current(iterator); wordStart >= 0; ) { 84 int wordEnd = ubrk_next(iterator); 84 85 if (wordEnd < 0) 85 86 break; -
trunk/Source/WebCore/editing/VisibleUnits.cpp
r208479 r209907 38 38 #include "Text.h" 39 39 #include "TextBoundaries.h" 40 #include <wtf/text/TextBreakIterator.h>41 40 #include "TextIterator.h" 42 41 #include "VisibleSelection.h" 42 #include <unicode/ubrk.h> 43 #include <wtf/text/TextBreakIterator.h> 43 44 #include "htmlediting.h" 44 45 … … 286 287 } 287 288 288 static TextBreakIterator* wordBreakIteratorForMinOffsetBoundary(const VisiblePosition& visiblePosition, const InlineTextBox* textBox,289 static UBreakIterator* wordBreakIteratorForMinOffsetBoundary(const VisiblePosition& visiblePosition, const InlineTextBox* textBox, 289 290 int& previousBoxLength, bool& previousBoxInDifferentBlock, Vector<UChar, 1024>& string, CachedLogicallyOrderedLeafBoxes& leafBoxes) 290 291 { … … 306 307 } 307 308 308 static TextBreakIterator* wordBreakIteratorForMaxOffsetBoundary(const VisiblePosition& visiblePosition, const InlineTextBox* textBox,309 static UBreakIterator* wordBreakIteratorForMaxOffsetBoundary(const VisiblePosition& visiblePosition, const InlineTextBox* textBox, 309 310 bool& nextBoxInDifferentBlock, Vector<UChar, 1024>& string, CachedLogicallyOrderedLeafBoxes& leafBoxes) 310 311 { … … 324 325 } 325 326 326 static bool isLogicalStartOfWord( TextBreakIterator* iter, int position, bool hardLineBreak)327 { 328 bool boundary = hardLineBreak ? true : isTextBreak(iter, position);327 static bool isLogicalStartOfWord(UBreakIterator* iter, int position, bool hardLineBreak) 328 { 329 bool boundary = hardLineBreak ? true : ubrk_isBoundary(iter, position); 329 330 if (!boundary) 330 331 return false; 331 332 332 textBreakFollowing(iter, position);333 ubrk_following(iter, position); 333 334 // isWordTextBreak returns true after moving across a word and false after moving across a punctuation/space. 334 335 return isWordTextBreak(iter); 335 336 } 336 337 337 static bool islogicalEndOfWord( TextBreakIterator* iter, int position, bool hardLineBreak)338 { 339 bool boundary = isTextBreak(iter, position);338 static bool islogicalEndOfWord(UBreakIterator* iter, int position, bool hardLineBreak) 339 { 340 bool boundary = ubrk_isBoundary(iter, position); 340 341 return (hardLineBreak || boundary) && isWordTextBreak(iter); 341 342 } … … 352 353 InlineBox* previouslyVisitedBox = nullptr; 353 354 VisiblePosition current = visiblePosition; 354 TextBreakIterator* iter = nullptr;355 UBreakIterator* iter = nullptr; 355 356 356 357 CachedLogicallyOrderedLeafBoxes leafBoxes; … … 391 392 break; 392 393 393 textBreakFirst(iter);394 ubrk_first(iter); 394 395 int offsetInIterator = offsetInBox - textBox.start() + previousBoxLength; 395 396 … … 1110 1111 { 1111 1112 // FIXME: The following function can return -1; we don't handle that. 1112 return textBreakPreceding(sentenceBreakIterator(text), text.length());1113 return ubrk_preceding(sentenceBreakIterator(text), text.length()); 1113 1114 } 1114 1115 … … 1120 1121 unsigned endSentenceBoundary(StringView text, unsigned, BoundarySearchContextAvailability, bool&) 1121 1122 { 1122 return textBreakNext(sentenceBreakIterator(text));1123 return ubrk_next(sentenceBreakIterator(text)); 1123 1124 } 1124 1125 … … 1133 1134 // FIXME: This is identical to startSentenceBoundary. I'm pretty sure that's not right. 1134 1135 // FIXME: The following function can return -1; we don't handle that. 1135 return textBreakPreceding(sentenceBreakIterator(text), text.length());1136 return ubrk_preceding(sentenceBreakIterator(text), text.length()); 1136 1137 } 1137 1138 … … 1145 1146 // FIXME: This is identical to endSentenceBoundary. 1146 1147 // That isn't right. This function needs to move to the equivalent position in the following sentence. 1147 return textBreakFollowing(sentenceBreakIterator(text), 0);1148 return ubrk_following(sentenceBreakIterator(text), 0); 1148 1149 } 1149 1150 -
trunk/Source/WebCore/html/HTMLInputElement.cpp
r209756 r209907 63 63 #include <wtf/MathExtras.h> 64 64 #include <wtf/Ref.h> 65 #include <wtf/text/TextBreakIterator.h>66 65 67 66 #if ENABLE(TOUCH_EVENTS) -
trunk/Source/WebCore/html/HTMLTextAreaElement.cpp
r209756 r209907 45 45 #include "ShadowRoot.h" 46 46 #include "Text.h" 47 #include <wtf/text/TextBreakIterator.h>48 47 #include "TextControlInnerElements.h" 49 48 #include "TextIterator.h" -
trunk/Source/WebCore/html/InputType.cpp
r208985 r209907 70 70 #include "SubmitInputType.h" 71 71 #include "TelephoneInputType.h" 72 #include <wtf/text/TextBreakIterator.h>73 72 #include "TextInputType.h" 74 73 #include "TimeInputType.h" … … 79 78 #include <wtf/HashMap.h> 80 79 #include <wtf/text/StringHash.h> 80 #include <wtf/text/TextBreakIterator.h> 81 81 82 82 namespace WebCore { -
trunk/Source/WebCore/html/TextFieldInputType.cpp
r208963 r209907 53 53 #include "RenderTheme.h" 54 54 #include "ShadowRoot.h" 55 #include <wtf/text/TextBreakIterator.h>56 55 #include "TextControlInnerElements.h" 57 56 #include "TextEvent.h" -
trunk/Source/WebCore/html/TextInputType.cpp
r203038 r209907 34 34 #include "HTMLInputElement.h" 35 35 #include "InputTypeNames.h" 36 #include <wtf/text/TextBreakIterator.h>37 36 38 37 namespace WebCore { -
trunk/Source/WebCore/platform/graphics/StringTruncator.cpp
r203038 r209907 33 33 #include <wtf/text/TextBreakIterator.h> 34 34 #include "TextRun.h" 35 #include <unicode/ubrk.h> 35 36 #include <wtf/Assertions.h> 36 37 #include <wtf/Vector.h> … … 44 45 typedef unsigned TruncationFunction(const String&, unsigned length, unsigned keepCount, UChar* buffer, bool shouldInsertEllipsis); 45 46 46 static inline int textBreakAtOrPreceding( TextBreakIterator* it, int offset)47 { 48 if ( isTextBreak(it, offset))47 static inline int textBreakAtOrPreceding(UBreakIterator* it, int offset) 48 { 49 if (ubrk_isBoundary(it, offset)) 49 50 return offset; 50 51 51 int result = textBreakPreceding(it, offset);52 return result == TextBreakDone? 0 : result;53 } 54 55 static inline int boundedTextBreakFollowing( TextBreakIterator* it, int offset, int length)56 { 57 int result = textBreakFollowing(it, offset);58 return result == TextBreakDone? length : result;52 int result = ubrk_preceding(it, offset); 53 return result == UBRK_DONE ? 0 : result; 54 } 55 56 static inline int boundedTextBreakFollowing(UBreakIterator* it, int offset, int length) 57 { 58 int result = ubrk_following(it, offset); 59 return result == UBRK_DONE ? length : result; 59 60 } 60 61 … … 147 148 ASSERT(keepCount < STRING_BUFFER_SIZE); 148 149 149 TextBreakIterator* it = wordBreakIterator(StringView(string).substring(0, length));150 UBreakIterator* it = wordBreakIterator(StringView(string).substring(0, length)); 150 151 unsigned keepLength = textBreakAtOrPreceding(it, keepCount); 151 152 StringView(string).substring(0, keepLength).getCharactersWithUpconvert(buffer); -
trunk/Source/WebCore/platform/graphics/mac/ComplexTextController.cpp
r209875 r209907 31 31 #include "RenderBlock.h" 32 32 #include "RenderText.h" 33 #include <wtf/text/TextBreakIterator.h>34 33 #include "TextRun.h" 34 #include <unicode/ubrk.h> 35 35 #include <wtf/Optional.h> 36 36 #include <wtf/StdLibExtras.h> 37 #include <wtf/text/TextBreakIterator.h> 37 38 #include <wtf/unicode/CharacterNames.h> 38 39 … … 177 178 CFIndex hitIndex = hitGlyphStart + (hitGlyphEnd - hitGlyphStart) * (m_run.ltr() ? x / adjustedAdvance : 1 - x / adjustedAdvance); 178 179 int stringLength = complexTextRun.stringLength(); 179 TextBreakIterator* cursorPositionIterator = cursorMovementIterator(StringView(complexTextRun.characters(), stringLength));180 UBreakIterator* cursorPositionIterator = cursorMovementIterator(StringView(complexTextRun.characters(), stringLength)); 180 181 int clusterStart; 181 if ( isTextBreak(cursorPositionIterator, hitIndex))182 if (ubrk_isBoundary(cursorPositionIterator, hitIndex)) 182 183 clusterStart = hitIndex; 183 184 else { 184 clusterStart = textBreakPreceding(cursorPositionIterator, hitIndex);185 if (clusterStart == TextBreakDone)185 clusterStart = ubrk_preceding(cursorPositionIterator, hitIndex); 186 if (clusterStart == UBRK_DONE) 186 187 clusterStart = 0; 187 188 } … … 190 191 return complexTextRun.stringLocation() + clusterStart; 191 192 192 int clusterEnd = textBreakFollowing(cursorPositionIterator, hitIndex);193 if (clusterEnd == TextBreakDone)193 int clusterEnd = ubrk_following(cursorPositionIterator, hitIndex); 194 if (clusterEnd == UBRK_DONE) 194 195 clusterEnd = stringLength; 195 196 -
trunk/Source/WebCore/platform/text/TextBoundaries.cpp
r203038 r209907 28 28 #include "TextBoundaries.h" 29 29 30 #include <unicode/ubrk.h> 30 31 #include <wtf/text/StringImpl.h> 31 32 #include <wtf/text/TextBreakIterator.h> … … 63 64 int findNextWordFromIndex(StringView text, int position, bool forward) 64 65 { 65 TextBreakIterator* it = wordBreakIterator(text);66 UBreakIterator* it = wordBreakIterator(text); 66 67 67 68 if (forward) { 68 position = textBreakFollowing(it, position);69 while (position != TextBreakDone) {69 position = ubrk_following(it, position); 70 while (position != UBRK_DONE) { 70 71 // We stop searching when the character preceeding the break is alphanumeric. 71 72 if (static_cast<unsigned>(position) < text.length() && u_isalnum(text[position - 1])) 72 73 return position; 73 74 74 position = textBreakFollowing(it, position);75 position = ubrk_following(it, position); 75 76 } 76 77 77 78 return text.length(); 78 79 } else { 79 position = textBreakPreceding(it, position);80 while (position != TextBreakDone) {80 position = ubrk_preceding(it, position); 81 while (position != UBRK_DONE) { 81 82 // We stop searching when the character following the break is alphanumeric. 82 83 if (position && u_isalnum(text[position])) 83 84 return position; 84 85 85 position = textBreakPreceding(it, position);86 position = ubrk_preceding(it, position); 86 87 } 87 88 … … 92 93 void findWordBoundary(StringView text, int position, int* start, int* end) 93 94 { 94 TextBreakIterator* it = wordBreakIterator(text);95 *end = textBreakFollowing(it, position);95 UBreakIterator* it = wordBreakIterator(text); 96 *end = ubrk_following(it, position); 96 97 if (*end < 0) 97 *end = textBreakLast(it);98 *start = textBreakPrevious(it);98 *end = ubrk_last(it); 99 *start = ubrk_previous(it); 99 100 } 100 101 101 102 void findEndWordBoundary(StringView text, int position, int* end) 102 103 { 103 TextBreakIterator* it = wordBreakIterator(text);104 *end = textBreakFollowing(it, position);104 UBreakIterator* it = wordBreakIterator(text); 105 *end = ubrk_following(it, position); 105 106 if (*end < 0) 106 *end = textBreakLast(it);107 *end = ubrk_last(it); 107 108 } 108 109 -
trunk/Source/WebCore/platform/text/enchant/TextCheckerEnchant.cpp
r203038 r209907 25 25 #include <Language.h> 26 26 #include <glib.h> 27 #include <unicode/ubrk.h> 27 28 #include <wtf/text/TextBreakIterator.h> 28 29 … … 92 93 return; 93 94 94 TextBreakIterator* iter = wordBreakIterator(string);95 UBreakIterator* iter = wordBreakIterator(string); 95 96 if (!iter) 96 97 return; 97 98 98 99 CString utf8String = string.utf8(); 99 int start = textBreakFirst(iter);100 for (int end = textBreakNext(iter); end != TextBreakDone; end = textBreakNext(iter)) {100 int start = ubrk_first(iter); 101 for (int end = ubrk_next(iter); end != UBRK_DONE; end = ubrk_next(iter)) { 101 102 if (isWordTextBreak(iter)) { 102 103 checkSpellingOfWord(utf8String, start, end, misspellingLocation, misspellingLength); -
trunk/Source/WebCore/platform/text/mac/TextBoundaries.mm
r204027 r209907 268 268 // tuned to improve the iPhone-specific behavior for the keyboard and text editing. 269 269 int pos = position; 270 TextBreakIterator* boundary = wordBreakIterator(text);270 UBreakIterator* boundary = wordBreakIterator(text); 271 271 if (boundary) { 272 272 if (forward) { 273 273 do { 274 pos = textBreakFollowing(boundary, pos);274 pos = ubrk_following(boundary, pos); 275 275 if (pos == UBRK_DONE) 276 276 pos = text.length(); … … 279 279 else { 280 280 do { 281 pos = textBreakPreceding(boundary, pos);281 pos = ubrk_preceding(boundary, pos); 282 282 if (pos == UBRK_DONE) 283 283 pos = 0; -
trunk/Source/WebCore/rendering/BreakLines.h
r208985 r209907 103 103 // Don't break if positioned at start of primary context and there is no prior context. 104 104 if (i || priorContextLength) { 105 TextBreakIterator* breakIterator = lazyBreakIterator.get(priorContextLength);105 UBreakIterator* breakIterator = lazyBreakIterator.get(priorContextLength); 106 106 if (breakIterator) { 107 int candidate = textBreakFollowing(breakIterator, i - 1 + priorContextLength);108 if (candidate == TextBreakDone)107 int candidate = ubrk_following(breakIterator, i - 1 + priorContextLength); 108 if (candidate == UBRK_DONE) 109 109 nextBreak = std::nullopt; 110 110 else { … … 148 148 // Don't break if positioned at start of primary context and there is no prior context. 149 149 if (i || priorContextLength) { 150 TextBreakIterator* breakIterator = lazyBreakIterator.get(priorContextLength);150 UBreakIterator* breakIterator = lazyBreakIterator.get(priorContextLength); 151 151 if (breakIterator) { 152 152 ASSERT(i + priorContextLength >= 1); 153 int candidate = textBreakFollowing(breakIterator, i + priorContextLength - 1);154 if (candidate == TextBreakDone)153 int candidate = ubrk_following(breakIterator, i + priorContextLength - 1); 154 if (candidate == UBRK_DONE) 155 155 nextBreak = std::nullopt; 156 156 else { -
trunk/Source/WebCore/rendering/RenderBlock.cpp
r209903 r209907 69 69 #include "ShadowRoot.h" 70 70 #include "ShapeOutsideInfo.h" 71 #include <wtf/text/TextBreakIterator.h>72 71 #include "TransformState.h" 73 72 -
trunk/Source/WebCore/rendering/RenderText.cpp
r209591 r209907 154 154 } 155 155 156 TextBreakIterator* boundary = wordBreakIterator(StringView(stringWithPrevious.characters(), length + 1));156 UBreakIterator* boundary = wordBreakIterator(StringView(stringWithPrevious.characters(), length + 1)); 157 157 if (!boundary) 158 158 return; … … 162 162 163 163 int32_t endOfWord; 164 int32_t startOfWord = textBreakFirst(boundary);165 for (endOfWord = textBreakNext(boundary); endOfWord != TextBreakDone; startOfWord = endOfWord, endOfWord = textBreakNext(boundary)) {164 int32_t startOfWord = ubrk_first(boundary); 165 for (endOfWord = ubrk_next(boundary); endOfWord != UBRK_DONE; startOfWord = endOfWord, endOfWord = ubrk_next(boundary)) { 166 166 if (startOfWord) // Ignore first char of previous string 167 167 result.append(stringImpl[startOfWord - 1] == noBreakSpace ? noBreakSpace : u_totitle(stringWithPrevious[startOfWord])); … … 1470 1470 1471 1471 StringImpl* textImpl = m_text.impl(); 1472 TextBreakIterator* iterator = cursorMovementIterator(StringView(textImpl->characters16(), textImpl->length()));1472 UBreakIterator* iterator = cursorMovementIterator(StringView(textImpl->characters16(), textImpl->length())); 1473 1473 if (!iterator) 1474 1474 return current - 1; 1475 1475 1476 long result = textBreakPreceding(iterator, current);1477 if (result == TextBreakDone)1476 long result = ubrk_preceding(iterator, current); 1477 if (result == UBRK_DONE) 1478 1478 result = current - 1; 1479 1479 … … 1524 1524 StringImpl& text = *m_text.impl(); 1525 1525 1526 // FIXME: Unclear why this has so much handrolled code rather than using TextBreakIterator.1526 // FIXME: Unclear why this has so much handrolled code rather than using UBreakIterator. 1527 1527 // Also unclear why this is so different from advanceByCombiningCharacterSequence. 1528 1528 … … 1650 1650 1651 1651 StringImpl* textImpl = m_text.impl(); 1652 TextBreakIterator* iterator = cursorMovementIterator(StringView(textImpl->characters16(), textImpl->length()));1652 UBreakIterator* iterator = cursorMovementIterator(StringView(textImpl->characters16(), textImpl->length())); 1653 1653 if (!iterator) 1654 1654 return current + 1; 1655 1655 1656 long result = textBreakFollowing(iterator, current);1657 if (result == TextBreakDone)1656 long result = ubrk_following(iterator, current); 1657 if (result == UBRK_DONE) 1658 1658 result = current + 1; 1659 1659 -
trunk/Source/WebCore/rendering/SimpleLineLayoutTextFragmentIterator.h
r204531 r209907 29 29 #include "RenderLineBreak.h" 30 30 #include "SimpleLineLayoutFlowContents.h" 31 #include <wtf/text/TextBreakIterator.h>32 31 33 32 namespace WebCore { -
trunk/Source/WebCore/rendering/line/LineBreaker.h
r208668 r209907 29 29 #include "LineInlineHeaders.h" 30 30 #include <wtf/Vector.h> 31 #include <wtf/text/TextBreakIterator.h>32 31 33 32 namespace WebCore { -
trunk/Source/WebKit/ios/ChangeLog
r208289 r209907 1 2016-12-15 Myles C. Maxfield <mmaxfield@apple.com> 2 3 Stop reinterpret_casting UBreakIterators to the undefined type TextBreakIterator 4 https://bugs.webkit.org/show_bug.cgi?id=165931 5 6 Reviewed by Alex Christensen. 7 8 * Misc/WebUIKitSupport.mm: 9 1 10 2016-11-01 Alex Christensen <achristensen@webkit.org> 2 11 -
trunk/Source/WebKit/ios/Misc/WebUIKitSupport.mm
r204531 r209907 41 41 #import <WebCore/WebCoreThreadSystemInterface.h> 42 42 #import <wtf/spi/darwin/dyldSPI.h> 43 #import <wtf/text/TextBreakIterator.h>44 43 45 44 #import <runtime/InitializeThreading.h> -
trunk/Source/WebKit2/UIProcess/efl/TextCheckerEfl.cpp
r209235 r209907 136 136 { 137 137 // FIXME: avoid creating textIterator object here, it could be passed as a parameter. 138 // isTextBreak() leaves the iterator pointing to the first boundary position at138 // ubrk_isBoundary() leaves the iterator pointing to the first boundary position at 139 139 // or after "offset" (ubrk_isBoundary side effect). 140 140 // For many word separators, the method doesn't properly determine the boundaries … … 145 145 146 146 unsigned wordOffset = currentOffset; 147 while (wordOffset < text.length() && isTextBreak(textIterator, wordOffset))147 while (wordOffset < text.length() && ubrk_isBoundary(textIterator, wordOffset)) 148 148 ++wordOffset; 149 149 … … 176 176 unsigned offset = nextWordOffset(text, 0); 177 177 unsigned lengthStrip = text.length(); 178 while (lengthStrip > 0 && isTextBreak(textIterator, lengthStrip - 1))178 while (lengthStrip > 0 && ubrk_isBoundary(textIterator, lengthStrip - 1)) 179 179 --lengthStrip; 180 180 -
trunk/Source/WebKit2/UIProcess/gtk/TextCheckerGtk.cpp
r206261 r209907 33 33 #include <WebCore/NotImplemented.h> 34 34 #include <WebCore/TextCheckerEnchant.h> 35 #include <unicode/ubrk.h> 35 36 #include <wtf/NeverDestroyed.h> 36 37 #include <wtf/text/TextBreakIterator.h> … … 227 228 { 228 229 // FIXME: avoid creating textIterator object here, it could be passed as a parameter. 229 // isTextBreak() leaves the iterator pointing to the first boundary position at230 // ubrk_isBoundary() leaves the iterator pointing to the first boundary position at 230 231 // or after "offset" (ubrk_isBoundary side effect). 231 232 // For many word separators, the method doesn't properly determine the boundaries 232 233 // without resetting the iterator. 233 TextBreakIterator* textIterator = wordBreakIterator(text);234 UBreakIterator* textIterator = wordBreakIterator(text); 234 235 if (!textIterator) 235 236 return currentOffset; 236 237 237 238 unsigned wordOffset = currentOffset; 238 while (wordOffset < text.length() && isTextBreak(textIterator, wordOffset))239 while (wordOffset < text.length() && ubrk_isBoundary(textIterator, wordOffset)) 239 240 ++wordOffset; 240 241 … … 259 260 return Vector<TextCheckingResult>(); 260 261 261 TextBreakIterator* textIterator = wordBreakIterator(text);262 UBreakIterator* textIterator = wordBreakIterator(text); 262 263 if (!textIterator) 263 264 return Vector<TextCheckingResult>(); … … 267 268 unsigned offset = nextWordOffset(text, 0); 268 269 unsigned lengthStrip = text.length(); 269 while (lengthStrip > 0 && isTextBreak(textIterator, lengthStrip - 1))270 while (lengthStrip > 0 && ubrk_isBoundary(textIterator, lengthStrip - 1)) 270 271 --lengthStrip; 271 272
Note: See TracChangeset
for help on using the changeset viewer.