Rename ICU cursor iterator to caret iterator
authormmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Feb 2017 22:44:19 +0000 (22:44 +0000)
committermmaxfield@apple.com <mmaxfield@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Mon, 27 Feb 2017 22:44:19 +0000 (22:44 +0000)
https://bugs.webkit.org/show_bug.cgi?id=168206

Reviewed by Simon Fraser.

Source/WebCore:

Mechanical find/replace.

No new tests because there is no behavior change.

* platform/graphics/ComplexTextController.cpp:
(WebCore::ComplexTextController::offsetForPosition):
* rendering/RenderText.cpp:
(WebCore::RenderText::previousOffset):
(WebCore::RenderText::nextOffset):

Source/WTF:

* wtf/text/TextBreakIterator.cpp:
(WTF::mapModeToBackingIterator):
* wtf/text/TextBreakIterator.h:
* wtf/text/cf/TextBreakIteratorCF.h:
(WTF::TextBreakIteratorCF::TextBreakIteratorCF):
* wtf/text/icu/TextBreakIteratorICU.h:
(WTF::caretRules):
(WTF::TextBreakIteratorICU::TextBreakIteratorICU):
(WTF::cursorRules): Deleted.
* wtf/text/mac/TextBreakIteratorInternalICUMac.mm:
(WTF::mapModeToBackingIterator):

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

Source/WTF/ChangeLog
Source/WTF/wtf/text/TextBreakIterator.cpp
Source/WTF/wtf/text/TextBreakIterator.h
Source/WTF/wtf/text/cf/TextBreakIteratorCF.h
Source/WTF/wtf/text/icu/TextBreakIteratorICU.h
Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm
Source/WebCore/ChangeLog
Source/WebCore/platform/graphics/ComplexTextController.cpp
Source/WebCore/rendering/RenderText.cpp

index a58524a..71e3238 100644 (file)
@@ -1,5 +1,24 @@
 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
 
+        Rename ICU cursor iterator to caret iterator
+        https://bugs.webkit.org/show_bug.cgi?id=168206
+
+        Reviewed by Simon Fraser.
+
+        * wtf/text/TextBreakIterator.cpp:
+        (WTF::mapModeToBackingIterator):
+        * wtf/text/TextBreakIterator.h:
+        * wtf/text/cf/TextBreakIteratorCF.h:
+        (WTF::TextBreakIteratorCF::TextBreakIteratorCF):
+        * wtf/text/icu/TextBreakIteratorICU.h:
+        (WTF::caretRules):
+        (WTF::TextBreakIteratorICU::TextBreakIteratorICU):
+        (WTF::cursorRules): Deleted.
+        * wtf/text/mac/TextBreakIteratorInternalICUMac.mm:
+        (WTF::mapModeToBackingIterator):
+
+2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
+
         Use RAII for ICU breaking iterators
         https://bugs.webkit.org/show_bug.cgi?id=168203
 
index ce85da8..5c0f79c 100644 (file)
@@ -43,7 +43,7 @@ static Variant<TextBreakIteratorICU, TextBreakIteratorPlatform> mapModeToBacking
     switch (mode) {
     case TextBreakIterator::Mode::Line:
         return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Line, locale.string().utf8().data());
-    case TextBreakIterator::Mode::Cursor:
+    case TextBreakIterator::Mode::Caret:
         return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Character, locale.string().utf8().data());
     case TextBreakIterator::Mode::Delete:
         return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Character, locale.string().utf8().data());
