Title: [213095] trunk/Source
Revision
213095
Author
mmaxfi...@apple.com
Date
2017-02-27 14:44:19 -0800 (Mon, 27 Feb 2017)

Log Message

Rename ICU cursor iterator to caret iterator
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):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (213094 => 213095)


--- trunk/Source/WTF/ChangeLog	2017-02-27 22:41:08 UTC (rev 213094)
+++ trunk/Source/WTF/ChangeLog	2017-02-27 22:44:19 UTC (rev 213095)
@@ -1,5 +1,24 @@
 2017-02-27  Myles C. Maxfield  <mmaxfi...@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  <mmaxfi...@apple.com>
+
         Use RAII for ICU breaking iterators
         https://bugs.webkit.org/show_bug.cgi?id=168203
 

Modified: trunk/Source/WTF/wtf/text/TextBreakIterator.cpp (213094 => 213095)


--- trunk/Source/WTF/wtf/text/TextBreakIterator.cpp	2017-02-27 22:41:08 UTC (rev 213094)
+++ trunk/Source/WTF/wtf/text/TextBreakIterator.cpp	2017-02-27 22:44:19 UTC (rev 213095)
@@ -43,7 +43,7 @@
     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());

Modified: trunk/Source/WTF/wtf/text/TextBreakIterator.h (213094 => 213095)


--- trunk/Source/WTF/wtf/text/TextBreakIterator.h	2017-02-27 22:41:08 UTC (rev 213094)
+++ trunk/Source/WTF/wtf/text/TextBreakIterator.h	2017-02-27 22:44:19 UTC (rev 213095)
@@ -46,7 +46,7 @@
 public:
     enum class Mode {
         Line,
-        Cursor,
+        Caret,
         Delete
     };
 

Modified: trunk/Source/WTF/wtf/text/cf/TextBreakIteratorCF.h (213094 => 213095)


--- trunk/Source/WTF/wtf/text/cf/TextBreakIteratorCF.h	2017-02-27 22:41:08 UTC (rev 213094)
+++ trunk/Source/WTF/wtf/text/cf/TextBreakIteratorCF.h	2017-02-27 22:44:19 UTC (rev 213095)
@@ -28,7 +28,7 @@
 class TextBreakIteratorCF {
 public:
     enum class Mode {
-        Cursor,
+        Caret,
         Delete
     };
 
@@ -36,7 +36,7 @@
         : m_string(string.createCFStringWithoutCopying())
     {
         switch (mode) {
-        case Mode::Cursor:
+        case Mode::Caret:
             m_type = kCFStringComposedCharacterCluster;
             break;
         case Mode::Delete:

Modified: trunk/Source/WTF/wtf/text/icu/TextBreakIteratorICU.h (213094 => 213095)


--- trunk/Source/WTF/wtf/text/icu/TextBreakIteratorICU.h	2017-02-27 22:41:08 UTC (rev 213094)
+++ trunk/Source/WTF/wtf/text/icu/TextBreakIteratorICU.h	2017-02-27 22:44:19 UTC (rev 213095)
@@ -24,12 +24,12 @@
 #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
@@ -36,9 +36,9 @@
         // <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 @@
     enum class Mode {
         Line,
         Character,
-#if USE_ICU_CURSOR_ITERATOR
-        Cursor,
+#if USE_ICU_CARET_ITERATOR
+        Caret,
 #endif
     };
 
@@ -169,8 +169,8 @@
         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 @@
 
         // 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);

Modified: trunk/Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm (213094 => 213095)


--- trunk/Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm	2017-02-27 22:41:08 UTC (rev 213094)
+++ trunk/Source/WTF/wtf/text/mac/TextBreakIteratorInternalICUMac.mm	2017-02-27 22:44:19 UTC (rev 213095)
@@ -31,11 +31,11 @@
     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);

Modified: trunk/Source/WebCore/ChangeLog (213094 => 213095)


--- trunk/Source/WebCore/ChangeLog	2017-02-27 22:41:08 UTC (rev 213094)
+++ trunk/Source/WebCore/ChangeLog	2017-02-27 22:44:19 UTC (rev 213095)
@@ -1,5 +1,22 @@
 2017-02-27  Myles C. Maxfield  <mmaxfi...@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  <mmaxfi...@apple.com>
+
         Unprefix -webkit-line-break
         https://bugs.webkit.org/show_bug.cgi?id=168213
 

Modified: trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp (213094 => 213095)


--- trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp	2017-02-27 22:41:08 UTC (rev 213094)
+++ trunk/Source/WebCore/platform/graphics/ComplexTextController.cpp	2017-02-27 22:44:19 UTC (rev 213095)
@@ -217,7 +217,7 @@
                 // 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;

Modified: trunk/Source/WebCore/rendering/RenderText.cpp (213094 => 213095)


--- trunk/Source/WebCore/rendering/RenderText.cpp	2017-02-27 22:41:08 UTC (rev 213094)
+++ trunk/Source/WebCore/rendering/RenderText.cpp	2017-02-27 22:44:19 UTC (rev 213095)
@@ -1505,7 +1505,7 @@
         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 @@
         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;
 }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to