Get rid of ICU_UNICODE and WCHAR_UNICODE remnants
authordarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Jan 2014 21:36:37 +0000 (21:36 +0000)
committerdarin@apple.com <darin@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 25 Jan 2014 21:36:37 +0000 (21:36 +0000)
https://bugs.webkit.org/show_bug.cgi?id=127623

Reviewed by Anders Carlsson.

.:

* Source/cmake/OptionsEfl.cmake: Removed ICU_UNICODE and WCHAR_UNICODE flags.
* Source/cmake/OptionsGTK.cmake: Ditto.
* Source/cmake/OptionsWinCE.cmake: Ditto.

Source/JavaScriptCore:

* runtime/DatePrototype.cpp: Removed USE(ICU_UNICODE) checks, since that's always true now.

Source/WebCore:

* CMakeLists.txt: Removed SmartReplaceICU.cpp.
* GNUmakefile.list.am: Ditto.
* PlatformEfl.cmake: Ditto.
* PlatformGTK.cmake: Ditto.

* editing/FrameSelection.cpp:
(WebCore::FrameSelection::modifyMovingRight): Ditto.
(WebCore::FrameSelection::modifyMovingLeft): Ditto.

* editing/SmartReplace.cpp: Moved code here from SmartReplaceICU,
since we always support ICU now. Added some FIXME comments about
bugs and mistakes I spotted in the code as I was moving it.
* editing/SmartReplaceICU.cpp: Removed.

* editing/TextIterator.cpp: Removed unneeded checks.
* platform/ThreadGlobalData.cpp:
(WebCore::ThreadGlobalData::ThreadGlobalData): Ditto.
(WebCore::ThreadGlobalData::destroy): Ditto.
* platform/ThreadGlobalData.h: Ditto.
* platform/URL.cpp:
(WebCore::appendEncodedHostname): Ditto.
* platform/graphics/SurrogatePairAwareTextIterator.cpp: Ditto.
Also removed unneeded "using namespace".
* platform/text/TextCodecICU.cpp: Ditto.
* platform/text/TextEncoding.cpp:
(WebCore::TextEncoding::encode): Ditto.
* platform/text/TextEncodingRegistry.cpp:
(WebCore::extendTextCodecMaps): Ditto.

Source/WTF:

* wtf/CMakeLists.txt: Removed WTF_USE_ICU_UNICODE and
WTF_USE_WCHAR_UNICODE since they are true and false respectively.

* wtf/Platform.h: Removed code to set WTF_USE_ICU_UNICODE.

* wtf/unicode/Collator.h: Removed ifdefs.
* wtf/unicode/CollatorDefault.cpp: Ditto.
* wtf/unicode/Unicode.h: Ditto.
* wtf/unicode/icu/CollatorICU.cpp: Ditto.

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

29 files changed:
ChangeLog
Source/JavaScriptCore/ChangeLog
Source/JavaScriptCore/runtime/DatePrototype.cpp
Source/WTF/ChangeLog
Source/WTF/wtf/CMakeLists.txt
Source/WTF/wtf/Platform.h
Source/WTF/wtf/unicode/Collator.h
Source/WTF/wtf/unicode/CollatorDefault.cpp
Source/WTF/wtf/unicode/Unicode.h
Source/WTF/wtf/unicode/icu/CollatorICU.cpp
Source/WebCore/CMakeLists.txt
Source/WebCore/ChangeLog
Source/WebCore/GNUmakefile.list.am
Source/WebCore/PlatformEfl.cmake
Source/WebCore/PlatformGTK.cmake
Source/WebCore/editing/FrameSelection.cpp
Source/WebCore/editing/SmartReplace.cpp
Source/WebCore/editing/SmartReplaceICU.cpp [deleted file]
Source/WebCore/editing/TextIterator.cpp
Source/WebCore/platform/ThreadGlobalData.cpp
Source/WebCore/platform/ThreadGlobalData.h
Source/WebCore/platform/URL.cpp
Source/WebCore/platform/graphics/SurrogatePairAwareTextIterator.cpp
Source/WebCore/platform/text/TextCodecICU.cpp
Source/WebCore/platform/text/TextEncoding.cpp
Source/WebCore/platform/text/TextEncodingRegistry.cpp
Source/cmake/OptionsEfl.cmake
Source/cmake/OptionsGTK.cmake
Source/cmake/OptionsWinCE.cmake

index 19dd7de..8997f4d 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2014-01-25  Darin Adler  <darin@apple.com>
+
+        Get rid of ICU_UNICODE and WCHAR_UNICODE remnants
+        https://bugs.webkit.org/show_bug.cgi?id=127623
+
+        Reviewed by Anders Carlsson.
+
+        * Source/cmake/OptionsEfl.cmake: Removed ICU_UNICODE and WCHAR_UNICODE flags.
+        * Source/cmake/OptionsGTK.cmake: Ditto.
+        * Source/cmake/OptionsWinCE.cmake: Ditto.
+
 2014-01-23  Max Vujovic  <mvujovic@adobe.com>
 
         Remove CSS Custom Filters code and tests
