WebKit Bugzilla
New
Browse
Search+
Log In
×
Sign in with GitHub
or
Remember my login
Create Account
·
Forgot Password
Forgotten password account recovery
[patch]
1/4 - Moving WTF Unicode backend to GLib (v2)
1_4_WTF_Unicode_GLib_v2.diff (text/plain), 30.56 KB, created by
Dominik Röttsches (drott)
on 2009-01-16 07:46:07 PST
(
hide
)
Description:
1/4 - Moving WTF Unicode backend to GLib (v2)
Filename:
MIME Type:
Creator:
Dominik Röttsches (drott)
Created:
2009-01-16 07:46:07 PST
Size:
30.56 KB
patch
obsolete
>Index: ChangeLog >=================================================================== >--- ChangeLog (revision 39967) >+++ ChangeLog (working copy) >@@ -1,3 +1,23 @@ >+2009-01-16 Dominik Röttsches <dominik.roettsches@access-company.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ https://bugs.webkit.org/show_bug.cgi?id=15914 >+ [GTK] Implement Unicode functionality using GLib >+ >+ Initial version of this patch by Jürg Billeter. >+ >+ Adding options for --with-unicode-backend=icu|glib >+ and checking for pango version >= 1.21.0 if GLib backend >+ is selected. Temporarily, until remaining parts of >+ this patch are committed, introduce WTF_USE_GLIB_ICU_UNICODE_HYBRID >+ macro to allow for a mixed compilation with WTF Unicode >+ backend based on GLib while text codecs and TextBreakIterator >+ remain ICU dependent. >+ >+ * GNUmakefile.am: >+ * configure.ac: >+ > 2009-01-11 Xan Lopez <xan@gnome.org> > > Reviewed by Holger Freyther. >Index: GNUmakefile.am >=================================================================== >--- GNUmakefile.am (revision 39967) >+++ GNUmakefile.am (working copy) >@@ -50,8 +50,23 @@ IDL_BINDINGS := > # Global flags to CPP > global_cppflags := > >+if USE_ICU_UNICODE > global_cppflags += \ > -DWTF_USE_ICU_UNICODE=1 >+endif >+ >+if USE_GLIB_UNICODE >+# https://bugs.webkit.org/show_bug.cgi?id=15914 >+# In patch 1/4 we are compiling a hybrid version of GLib WTF Unicode >+# functionality mixed with ICU-based text codecs and TextBreakIterator. >+# For the transition, introducing an interim HYBRID macro. >+# This macro is required for compiling WTF with GLib Unicode backend, >+# but at the same time keeping ICU dependency for codecs and break iterator. >+# It will be removed with patch 3/4 of the above bug. >+global_cppflags += \ >+ -DWTF_USE_GLIB_UNICODE=1 \ >+ -DWTF_USE_GLIB_ICU_UNICODE_HYBRID=1 >+endif > > # Default compiler flags > global_cflags := \ >Index: configure.ac >=================================================================== >--- configure.ac (revision 39967) >+++ configure.ac (working copy) >@@ -222,18 +222,22 @@ AC_SUBST([PNG_LIBS]) > # determine the Unicode backend > AC_MSG_CHECKING([the Unicode backend to use]) > AC_ARG_WITH(unicode_backend, >- AC_HELP_STRING([--with-unicode-backend=@<:@icu@:>@], >+ AC_HELP_STRING([--with-unicode-backend=@<:@icu/glib@:>@], > [Select Unicode backend [default=icu]]), >- [],[unicode_backend="icu"]) >+ [],[with_unicode_backend="icu"]) > >-case "$unicode_backend" in >- icu) ;; >- *) AC_MSG_ERROR([Invalid Unicode backend: must be icu.]) ;; >+case "$with_unicode_backend" in >+ icu|glib) ;; >+ *) AC_MSG_ERROR([Invalid Unicode backend: must be icu or glib.]) ;; > esac > >-AC_MSG_RESULT([$unicode_backend]) >+AC_MSG_RESULT([$with_unicode_backend]) > >-if test "$unicode_backend" = "icu"; then >+# https://bugs.webkit.org/show_bug.cgi?id=15914 >+# Splitting ICU removal patch into smaller portions. We compile a hybrid version >+# with the WTF Unicode backend being based on GLib while text codecs and TextBreakIterator >+# keep the ICU dependency. That's why we temporarily add icu headers and libs for glib config case as well. >+if test "$with_unicode_backend" = "icu" -o "$with_unicode_backend" = "glib"; then > AC_PATH_PROG(icu_config, icu-config, no) > if test "$icu_config" = "no"; then > if test "$os_darwin" = "yes"; then >@@ -254,6 +258,17 @@ if test "$unicode_backend" = "icu"; then > fi > fi > >+if test "$with_unicode_backend" = "glib"; then >+ # https://bugs.webkit.org/show_bug.cgi?id=15914 >+ # Splitting ICU removal patch into smaller portions, that's why we >+ # temporarily retrieve flags & libs info for glib into UNICODEGLIB >+ # instead of UNICODE variable, then concatenate. >+ # Patch 3/4 of the above issue will rename the variable back to UNICODE. >+ PKG_CHECK_MODULES([UNICODEGLIB], [glib-2.0 pango >= 1.21.0]) >+ UNICODE_CFLAGS="$UNICODE_CFLAGS $UNICODEGLIB_CFLAGS" >+ UNICODE_LIBS="$UNICODE_LIBS $UNICODEGLIB_LIBS" >+fi >+ > AC_SUBST([UNICODE_CFLAGS]) > AC_SUBST([UNICODE_LIBS]) > >@@ -712,6 +727,10 @@ AM_CONDITIONAL([TARGET_WIN32], [test "$w > AM_CONDITIONAL([TARGET_QUARTZ], [test "$with_target" = "quartz"]) > AM_CONDITIONAL([TARGET_DIRECTFB], [test "$with_target" = "directfb"]) > >+# Unicode backend conditionals >+AM_CONDITIONAL([USE_ICU_UNICODE], [test "$with_unicode_backend" = "icu"]) >+AM_CONDITIONAL([USE_GLIB_UNICODE], [test "$with_unicode_backend" = "glib"]) >+ > # HTTP backend conditionals > AM_CONDITIONAL([USE_CURL], [test "$with_http_backend" = "curl"]) > AM_CONDITIONAL([USE_SOUP], [test "$with_http_backend" = "soup"]) >@@ -761,7 +780,7 @@ Build configuration: > Enable debugging (slow) : $enable_debug > Enable GCC build optimization : $enable_optimizations > Code coverage support : $enable_coverage >- Unicode backend : $unicode_backend >+ Unicode backend : $with_unicode_backend > HTTP backend : $with_http_backend > Font backend : $with_font_backend > Optimized memory allocator : $enable_fast_malloc >Index: JavaScriptCore/ChangeLog >=================================================================== >--- JavaScriptCore/ChangeLog (revision 39967) >+++ JavaScriptCore/ChangeLog (working copy) >@@ -1,3 +1,41 @@ >+2009-01-16 Dominik Röttsches <dominik.roettsches@access-company.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ https://bugs.webkit.org/show_bug.cgi?id=15914 >+ [GTK] Implement Unicode functionality using GLib >+ >+ Original patch by Jürg Billeter and Naiem Shaik. >+ Implementing WTF Unicode functionality based on GLib. >+ >+ * GNUmakefile.am: >+ * wtf/unicode/Unicode.h: >+ * wtf/unicode/glib: Added. >+ * wtf/unicode/glib/UnicodeGLib.cpp: Added. >+ (WTF::Unicode::foldCase): >+ (WTF::Unicode::toLower): >+ (WTF::Unicode::toUpper): >+ (WTF::Unicode::direction): >+ (WTF::Unicode::umemcasecmp): >+ * wtf/unicode/glib/UnicodeGLib.h: Added. >+ (WTF::Unicode::): >+ (WTF::Unicode::toLower): >+ (WTF::Unicode::toUpper): >+ (WTF::Unicode::toTitleCase): >+ (WTF::Unicode::isArabicChar): >+ (WTF::Unicode::isFormatChar): >+ (WTF::Unicode::isSeparatorSpace): >+ (WTF::Unicode::isPrintableChar): >+ (WTF::Unicode::isDigit): >+ (WTF::Unicode::isPunct): >+ (WTF::Unicode::mirroredChar): >+ (WTF::Unicode::category): >+ (WTF::Unicode::isLower): >+ (WTF::Unicode::digitValue): >+ (WTF::Unicode::combiningClass): >+ (WTF::Unicode::decompositionType): >+ * wtf/unicode/glib/UnicodeMacrosFromICU.h: Added. >+ > 2009-01-15 Geoffrey Garen <ggaren@apple.com> > > Reviewed by Cameron Zwarich. >Index: JavaScriptCore/GNUmakefile.am >=================================================================== >--- JavaScriptCore/GNUmakefile.am (revision 39967) >+++ JavaScriptCore/GNUmakefile.am (working copy) >@@ -249,9 +249,26 @@ javascriptcore_sources += \ > JavaScriptCore/wtf/unicode/CollatorDefault.cpp \ > JavaScriptCore/wtf/unicode/UTF8.cpp \ > JavaScriptCore/wtf/unicode/UTF8.h \ >- JavaScriptCore/wtf/unicode/Unicode.h \ >+ JavaScriptCore/wtf/unicode/Unicode.h >+ >+# ---- >+# icu unicode backend >+# ---- >+if USE_ICU_UNICODE >+javascriptcore_sources += \ > JavaScriptCore/wtf/unicode/icu/CollatorICU.cpp \ > JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h >+endif # USE_ICU_UNICODE >+ >+# ---- >+# glib unicode backend >+# ---- >+if USE_GLIB_UNICODE >+javascriptcore_sources += \ >+ JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h \ >+ JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp \ >+ JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h >+endif > > # Debug build > if ENABLE_DEBUG >Index: JavaScriptCore/wtf/unicode/Unicode.h >=================================================================== >--- JavaScriptCore/wtf/unicode/Unicode.h (revision 39967) >+++ JavaScriptCore/wtf/unicode/Unicode.h (working copy) >@@ -28,6 +28,8 @@ > #include "qt4/UnicodeQt4.h" > #elif USE(ICU_UNICODE) > #include <wtf/unicode/icu/UnicodeIcu.h> >+#elif USE(GLIB_UNICODE) >+#include <wtf/unicode/glib/UnicodeGLib.h> > #else > #error "Unknown Unicode implementation" > #endif >Index: JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp >=================================================================== >--- JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp (revision 0) >+++ JavaScriptCore/wtf/unicode/glib/UnicodeGLib.cpp (revision 0) >@@ -0,0 +1,214 @@ >+/* >+ * Copyright (C) 2008 Jürg Billeter <j@bitron.ch> >+ * Copyright (C) 2008 Dominik Röttsches <dominik.roettsches@access-company.com> >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ * >+ */ >+ >+#include "UnicodeGLib.h" >+ >+namespace WTF { >+namespace Unicode { >+ >+UChar32 foldCase(UChar32 ch) >+{ >+ GOwnPtr<GError> gerror; >+ >+ GOwnPtr<char> utf8char; >+ utf8char.set(g_ucs4_to_utf8(reinterpret_cast<gunichar*>(&ch), 1, 0, 0, &gerror.outPtr())); >+ if (gerror) >+ return ch; >+ >+ GOwnPtr<char> utf8caseFolded; >+ utf8caseFolded.set(g_utf8_casefold(utf8char.get(), -1)); >+ >+ GOwnPtr<gunichar> ucs4Result; >+ ucs4Result.set(g_utf8_to_ucs4_fast(utf8caseFolded.get(), -1, 0)); >+ >+ return *ucs4Result; >+} >+ >+int foldCase(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error) >+{ >+ *error = false; >+ GOwnPtr<GError> gerror; >+ >+ GOwnPtr<char> utf8src; >+ utf8src.set(g_utf16_to_utf8(src, srcLength, 0, 0, &gerror.outPtr())); >+ if (gerror) { >+ *error = true; >+ return -1; >+ } >+ >+ GOwnPtr<char> utf8result; >+ utf8result.set(g_utf8_casefold(utf8src.get(), -1)); >+ >+ long utf16resultLength = -1; >+ GOwnPtr<UChar> utf16result; >+ utf16result.set(g_utf8_to_utf16(utf8result.get(), -1, 0, &utf16resultLength, &gerror.outPtr())); >+ if (gerror) { >+ *error = true; >+ return -1; >+ } >+ >+ if (utf16resultLength > resultLength) { >+ *error = true; >+ return utf16resultLength; >+ } >+ memcpy(result, utf16result.get(), utf16resultLength * sizeof(UChar)); >+ >+ return utf16resultLength; >+} >+ >+int toLower(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error) >+{ >+ *error = false; >+ GOwnPtr<GError> gerror; >+ >+ GOwnPtr<char> utf8src; >+ utf8src.set(g_utf16_to_utf8(src, srcLength, 0, 0, &gerror.outPtr())); >+ if (gerror) { >+ *error = true; >+ return -1; >+ } >+ >+ GOwnPtr<char> utf8result; >+ utf8result.set(g_utf8_strdown(utf8src.get(), -1)); >+ >+ long utf16resultLength = -1; >+ GOwnPtr<UChar> utf16result; >+ utf16result.set(g_utf8_to_utf16(utf8result.get(), -1, 0, &utf16resultLength, &gerror.outPtr())); >+ if (gerror) { >+ *error = true; >+ return -1; >+ } >+ >+ if (utf16resultLength > resultLength) { >+ *error = true; >+ return utf16resultLength; >+ } >+ memcpy(result, utf16result.get(), utf16resultLength * sizeof(UChar)); >+ >+ return utf16resultLength; >+} >+ >+int toUpper(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error) >+{ >+ *error = false; >+ GOwnPtr<GError> gerror; >+ >+ GOwnPtr<char> utf8src; >+ utf8src.set(g_utf16_to_utf8(src, srcLength, 0, 0, &gerror.outPtr())); >+ if (gerror) { >+ *error = true; >+ return -1; >+ } >+ >+ GOwnPtr<char> utf8result; >+ utf8result.set(g_utf8_strup(utf8src.get(), -1)); >+ >+ long utf16resultLength = -1; >+ GOwnPtr<UChar> utf16result; >+ utf16result.set(g_utf8_to_utf16(utf8result.get(), -1, 0, &utf16resultLength, &gerror.outPtr())); >+ if (gerror) { >+ *error = true; >+ return -1; >+ } >+ >+ if (utf16resultLength > resultLength) { >+ *error = true; >+ return utf16resultLength; >+ } >+ memcpy(result, utf16result.get(), utf16resultLength * sizeof(UChar)); >+ >+ return utf16resultLength; >+} >+ >+Direction direction(UChar32 c) >+{ >+ PangoBidiType type = pango_bidi_type_for_unichar(c); >+ switch (type) { >+ case PANGO_BIDI_TYPE_L: >+ return LeftToRight; >+ case PANGO_BIDI_TYPE_R: >+ return RightToLeft; >+ case PANGO_BIDI_TYPE_AL: >+ return RightToLeftArabic; >+ case PANGO_BIDI_TYPE_LRE: >+ return LeftToRightEmbedding; >+ case PANGO_BIDI_TYPE_RLE: >+ return RightToLeftEmbedding; >+ case PANGO_BIDI_TYPE_LRO: >+ return LeftToRightOverride; >+ case PANGO_BIDI_TYPE_RLO: >+ return RightToLeftOverride; >+ case PANGO_BIDI_TYPE_PDF: >+ return PopDirectionalFormat; >+ case PANGO_BIDI_TYPE_EN: >+ return EuropeanNumber; >+ case PANGO_BIDI_TYPE_AN: >+ return ArabicNumber; >+ case PANGO_BIDI_TYPE_ES: >+ return EuropeanNumberSeparator; >+ case PANGO_BIDI_TYPE_ET: >+ return EuropeanNumberTerminator; >+ case PANGO_BIDI_TYPE_CS: >+ return CommonNumberSeparator; >+ case PANGO_BIDI_TYPE_NSM: >+ return NonSpacingMark; >+ case PANGO_BIDI_TYPE_BN: >+ return BoundaryNeutral; >+ case PANGO_BIDI_TYPE_B: >+ return BlockSeparator; >+ case PANGO_BIDI_TYPE_S: >+ return SegmentSeparator; >+ case PANGO_BIDI_TYPE_WS: >+ return WhiteSpaceNeutral; >+ default: >+ return OtherNeutral; >+ } >+} >+ >+int umemcasecmp(const UChar* a, const UChar* b, int len) >+{ >+ GOwnPtr<char> utf8a; >+ GOwnPtr<char> utf8b; >+ >+ utf8a.set(g_utf16_to_utf8(a, len, 0, 0, 0)); >+ utf8b.set(g_utf16_to_utf8(b, len, 0, 0, 0)); >+ >+ GOwnPtr<char> foldedA; >+ GOwnPtr<char> foldedB; >+ >+ foldedA.set(g_utf8_casefold(utf8a.get(), -1)); >+ foldedB.set(g_utf8_casefold(utf8b.get(), -1)); >+ >+ // FIXME: umemcasecmp needs to mimic u_memcasecmp of icu >+ // from the ICU docs: >+ // "Compare two strings case-insensitively using full case folding. >+ // his is equivalent to u_strcmp(u_strFoldCase(s1, n, options), u_strFoldCase(s2, n, options))." >+ // >+ // So it looks like we don't need the full g_utf8_collate here, >+ // but really a bitwise comparison of casefolded unicode chars (not utf-8 bytes). >+ // As there is no direct equivalent to this icu function in GLib, for now >+ // we'll use g_utf8_collate(): >+ >+ return g_utf8_collate(foldedA.get(), foldedB.get()); >+} >+ >+ >+} } >Index: JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h >=================================================================== >--- JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h (revision 0) >+++ JavaScriptCore/wtf/unicode/glib/UnicodeGLib.h (revision 0) >@@ -0,0 +1,228 @@ >+/* >+ * Copyright (C) 2006 George Staikos <staikos@kde.org> >+ * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com> >+ * Copyright (C) 2007 Apple Computer, Inc. All rights reserved. >+ * Copyright (C) 2008 Jürg Billeter <j@bitron.ch> >+ * Copyright (C) 2008 Dominik Röttsches <dominik.roettsches@access-company.com> >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ * >+ */ >+ >+#ifndef UnicodeGLib_h >+#define UnicodeGLib_h >+ >+#include <stdlib.h> >+#include <stdint.h> >+#include <string.h> >+ >+#include <glib.h> >+#include <pango/pango.h> >+ >+#include <wtf/GOwnPtr.h> >+ >+#include "UnicodeMacrosFromICU.h" >+ >+typedef uint16_t UChar; >+typedef int32_t UChar32; >+ >+namespace WTF { >+ namespace Unicode { >+ >+ enum Direction { >+ LeftToRight, >+ RightToLeft, >+ EuropeanNumber, >+ EuropeanNumberSeparator, >+ EuropeanNumberTerminator, >+ ArabicNumber, >+ CommonNumberSeparator, >+ BlockSeparator, >+ SegmentSeparator, >+ WhiteSpaceNeutral, >+ OtherNeutral, >+ LeftToRightEmbedding, >+ LeftToRightOverride, >+ RightToLeftArabic, >+ RightToLeftEmbedding, >+ RightToLeftOverride, >+ PopDirectionalFormat, >+ NonSpacingMark, >+ BoundaryNeutral >+ }; >+ >+ enum DecompositionType { >+ DecompositionNone, >+ DecompositionCanonical, >+ DecompositionCompat, >+ DecompositionCircle, >+ DecompositionFinal, >+ DecompositionFont, >+ DecompositionFraction, >+ DecompositionInitial, >+ DecompositionIsolated, >+ DecompositionMedial, >+ DecompositionNarrow, >+ DecompositionNoBreak, >+ DecompositionSmall, >+ DecompositionSquare, >+ DecompositionSub, >+ DecompositionSuper, >+ DecompositionVertical, >+ DecompositionWide, >+ }; >+ >+ enum CharCategory { >+ NoCategory = 0, >+ Other_NotAssigned = U_MASK(G_UNICODE_UNASSIGNED), >+ Letter_Uppercase = U_MASK(G_UNICODE_UPPERCASE_LETTER), >+ Letter_Lowercase = U_MASK(G_UNICODE_LOWERCASE_LETTER), >+ Letter_Titlecase = U_MASK(G_UNICODE_TITLECASE_LETTER), >+ Letter_Modifier = U_MASK(G_UNICODE_MODIFIER_LETTER), >+ Letter_Other = U_MASK(G_UNICODE_OTHER_LETTER), >+ >+ Mark_NonSpacing = U_MASK(G_UNICODE_NON_SPACING_MARK), >+ Mark_Enclosing = U_MASK(G_UNICODE_ENCLOSING_MARK), >+ Mark_SpacingCombining = U_MASK(G_UNICODE_COMBINING_MARK), >+ >+ Number_DecimalDigit = U_MASK(G_UNICODE_DECIMAL_NUMBER), >+ Number_Letter = U_MASK(G_UNICODE_LETTER_NUMBER), >+ Number_Other = U_MASK(G_UNICODE_OTHER_NUMBER), >+ >+ Separator_Space = U_MASK(G_UNICODE_SPACE_SEPARATOR), >+ Separator_Line = U_MASK(G_UNICODE_LINE_SEPARATOR), >+ Separator_Paragraph = U_MASK(G_UNICODE_PARAGRAPH_SEPARATOR), >+ >+ Other_Control = U_MASK(G_UNICODE_CONTROL), >+ Other_Format = U_MASK(G_UNICODE_FORMAT), >+ Other_PrivateUse = U_MASK(G_UNICODE_PRIVATE_USE), >+ Other_Surrogate = U_MASK(G_UNICODE_SURROGATE), >+ >+ Punctuation_Dash = U_MASK(G_UNICODE_DASH_PUNCTUATION), >+ Punctuation_Open = U_MASK(G_UNICODE_OPEN_PUNCTUATION), >+ Punctuation_Close = U_MASK(G_UNICODE_CLOSE_PUNCTUATION), >+ Punctuation_Connector = U_MASK(G_UNICODE_CONNECT_PUNCTUATION), >+ Punctuation_Other = U_MASK(G_UNICODE_OTHER_PUNCTUATION), >+ >+ Symbol_Math = U_MASK(G_UNICODE_MATH_SYMBOL), >+ Symbol_Currency = U_MASK(G_UNICODE_CURRENCY_SYMBOL), >+ Symbol_Modifier = U_MASK(G_UNICODE_MODIFIER_SYMBOL), >+ Symbol_Other = U_MASK(G_UNICODE_OTHER_SYMBOL), >+ >+ Punctuation_InitialQuote = U_MASK(G_UNICODE_INITIAL_PUNCTUATION), >+ Punctuation_FinalQuote = U_MASK(G_UNICODE_FINAL_PUNCTUATION) >+ }; >+ >+ UChar32 foldCase(UChar32); >+ >+ int foldCase(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error); >+ >+ int toLower(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error); >+ >+ inline UChar32 toLower(UChar32 c) >+ { >+ return g_unichar_tolower(c); >+ } >+ >+ inline UChar32 toUpper(UChar32 c) >+ { >+ return g_unichar_toupper(c); >+ } >+ >+ int toUpper(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error); >+ >+ inline UChar32 toTitleCase(UChar32 c) >+ { >+ return g_unichar_totitle(c); >+ } >+ >+ inline bool isArabicChar(UChar32 c) >+ { >+ return c >= 0x0600 && c <= 0x06FF; >+ } >+ >+ inline bool isFormatChar(UChar32 c) >+ { >+ return g_unichar_type(c) == G_UNICODE_FORMAT; >+ } >+ >+ inline bool isSeparatorSpace(UChar32 c) >+ { >+ return g_unichar_type(c) == G_UNICODE_SPACE_SEPARATOR; >+ } >+ >+ inline bool isPrintableChar(UChar32 c) >+ { >+ return g_unichar_isprint(c); >+ } >+ >+ inline bool isDigit(UChar32 c) >+ { >+ return g_unichar_isdigit(c); >+ } >+ >+ inline bool isPunct(UChar32 c) >+ { >+ return g_unichar_ispunct(c); >+ } >+ >+ inline UChar32 mirroredChar(UChar32 c) >+ { >+ gunichar mirror = 0; >+ g_unichar_get_mirror_char(c, &mirror); >+ return mirror; >+ } >+ >+ inline CharCategory category(UChar32 c) >+ { >+ if (c > 0xffff) >+ return NoCategory; >+ >+ return (CharCategory) U_MASK(g_unichar_type(c)); >+ } >+ >+ Direction direction(UChar32); >+ >+ inline bool isLower(UChar32 c) >+ { >+ return g_unichar_islower(c); >+ } >+ >+ inline int digitValue(UChar32 c) >+ { >+ return g_unichar_digit_value(c); >+ } >+ >+ inline uint8_t combiningClass(UChar32 c) >+ { >+ // FIXME >+ // return g_unichar_combining_class(c); >+ return 0; >+ } >+ >+ inline DecompositionType decompositionType(UChar32 c) >+ { >+ // FIXME >+ return DecompositionNone; >+ } >+ >+ int umemcasecmp(const UChar*, const UChar*, int len); >+ >+ } >+} >+ >+#endif >+ >Index: JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h >=================================================================== >--- JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h (revision 0) >+++ JavaScriptCore/wtf/unicode/glib/UnicodeMacrosFromICU.h (revision 0) >@@ -0,0 +1,58 @@ >+/* >+ * Copyright (C) 2006 George Staikos <staikos@kde.org> >+ * Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com> >+ * Copyright (C) 2007 Apple Computer, Inc. All rights reserved. >+ * Copyright (C) 2008 Jürg Billeter <j@bitron.ch> >+ * Copyright (C) 2008 Dominik Röttsches <dominik.roettsches@access-company.com> >+ * >+ * This library is free software; you can redistribute it and/or >+ * modify it under the terms of the GNU Library General Public >+ * License as published by the Free Software Foundation; either >+ * version 2 of the License, or (at your option) any later version. >+ * >+ * This library is distributed in the hope that it will be useful, >+ * but WITHOUT ANY WARRANTY; without even the implied warranty of >+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU >+ * Library General Public License for more details. >+ * >+ * You should have received a copy of the GNU Library General Public License >+ * along with this library; see the file COPYING.LIB. If not, write to >+ * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, >+ * Boston, MA 02110-1301, USA. >+ * >+ */ >+ >+#ifndef UnicodeMacrosFromICU_h >+#define UnicodeMacrosFromICU_h >+ >+// some defines from ICU >+ >+#define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800) >+#define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00) >+#define U16_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000) >+#define U16_GET_SUPPLEMENTARY(lead, trail) \ >+ (((UChar32)(lead)<<10UL)+(UChar32)(trail)-U16_SURROGATE_OFFSET) >+ >+#define U16_LEAD(supplementary) (UChar)(((supplementary)>>10)+0xd7c0) >+#define U16_TRAIL(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00) >+ >+#define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800) >+#define U16_IS_SINGLE(c) !U_IS_SURROGATE(c) >+#define U16_IS_SURROGATE(c) U_IS_SURROGATE(c) >+#define U16_IS_SURROGATE_LEAD(c) (((c)&0x400)==0) >+ >+#define U16_NEXT(s, i, length, c) { \ >+ (c)=(s)[(i)++]; \ >+ if(U16_IS_LEAD(c)) { \ >+ uint16_t __c2; \ >+ if((i)<(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \ >+ ++(i); \ >+ (c)=U16_GET_SUPPLEMENTARY((c), __c2); \ >+ } \ >+ } \ >+} >+ >+#define U_MASK(x) ((uint32_t)1<<(x)) >+ >+#endif >+ >Index: WebCore/ChangeLog >=================================================================== >--- WebCore/ChangeLog (revision 39967) >+++ WebCore/ChangeLog (working copy) >@@ -1,3 +1,30 @@ >+2009-01-16 Dominik Röttsches <dominik.roettsches@access-company.com> >+ >+ Reviewed by NOBODY (OOPS!). >+ >+ https://bugs.webkit.org/show_bug.cgi?id=15914 >+ [GTK] Implement Unicode functionality using GLib >+ >+ Minor changes that allow building a hybrid version of WebKit >+ that has WTF Unicode backend based on GLib functions while >+ text codecs and TextBreakIterator remain based on ICU. >+ >+ Fixed some includes that were assuming a WTF ICU backend and >+ introduced temporary usage of WTF_USE_GLIB_ICU_UNICODE_HYBRID >+ macro. >+ >+ * platform/ThreadGlobalData.cpp: >+ (WebCore::ThreadGlobalData::ThreadGlobalData): >+ (WebCore::ThreadGlobalData::~ThreadGlobalData): >+ * platform/ThreadGlobalData.h: >+ * platform/text/TextBoundariesICU.cpp: >+ * platform/text/TextCodecICU.h: >+ * platform/text/TextEncoding.cpp: >+ (WebCore::TextEncoding::encode): >+ * platform/text/TextEncodingRegistry.cpp: >+ (WebCore::buildBaseTextCodecMaps): >+ (WebCore::extendTextCodecMaps): >+ > 2009-01-16 Ariya Hidayat <ariya.hidayat@trolltech.com> > > Another attempt at fixing the Qt build. >Index: WebCore/platform/ThreadGlobalData.cpp >=================================================================== >--- WebCore/platform/ThreadGlobalData.cpp (revision 39967) >+++ WebCore/platform/ThreadGlobalData.cpp (working copy) >@@ -31,7 +31,7 @@ > #include "StringImpl.h" > #include <wtf/UnusedParam.h> > >-#if USE(ICU_UNICODE) >+#if USE(ICU_UNICODE) || USE(GLIB_ICU_UNICODE_HYBRID) > #include "TextCodecICU.h" > #endif > >@@ -70,7 +70,7 @@ ThreadGlobalData::ThreadGlobalData() > : m_emptyString(new StringImpl) > , m_atomicStringTable(new HashSet<StringImpl*>) > , m_eventNames(new EventNames) >-#if USE(ICU_UNICODE) >+#if USE(ICU_UNICODE) || USE(GLIB_ICU_UNICODE_HYBRID) > , m_cachedConverterICU(new ICUConverterWrapper) > #endif > #if PLATFORM(MAC) >@@ -84,7 +84,7 @@ ThreadGlobalData::~ThreadGlobalData() > #if PLATFORM(MAC) > delete m_cachedConverterTEC; > #endif >-#if USE(ICU_UNICODE) >+#if USE(ICU_UNICODE) || USE(GLIB_ICU_UNICODE_HYBRID) > delete m_cachedConverterICU; > #endif > >Index: WebCore/platform/ThreadGlobalData.h >=================================================================== >--- WebCore/platform/ThreadGlobalData.h (revision 39967) >+++ WebCore/platform/ThreadGlobalData.h (working copy) >@@ -46,7 +46,7 @@ namespace WebCore { > StringImpl* emptyString() { return m_emptyString; } > HashSet<StringImpl*>& atomicStringTable() { return *m_atomicStringTable; } > >-#if USE(ICU_UNICODE) >+#if USE(ICU_UNICODE) || USE(GLIB_ICU_UNICODE_HYBRID) > ICUConverterWrapper& cachedConverterICU() { return *m_cachedConverterICU; } > #endif > >@@ -59,7 +59,7 @@ namespace WebCore { > HashSet<StringImpl*>* m_atomicStringTable; > EventNames* m_eventNames; > >-#if USE(ICU_UNICODE) >+#if USE(ICU_UNICODE) || USE(GLIB_ICU_UNICODE_HYBRID) > ICUConverterWrapper* m_cachedConverterICU; > #endif > >Index: WebCore/platform/text/TextBoundariesICU.cpp >=================================================================== >--- WebCore/platform/text/TextBoundariesICU.cpp (revision 39967) >+++ WebCore/platform/text/TextBoundariesICU.cpp (working copy) >@@ -27,6 +27,7 @@ > #include "TextBoundaries.h" > > #include <unicode/ubrk.h> >+#include <unicode/uchar.h> > > #include "StringImpl.h" > #include "TextBreakIterator.h" >Index: WebCore/platform/text/TextCodecICU.h >=================================================================== >--- WebCore/platform/text/TextCodecICU.h (revision 39967) >+++ WebCore/platform/text/TextCodecICU.h (working copy) >@@ -30,6 +30,8 @@ > #include "TextCodec.h" > #include "TextEncoding.h" > >+#include <unicode/utypes.h> >+ > typedef struct UConverter UConverter; > > namespace WebCore { >Index: WebCore/platform/text/TextEncoding.cpp >=================================================================== >--- WebCore/platform/text/TextEncoding.cpp (revision 39967) >+++ WebCore/platform/text/TextEncoding.cpp (working copy) >@@ -32,7 +32,7 @@ > #include "TextCodec.h" > #include "TextDecoder.h" > #include "TextEncodingRegistry.h" >-#if USE(ICU_UNICODE) >+#if USE(ICU_UNICODE) || USE(GLIB_ICU_UNICODE_HYBRID) > #include <unicode/unorm.h> > #elif USE(QT4_UNICODE) > #include <QString> >@@ -82,7 +82,7 @@ CString TextEncoding::encode(const UChar > if (!length) > return ""; > >-#if USE(ICU_UNICODE) >+#if USE(ICU_UNICODE) || USE(GLIB_ICU_UNICODE_HYBRID) > // 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. >Index: WebCore/platform/text/TextEncodingRegistry.cpp >=================================================================== >--- WebCore/platform/text/TextEncodingRegistry.cpp (revision 39967) >+++ WebCore/platform/text/TextEncodingRegistry.cpp (working copy) >@@ -38,7 +38,7 @@ > #include <wtf/StringExtras.h> > #include <wtf/Threading.h> > >-#if USE(ICU_UNICODE) >+#if USE(ICU_UNICODE) || USE(GLIB_ICU_UNICODE_HYBRID) > #include "TextCodecICU.h" > #endif > #if PLATFORM(MAC) >@@ -185,7 +185,7 @@ static void buildBaseTextCodecMaps() > TextCodecUserDefined::registerEncodingNames(addToTextEncodingNameMap); > TextCodecUserDefined::registerCodecs(addToTextCodecMap); > >-#if USE(ICU_UNICODE) >+#if USE(ICU_UNICODE) || USE(GLIB_ICU_UNICODE_HYBRID) > TextCodecICU::registerBaseEncodingNames(addToTextEncodingNameMap); > TextCodecICU::registerBaseCodecs(addToTextCodecMap); > #endif >@@ -193,7 +193,7 @@ static void buildBaseTextCodecMaps() > > static void extendTextCodecMaps() > { >-#if USE(ICU_UNICODE) >+#if USE(ICU_UNICODE) || USE(GLIB_ICU_UNICODE_HYBRID) > TextCodecICU::registerExtendedEncodingNames(addToTextEncodingNameMap); > TextCodecICU::registerExtendedCodecs(addToTextCodecMap); > #endif
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Formatted Diff
|
Diff
Attachments on
bug 15914
:
18852
|
20824
|
21500
|
23001
|
23031
|
23124
|
23167
|
23263
|
25314
|
25348
|
25627
|
25628
|
25629
|
26711
|
26712
| 26793 |
26794
|
41434
|
41866
|
42210
|
42465