Title: [158499] trunk/Source
Revision
158499
Author
par...@webkit.org
Date
2013-11-02 14:47:46 -0700 (Sat, 02 Nov 2013)

Log Message

Fix UnicodeWchar after r157330.
https://bugs.webkit.org/show_bug.cgi?id=123668

Reviewed by Darin Adler.

Source/WebCore:

* editing/TextIterator.cpp:
(WebCore::SearchBuffer::append):
* platform/graphics/wince/FontWinCE.cpp:
(WebCore::generateComponents):
* platform/graphics/wince/GraphicsContextWinCE.cpp:
(WebCore::GraphicsContext::drawText):
* platform/text/wchar/TextBreakIteratorWchar.cpp:
(WebCore::isCharStop):
(WebCore::isLineStop):
(WebCore::isSentenceStop):
(WebCore::WordBreakIterator::next):
(WebCore::WordBreakIterator::previous):

Source/WTF:

* wtf/unicode/wchar/UnicodeWchar.cpp:
(unorm_normalize):
(u_strFoldCase):
(u_strToLower):
(u_strToUpper):
* wtf/unicode/wchar/UnicodeWchar.h:
(u_foldCase):
(u_isprint):
(u_isspace):

Modified Paths

Diff

Modified: trunk/Source/WTF/ChangeLog (158498 => 158499)


--- trunk/Source/WTF/ChangeLog	2013-11-02 21:18:59 UTC (rev 158498)
+++ trunk/Source/WTF/ChangeLog	2013-11-02 21:47:46 UTC (rev 158499)
@@ -1,3 +1,20 @@
+2013-11-02  Patrick Gansterer  <par...@webkit.org>
+
+        Fix UnicodeWchar after r157330.
+        https://bugs.webkit.org/show_bug.cgi?id=123668
+
+        Reviewed by Darin Adler.
+
+        * wtf/unicode/wchar/UnicodeWchar.cpp:
+        (unorm_normalize):
+        (u_strFoldCase):
+        (u_strToLower):
+        (u_strToUpper):
+        * wtf/unicode/wchar/UnicodeWchar.h:
+        (u_foldCase):
+        (u_isprint):
+        (u_isspace):
+
 2013-11-02  Andreas Kling  <akl...@apple.com>
 
         Make remaining StringImpl functions return PassRef.

Modified: trunk/Source/WTF/wtf/unicode/wchar/UnicodeWchar.cpp (158498 => 158499)


--- trunk/Source/WTF/wtf/unicode/wchar/UnicodeWchar.cpp	2013-11-02 21:18:59 UTC (rev 158498)
+++ trunk/Source/WTF/wtf/unicode/wchar/UnicodeWchar.cpp	2013-11-02 21:47:46 UTC (rev 158499)
@@ -30,6 +30,7 @@
 int unorm_normalize(const UChar*, int32_t, UNormalizationMode, int32_t, UChar*, int32_t, UErrorCode*)
 {
     ASSERT_NOT_REACHED();
+    return 0;
 }
 
 UCharDirection u_charDirection(UChar32)
@@ -82,7 +83,7 @@
     return 0;
 }
 
-template<UChar Function(UChar)>
+template<wint_t Function(wint_t)>
 static inline int convertWithFunction(UChar* result, int resultLength, const UChar* source, int sourceLength, UErrorCode& status)
 {
     UChar* resultIterator = result;
@@ -100,15 +101,15 @@
 int u_strFoldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, unsigned options, UErrorCode* status)
 {
     ASSERT_UNUSED(options, options == U_FOLD_CASE_DEFAULT);
-    return convertWithFunction<u_foldCase>(result, resultLength, source, sourceLength, *status);
+    return convertWithFunction<towlower>(result, resultLength, source, sourceLength, *status);
 }
 
 int u_strToLower(UChar* result, int resultLength, const UChar* source, int sourceLength, const char*, UErrorCode* status)
 {
-    return convertWithFunction<u_tolower>(result, resultLength, source, sourceLength, *status);
+    return convertWithFunction<towlower>(result, resultLength, source, sourceLength, *status);
 }
 
 int u_strToUpper(UChar* result, int resultLength, const UChar* source, int sourceLength, const char*, UErrorCode* status)
 {
-    return convertWithFunction<u_toupper>(result, resultLength, source, sourceLength, *status);
+    return convertWithFunction<towupper>(result, resultLength, source, sourceLength, *status);
 }

Modified: trunk/Source/WTF/wtf/unicode/wchar/UnicodeWchar.h (158498 => 158499)


--- trunk/Source/WTF/wtf/unicode/wchar/UnicodeWchar.h	2013-11-02 21:18:59 UTC (rev 158498)
+++ trunk/Source/WTF/wtf/unicode/wchar/UnicodeWchar.h	2013-11-02 21:47:46 UTC (rev 158499)
@@ -63,7 +63,7 @@
     U_BOUNDARY_NEUTRAL
 };
 