index d1543c1..09a6c4e 100644 (file)
@@ -1,5 +1,14 @@
 2014-01-25  Darin Adler  <darin@apple.com>
 
+        Get rid of ICU_UNICODE and WCHAR_UNICODE remnants
+        https://bugs.webkit.org/show_bug.cgi?id=127623
+
+        Reviewed by Anders Carlsson.
+
+        * runtime/DatePrototype.cpp: Removed USE(ICU_UNICODE) checks, since that's always true now.
+
+2014-01-25  Darin Adler  <darin@apple.com>
+
         [Mac] Rewrite locale-specific date formatting code to remove strange string creation
         https://bugs.webkit.org/show_bug.cgi?id=127624
 
index 87623ac..b44a432 100644 (file)
 #include "Lookup.h"
 #include "ObjectPrototype.h"
 #include "Operations.h"
-
-#if !PLATFORM(MAC) && HAVE(LANGINFO_H)
-#include <langinfo.h>
-#endif
-
 #include <limits.h>
 #include <locale.h>
 #include <math.h>
 #include <stdlib.h>
 #include <time.h>
+#include <unicode/udat.h>
 #include <wtf/Assertions.h>
 #include <wtf/MathExtras.h>
 #include <wtf/StringExtras.h>
 
+#if HAVE(LANGINFO_H)
+#include <langinfo.h>
+#endif
+
 #if HAVE(SYS_PARAM_H)
 #include <sys/param.h>
 #endif
 #include <sys/timeb.h>
 #endif
 
-#if OS(DARWIN) && USE(CF)
+#if USE(CF)
 #include <CoreFoundation/CoreFoundation.h>
-#elif USE(ICU_UNICODE)
-#include <unicode/udat.h>
 #endif
 
 using namespace WTF;
@@ -170,7 +168,7 @@ static JSCell* formatLocaleDate(ExecState* exec, DateInstance*, double timeInMil
     return jsNontrivialString(exec, adoptCF(CFDateFormatterCreateStringWithAbsoluteTime(kCFAllocatorDefault, formatter.get(), absoluteTime)).get());
 }
 