index 0394d4f..b22ea61 100644 (file)
@@ -46,7 +46,7 @@ class TextBreakIterator {
 public:
     enum class Mode {
         Line,
-        Cursor,
+        Caret,
         Delete
     };
 
index 8366e2c..27e50bc 100644 (file)
@@ -28,7 +28,7 @@ namespace WTF {
 class TextBreakIteratorCF {
 public:
     enum class Mode {
-        Cursor,
+        Caret,
         Delete
     };
 
@@ -36,7 +36,7 @@ public:
         : m_string(string.createCFStringWithoutCopying())
     {
         switch (mode) {
-        case Mode::Cursor:
+        case Mode::Caret:
             m_type = kCFStringComposedCharacterCluster;
             break;
         case Mode::Delete:
index eeb4392..0b17fa8 100644 (file)
 #include <wtf/Optional.h>
 #include <wtf/text/icu/UTextProviderLatin1.h>
 
-#define USE_ICU_CURSOR_ITERATOR (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
+#define USE_ICU_CARET_ITERATOR (PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED < 101200)
 
 namespace WTF {
 
-#if USE_ICU_CURSOR_ITERATOR
-static String cursorRules()
+#if USE_ICU_CARET_ITERATOR
+static String caretRules()
 {
     return ASCIILiteral(
         // This rule set is based on character-break iterator rules of ICU 57
         // <http://source.icu-project.org/repos/icu/icu/tags/release-57-1/source/data/brkitr/>.
         // The major differences from the original ones are listed below:
         // * Replaced '[\p{Grapheme_Cluster_Break = SpacingMark}]' with '[\p{General_Category = Spacing Mark} - $Extend]' for ICU 3.8 or earlier;
-        // * Removed rules that prevent a cursor from moving after prepend characters (Bug 24342);
-        // * Added rules that prevent a cursor from moving after virama signs of Indic languages except Tamil (Bug 15790), and;
-        // * Added rules that prevent a cursor from moving before Japanese half-width katakara voiced marks.
+        // * Removed rules that prevent a caret from moving after prepend characters (Bug 24342);
+        // * Added rules that prevent a caret from moving after virama signs of Indic languages except Tamil (Bug 15790), and;
+        // * Added rules that prevent a caret from moving before Japanese half-width katakara voiced marks.
         // * Added rules for regional indicator symbols.
         "$CR      = [\\p{Grapheme_Cluster_Break = CR}];"
         "$LF      = [\\p{Grapheme_Cluster_Break = LF}];"
@@ -136,8 +136,8 @@ public:
     enum class Mode {
         Line,
         Character,
-#if USE_ICU_CURSOR_ITERATOR
-        Cursor,
+#if USE_ICU_CARET_ITERATOR
+        Caret,
 #endif
     };
 
@@ -169,8 +169,8 @@ public:
         case Mode::Character:
             type = UBRK_CHARACTER;
             break;
-#if USE_ICU_CURSOR_ITERATOR
-        case Mode::Cursor:
+#if USE_ICU_CARET_ITERATOR
+        case Mode::Caret:
             type = UBRK_CHARACTER;
             break;
 #endif
@@ -187,12 +187,12 @@ public:
 
         // FIXME: Handle weak / normal / strict line breaking.
         UErrorCode status = U_ZERO_ERROR;
-#if USE_ICU_CURSOR_ITERATOR
-        if (mode == Mode::Cursor) {
-            static NeverDestroyed<String> cursorRules = WTF::cursorRules();
-            static NeverDestroyed<StringView::UpconvertedCharacters> upconvertedRules = StringView(cursorRules).upconvertedCharacters();
+#if USE_ICU_CARET_ITERATOR
+        if (mode == Mode::Caret) {
+            static NeverDestroyed<String> caretRules = WTF::caretRules();
+            static NeverDestroyed<StringView::UpconvertedCharacters> upconvertedRules = StringView(caretRules).upconvertedCharacters();
             UParseError parseError;
-            m_iterator = ubrk_openRules(upconvertedRules.get(), cursorRules.get().length(), text, textLength, &parseError, &status);
+            m_iterator = ubrk_openRules(upconvertedRules.get(), caretRules.get().length(), text, textLength, &parseError, &status);
         } else
 #endif
             m_iterator = ubrk_open(type, locale, text, textLength, &status);
index 90863e6..5fd654a 100644 (file)
@@ -31,11 +31,11 @@ static Variant<TextBreakIteratorICU, TextBreakIteratorPlatform> mapModeToBacking
     switch (mode) {
     case TextBreakIterator::Mode::Line:
         return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Line, locale.string().utf8().data());
-    case TextBreakIterator::Mode::Cursor:
-#if USE_ICU_CURSOR_ITERATOR
-        return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Cursor, locale.string().utf8().data());
+    case TextBreakIterator::Mode::Caret:
+#if USE_ICU_CARET_ITERATOR
+        return TextBreakIteratorICU(string, TextBreakIteratorICU::Mode::Caret, locale.string().utf8().data());
 #else
-        return TextBreakIteratorCF(string, TextBreakIteratorCF::Mode::Cursor);
+        return TextBreakIteratorCF(string, TextBreakIteratorCF::Mode::Caret);
 #endif
     case TextBreakIterator::Mode::Delete:
         return TextBreakIteratorCF(string, TextBreakIteratorCF::Mode::Delete);
index 75ee2cb..acb7173 100644 (file)
@@ -1,5 +1,22 @@
 2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
 
+        Rename ICU cursor iterator to caret iterator
+        https://bugs.webkit.org/show_bug.cgi?id=168206
+
+        Reviewed by Simon Fraser.
+
+        Mechanical find/replace.
+
+        No new tests because there is no behavior change.
+
+        * platform/graphics/ComplexTextController.cpp:
+        (WebCore::ComplexTextController::offsetForPosition):
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::previousOffset):
+        (WebCore::RenderText::nextOffset):
+
+2017-02-27  Myles C. Maxfield  <mmaxfield@apple.com>
+
         Unprefix -webkit-line-break
         https://bugs.webkit.org/show_bug.cgi?id=168213
 
index dc80607..c984b95 100644 (file)
@@ -217,7 +217,7 @@ unsigned ComplexTextController::offsetForPosition(float h, bool includePartialGl
                 // could use the glyph's "ligature carets". This is available in CoreText via CTFontGetLigatureCaretPositions().
                 unsigned hitIndex = hitGlyphStart + (hitGlyphEnd - hitGlyphStart) * (m_run.ltr() ? x / adjustedAdvance : 1 - x / adjustedAdvance);
                 unsigned stringLength = complexTextRun.stringLength();
-                CachedTextBreakIterator cursorPositionIterator(StringView(complexTextRun.characters(), stringLength), TextBreakIterator::Mode::Cursor, nullAtom);
+                CachedTextBreakIterator cursorPositionIterator(StringView(complexTextRun.characters(), stringLength), TextBreakIterator::Mode::Caret, nullAtom);
                 unsigned clusterStart;
                 if (cursorPositionIterator.isBoundary(hitIndex))
                     clusterStart = hitIndex;
index de1fda0..f1bba79 100644 (file)
@@ -1505,7 +1505,7 @@ int RenderText::previousOffset(int current) const
         return current - 1;
 
     StringImpl* textImpl = m_text.impl();
-    CachedTextBreakIterator iterator(StringView(textImpl->characters16(), textImpl->length()), TextBreakIterator::Mode::Cursor, nullAtom);
+    CachedTextBreakIterator iterator(StringView(textImpl->characters16(), textImpl->length()), TextBreakIterator::Mode::Caret, nullAtom);
     auto result = iterator.preceding(current).value_or(current - 1);
     return result;
 }
@@ -1678,7 +1678,7 @@ int RenderText::nextOffset(int current) const
         return current + 1;
 
     StringImpl* textImpl = m_text.impl();
-    CachedTextBreakIterator iterator(StringView(textImpl->characters16(), textImpl->length()), TextBreakIterator::Mode::Cursor, nullAtom);
+    CachedTextBreakIterator iterator(StringView(textImpl->characters16(), textImpl->length()), TextBreakIterator::Mode::Caret, nullAtom);
     auto result = iterator.following(current).value_or(current + 1);
     return result;
 }