-enum UDecompositionType { U_DT_NONE, U_DT_COMPAT, U_DT_FONT }
+enum UDecompositionType { U_DT_NONE, U_DT_COMPAT, U_DT_FONT };
 
 enum UErrorCode { U_ZERO_ERROR = 0, U_ERROR };
 
@@ -79,6 +79,7 @@
 // is implemented, that's not really worth the time.
 
 #define U_GC_CC_MASK 0
+#define U_GC_CS_MASK 0
 #define U_GC_CF_MASK 0
 #define U_GC_CN_MASK 0
 #define U_GC_LL_MASK 0
@@ -114,12 +115,14 @@
 WTF_EXPORT_PRIVATE int unorm_normalize(const UChar* source, int32_t sourceLength, UNormalizationMode mode, int32_t options, UChar* result, int32_t resultLength, UErrorCode* status);
 WTF_EXPORT_PRIVATE UCharDirection u_charDirection(UChar32);
 WTF_EXPORT_PRIVATE UChar32 u_charMirror(UChar32);
-WTF_EXPORT_PRIVATE UCharCategory u_charType(UChar32);
-inline UChar32 u_foldCase(UChar32 character, unsigned option) { ASSERT_UNUSED(options, options == U_FOLD_CASE_DEFAULT); return towlower(character); }
+WTF_EXPORT_PRIVATE int8_t u_charType(UChar32);
+inline UChar32 u_foldCase(UChar32 character, unsigned options) { ASSERT_UNUSED(options, options == U_FOLD_CASE_DEFAULT); return towlower(character); }
 WTF_EXPORT_PRIVATE uint8_t u_getCombiningClass(UChar32);
 WTF_EXPORT_PRIVATE int u_getIntPropertyValue(UChar32, UProperty);
 inline bool u_isalnum(UChar32 character) { return iswalnum(character); }
+inline bool u_isprint(UChar32 character) { return iswprint(character); }
 inline bool u_ispunct(UChar32 character) { return iswpunct(character); }
+inline bool u_isspace(UChar32 character) { return iswspace(character); }
 WTF_EXPORT_PRIVATE int u_memcasecmp(const UChar*, const UChar*, int sourceLength, unsigned options);
 inline bool u_print(UChar32 character) { return iswprint(character); }
 WTF_EXPORT_PRIVATE int u_strFoldCase(UChar* result, int resultLength, const UChar* source, int sourceLength, unsigned options, UErrorCode*);

Modified: trunk/Source/WebCore/ChangeLog (158498 => 158499)


--- trunk/Source/WebCore/ChangeLog	2013-11-02 21:18:59 UTC (rev 158498)
+++ trunk/Source/WebCore/ChangeLog	2013-11-02 21:47:46 UTC (rev 158499)
@@ -1,3 +1,23 @@
+2013-11-02  Patrick Gansterer  <par...@webkit.org>
+
+        Fix UnicodeWchar after r157330.
+        https://bugs.webkit.org/show_bug.cgi?id=123668
+
+        Reviewed by Darin Adler.
+
+        * editing/TextIterator.cpp:
+        (WebCore::SearchBuffer::append):
+        * platform/graphics/wince/FontWinCE.cpp:
+        (WebCore::generateComponents):
+        * platform/graphics/wince/GraphicsContextWinCE.cpp:
+        (WebCore::GraphicsContext::drawText):
+        * platform/text/wchar/TextBreakIteratorWchar.cpp:
+        (WebCore::isCharStop):
+        (WebCore::isLineStop):
+        (WebCore::isSentenceStop):
+        (WebCore::WordBreakIterator::next):
+        (WebCore::WordBreakIterator::previous):
+
 2013-11-02  Andreas Kling  <akl...@apple.com>
 
         Use RenderChildIterator in a couple of places.

Modified: trunk/Source/WebCore/editing/TextIterator.cpp (158498 => 158499)


--- trunk/Source/WebCore/editing/TextIterator.cpp	2013-11-02 21:18:59 UTC (rev 158498)
+++ trunk/Source/WebCore/editing/TextIterator.cpp	2013-11-02 21:47:46 UTC (rev 158499)
@@ -2350,7 +2350,7 @@
     ASSERT(U_SUCCESS(status));
     ASSERT(numFoldedCharacters);
     ASSERT(numFoldedCharacters <= maxFoldedCharacters);