-#elif USE(ICU_UNICODE) && !UCONFIG_NO_FORMATTING
+#elif !UCONFIG_NO_FORMATTING
 
 static JSCell* formatLocaleDate(ExecState* exec, DateInstance*, double timeInMilliseconds, LocaleDateTimeFormat format)
 {
index ecf0de4..053e15c 100644 (file)
@@ -1,3 +1,20 @@
+2014-01-25  Darin Adler  <darin@apple.com>
+
+        Get rid of ICU_UNICODE and WCHAR_UNICODE remnants
+        https://bugs.webkit.org/show_bug.cgi?id=127623
+
+        Reviewed by Anders Carlsson.
+
+        * wtf/CMakeLists.txt: Removed WTF_USE_ICU_UNICODE and
+        WTF_USE_WCHAR_UNICODE since they are true and false respectively.
+
+        * wtf/Platform.h: Removed code to set WTF_USE_ICU_UNICODE.
+
+        * wtf/unicode/Collator.h: Removed ifdefs.
+        * wtf/unicode/CollatorDefault.cpp: Ditto.
+        * wtf/unicode/Unicode.h: Ditto.
+        * wtf/unicode/icu/CollatorICU.cpp: Ditto.
+
 2014-01-25  Anders Carlsson  <andersca@apple.com>
 
         Remove atomicIncrement/atomicDecrement
index 56aa114..98bafb9 100644 (file)
@@ -222,30 +222,19 @@ set(WTF_LIBRARIES
     ${CMAKE_DL_LIBS}
 )
 
-if (WTF_USE_ICU_UNICODE)
-    list(APPEND WTF_HEADERS
-        unicode/icu/UnicodeIcu.h
-    )
-    list(APPEND WTF_SOURCES
-        unicode/icu/CollatorICU.cpp
-    )
-    list(APPEND WTF_INCLUDE_DIRECTORIES
-        ${ICU_INCLUDE_DIRS}
-    )
-    list(APPEND WTF_LIBRARIES
-        ${ICU_I18N_LIBRARIES}
-        ${ICU_LIBRARIES}
-    )
-elseif (WTF_USE_WCHAR_UNICODE)
-    list(APPEND WTF_HEADERS
-        unicode/wchar/UnicodeWchar.h
-    )
-    list(APPEND WTF_SOURCES
-        unicode/CollatorDefault.cpp
-
-        unicode/wchar/UnicodeWchar.cpp
-    )
-endif ()
+list(APPEND WTF_HEADERS
+    unicode/icu/UnicodeIcu.h
+)
+list(APPEND WTF_SOURCES
+    unicode/icu/CollatorICU.cpp
+)
+list(APPEND WTF_INCLUDE_DIRECTORIES
+    ${ICU_INCLUDE_DIRS}
+)
+list(APPEND WTF_LIBRARIES
+    ${ICU_I18N_LIBRARIES}
+    ${ICU_LIBRARIES}
+)
 
 if (WIN32)
     list(APPEND WTF_SOURCES
index 826526d..aa0ac57 100644 (file)
 #define WTF_USE_QUERY_PERFORMANCE_COUNTER  1
 #endif
 
-#if !USE(WCHAR_UNICODE)
-#define WTF_USE_ICU_UNICODE 1
-#endif
-
 #if PLATFORM(COCOA)
 
 #define WTF_USE_CF 1
index 913b137..67486c7 100644 (file)
@@ -33,9 +33,7 @@
 #include <wtf/OwnPtr.h>
 #include <wtf/unicode/Unicode.h>
 
-#if USE(ICU_UNICODE) && !UCONFIG_NO_COLLATION
 struct UCollator;
-#endif
 
 namespace WTF {
 
@@ -53,7 +51,7 @@ namespace WTF {
         WTF_EXPORT_PRIVATE Result collate(const ::UChar*, size_t, const ::UChar*, size_t) const;
 
     private:
-#if USE(ICU_UNICODE) && !UCONFIG_NO_COLLATION
+#if !UCONFIG_NO_COLLATION
         void createCollator() const;
         void releaseCollator();
         mutable UCollator* m_collator;
index 4e81fef..d56bb5a 100644 (file)
@@ -29,7 +29,7 @@
 #include "config.h"
 #include "Collator.h"
 
-#if !USE(ICU_UNICODE) || UCONFIG_NO_COLLATION
+#if UCONFIG_NO_COLLATION
 
 namespace WTF {
 
index bf38e2e..84f7773 100644 (file)
 // Define platform neutral 8 bit character type (L is for Latin-1).
 typedef unsigned char LChar;
 
-#if USE(ICU_UNICODE)
 #include <wtf/unicode/icu/UnicodeIcu.h>
-#elif USE(WCHAR_UNICODE)
-#include <wtf/unicode/wchar/UnicodeWchar.h>
-#else
-#error "Unknown Unicode implementation"
-#endif
 
 static_assert(sizeof(UChar) == 2, "UChar must be two bytes!");
 
index 209c023..e4059bc 100644 (file)
@@ -29,7 +29,7 @@
 #include "config.h"
 #include <wtf/unicode/Collator.h>
 
-#if USE(ICU_UNICODE) && !UCONFIG_NO_COLLATION
+#if !UCONFIG_NO_COLLATION
 
 #include <mutex>
 #include <wtf/Assertions.h>
@@ -156,4 +156,4 @@ void Collator::releaseCollator()
 
 } // namespace WTF
 
-#endif // USE(ICU_UNICODE) && !UCONFIG_NO_COLLATION
+#endif
index 859c40c..764ce28 100644 (file)
@@ -2769,29 +2769,19 @@ if (ENABLE_QUOTA)
     )
 endif ()
 
-
-if (WTF_USE_ICU_UNICODE)
-    list(APPEND WebCore_SOURCES
-        platform/text/icu/UTextProvider.cpp
-        platform/text/icu/UTextProviderLatin1.cpp
-        platform/text/icu/UTextProviderUTF16.cpp
-        platform/text/TextCodecICU.cpp
-        platform/text/TextEncodingDetectorICU.cpp
-    )
-    list(APPEND WebCore_INCLUDE_DIRECTORIES
-        ${ICU_INCLUDE_DIRS}
-    )
-    list(APPEND WebCore_LIBRARIES
-        ${ICU_LIBRARIES}
-    )
-elseif (WTF_USE_WCHAR_UNICODE)
-    list(APPEND WebCore_SOURCES
-        platform/text/TextEncodingDetectorNone.cpp
-
-        platform/text/wchar/TextBreakIteratorWchar.cpp
-    )
-endif ()
-
+list(APPEND WebCore_SOURCES
+    platform/text/icu/UTextProvider.cpp
+    platform/text/icu/UTextProviderLatin1.cpp
+    platform/text/icu/UTextProviderUTF16.cpp
+    platform/text/TextCodecICU.cpp
+    platform/text/TextEncodingDetectorICU.cpp
+)
+list(APPEND WebCore_INCLUDE_DIRECTORIES
+    ${ICU_INCLUDE_DIRS}
+)
+list(APPEND WebCore_LIBRARIES
+    ${ICU_LIBRARIES}
+)
 
 if (WTF_USE_LEVELDB)
     list(APPEND WebCore_INCLUDE_DIRECTORIES
index 778bc4d..da3f236 100644 (file)
@@ -1,5 +1,41 @@
 2014-01-25  Darin Adler  <darin@apple.com>
 
+        Get rid of ICU_UNICODE and WCHAR_UNICODE remnants
+        https://bugs.webkit.org/show_bug.cgi?id=127623
+
+        Reviewed by Anders Carlsson.
+
+        * CMakeLists.txt: Removed SmartReplaceICU.cpp.
+        * GNUmakefile.list.am: Ditto.
+        * PlatformEfl.cmake: Ditto.
+        * PlatformGTK.cmake: Ditto.
+
+        * editing/FrameSelection.cpp:
+        (WebCore::FrameSelection::modifyMovingRight): Ditto.
+        (WebCore::FrameSelection::modifyMovingLeft): Ditto.
+
+        * editing/SmartReplace.cpp: Moved code here from SmartReplaceICU,
+        since we always support ICU now. Added some FIXME comments about
+        bugs and mistakes I spotted in the code as I was moving it.
+        * editing/SmartReplaceICU.cpp: Removed.
+
+        * editing/TextIterator.cpp: Removed unneeded checks.
+        * platform/ThreadGlobalData.cpp:
+        (WebCore::ThreadGlobalData::ThreadGlobalData): Ditto.
+        (WebCore::ThreadGlobalData::destroy): Ditto.
+        * platform/ThreadGlobalData.h: Ditto.
+        * platform/URL.cpp:
+        (WebCore::appendEncodedHostname): Ditto.
+        * platform/graphics/SurrogatePairAwareTextIterator.cpp: Ditto.
+        Also removed unneeded "using namespace".
+        * platform/text/TextCodecICU.cpp: Ditto.
+        * platform/text/TextEncoding.cpp:
+        (WebCore::TextEncoding::encode): Ditto.
+        * platform/text/TextEncodingRegistry.cpp:
+        (WebCore::extendTextCodecMaps): Ditto.
+
+2014-01-25  Darin Adler  <darin@apple.com>
+
         Get rid of UnicodeRange.h/cpp, using ICU instead
         https://bugs.webkit.org/show_bug.cgi?id=127622
 
index 7f727df..df63e1d 100644 (file)
@@ -3135,7 +3135,6 @@ webcore_sources += \
        Source/WebCore/editing/SimplifyMarkupCommand.h \
        Source/WebCore/editing/SmartReplace.cpp \
        Source/WebCore/editing/SmartReplace.h \
-       Source/WebCore/editing/SmartReplaceICU.cpp \
        Source/WebCore/editing/SpellChecker.cpp \
        Source/WebCore/editing/SpellChecker.h \
        Source/WebCore/editing/SpellingCorrectionCommand.cpp \
index 7105ec4..996b76f 100644 (file)
@@ -34,7 +34,7 @@ list(APPEND WebCore_SOURCES
     accessibility/atk/WebKitAccessibleUtil.cpp
     accessibility/atk/WebKitAccessibleWrapperAtk.cpp
 
-    editing/SmartReplaceICU.cpp
+    editing/SmartReplace.cpp
 
     editing/atk/FrameSelectionAtk.cpp
 
index dfe38cc..ff6e7ee 100644 (file)
@@ -25,7 +25,7 @@ list(APPEND WebCore_INCLUDE_DIRECTORIES
 )
 
 list(APPEND WebCore_SOURCES
-    editing/SmartReplaceICU.cpp
+    editing/SmartReplace.cpp
 
     html/shadow/MediaControlsGtk.cpp
 
index cf0feaf..fcdf677 100644 (file)
@@ -712,13 +712,11 @@ VisiblePosition FrameSelection::modifyMovingRight(TextGranularity granularity)
             pos = VisiblePosition(m_selection.extent(), m_selection.affinity()).right(true);
         break;
     case WordGranularity: {
-#if USE(ICU_UNICODE)
         // Visual word movement relies on isWordTextBreak which is not implemented in WinCE and QT.
         // https://bugs.webkit.org/show_bug.cgi?id=81136.
         bool skipsSpaceWhenMovingRight = m_frame && m_frame->editor().behavior().shouldSkipSpaceWhenMovingRight();
         pos = rightWordPosition(VisiblePosition(m_selection.extent(), m_selection.affinity()), skipsSpaceWhenMovingRight);
         break;
-#endif
     }
     case SentenceGranularity:
     case LineGranularity:
@@ -908,11 +906,9 @@ VisiblePosition FrameSelection::modifyMovingLeft(TextGranularity granularity)
             pos = VisiblePosition(m_selection.extent(), m_selection.affinity()).left(true);
         break;
     case WordGranularity: {
-#if USE(ICU_UNICODE)
         bool skipsSpaceWhenMovingRight = m_frame && m_frame->editor().behavior().shouldSkipSpaceWhenMovingRight();
         pos = leftWordPosition(VisiblePosition(m_selection.extent(), m_selection.affinity()), skipsSpaceWhenMovingRight);
         break;
-#endif
     }
     case SentenceGranularity:
     case LineGranularity:
index 7b8ca45..034dbfe 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2007 Apple Inc.  All rights reserved.
+ * Copyright (C) 2008 Tony Chang <idealisms@gmail.com>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 #include "config.h"
 #include "SmartReplace.h"
 
-#if !USE(CF) && !USE(ICU_UNICODE)
+#if !USE(CF)
+
+#include <unicode/uset.h>
+#include <wtf/Assertions.h>
+#include <wtf/text/WTFString.h>
 
 namespace WebCore {
 
+static void addAllCodePoints(USet* smartSet, const String& string)
+{
+    const UChar* characters = string.characters();
+    for (size_t i = 0; i < string.length(); i++)
+        uset_add(smartSet, characters[i]);
+}
+
+// This is mostly a port of the code in WebCore/editing/SmartReplaceCF.cpp
+// except we use ICU instead of CoreFoundation character classes.
+static USet* getSmartSet(bool isPreviousCharacter)
+{
+    static USet* preSmartSet = nullptr;
+    static USet* postSmartSet = nullptr;
+    USet* smartSet = isPreviousCharacter ? preSmartSet : postSmartSet;
+    if (!smartSet) {
+        // Whitespace and newline (kCFCharacterSetWhitespaceAndNewline)
+        UErrorCode ec = U_ZERO_ERROR;
+        String whitespaceAndNewline = ASCIILiteral("[[:WSpace:] [\\u000A\\u000B\\u000C\\u000D\\u0085]]");
+        smartSet = uset_openPattern(whitespaceAndNewline.characters(), whitespaceAndNewline.length(), &ec);
+        ASSERT(U_SUCCESS(ec));
+
+        // CJK ranges
+        // FIXME: Looks like all these ranges include one extra character past the end.
+        uset_addRange(smartSet, 0x1100, 0x1100 + 256); // Hangul Jamo (0x1100 - 0x11FF)
+        uset_addRange(smartSet, 0x2E80, 0x2E80 + 352); // CJK & Kangxi Radicals (0x2E80 - 0x2FDF)
+        uset_addRange(smartSet, 0x2FF0, 0x2FF0 + 464); // Ideograph Descriptions, CJK Symbols, Hiragana, Katakana, Bopomofo, Hangul Compatibility Jamo, Kanbun, & Bopomofo Ext (0x2FF0 - 0x31BF)
+        uset_addRange(smartSet, 0x3200, 0x3200 + 29392); // Enclosed CJK, CJK Ideographs (Uni Han & Ext A), & Yi (0x3200 - 0xA4CF)
+        uset_addRange(smartSet, 0xAC00, 0xAC00 + 11183); // Hangul Syllables (0xAC00 - 0xD7AF)
+        uset_addRange(smartSet, 0xF900, 0xF900 + 352); // CJK Compatibility Ideographs (0xF900 - 0xFA5F)
+        uset_addRange(smartSet, 0xFE30, 0xFE30 + 32); // CJK Compatibility From (0xFE30 - 0xFE4F)
+        uset_addRange(smartSet, 0xFF00, 0xFF00 + 240); // Half/Full Width Form (0xFF00 - 0xFFEF)
+        uset_addRange(smartSet, 0x20000, 0x20000 + 0xA6D7); // CJK Ideograph Exntension B
+        uset_addRange(smartSet, 0x2F800, 0x2F800 + 0x021E); // CJK Compatibility Ideographs (0x2F800 - 0x2FA1D)
+
+        if (isPreviousCharacter) {
+            // FIXME: Silly to convert this to a WTF::String just to loop through the characters.
+            addAllCodePoints(smartSet, ASCIILiteral("([\"\'#$/-`{"));
+            preSmartSet = smartSet;
+        } else {
+            // FIXME: Silly to convert this to a WTF::String just to loop through the characters.
+            addAllCodePoints(smartSet, ASCIILiteral(")].,;:?\'!\"%*-/}"));
+
+            // Punctuation (kCFCharacterSetPunctuation)
+            UErrorCode ec = U_ZERO_ERROR;
+            String punctuationClass = ASCIILiteral("[:P:]");
+            USet* icuPunct = uset_openPattern(punctuationClass.characters(), punctuationClass.length(), &ec);
+            ASSERT(U_SUCCESS(ec));
+            uset_addAll(smartSet, icuPunct);
+            uset_close(icuPunct);
+
+            postSmartSet = smartSet;
+        }
+    }
+    return smartSet;
+}
+
 bool isCharacterSmartReplaceExempt(UChar32 c, bool isPreviousCharacter)
 {
-    return false;
+    return uset_contains(getSmartSet(isPreviousCharacter), c);
 }
 
 }
diff --git a/Source/WebCore/editing/SmartReplaceICU.cpp b/Source/WebCore/editing/SmartReplaceICU.cpp
deleted file mode 100644 (file)
index c6ea7d6..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * Copyright (C) 2007 Apple Inc.  All rights reserved.
- * Copyright (C) 2008 Tony Chang <idealisms@gmail.com>
- *
- * Redistribution and use in source and binary forms, with or without
- * modification, are permitted provided that the following conditions
- * are met:
- *
- * 1.  Redistributions of source code must retain the above copyright
- *     notice, this list of conditions and the following disclaimer. 
- * 2.  Redistributions in binary form must reproduce the above copyright
- *     notice, this list of conditions and the following disclaimer in the
- *     documentation and/or other materials provided with the distribution. 
- * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
- *     its contributors may be used to endorse or promote products derived
- *     from this software without specific prior written permission. 
- *
- * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
- * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
- * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
- * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
- * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
- * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
- * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
- * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
- * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- */
-
-#include "config.h"
-#include "SmartReplace.h"
-
-#if !USE(CF) && USE(ICU_UNICODE)
-#include <unicode/uset.h>
-#include <wtf/Assertions.h>
-#include <wtf/text/WTFString.h>
-
-namespace WebCore {
-
-static void addAllCodePoints(USet* smartSet, const String& string)
-{
-    const UChar* characters = string.characters();
-    for (size_t i = 0; i < string.length(); i++)
-        uset_add(smartSet, characters[i]);
-}
-
-// This is mostly a port of the code in WebCore/editing/SmartReplaceCF.cpp
-// except we use icu in place of CoreFoundations character classes.
-static USet* getSmartSet(bool isPreviousCharacter)
-{
-    static USet* preSmartSet = NULL; 
-    static USet* postSmartSet = NULL;
-    USet* smartSet = isPreviousCharacter ? preSmartSet : postSmartSet;
-    if (!smartSet) {
-        // Whitespace and newline (kCFCharacterSetWhitespaceAndNewline)
-        UErrorCode ec = U_ZERO_ERROR;
-        String whitespaceAndNewline = ASCIILiteral("[[:WSpace:] [\\u000A\\u000B\\u000C\\u000D\\u0085]]");
-        smartSet = uset_openPattern(whitespaceAndNewline.characters(), whitespaceAndNewline.length(), &ec);
-        ASSERT(U_SUCCESS(ec));
-
-        // CJK ranges
-        uset_addRange(smartSet, 0x1100, 0x1100 + 256); // Hangul Jamo (0x1100 - 0x11FF)
-        uset_addRange(smartSet, 0x2E80, 0x2E80 + 352); // CJK & Kangxi Radicals (0x2E80 - 0x2FDF)
-        uset_addRange(smartSet, 0x2FF0, 0x2FF0 + 464); // Ideograph Descriptions, CJK Symbols, Hiragana, Katakana, Bopomofo, Hangul Compatibility Jamo, Kanbun, & Bopomofo Ext (0x2FF0 - 0x31BF)
-        uset_addRange(smartSet, 0x3200, 0x3200 + 29392); // Enclosed CJK, CJK Ideographs (Uni Han & Ext A), & Yi (0x3200 - 0xA4CF)
-        uset_addRange(smartSet, 0xAC00, 0xAC00 + 11183); // Hangul Syllables (0xAC00 - 0xD7AF)
-        uset_addRange(smartSet, 0xF900, 0xF900 + 352); // CJK Compatibility Ideographs (0xF900 - 0xFA5F)
-        uset_addRange(smartSet, 0xFE30, 0xFE30 + 32); // CJK Compatibility From (0xFE30 - 0xFE4F)
-        uset_addRange(smartSet, 0xFF00, 0xFF00 + 240); // Half/Full Width Form (0xFF00 - 0xFFEF)
-        uset_addRange(smartSet, 0x20000, 0x20000 + 0xA6D7); // CJK Ideograph Exntension B
-        uset_addRange(smartSet, 0x2F800, 0x2F800 + 0x021E); // CJK Compatibility Ideographs (0x2F800 - 0x2FA1D)
-
-        if (isPreviousCharacter) {
-            addAllCodePoints(smartSet, ASCIILiteral("([\"\'#$/-`{"));
-            preSmartSet = smartSet;
-        } else {
-            addAllCodePoints(smartSet, ASCIILiteral(")].,;:?\'!\"%*-/}"));
-
-            // Punctuation (kCFCharacterSetPunctuation)
-            UErrorCode ec = U_ZERO_ERROR;
-            String punctuationClass = ASCIILiteral("[:P:]");
-            USet* icuPunct = uset_openPattern(punctuationClass.characters(), punctuationClass.length(), &ec);
-            ASSERT(U_SUCCESS(ec));
-            uset_addAll(smartSet, icuPunct);
-            uset_close(icuPunct);
-
-            postSmartSet = smartSet;
-        }
-    }
-    return smartSet;
-}
-
-bool isCharacterSmartReplaceExempt(UChar32 c, bool isPreviousCharacter)
-{
-    return uset_contains(getSmartSet(isPreviousCharacter), c);
-}
-
-}
-
-#endif // !USE(CF) && USE(ICU_UNICODE)
index 8ca767b..1e40780 100644 (file)
@@ -52,7 +52,7 @@
 #include <wtf/text/CString.h>
 #include <wtf/unicode/CharacterNames.h>
 
-#if USE(ICU_UNICODE) && !UCONFIG_NO_COLLATION
+#if !UCONFIG_NO_COLLATION
 #include "TextBreakIteratorInternalICU.h"
 #include <unicode/usearch.h>
 #endif
@@ -86,7 +86,7 @@ public:
     size_t search(size_t& startOffset);
     bool atBreak() const;
 
-#if USE(ICU_UNICODE) && !UCONFIG_NO_COLLATION
+#if !UCONFIG_NO_COLLATION
 
 private:
     bool isBadMatch(const UChar*, size_t length) const;
@@ -1702,7 +1702,7 @@ static inline void foldQuoteMarksAndSoftHyphens(String& s)
     s.replace(softHyphen, 0);
 }
 
-#if USE(ICU_UNICODE) && !UCONFIG_NO_COLLATION
+#if !UCONFIG_NO_COLLATION
 
 static inline void foldQuoteMarksAndSoftHyphens(UChar* data, size_t length)
 {
@@ -2305,7 +2305,7 @@ nextMatch:
     return matchedLength;
 }
 
-#else // !ICU_UNICODE
+#else
 
 inline SearchBuffer::SearchBuffer(const String& target, FindOptions options)
     : m_target(options & CaseInsensitive ? target.foldCase() : target)
@@ -2415,7 +2415,7 @@ size_t SearchBuffer::length() const
     return length;
 }
 
-#endif // !ICU_UNICODE
+#endif
 
 // --------
 
index cefb19d..8e7e6e2 100644 (file)
 #include "CachedResourceRequestInitiators.h"
 #include "EventNames.h"
 #include "InspectorCounters.h"
+#include "TextCodecICU.h"
 #include "ThreadTimers.h"
 #include <wtf/MainThread.h>
+#include <wtf/ThreadSpecific.h>
+#include <wtf/Threading.h>
 #include <wtf/WTFThreadData.h>
 #include <wtf/text/StringImpl.h>
 
-#if USE(ICU_UNICODE)
-#include "TextCodecICU.h"
-#endif
-
-#if PLATFORM(MAC)
-#include "TextCodecMac.h"
+#if PLATFORM(MAC) && !PLATFORM(IOS)
+#include "TextCodeCMac.h"
 #endif
 
-#include <wtf/Threading.h>
-#include <wtf/ThreadSpecific.h>
-using namespace WTF;
-
 namespace WebCore {
 
 ThreadSpecific<ThreadGlobalData>* ThreadGlobalData::staticData;
@@ -61,9 +56,7 @@ ThreadGlobalData::ThreadGlobalData()
 #ifndef NDEBUG
     , m_isMainThread(isMainThread())
 #endif
-#if USE(ICU_UNICODE)
     , m_cachedConverterICU(adoptPtr(new ICUConverterWrapper))
-#endif
 #if PLATFORM(MAC) && !PLATFORM(IOS)
     , m_cachedConverterTEC(adoptPtr(new TECConverterWrapper))
 #endif
@@ -89,9 +82,7 @@ void ThreadGlobalData::destroy()
     m_cachedConverterTEC.clear();
 #endif
 
-#if USE(ICU_UNICODE)
     m_cachedConverterICU.clear();
-#endif
 
 #if ENABLE(INSPECTOR)
     m_inspectorCounters.clear();
index ffb018c..e386be2 100644 (file)
@@ -58,9 +58,7 @@ namespace WebCore {
         EventNames& eventNames() { return *m_eventNames; }
         ThreadTimers& threadTimers() { return *m_threadTimers; }
 
-#if USE(ICU_UNICODE)
         ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; }
-#endif
 
 #if PLATFORM(MAC) && !PLATFORM(IOS)
         TECConverterWrapper& cachedConverterTEC() { return *m_cachedConverterTEC; }
@@ -83,9 +81,7 @@ namespace WebCore {
         bool m_isMainThread;
 #endif
 
-#if USE(ICU_UNICODE)
         OwnPtr<ICUConverterWrapper> m_cachedConverterICU;
-#endif
 
 #if PLATFORM(MAC) && !PLATFORM(IOS)
         OwnPtr<TECConverterWrapper> m_cachedConverterTEC;
index 34863be..1bce2aa 100644 (file)
@@ -31,6 +31,7 @@
 #include "MIMETypeRegistry.h"
 #include "TextEncoding.h"
 #include <stdio.h>
+#include <unicode/uidna.h>
 #include <wtf/HashMap.h>
 #include <wtf/HexNumber.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/StringBuilder.h>
 #include <wtf/text/StringHash.h>
 
-#if USE(ICU_UNICODE)
-#include <unicode/uidna.h>
-#endif
-
 // FIXME: This file makes too much use of the + operator on String.
 // We either have to optimize that operator so it doesn't involve
 // so many allocations, or change this to use StringBuffer instead.
@@ -1504,14 +1501,12 @@ static void appendEncodedHostname(UCharBuffer& buffer, const UChar* str, unsigne
         return;
     }
 
-#if USE(ICU_UNICODE)
     UChar hostnameBuffer[hostnameBufferLength];
     UErrorCode error = U_ZERO_ERROR;
     int32_t numCharactersConverted = uidna_IDNToASCII(str, strLen, hostnameBuffer,
         hostnameBufferLength, UIDNA_ALLOW_UNASSIGNED, 0, &error);
     if (error == U_ZERO_ERROR)
         buffer.append(hostnameBuffer, numCharactersConverted);
-#endif
 }
 
 static void findHostnamesInMailToURL(const UChar* str, int strLen, Vector<std::pair<int, int>>& nameRanges)
index ed6a333..9155e71 100644 (file)
 #include "config.h"
 #include "SurrogatePairAwareTextIterator.h"
 
-#if USE(ICU_UNICODE)
 #include <unicode/unorm.h>
-#endif
-
-using namespace WTF;
-using namespace Unicode;
 
 namespace WebCore {
 
index c954bf2..f6d16cb 100644 (file)
@@ -25,7 +25,6 @@
  */
 
 #include "config.h"
-#if USE(ICU_UNICODE)
 #include "TextCodecICU.h"
 
 #include "TextEncoding.h"
@@ -542,5 +541,3 @@ CString TextCodecICU::encode(const UChar* characters, size_t length, Unencodable
 }
 
 } // namespace WebCore
-#endif
-
index f457b16..d270826 100644 (file)
 
 #include "TextCodec.h"
 #include "TextEncodingRegistry.h"
+#include <unicode/unorm.h>
 #include <wtf/OwnPtr.h>
 #include <wtf/StdLibExtras.h>
 #include <wtf/text/CString.h>
 #include <wtf/text/WTFString.h>
 
-#if USE(ICU_UNICODE)
-#include <unicode/unorm.h>
-#endif
-
 namespace WebCore {
 
 static const TextEncoding& UTF7Encoding()
@@ -75,7 +72,6 @@ CString TextEncoding::encode(const UChar* characters, size_t length, Unencodable
     if (!length)
         return "";
 
-#if USE(ICU_UNICODE)
     // FIXME: What's the right place to do normalization?
     // It's a little strange to do it inside the encode function.
     // Perhaps normalization should be an explicit step done before calling encode.
@@ -101,11 +97,6 @@ CString TextEncoding::encode(const UChar* characters, size_t length, Unencodable
         sourceLength = normalizedLength;
     }
     return newTextCodec(*this)->encode(source, sourceLength, handling);
-#elif OS(WINDOWS) && USE(WCHAR_UNICODE)
-    // normalization will be done by Windows CE API
-    OwnPtr<TextCodec> textCodec = newTextCodec(*this);
-    return textCodec.get() ? textCodec->encode(characters, length, handling) : CString();
-#endif
 }
 
 const char* TextEncoding::domName() const
index 8dfd1fd..6bdd8fa 100644 (file)
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "TextEncodingRegistry.h"
 
+#include "TextCodecICU.h"
 #include "TextCodecLatin1.h"
 #include "TextCodecUserDefined.h"
 #include "TextCodecUTF16.h"
 #include <wtf/StdLibExtras.h>
 #include <wtf/StringExtras.h>
 
-#if USE(ICU_UNICODE)
-#include "TextCodecICU.h"
-#endif
 #if PLATFORM(MAC) && !PLATFORM(IOS)
 #include "TextCodecMac.h"
 #endif
-#if OS(WINDOWS) && USE(WCHAR_UNICODE)
-#include "win/TextCodecWin.h"
-#endif
 
 #include <wtf/CurrentTime.h>
 #include <wtf/text/CString.h>
@@ -281,21 +276,14 @@ bool shouldShowBackslashAsCurrencySymbolIn(const char* canonicalEncodingName)
 
 static void extendTextCodecMaps()
 {
-#if USE(ICU_UNICODE)
     TextCodecICU::registerEncodingNames(addToTextEncodingNameMap);
     TextCodecICU::registerCodecs(addToTextCodecMap);
-#endif
 
 #if PLATFORM(MAC) && !PLATFORM(IOS)
     TextCodecMac::registerEncodingNames(addToTextEncodingNameMap);
     TextCodecMac::registerCodecs(addToTextCodecMap);
 #endif
 
-#if OS(WINDOWS) && USE(WCHAR_UNICODE)
-    TextCodecWin::registerExtendedEncodingNames(addToTextEncodingNameMap);
-    TextCodecWin::registerExtendedCodecs(addToTextCodecMap);
-#endif
-
     pruneBlacklistedCodecs();
     buildQuirksSets();
 }
index 5e806bb..b4e8206 100644 (file)
@@ -28,13 +28,11 @@ find_package(ZLIB REQUIRED)
 find_package(GLIB 2.36.0 REQUIRED COMPONENTS gio gobject gthread)
 find_package(LibSoup 2.42.0 REQUIRED)
 
-set(WTF_USE_ICU_UNICODE 1)
 set(WTF_USE_SOUP 1)
 set(WTF_USE_UDIS86 1)
 
 add_definitions(-DWTF_USE_GLIB=1)
 add_definitions(-DWTF_USE_SOUP=1)
-add_definitions(-DWTF_USE_ICU_UNICODE=1)
 add_definitions(-DWTF_USE_CAIRO=1)
 add_definitions(-DWTF_USE_CROSS_PLATFORM_CONTEXT_MENUS=1)
 
index 93efd85..246a62a 100644 (file)
@@ -111,7 +111,6 @@ set(ENABLE_PLUGIN_PROCESS ON)
 set(ENABLE_WEBKIT ON)
 set(ENABLE_WEBKIT2 ON)
 
-set(WTF_USE_ICU_UNICODE 1)
 set(WTF_USE_SOUP 1)
 
 set(WTF_OUTPUT_NAME WTFGTK)
index 8778c4d..4337a48 100644 (file)
@@ -1,11 +1,9 @@
 include(OptionsWindows)
 
 set(PORT_FALLBACK Win)
-set(WTF_USE_WCHAR_UNICODE 1)
 
 add_definitions(-D_CE_CRT_ALLOW_WIN_MINMAX)
 add_definitions(-DWTF_USE_EXPORT_MACROS=0)
-add_definitions(-DWTF_USE_WCHAR_UNICODE=1)
 add_definitions(-DWTF_USE_WINGDI=1)
 add_definitions(-DWTF_USE_WININET=1)
 add_definitions(-DWINCEBASIC)