-    if (!error && numFoldedCharacters) {
+    if (U_SUCCESS(status) && numFoldedCharacters) {
         numFoldedCharacters = std::min(numFoldedCharacters, maxFoldedCharacters);
         append(foldedCharacters[0], true);
         for (int i = 1; i < numFoldedCharacters; ++i)

Modified: trunk/Source/WebCore/platform/graphics/wince/FontWinCE.cpp (158498 => 158499)


--- trunk/Source/WebCore/platform/graphics/wince/FontWinCE.cpp	2013-11-02 21:18:59 UTC (rev 158498)
+++ trunk/Source/WebCore/platform/graphics/wince/FontWinCE.cpp	2013-11-02 21:47:46 UTC (rev 158499)
@@ -140,7 +140,7 @@
             UChar ch = run[i];
             if (U16_IS_LEAD(ch) && U16_IS_TRAIL(run[i-1]))
                 ch = U16_GET_SUPPLEMENTARY(ch, run[i-1]);
-            if (U16_IS_TRAIL(ch) || category(ch) == Mark_NonSpacing)
+            if (U16_IS_TRAIL(ch) || U_GET_GC_MASK(ch) & U_GC_MN_MASK)
                 continue;
             if (Font::treatAsSpace(run[i])) {
                 int add = 0;

Modified: trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp (158498 => 158499)


--- trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp	2013-11-02 21:18:59 UTC (rev 158498)
+++ trunk/Source/WebCore/platform/graphics/wince/GraphicsContextWinCE.cpp	2013-11-02 21:47:46 UTC (rev 158499)
@@ -1623,7 +1623,7 @@
                 offset += (*advance++).width();
                 int offsetInt = stableRound(offset);
                 if (isCharVisible(*srcChar)) {
-                    if (!drawOneByOne && WTF::Unicode::direction(*srcChar) == WTF::Unicode::RightToLeft)
+                    if (!drawOneByOne && u_charDirection(*srcChar) == U_RIGHT_TO_LEFT)
                         drawOneByOne = true;
                     *curChar++ = *srcChar;
                     *curSpace++ = offsetInt - lastOffset;
@@ -1635,7 +1635,7 @@
                 offset += (*advance++).width() * scaleX;
                 int offsetInt = stableRound(offset);
                 if (isCharVisible(*srcChar)) {
-                    if (!drawOneByOne && WTF::Unicode::direction(*srcChar) == WTF::Unicode::RightToLeft)
+                    if (!drawOneByOne && u_charDirection(*srcChar) == U_RIGHT_TO_LEFT)
                         drawOneByOne = true;
                     *curChar++ = *srcChar;
                     *curSpace++ = offsetInt - lastOffset;

Modified: trunk/Source/WebCore/platform/text/wchar/TextBreakIteratorWchar.cpp (158498 => 158499)


--- trunk/Source/WebCore/platform/text/wchar/TextBreakIteratorWchar.cpp	2013-11-02 21:18:59 UTC (rev 158498)
+++ trunk/Source/WebCore/platform/text/wchar/TextBreakIteratorWchar.cpp	2013-11-02 21:47:46 UTC (rev 158499)
@@ -28,7 +28,6 @@
 #include <wtf/unicode/Unicode.h>
 
 using namespace WTF;
-using namespace WTF::Unicode;
 using namespace std;
 
 namespace WebCore {
@@ -36,18 +35,18 @@
 // Hack, not entirely correct
 static inline bool isCharStop(UChar c)
 {
-    CharCategory charCategory = category(c);
-    return charCategory != Mark_NonSpacing && (charCategory != Other_Surrogate || (c < 0xd800 || c >= 0xdc00));
+    int8_t charType = u_charType(c);
+    return U_MASK(charType) & U_GC_MN_MASK || (U_MASK(charType) & U_GC_CS_MASK && (c >= 0xd800 && c < 0xdc00));
 }
 
 static inline bool isLineStop(UChar c)
 {
-    return category(c) != Separator_Line;
+    return !(U_GET_GC_MASK(c) & U_GC_ZL_MASK);
 }
 
 static inline bool isSentenceStop(UChar c)
 {
-    return isPunct(c);
+    return u_ispunct(c);
 }
 
 class TextBreakIterator {
@@ -114,9 +113,9 @@
     }
     bool haveSpace = false;
     while (currentPos < length) {
-        if (haveSpace && !isSpace(string[currentPos]))
+        if (haveSpace && !u_isspace(string[currentPos]))
             break;
-        if (isSpace(string[currentPos]))
+        if (u_isspace(string[currentPos]))
             haveSpace = true;
         ++currentPos;
     }
@@ -131,9 +130,9 @@
     }
     bool haveSpace = false;
     while (currentPos > 0) {
-        if (haveSpace && !isSpace(string[currentPos]))
+        if (haveSpace && !u_isspace(string[currentPos]))
             break;
-        if (isSpace(string[currentPos]))
+        if (u_isspace(string[currentPos]))
             haveSpace = true;
         --currentPos;
     }
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to