JavaScriptCore:
authorhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Dec 2006 05:54:29 +0000 (05:54 +0000)
committerhyatt <hyatt@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Sat, 9 Dec 2006 05:54:29 +0000 (05:54 +0000)
        Land the new ICU abstraction layer.  Patch by Lars.

        Reviewed by me

        * JavaScriptCore.xcodeproj/project.pbxproj:
        * wtf/Platform.h:
        * wtf/unicode/UnicodeCategory.h: Removed.
        * wtf/unicode/UnicodeDecomposition.h: Removed.
        * wtf/unicode/UnicodeDirection.h: Removed.
        * wtf/unicode/icu/UnicodeIcu.h:
        (WTF::Unicode::):
        (WTF::Unicode::foldCase):
        (WTF::Unicode::toLower):
        (WTF::Unicode::toUpper):
        (WTF::Unicode::toTitleCase):
        (WTF::Unicode::isDigit):
        (WTF::Unicode::isSpace):
        (WTF::Unicode::isPunct):
        (WTF::Unicode::mirroredChar):
        (WTF::Unicode::category):
        (WTF::Unicode::direction):
        (WTF::Unicode::isLower):
        (WTF::Unicode::isUpper):
        (WTF::Unicode::digitValue):
        (WTF::Unicode::combiningClass):
        (WTF::Unicode::decompositionType):
        (WTF::Unicode::strcasecmp):
        (WTF::Unicode::memset):
        * wtf/unicode/qt4/UnicodeQt4.cpp: Removed.
        * wtf/unicode/qt4/UnicodeQt4.h:
        (WTF::Unicode::):
        (WTF::Unicode::toLower):
        (WTF::Unicode::toUpper):
        (WTF::Unicode::toTitleCase):
        (WTF::Unicode::foldCase):
        (WTF::Unicode::isPrintableChar):
        (WTF::Unicode::isLower):
        (WTF::Unicode::isUpper):
        (WTF::Unicode::digitValue):
        (WTF::Unicode::combiningClass):
        (WTF::Unicode::decompositionType):
        (WTF::Unicode::strcasecmp):
        (WTF::Unicode::memset):
        (WTF::Unicode::direction):
        (WTF::Unicode::category):

WebCore:

        Land the new ICU abstraction layer (WTF::Unicode).  Patch
        by Lars with a couple of fixes thrown in by me.

        Reviewed by hyatt

        * ForwardingHeaders/wtf/icu/UnicodeIcu.h: Added.
        * ForwardingHeaders/wtf/unicode/Unicode.h: Added.
        * WebCore.xcodeproj/project.pbxproj:
        * css/cssparser.cpp:
        (WebCore::ParseString::lower):
        * dom/Document.cpp:
        (WebCore::isValidNameStart):
        (WebCore::isValidNamePart):
        * editing/TextIterator.cpp:
        (WebCore::CircularSearchBuffer::append):
        * html/HTMLFontElement.cpp:
        (WebCore::parseFontSizeNumber):
        * html/HTMLInputElement.cpp:
        (WebCore::numGraphemeClusters):
        (WebCore::numCharactersInGraphemeClusters):
        * html/HTMLSelectElement.cpp:
        (WebCore::stripLeadingWhiteSpace):
        * page/Frame.h:
        * platform/DeprecatedString.h:
        (WebCore::DeprecatedChar::isSpace):
        (WebCore::DeprecatedChar::lower):
        (WebCore::DeprecatedChar::upper):
        * platform/Font.cpp:
        (WebCore::WidthIterator::advance):
        (WebCore::WidthIterator::normalizeVoicingMarks):
        * platform/FontCache.h:
        * platform/FontData.h:
        * platform/GlyphMap.cpp:
        * platform/GlyphMap.h:
        * platform/GlyphWidthMap.h:
        * platform/KURL.cpp:
        (WebCore::encodeHostname):
        * platform/StringHash.h:
        (WTF::):
        * platform/StringImpl.cpp:
        (WebCore::isSpace):
        (WebCore::parseLength):
        (WebCore::StringImpl::isLower):
        (WebCore::StringImpl::lower):
        (WebCore::StringImpl::upper):
        (WebCore::StringImpl::secure):
        (WebCore::StringImpl::foldCase):
        (WebCore::StringImpl::capitalize):
        (WebCore::StringImpl::toInt):
        (WebCore::equalIgnoringCase):
        (WebCore::StringImpl::find):
        * platform/StringImpl.h:
        * platform/TextBoundaries.h:
        * platform/TextBreakIterator.h: Added.
        (WebCore::):
        * platform/TextBreakIteratorICU.cpp: Added.
        (WebCore::wordBreakIterator):
        (WebCore::characterBreakIterator):
        (WebCore::textBreakFirst):
        (WebCore::textBreakNext):
        (WebCore::textBreakPreceding):
        (WebCore::textBreakFollowing):
        (WebCore::textBreakCurrent):
        * platform/TextCodec.h:
        * platform/TextCodecLatin1.cpp:
        * platform/TextEncoding.cpp:
        (WebCore::TextEncoding::encode):
        * platform/TextEncoding.h:
        * platform/TextEncodingRegistry.cpp:
        (WebCore::buildTextEncodingNameMap):
        (WebCore::buildTextCodecMap):
        * platform/TextEncodingRegistry.h:
        * platform/UChar.h: Removed.
        * platform/graphics/GraphicsContext.h:
        * platform/qt/GlyphMapQt.cpp:
        * platform/qt/TextBreakIteratorQt.cpp: Added.
        (WebCore::TextBreakIterator::following):
        (WebCore::TextBreakIterator::preceding):
        (WebCore::WordBreakIteratorQt::first):
        (WebCore::WordBreakIteratorQt::next):
        (WebCore::WordBreakIteratorQt::previous):
        (WebCore::CharBreakIteratorQt::first):
        (WebCore::CharBreakIteratorQt::next):
        (WebCore::CharBreakIteratorQt::previous):
        (WebCore::wordBreakIterator):
        (WebCore::characterBreakIterator):
        (WebCore::textBreakFirst):
        (WebCore::textBreakNext):
        (WebCore::textBreakPreceding):
        (WebCore::textBreakFollowing):
        (WebCore::textBreakCurrent):
        * platform/qt/TextCodecQt.cpp: Added.
        (WebCore::getAtomicName):
        (WebCore::TextCodecQt::registerEncodingNames):
        (WebCore::newTextCodecQt):
        (WebCore::TextCodecQt::registerCodecs):
        (WebCore::TextCodecQt::TextCodecQt):
        (WebCore::TextCodecQt::~TextCodecQt):
        (WebCore::TextCodecQt::decode):
        (WebCore::TextCodecQt::encode):
        * platform/qt/TextCodecQt.h: Added.
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::updateFirstLetter):
        * rendering/RenderText.cpp:
        (WebCore::RenderText::previousOffset):
        (WebCore::RenderText::nextOffset):
        (WebCore::RenderText::widthFromCache):
        * rendering/RenderText.h:
        * rendering/bidi.cpp:
        (WebCore::BidiState::BidiState):
        (WebCore::BidiContext::BidiContext):
        (WebCore::bidiNext):
        (WebCore::bidiFirst):
        (WebCore::BidiIterator::direction):
        (WebCore::appendRun):
        (WebCore::embed):
        (WebCore::RenderBlock::computeHorizontalPositionsForLine):
        (WebCore::RenderBlock::bidiReorderLine):
        (WebCore::RenderBlock::layoutInlineChildren):
        * rendering/bidi.h:
        (WebCore::BidiStatus::BidiStatus):
        (WebCore::BidiContext::dir):
        (WebCore::BidiContext::basicDir):
        (WebCore::BidiRun::BidiRun):
        * rendering/break_lines.h:

WebKit:

        Land new ICU abstraction layer.  Patch by Lars.

        Reviewed by me

        * ForwardingHeaders/wtf/icu/UnicodeIcu.h: Added.
        * ForwardingHeaders/wtf/unicode/Unicode.h: Added.
        * WebKit.xcodeproj/project.pbxproj:

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

55 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
JavaScriptCore/wtf/Platform.h
JavaScriptCore/wtf/unicode/UnicodeCategory.h [deleted file]
JavaScriptCore/wtf/unicode/UnicodeDecomposition.h [deleted file]
JavaScriptCore/wtf/unicode/UnicodeDirection.h [deleted file]
JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h
JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.cpp [deleted file]
JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
WebCore/ChangeLog
WebCore/ForwardingHeaders/wtf/icu/UnicodeIcu.h [new file with mode: 0644]
WebCore/ForwardingHeaders/wtf/unicode/Unicode.h [new file with mode: 0644]
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/css/cssparser.cpp
WebCore/dom/Document.cpp
WebCore/editing/TextIterator.cpp
WebCore/html/HTMLFontElement.cpp
WebCore/html/HTMLInputElement.cpp
WebCore/html/HTMLSelectElement.cpp
WebCore/page/Frame.h
WebCore/platform/DeprecatedString.h
WebCore/platform/Font.cpp
WebCore/platform/FontCache.h
WebCore/platform/FontData.h
WebCore/platform/GlyphMap.cpp
WebCore/platform/GlyphMap.h
WebCore/platform/GlyphWidthMap.h
WebCore/platform/KURL.cpp
WebCore/platform/StringHash.h
WebCore/platform/StringImpl.cpp
WebCore/platform/StringImpl.h
WebCore/platform/TextBoundaries.h
WebCore/platform/TextBreakIterator.h [new file with mode: 0644]
WebCore/platform/TextBreakIteratorICU.cpp [new file with mode: 0644]
WebCore/platform/TextCodec.h
WebCore/platform/TextCodecLatin1.cpp
WebCore/platform/TextEncoding.cpp
WebCore/platform/TextEncoding.h
WebCore/platform/TextEncodingRegistry.cpp
WebCore/platform/TextEncodingRegistry.h
WebCore/platform/graphics/GraphicsContext.h
WebCore/platform/qt/GlyphMapQt.cpp
WebCore/platform/qt/TextBreakIteratorQt.cpp [new file with mode: 0644]
WebCore/platform/qt/TextCodecQt.cpp [new file with mode: 0644]
WebCore/platform/qt/TextCodecQt.h [moved from WebCore/platform/UChar.h with 61% similarity]
WebCore/rendering/RenderBlock.cpp
WebCore/rendering/RenderText.cpp
WebCore/rendering/RenderText.h
WebCore/rendering/bidi.cpp
WebCore/rendering/bidi.h
WebCore/rendering/break_lines.h
WebKit/ChangeLog
WebKit/ForwardingHeaders/wtf/icu/UnicodeIcu.h [new file with mode: 0644]
WebKit/ForwardingHeaders/wtf/unicode/Unicode.h [new file with mode: 0644]
WebKit/WebKit.xcodeproj/project.pbxproj

index d3920b5974638b2b9994e1dcc4cf91979ac06906..1a2c66126d7f18264b0dd7bde1e9b3e8611452ad 100644 (file)
@@ -1,3 +1,51 @@
+2006-12-08  David Hyatt  <hyatt@apple.com>
+
+        Land the new ICU abstraction layer.  Patch by Lars.
+
+        Reviewed by me
+
+        * JavaScriptCore.xcodeproj/project.pbxproj:
+        * wtf/Platform.h:
+        * wtf/unicode/UnicodeCategory.h: Removed.
+        * wtf/unicode/UnicodeDecomposition.h: Removed.
+        * wtf/unicode/UnicodeDirection.h: Removed.
+        * wtf/unicode/icu/UnicodeIcu.h:
+        (WTF::Unicode::):
+        (WTF::Unicode::foldCase):
+        (WTF::Unicode::toLower):
+        (WTF::Unicode::toUpper):
+        (WTF::Unicode::toTitleCase):
+        (WTF::Unicode::isDigit):
+        (WTF::Unicode::isSpace):
+        (WTF::Unicode::isPunct):
+        (WTF::Unicode::mirroredChar):
+        (WTF::Unicode::category):
+        (WTF::Unicode::direction):
+        (WTF::Unicode::isLower):
+        (WTF::Unicode::isUpper):
+        (WTF::Unicode::digitValue):
+        (WTF::Unicode::combiningClass):
+        (WTF::Unicode::decompositionType):
+        (WTF::Unicode::strcasecmp):
+        (WTF::Unicode::memset):
+        * wtf/unicode/qt4/UnicodeQt4.cpp: Removed.
+        * wtf/unicode/qt4/UnicodeQt4.h:
+        (WTF::Unicode::):
+        (WTF::Unicode::toLower):
+        (WTF::Unicode::toUpper):
+        (WTF::Unicode::toTitleCase):
+        (WTF::Unicode::foldCase):
+        (WTF::Unicode::isPrintableChar):
+        (WTF::Unicode::isLower):
+        (WTF::Unicode::isUpper):
+        (WTF::Unicode::digitValue):
+        (WTF::Unicode::combiningClass):
+        (WTF::Unicode::decompositionType):
+        (WTF::Unicode::strcasecmp):
+        (WTF::Unicode::memset):
+        (WTF::Unicode::direction):
+        (WTF::Unicode::category):
+
 === Safari-521.32 ===
 
 2006-12-08  Adam Roben  <aroben@apple.com>
index 1b21e4365d5485bccb6a821903591e75a7db6b8b..74b42b9b410dc9e3483cabd76c4552f1573feb54 100644 (file)
                BCF655590A2049710038A194 /* MathExtras.h in Headers */ = {isa = PBXBuildFile; fileRef = BCF6553B0A2048DE0038A194 /* MathExtras.h */; settings = {ATTRIBUTES = (Private, ); }; };
                D212022A0AD4310D00ED79B6 /* DateMath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D21202280AD4310C00ED79B6 /* DateMath.cpp */; };
                D212022B0AD4310D00ED79B6 /* DateMath.h in Headers */ = {isa = PBXBuildFile; fileRef = D21202290AD4310C00ED79B6 /* DateMath.h */; };
-               E195679609E7CF1200B89D13 /* UnicodeIcu.h in Headers */ = {isa = PBXBuildFile; fileRef = E195678F09E7CF1200B89D13 /* UnicodeIcu.h */; };
-               E195679809E7CF1200B89D13 /* Unicode.h in Headers */ = {isa = PBXBuildFile; fileRef = E195679409E7CF1200B89D13 /* Unicode.h */; };
-               E195679909E7CF1200B89D13 /* UnicodeCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = E195679509E7CF1200B89D13 /* UnicodeCategory.h */; };
+               E195679609E7CF1200B89D13 /* UnicodeIcu.h in Headers */ = {isa = PBXBuildFile; fileRef = E195678F09E7CF1200B89D13 /* UnicodeIcu.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               E195679809E7CF1200B89D13 /* Unicode.h in Headers */ = {isa = PBXBuildFile; fileRef = E195679409E7CF1200B89D13 /* Unicode.h */; settings = {ATTRIBUTES = (Private, ); }; };
 /* End PBXBuildFile section */
 
 /* Begin PBXBuildRule section */
                };
 /* End PBXBuildRule section */
 
+/* Begin PBXBuildStyle section */
+               BC4C649B0B2A359400E57352 /* Development */ = {
+                       isa = PBXBuildStyle;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                       };
+                       name = Development;
+               };
+               BC4C649C0B2A359400E57352 /* Deployment */ = {
+                       isa = PBXBuildStyle;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                       };
+                       name = Deployment;
+               };
+/* End PBXBuildStyle section */
+
 /* Begin PBXContainerItemProxy section */
                141211350A48796100480255 /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                D21202290AD4310C00ED79B6 /* DateMath.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DateMath.h; sourceTree = "<group>"; };
                E195678F09E7CF1200B89D13 /* UnicodeIcu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnicodeIcu.h; sourceTree = "<group>"; };
                E195679409E7CF1200B89D13 /* Unicode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Unicode.h; sourceTree = "<group>"; };
-               E195679509E7CF1200B89D13 /* UnicodeCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnicodeCategory.h; sourceTree = "<group>"; };
                F5BB2BC5030F772101FCFE1D /* completion.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = completion.h; sourceTree = "<group>"; tabWidth = 8; };
                F5C290E60284F98E018635CA /* JavaScriptCorePrefix.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; name = JavaScriptCorePrefix.h; path = ../JavaScriptCorePrefix.h; sourceTree = "<group>"; tabWidth = 8; };
                F5FFE656026B47A6018635CA /* nodes2string.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = nodes2string.cpp; sourceTree = "<group>"; tabWidth = 8; };
                        children = (
                                E195678E09E7CF1200B89D13 /* icu */,
                                E195679409E7CF1200B89D13 /* Unicode.h */,
-                               E195679509E7CF1200B89D13 /* UnicodeCategory.h */,
                        );
                        path = unicode;
                        sourceTree = "<group>";
                                65FB3F5409D11B2400F49DEB /* regexp_object.lut.h in Headers */,
                                E195679609E7CF1200B89D13 /* UnicodeIcu.h in Headers */,
                                E195679809E7CF1200B89D13 /* Unicode.h in Headers */,
-                               E195679909E7CF1200B89D13 /* UnicodeCategory.h in Headers */,
                                935AF46C09E9D9DB00ACD1D8 /* Forward.h in Headers */,
                                935AF46E09E9D9DB00ACD1D8 /* UnusedParam.h in Headers */,
                                BCF655590A2049710038A194 /* MathExtras.h in Headers */,
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C277108902AFE008A9EFC /* Build configuration list for PBXProject "JavaScriptCore" */;
-                       compatibilityVersion = "Xcode 2.4";
+                       buildSettings = {
+                       };
+                       buildStyles = (
+                               BC4C649B0B2A359400E57352 /* Development */,
+                               BC4C649C0B2A359400E57352 /* Deployment */,
+                       );
                        hasScannedForEncodings = 1;
                        mainGroup = 0867D691FE84028FC02AAC07 /* JavaScriptCore */;
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
-                       projectRoot = "";
-                       shouldCheckCompatibility = 1;
                        targets = (
                                932F5B3E0822A1C700736975 /* JavaScriptCore */,
                                935F69F508244FEA003D1A45 /* dftables */,
index aa85aa1651e7bc8f9979be2d1006a019ab2e503f..4deddd6e5dc76b082b34c2a8d17a6e12218cd293 100644 (file)
 #endif
 
 /* for Unicode, KDE uses Qt, everything else uses ICU */
-#if PLATFORM(KDE)
-/* FIXME: Not using Qt4 unicode for now! */
-#define WTF_USE_ICU_UNICODE 1
+#if PLATFORM(KDE) || PLATFORM(QT)
+#define WTF_USE_QT4_UNICODE 1
 #elif PLATFORM(SYMBIAN)
 #define WTF_USE_SYMBIAN_UNICODE 1
 #else
diff --git a/JavaScriptCore/wtf/unicode/UnicodeCategory.h b/JavaScriptCore/wtf/unicode/UnicodeCategory.h
deleted file mode 100644 (file)
index 6632eac..0000000
+++ /dev/null
@@ -1,65 +0,0 @@
-// -*- c-basic-offset: 2 -*-
-/*
- *  This file is part of the KDE libraries
- *  Copyright (C) 2006 George Staikos <staikos@kde.org>
- *
- *  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 KJS_UNICODE_CATEGORY_H
-#define KJS_UNICODE_CATEGORY_H
-
-namespace WTF {
-  namespace Unicode {
-    enum CharCategory {
-      NoCategory = 0,
-      Mark_NonSpacing = 0x00000001,          // Unicode class name Mn
-      Mark_SpacingCombining = 0x00000002,    // Unicode class name Mc
-      Mark_Enclosing = 0x00000004,           // Unicode class name Me
-      Number_DecimalDigit = 0x00000008,      // Unicode class name Nd
-      Number_Letter = 0x00000010,            // Unicode class name Nl
-      Number_Other = 0x00000020,             // Unicode class name No
-      Separator_Space = 0x00000040,          // Unicode class name Zs
-      Separator_Line = 0x00000080,           // Unicode class name Zl
-      Separator_Paragraph = 0x00000100,      // Unicode class name Zp
-      Other_Control = 0x00000200,            // Unicode class name Cc
-      Other_Format = 0x00000400,             // Unicode class name Cf
-      Other_Surrogate = 0x00000800,          // Unicode class name Cs
-      Other_PrivateUse = 0x00001000,         // Unicode class name Co
-      Other_NotAssigned = 0x00002000,        // Unicode class name Cn
-      Letter_Uppercase = 0x00004000,         // Unicode class name Lu
-      Letter_Lowercase = 0x00008000,         // Unicode class name Ll
-      Letter_Titlecase = 0x00010000,         // Unicode class name Lt
-      Letter_Modifier = 0x00020000,          // Unicode class name Lm
-      Letter_Other = 0x00040000,             // Unicode class name Lo
-      Punctuation_Connector = 0x00080000,    // Unicode class name Pc
-      Punctuation_Dash = 0x00100000,         // Unicode class name Pd
-      Punctuation_Open = 0x00200000,         // Unicode class name Ps
-      Punctuation_Close = 0x00400000,        // Unicode class name Pe
-      Punctuation_InitialQuote = 0x00800000, // Unicode class name Pi
-      Punctuation_FinalQuote = 0x01000000,   // Unicode class name Pf
-      Punctuation_Other = 0x02000000,        // Unicode class name Po
-      Symbol_Math = 0x04000000,              // Unicode class name Sm
-      Symbol_Currency = 0x08000000,          // Unicode class name Sc
-      Symbol_Modifier = 0x10000000,          // Unicode class name Sk
-      Symbol_Other = 0x20000000              // Unicode class name So
-    };
-  }
-}
-
-#endif
-// vim: ts=2 sw=2 et
diff --git a/JavaScriptCore/wtf/unicode/UnicodeDecomposition.h b/JavaScriptCore/wtf/unicode/UnicodeDecomposition.h
deleted file mode 100644 (file)
index 11fbc9d..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-// -*- c-basic-offset: 2 -*-
-/*
- *  This file is part of the KDE libraries
- *  Copyright (C) 2006 George Staikos <staikos@kde.org>
- *
- *  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 KJS_UNICODE_DECOMPOSITION_H
-#define KJS_UNICODE_DECOMPOSITION_H
-
-namespace WTF {
-  namespace Unicode {
-    enum Decomposition {
-      None = 0,
-      Canonical = 0x00000001,
-      Font = 0x00000002,
-      NoBreak = 0x00000004,
-      Initial = 0x00000008,
-      Medial = 0x00000010,
-      Final = 0x00000020,
-      Isolated = 0x00000040,
-      Circle = 0x00000080,
-      Super = 0x00000100,
-      Sub = 0x00000200,
-      Vertical = 0x00000400,
-      Wide = 0x00000800,
-      Narrow = 0x00001000,
-      Small = 0x00002000,
-      Square = 0x00004000,
-      Compat = 0x00008000,
-      Fraction = 0x00010000
-    };
-  }
-}
-
-#endif
-// vim: ts=2 sw=2 et
diff --git a/JavaScriptCore/wtf/unicode/UnicodeDirection.h b/JavaScriptCore/wtf/unicode/UnicodeDirection.h
deleted file mode 100644 (file)
index 728a57e..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-// -*- c-basic-offset: 2 -*-
-/*
- *  This file is part of the KDE libraries
- *  Copyright (C) 2006 George Staikos <staikos@kde.org>
- *
- *  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 KJS_UNICODE_DIRECTION_H
-#define KJS_UNICODE_DIRECTION_H
-
-namespace WTF {
-  namespace Unicode {
-    enum Direction {
-      LeftToRight = 0,
-      RightToLeft = 0x00000001,
-      EuropeanNumber = 0x00000002,
-      EuropeanNumberSeparator = 0x00000004,
-      EuropeanNumberTerminator = 0x00000008,
-      ArabicNumber = 0x00000010,
-      CommonNumberSeparator = 0x00000020,
-      BlockSeparator = 0x00000040,
-      SegmentSeparator = 0x00000080,
-      WhiteSpaceNeutral = 0x00000100,
-      OtherNeutral = 0x00000200,
-      LeftToRightEmbedding = 0x00000400,
-      LeftToRightOverride = 0x00000800,
-      RightToLeftArabic = 0x00001000,
-      RightToLeftEmbedding = 0x00002000,
-      RightToLeftOverride = 0x00004000,
-      PopDirectionalFormat = 0x00008000,
-      NonSpacingMark = 0x00010000,
-      BoundaryNeutral = 0x00020000
-    };
-  }
-}
-
-#endif
-// vim: ts=2 sw=2 et
index 3494a357af3b1309c17fa9454e323109f66f6c60..752c1a2347658c4c09dc0b4f8bae514517579d66 100644 (file)
 
 #include <unicode/uchar.h>
 #include <unicode/ustring.h>
+#include <unicode/utf16.h>
 
-#include "../UnicodeCategory.h"
+#include <stdlib.h>
 
 namespace WTF {
   namespace Unicode {
 
+    enum Direction {
+      LeftToRight = U_LEFT_TO_RIGHT,
+      RightToLeft = U_RIGHT_TO_LEFT,
+      EuropeanNumber = U_EUROPEAN_NUMBER,
+      EuropeanNumberSeparator = U_EUROPEAN_NUMBER_SEPARATOR,
+      EuropeanNumberTerminator = U_EUROPEAN_NUMBER_TERMINATOR,
+      ArabicNumber = U_ARABIC_NUMBER,
+      CommonNumberSeparator = U_COMMON_NUMBER_SEPARATOR,
+      BlockSeparator = U_BLOCK_SEPARATOR,
+      SegmentSeparator = U_SEGMENT_SEPARATOR,
+      WhiteSpaceNeutral = U_WHITE_SPACE_NEUTRAL,
+      OtherNeutral = U_OTHER_NEUTRAL,
+      LeftToRightEmbedding = U_LEFT_TO_RIGHT_EMBEDDING,
+      LeftToRightOverride = U_LEFT_TO_RIGHT_OVERRIDE,
+      RightToLeftArabic = U_RIGHT_TO_LEFT_ARABIC,
+      RightToLeftEmbedding = U_RIGHT_TO_LEFT_EMBEDDING,
+      RightToLeftOverride = U_RIGHT_TO_LEFT_OVERRIDE,
+      PopDirectionalFormat = U_POP_DIRECTIONAL_FORMAT,
+      NonSpacingMark = U_DIR_NON_SPACING_MARK,
+      BoundaryNeutral = U_BOUNDARY_NEUTRAL
+    };
+
+    enum DecompositionType {
+      DecompositionNone = U_DT_NONE,
+      DecompositionCanonical = U_DT_CANONICAL,
+      DecompositionCompat = U_DT_COMPAT,
+      DecompositionCircle = U_DT_CIRCLE,
+      DecompositionFinal = U_DT_FINAL,
+      DecompositionFont = U_DT_FONT,
+      DecompositionFraction = U_DT_FRACTION,
+      DecompositionInitial = U_DT_INITIAL,
+      DecompositionIsolated = U_DT_ISOLATED,
+      DecompositionMedial = U_DT_MEDIAL,
+      DecompositionNarrow = U_DT_NARROW,
+      DecompositionNoBreak = U_DT_NOBREAK,
+      DecompositionSmall = U_DT_SMALL,
+      DecompositionSquare = U_DT_SQUARE,
+      DecompositionSub = U_DT_SUB,
+      DecompositionSuper = U_DT_SUPER,
+      DecompositionVertical = U_DT_VERTICAL,
+      DecompositionWide = U_DT_WIDE,
+    };
+
+    enum CharCategory {
+      NoCategory =  0,
+      Other_NotAssigned = U_MASK(U_GENERAL_OTHER_TYPES),
+      Letter_Uppercase = U_MASK(U_UPPERCASE_LETTER),
+      Letter_Lowercase = U_MASK(U_LOWERCASE_LETTER),
+      Letter_Titlecase = U_MASK(U_TITLECASE_LETTER),
+      Letter_Modifier = U_MASK(U_MODIFIER_LETTER),
+      Letter_Other = U_MASK(U_OTHER_LETTER),
+
+      Mark_NonSpacing = U_MASK(U_NON_SPACING_MARK),
+      Mark_Enclosing = U_MASK(U_ENCLOSING_MARK),
+      Mark_SpacingCombining = U_MASK(U_COMBINING_SPACING_MARK),
+
+      Number_DecimalDigit = U_MASK(U_DECIMAL_DIGIT_NUMBER),
+      Number_Letter = U_MASK(U_LETTER_NUMBER),
+      Number_Other = U_MASK(U_OTHER_NUMBER),
+
+      Separator_Space = U_MASK(U_SPACE_SEPARATOR),
+      Separator_Line = U_MASK(U_LINE_SEPARATOR),
+      Separator_Paragraph = U_MASK(U_PARAGRAPH_SEPARATOR),
+
+      Other_Control = U_MASK(U_CONTROL_CHAR),
+      Other_Format = U_MASK(U_FORMAT_CHAR),
+      Other_PrivateUse = U_MASK(U_PRIVATE_USE_CHAR),
+      Other_Surrogate = U_MASK(U_SURROGATE),
+
+      Punctuation_Dash = U_MASK(U_DASH_PUNCTUATION),
+      Punctuation_Open = U_MASK(U_START_PUNCTUATION),
+      Punctuation_Close = U_MASK(U_END_PUNCTUATION),
+      Punctuation_Connector = U_MASK(U_CONNECTOR_PUNCTUATION),
+      Punctuation_Other = U_MASK(U_OTHER_PUNCTUATION),
+
+      Symbol_Math = U_MASK(U_MATH_SYMBOL),
+      Symbol_Currency = U_MASK(U_CURRENCY_SYMBOL),
+      Symbol_Modifier = U_MASK(U_MODIFIER_SYMBOL),
+      Symbol_Other = U_MASK(U_OTHER_SYMBOL),
+
+      Punctuation_InitialQuote = U_MASK(U_INITIAL_PUNCTUATION),
+      Punctuation_FinalQuote = U_MASK(U_FINAL_PUNCTUATION)
+    };
+
+    inline uint32_t foldCase(uint32_t c)
+    {
+      return u_foldCase(c, U_FOLD_CASE_DEFAULT);
+    }
+
+    inline int foldCase(UChar* result, int resultLength, UChar* src, int srcLength,  bool* error)
+    {
+      UErrorCode status = U_ZERO_ERROR;
+      int32_t realLength = u_strFoldCase(result, resultLength, src, srcLength, U_FOLD_CASE_DEFAULT, &status);
+      *error = !(U_SUCCESS(status) && realLength < resultLength);
+      return realLength;
+    }
+
     inline int toLower(uint16_t* str, int strLength, uint16_t*& destIfNeeded)
     {
       UErrorCode err = U_ZERO_ERROR;
@@ -52,6 +150,24 @@ namespace WTF {
       return U_FAILURE(err) ? -1 : resultLength;
     }
 
+    inline int toLower(UChar* result, int resultLength, UChar* src, int srcLength,  bool* error)
+    {
+      UErrorCode status = U_ZERO_ERROR;
+      int32_t realLength = u_strToLower(result, resultLength, src, srcLength, "", &status);
+      *error = U_FAILURE(status);
+      return realLength;
+    }
+
+    inline int32_t toLower(int32_t c)
+    {
+      return u_tolower(c);
+    }
+
+    inline int32_t toUpper(int32_t c)
+    {
+      return u_toupper(c);
+    }
+
     inline int toUpper(uint16_t* str, int strLength, uint16_t*& destIfNeeded)
     {
       UErrorCode err = U_ZERO_ERROR;
@@ -72,6 +188,19 @@ namespace WTF {
       return U_FAILURE(err) ? -1 : resultLength;
     }
 
+    inline int toUpper(UChar* result, int resultLength, UChar* src, int srcLength,  bool* error)
+    {
+      UErrorCode status = U_ZERO_ERROR;
+      int32_t realLength = u_strToUpper(result, resultLength, src, srcLength, "", &status);
+      *error = U_FAILURE(status);
+      return realLength;
+    }
+
+    inline int toTitleCase (uint32_t c)
+    {
+      return u_totitle(c);
+    }
+
     inline bool isFormatChar(int32_t c)
     {
       return u_charType(c) == U_FORMAT_CHAR;
@@ -87,72 +216,68 @@ namespace WTF {
       return !!u_isprint(c);
     }
     
+    inline bool isDigit(int32_t c)
+    {
+      return u_isdigit(c);
+    }
+
+    inline bool isSpace(int32_t c)
+    {
+      return u_isspace(c);
+    }
+
+    inline bool isPunct(int32_t c)
+    {
+      return u_ispunct(c);
+    }
+
+    inline int32_t mirroredChar(int32_t c)
+    {
+      return u_charMirror(c);
+    }
+
     inline CharCategory category(int32_t c)
     {
-      switch (u_charType(c)) {
-        case U_NON_SPACING_MARK:
-          return Mark_NonSpacing;
-        case U_COMBINING_SPACING_MARK:
-          return Mark_SpacingCombining;
-        case U_ENCLOSING_MARK:
-          return Mark_Enclosing;
-        case U_DECIMAL_DIGIT_NUMBER:
-          return Number_DecimalDigit;
-        case U_LETTER_NUMBER:
-          return Number_Letter;
-        case U_OTHER_NUMBER:
-          return Number_Other;
-        case U_SPACE_SEPARATOR:
-          return Separator_Space;
-        case U_LINE_SEPARATOR:
-          return Separator_Line;
-        case U_PARAGRAPH_SEPARATOR:
-          return Separator_Paragraph;
-        case U_CONTROL_CHAR:
-          return Other_Control;
-        case U_FORMAT_CHAR:
-          return Other_Format;
-        case U_SURROGATE:
-          return Other_Surrogate;
-        case U_PRIVATE_USE_CHAR:
-          return Other_PrivateUse;
-        case U_GENERAL_OTHER_TYPES:
-          return Other_NotAssigned;
-        case U_UPPERCASE_LETTER:
-          return Letter_Uppercase;
-        case U_LOWERCASE_LETTER:
-          return Letter_Lowercase;
-        case U_TITLECASE_LETTER:
-          return Letter_Titlecase;
-        case U_MODIFIER_LETTER:
-          return Letter_Modifier;
-        case U_OTHER_LETTER:
-          return Letter_Other;
-        case U_CONNECTOR_PUNCTUATION:
-          return Punctuation_Connector;
-        case U_DASH_PUNCTUATION:
-          return Punctuation_Dash;
-        case U_START_PUNCTUATION:
-          return Punctuation_Open;
-        case U_END_PUNCTUATION:
-          return Punctuation_Close;
-        case U_INITIAL_PUNCTUATION:
-          return Punctuation_InitialQuote;
-        case U_FINAL_PUNCTUATION:
-          return Punctuation_FinalQuote;
-        case U_OTHER_PUNCTUATION:
-          return Punctuation_Other;
-        case U_MATH_SYMBOL:
-          return Symbol_Math;
-        case U_CURRENCY_SYMBOL:
-          return Symbol_Currency;
-        case U_MODIFIER_SYMBOL:
-          return Symbol_Modifier;
-        case U_OTHER_SYMBOL:
-          return Symbol_Other;
-        default:
-          return NoCategory;
+      return static_cast<CharCategory>(U_GET_GC_MASK(c));
+    }
+
+    inline Direction direction(int c) {
+      return (Direction)u_charDirection(c);
+    }
+
+    inline bool isLower(int32_t c)
+    {
+      return u_islower(c);
+    }
+
+    inline bool isUpper(int32_t c)
+    {
+      return u_isUUppercase(c);
       }
+
+    inline int digitValue(int32_t c)
+    {
+      return u_charDigitValue(c);
+    }
+
+    inline uint8_t combiningClass(UChar32 c)
+    {
+      return u_getCombiningClass(c);
+    }
+
+    inline DecompositionType decompositionType(UChar32 c)
+    {
+      return static_cast<DecompositionType>(u_getIntPropertyValue(c, UCHAR_DECOMPOSITION_TYPE));
+    }
+
+    inline int strcasecmp(const UChar *a, const UChar *b, int len)
+    {
+      return u_memcasecmp(a, b, len, U_FOLD_CASE_DEFAULT);
+    }
+
+    inline void memset(UChar* dest, UChar ch, int32_t count)
+    {
+      u_memset(dest, ch, count);
     }
   }
 }
diff --git a/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.cpp b/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.cpp
deleted file mode 100644 (file)
index 42398f7..0000000
+++ /dev/null
@@ -1,197 +0,0 @@
-// -*- c-basic-offset: 2 -*-
-/*
- *  This file is part of the KDE libraries
- *  Copyright (C) 2006 George Staikos <staikos@kde.org>
- *
- *  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 "UnicodeQt4.h"
-
-using namespace WTF::Unicode;
-
-Direction WTF::Unicode::direction(int c)
-{
-  // FIXME: implement support for non-BMP code points
-  if ((c & 0xffff0000) != 0)
-    return LeftToRight;
-
-  switch (QChar((unsigned short)c).direction()) {
-    case QChar::DirL:
-      return LeftToRight;
-    case QChar::DirR:
-      return RightToLeft;
-    case QChar::DirNSM:
-      return NonSpacingMark;
-    case QChar::DirBN:
-      return BoundaryNeutral;
-    case QChar::DirEN:
-      return EuropeanNumber;
-    case QChar::DirES:
-      return EuropeanNumberSeparator;
-    case QChar::DirET:
-      return EuropeanNumberTerminator;
-    case QChar::DirAN:
-      return ArabicNumber;
-    case QChar::DirCS:
-      return CommonNumberSeparator;
-    case QChar::DirB:
-      return BlockSeparator;
-    case QChar::DirS:
-      return SegmentSeparator;
-    case QChar::DirWS:
-      return WhiteSpaceNeutral;
-    case QChar::DirON:
-      return OtherNeutral;
-    case QChar::DirLRE:
-      return LeftToRightEmbedding;
-    case QChar::DirLRO:
-      return LeftToRightOverride;
-    case QChar::DirAL:
-      return RightToLeftArabic;
-    case QChar::DirRLE:
-      return RightToLeftEmbedding;
-    case QChar::DirRLO:
-      return RightToLeftOverride;
-    case QChar::DirPDF:
-      return PopDirectionalFormat;
-    default:
-      return LeftToRight;
-  }
-}
-
-CharCategory WTF::Unicode::category(int c)
-{
-  // FIXME: implement support for non-BMP code points
-  if ((c & 0xffff0000) != 0)
-    return NoCategory;
-
-  switch (QChar((unsigned short)c).category()) {
-    case QChar::Mark_NonSpacing:
-      return Mark_NonSpacing;
-    case QChar::Mark_SpacingCombining:
-      return Mark_SpacingCombining;
-    case QChar::Mark_Enclosing:
-      return Mark_Enclosing;
-    case QChar::Number_DecimalDigit:
-      return Number_DecimalDigit;
-    case QChar::Number_Letter:
-      return Number_Letter;
-    case QChar::Number_Other:
-      return Number_Other;
-    case QChar::Separator_Space:
-      return Separator_Space;
-    case QChar::Separator_Line:
-      return Separator_Line;
-    case QChar::Separator_Paragraph:
-      return Separator_Paragraph;
-    case QChar::Other_Control:
-      return Other_Control;
-    case QChar::Other_Format:
-      return Other_Format;
-    case QChar::Other_Surrogate:
-      return Other_Surrogate;
-    case QChar::Other_PrivateUse:
-      return Other_PrivateUse;
-    case QChar::Other_NotAssigned:
-      return Other_NotAssigned;
-    case QChar::Letter_Uppercase:
-      return Letter_Uppercase;
-    case QChar::Letter_Lowercase:
-      return Letter_Lowercase;
-    case QChar::Letter_Titlecase:
-      return Letter_Titlecase;
-    case QChar::Letter_Modifier:
-      return Letter_Modifier;
-    case QChar::Letter_Other:
-      return Letter_Other;
-    case QChar::Punctuation_Connector:
-      return Punctuation_Connector;
-    case QChar::Punctuation_Dash:
-      return Punctuation_Dash;
-    case QChar::Punctuation_Open:
-      return Punctuation_Open;
-    case QChar::Punctuation_Close:
-      return Punctuation_Close;
-    case QChar::Punctuation_InitialQuote:
-      return Punctuation_InitialQuote;
-    case QChar::Punctuation_FinalQuote:
-      return Punctuation_FinalQuote;
-    case QChar::Punctuation_Other:
-      return Punctuation_Other;
-    case QChar::Symbol_Math:
-      return Symbol_Math;
-    case QChar::Symbol_Currency:
-      return Symbol_Currency;
-    case QChar::Symbol_Modifier:
-      return Symbol_Modifier;
-    case QChar::Symbol_Other:
-      return Symbol_Other;
-    default:
-      return NoCategory;
-  }
-}
-
-
-Decomposition WTF::Unicode::decomposition(int c)
-{
-  // FIXME: implement support for non-BMP code points
-  if ((c & 0xffff0000) != 0)
-    return None;
-
-  switch (QChar((unsigned short)c).decompositionTag()) {
-    default:
-    case QChar::NoDecomposition:
-      return None;
-    case QChar::Canonical:
-      return Canonical;
-    case QChar::Font:
-      return Font;
-    case QChar::NoBreak:
-      return NoBreak;
-    case QChar::Initial:
-      return Initial;
-    case QChar::Medial:
-      return Medial;
-    case QChar::Final:
-      return Final;
-    case QChar::Isolated:
-      return Isolated;
-    case QChar::Circle:
-      return Circle;
-    case QChar::Super:
-      return Super;
-    case QChar::Sub:
-      return Sub;
-    case QChar::Vertical:
-      return Vertical;
-    case QChar::Wide:
-      return Wide;
-    case QChar::Narrow:
-      return Narrow;
-    case QChar::Small:
-      return Small;
-    case QChar::Square:
-      return Square;
-    case QChar::Compat:
-      return Compat;
-    case QChar::Fraction:
-      return Fraction;
-  }
-}
-
-// vim: ts=2 sw=2 et
index 28ff8d92322ce1019b9d3890f07fe8cb3784257a..b06275f7831a465cf99b4f9842c340993346a245 100644 (file)
 #include <QString>
 
 #include <config.h>
-#include <kjs/ustring.h>
-
-#include "../UnicodeCategory.h"
-#include "../UnicodeDecomposition.h"
-#include "../UnicodeDirection.h"
 
 #include <stdint.h>
 
+typedef uint16_t UChar;
+typedef uint32_t UChar32;
+
+// some defines from ICU needed one or two places
+
+#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_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))
+
 namespace WTF {
   namespace Unicode {
+
+    enum Direction {
+      LeftToRight = QChar::DirL,
+      RightToLeft = QChar::DirR,
+      EuropeanNumber = QChar::DirEN,
+      EuropeanNumberSeparator = QChar::DirES,
+      EuropeanNumberTerminator = QChar::DirET,
+      ArabicNumber = QChar::DirAN,
+      CommonNumberSeparator = QChar::DirCS,
+      BlockSeparator = QChar::DirB,
+      SegmentSeparator = QChar::DirS,
+      WhiteSpaceNeutral = QChar::DirWS,
+      OtherNeutral = QChar::DirON,
+      LeftToRightEmbedding = QChar::DirLRE,
+      LeftToRightOverride = QChar::DirLRO,
+      RightToLeftArabic = QChar::DirAL,
+      RightToLeftEmbedding = QChar::DirRLE,
+      RightToLeftOverride = QChar::DirRLO,
+      PopDirectionalFormat = QChar::DirPDF,
+      NonSpacingMark = QChar::DirNSM,
+      BoundaryNeutral = QChar::DirBN
+    };
+
+    enum DecompositionType {
+      DecompositionNone = QChar::NoDecomposition,
+      DecompositionCanonical = QChar::Canonical,
+      DecompositionCompat = QChar::Compat,
+      DecompositionCircle = QChar::Circle,
+      DecompositionFinal = QChar::Final,
+      DecompositionFont = QChar::Font,
+      DecompositionFraction = QChar::Fraction,
+      DecompositionInitial = QChar::Initial,
+      DecompositionIsolated = QChar::Isolated,
+      DecompositionMedial = QChar::Medial,
+      DecompositionNarrow = QChar::Narrow,
+      DecompositionNoBreak = QChar::NoBreak,
+      DecompositionSmall = QChar::Small,
+      DecompositionSquare = QChar::Square,
+      DecompositionSub = QChar::Sub,
+      DecompositionSuper = QChar::Super,
+      DecompositionVertical = QChar::Vertical,
+      DecompositionWide = QChar::Wide
+    };
+
+    enum CharCategory {
+      NoCategory = 0,
+      Mark_NonSpacing = U_MASK(QChar::Mark_NonSpacing),
+      Mark_SpacingCombining = U_MASK(QChar::Mark_SpacingCombining),
+      Mark_Enclosing = U_MASK(QChar::Mark_Enclosing),
+      Number_DecimalDigit = U_MASK(QChar::Number_DecimalDigit),
+      Number_Letter = U_MASK(QChar::Number_Letter),
+      Number_Other = U_MASK(QChar::Number_Other),
+      Separator_Space = U_MASK(QChar::Separator_Space),
+      Separator_Line = U_MASK(QChar::Separator_Line),
+      Separator_Paragraph = U_MASK(QChar::Separator_Paragraph),
+      Other_Control = U_MASK(QChar::Other_Control),
+      Other_Format = U_MASK(QChar::Other_Format),
+      Other_Surrogate = U_MASK(QChar::Other_Surrogate),
+      Other_PrivateUse = U_MASK(QChar::Other_PrivateUse),
+      Other_NotAssigned = U_MASK(QChar::Other_NotAssigned),
+      Letter_Uppercase = U_MASK(QChar::Letter_Uppercase),
+      Letter_Lowercase = U_MASK(QChar::Letter_Lowercase),
+      Letter_Titlecase = U_MASK(QChar::Letter_Titlecase),
+      Letter_Modifier = U_MASK(QChar::Letter_Modifier),
+      Letter_Other = U_MASK(QChar::Letter_Other),
+      Punctuation_Connector = U_MASK(QChar::Punctuation_Connector),
+      Punctuation_Dash = U_MASK(QChar::Punctuation_Dash),
+      Punctuation_Open = U_MASK(QChar::Punctuation_Open),
+      Punctuation_Close = U_MASK(QChar::Punctuation_Close),
+      Punctuation_InitialQuote = U_MASK(QChar::Punctuation_InitialQuote),
+      Punctuation_FinalQuote = U_MASK(QChar::Punctuation_FinalQuote),
+      Punctuation_Other = U_MASK(QChar::Punctuation_Other),
+      Symbol_Math = U_MASK(QChar::Symbol_Math),
+      Symbol_Currency = U_MASK(QChar::Symbol_Currency),
+      Symbol_Modifier = U_MASK(QChar::Symbol_Modifier),
+      Symbol_Other = U_MASK(QChar::Symbol_Other),
+    };
+
     inline int toLower(uint16_t* str, int strLength, uint16_t*& destIfNeeded)
     {
       destIfNeeded = 0;
@@ -53,6 +157,17 @@ namespace WTF {
       return QChar(ch).toLower().unicode();
     }
 
+    inline int toLower(UChar* result, int resultLength, UChar* src, int srcLength,  bool* error)
+    {
+      *error = false;
+      if (resultLength < srcLength) {
+        *error = true;
+        return srcLength;
+      }
+      for (int i = 0; i < srcLength; ++i)
+        result[i] = QChar(src[i]).toLower().unicode();
+    }
+
     inline int toUpper(uint16_t* str, int strLength, uint16_t*& destIfNeeded)
     {
       destIfNeeded = 0;
@@ -68,6 +183,36 @@ namespace WTF {
       return QChar(ch).toUpper().unicode();
     }
 
+    inline int toUpper(UChar* result, int resultLength, UChar* src, int srcLength,  bool* error)
+    {
+      *error = false;
+      if (resultLength < srcLength) {
+        *error = true;
+        return srcLength;
+      }
+      for (int i = 0; i < srcLength; ++i)
+        result[i] = QChar(src[i]).toUpper().unicode();
+    }
+
+    inline int toTitleCase (uint32_t c)
+    {
+      if (c > 0xffff)
+        return c;
+      return QChar(c).toUpper().unicode();
+    }
+
+    inline uint32_t foldCase(uint32_t c)
+    {
+      if (c > 0xffff)
+        return c;
+      return QChar(c).toLower().unicode();
+    }
+
+    inline int foldCase(UChar* result, int resultLength, UChar* src, int srcLength,  bool* error)
+    {
+      return toLower(result, resultLength, src, srcLength, error);
+    }
+
     inline bool isFormatChar(int32_t c)
     {
       return (c & 0xffff0000) == 0 && QChar((unsigned short)c).category() == QChar::Other_Format;
@@ -75,7 +220,7 @@ namespace WTF {
 
     inline bool isPrintableChar(int32_t c)
     {
-      return (c & 0xffff0000) == 0 && QChar((unsigned short)c).isPrint(); 
+      return (c & 0xffff0000) == 0 && QChar((unsigned short)c).isPrint();
     }
 
     inline bool isSeparatorSpace(int32_t c)
@@ -98,23 +243,72 @@ namespace WTF {
       return (c & 0xffff0000) == 0 && QChar((unsigned short)c).isDigit();
     }
 
+    inline bool isLower(int32_t c)
+    {
+      return (c & 0xffff0000) == 0 && QChar((unsigned short)c).category() == QChar::Letter_Lowercase;
+    }
+
+    inline bool isUpper(int32_t c)
+    {
+      return (c & 0xffff0000) == 0 && QChar((unsigned short)c).category() == QChar::Letter_Uppercase;
+    }
+
+    inline int digitValue(int32_t c)
+    {
+      if (c > 0xffff)
+        return 0;
+      return QChar(c).digitValue();
+    }
+
     inline uint16_t mirroredChar(uint16_t c)
     {
       return QChar(c).mirroredChar().unicode();
     }
 
-    inline int compare(const KJS::UChar *a, const KJS::UChar *b, int len, bool caseSensitive = true)
+    inline uint8_t combiningClass(UChar32 c)
+    {
+      if (c > 0xffff)
+        return 0;
+      return QChar((unsigned short)c).combiningClass();
+    }
+
+    inline DecompositionType decompositionType(UChar32 c)
+    {
+      if (c > 0xffff)
+        return DecompositionNone;
+      return (DecompositionType)QChar(c).decompositionTag();
+    }
+
+
+    inline int strcasecmp(const UChar *a, const UChar *b, int len)
     {
-      const QString left(reinterpret_cast<const QChar *>(a), len);
-      const QString right(reinterpret_cast<const QChar *>(b), len);
-      return left.compare(right, caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive);
+      for (int i = 0; i < len; ++i) {
+        QChar c1 = QChar(a[i]).toLower();
+        QChar c2 = QChar(b[i]).toLower();
+        if (c1 != c2)
+          return c1 < c2;
+      }
+      return 0;
     }
 
-    Direction direction(int c);
+    inline void memset(UChar* dest, UChar ch, int32_t count)
+    {
+      UChar *end = dest + count;
+      while (dest < end)
+        *dest++ = ch;
+    }
 
-    CharCategory category(int c);
+    inline Direction direction(int c) {
+      if (c > 0xffff)
+        return LeftToRight;
+      return (Direction)QChar(c).direction();
+    }
 
-    Decomposition decomposition(int c);
+    inline CharCategory category(int c) {
+      if (c > 0xffff)
+        return (CharCategory) U_MASK(QChar::Letter_Other);
+      return (CharCategory) U_MASK(QChar(c).category());
+    }
   }
 }
 
index 6c4b90e37f7f8f249867889bd22ac8a06d49bf37..b929d6749e34de828acef145fd4c696ad4e0ab47 100644 (file)
@@ -1,3 +1,131 @@
+2006-12-08  David Hyatt  <hyatt@apple.com>
+
+        Land the new ICU abstraction layer (WTF::Unicode).  Patch
+        by Lars with a couple of fixes thrown in by me.
+
+        Reviewed by hyatt
+
+        * ForwardingHeaders/wtf/icu/UnicodeIcu.h: Added.
+        * ForwardingHeaders/wtf/unicode/Unicode.h: Added.
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/cssparser.cpp:
+        (WebCore::ParseString::lower):
+        * dom/Document.cpp:
+        (WebCore::isValidNameStart):
+        (WebCore::isValidNamePart):
+        * editing/TextIterator.cpp:
+        (WebCore::CircularSearchBuffer::append):
+        * html/HTMLFontElement.cpp:
+        (WebCore::parseFontSizeNumber):
+        * html/HTMLInputElement.cpp:
+        (WebCore::numGraphemeClusters):
+        (WebCore::numCharactersInGraphemeClusters):
+        * html/HTMLSelectElement.cpp:
+        (WebCore::stripLeadingWhiteSpace):
+        * page/Frame.h:
+        * platform/DeprecatedString.h:
+        (WebCore::DeprecatedChar::isSpace):
+        (WebCore::DeprecatedChar::lower):
+        (WebCore::DeprecatedChar::upper):
+        * platform/Font.cpp:
+        (WebCore::WidthIterator::advance):
+        (WebCore::WidthIterator::normalizeVoicingMarks):
+        * platform/FontCache.h:
+        * platform/FontData.h:
+        * platform/GlyphMap.cpp:
+        * platform/GlyphMap.h:
+        * platform/GlyphWidthMap.h:
+        * platform/KURL.cpp:
+        (WebCore::encodeHostname):
+        * platform/StringHash.h:
+        (WTF::):
+        * platform/StringImpl.cpp:
+        (WebCore::isSpace):
+        (WebCore::parseLength):
+        (WebCore::StringImpl::isLower):
+        (WebCore::StringImpl::lower):
+        (WebCore::StringImpl::upper):
+        (WebCore::StringImpl::secure):
+        (WebCore::StringImpl::foldCase):
+        (WebCore::StringImpl::capitalize):
+        (WebCore::StringImpl::toInt):
+        (WebCore::equalIgnoringCase):
+        (WebCore::StringImpl::find):
+        * platform/StringImpl.h:
+        * platform/TextBoundaries.h:
+        * platform/TextBreakIterator.h: Added.
+        (WebCore::):
+        * platform/TextBreakIteratorICU.cpp: Added.
+        (WebCore::wordBreakIterator):
+        (WebCore::characterBreakIterator):
+        (WebCore::textBreakFirst):
+        (WebCore::textBreakNext):
+        (WebCore::textBreakPreceding):
+        (WebCore::textBreakFollowing):
+        (WebCore::textBreakCurrent):
+        * platform/TextCodec.h:
+        * platform/TextCodecLatin1.cpp:
+        * platform/TextEncoding.cpp:
+        (WebCore::TextEncoding::encode):
+        * platform/TextEncoding.h:
+        * platform/TextEncodingRegistry.cpp:
+        (WebCore::buildTextEncodingNameMap):
+        (WebCore::buildTextCodecMap):
+        * platform/TextEncodingRegistry.h:
+        * platform/UChar.h: Removed.
+        * platform/graphics/GraphicsContext.h:
+        * platform/qt/GlyphMapQt.cpp:
+        * platform/qt/TextBreakIteratorQt.cpp: Added.
+        (WebCore::TextBreakIterator::following):
+        (WebCore::TextBreakIterator::preceding):
+        (WebCore::WordBreakIteratorQt::first):
+        (WebCore::WordBreakIteratorQt::next):
+        (WebCore::WordBreakIteratorQt::previous):
+        (WebCore::CharBreakIteratorQt::first):
+        (WebCore::CharBreakIteratorQt::next):
+        (WebCore::CharBreakIteratorQt::previous):
+        (WebCore::wordBreakIterator):
+        (WebCore::characterBreakIterator):
+        (WebCore::textBreakFirst):
+        (WebCore::textBreakNext):
+        (WebCore::textBreakPreceding):
+        (WebCore::textBreakFollowing):
+        (WebCore::textBreakCurrent):
+        * platform/qt/TextCodecQt.cpp: Added.
+        (WebCore::getAtomicName):
+        (WebCore::TextCodecQt::registerEncodingNames):
+        (WebCore::newTextCodecQt):
+        (WebCore::TextCodecQt::registerCodecs):
+        (WebCore::TextCodecQt::TextCodecQt):
+        (WebCore::TextCodecQt::~TextCodecQt):
+        (WebCore::TextCodecQt::decode):
+        (WebCore::TextCodecQt::encode):
+        * platform/qt/TextCodecQt.h: Added.
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::updateFirstLetter):
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::previousOffset):
+        (WebCore::RenderText::nextOffset):
+        (WebCore::RenderText::widthFromCache):
+        * rendering/RenderText.h:
+        * rendering/bidi.cpp:
+        (WebCore::BidiState::BidiState):
+        (WebCore::BidiContext::BidiContext):
+        (WebCore::bidiNext):
+        (WebCore::bidiFirst):
+        (WebCore::BidiIterator::direction):
+        (WebCore::appendRun):
+        (WebCore::embed):
+        (WebCore::RenderBlock::computeHorizontalPositionsForLine):
+        (WebCore::RenderBlock::bidiReorderLine):
+        (WebCore::RenderBlock::layoutInlineChildren):
+        * rendering/bidi.h:
+        (WebCore::BidiStatus::BidiStatus):
+        (WebCore::BidiContext::dir):
+        (WebCore::BidiContext::basicDir):
+        (WebCore::BidiRun::BidiRun):
+        * rendering/break_lines.h:
+
 2006-12-08  Adam Roben  <aroben@apple.com>
 
         Rolling out r17865 because it caused a performance regression.
diff --git a/WebCore/ForwardingHeaders/wtf/icu/UnicodeIcu.h b/WebCore/ForwardingHeaders/wtf/icu/UnicodeIcu.h
new file mode 100644 (file)
index 0000000..6b64eb5
--- /dev/null
@@ -0,0 +1 @@
+#include <JavaScriptCore/UnicodeIcu.h>
diff --git a/WebCore/ForwardingHeaders/wtf/unicode/Unicode.h b/WebCore/ForwardingHeaders/wtf/unicode/Unicode.h
new file mode 100644 (file)
index 0000000..623917f
--- /dev/null
@@ -0,0 +1 @@
+#include <JavaScriptCore/Unicode.h>
index 7b94898d1e2c78906675969bf11a1926146d9656..0bb2c17f3d843cb8aeb64207da9339cfc5300da3 100644 (file)
                93B70D7509EB0C7C009D8468 /* kjs_window.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93B70D5909EB0C7C009D8468 /* kjs_window.cpp */; };
                93B70D7609EB0C7C009D8468 /* kjs_window.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B70D5A09EB0C7C009D8468 /* kjs_window.h */; };
                93B77A380ADD792500EA4B81 /* FrameLoaderTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B77A370ADD792500EA4B81 /* FrameLoaderTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
-               93B77B1D0ADDA10700EA4B81 /* UChar.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B77B1C0ADDA10700EA4B81 /* UChar.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93B780CA09B3B7FE00690162 /* WidgetClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B780C909B3B7FE00690162 /* WidgetClient.h */; };
                93C09A530B064DB3005ABD4D /* EventHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 93C09A520B064DB3005ABD4D /* EventHandler.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93C09A7F0B064EEF005ABD4D /* EventHandlerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93C09A7E0B064EEF005ABD4D /* EventHandlerMac.mm */; };
                B2FA3E180AB75A6F000E5AC4 /* JSSVGZoomEvent.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B2FA3D300AB75A6F000E5AC4 /* JSSVGZoomEvent.cpp */; };
                B2FA3E190AB75A6F000E5AC4 /* JSSVGZoomEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = B2FA3D310AB75A6F000E5AC4 /* JSSVGZoomEvent.h */; };
                BC066F6F09FEB2FA00C589A7 /* WebCoreTextRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = BC066F6C09FEB2FA00C589A7 /* WebCoreTextRenderer.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               BC18C5D00B2A886F0018461D /* TextBreakIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C5CE0B2A886F0018461D /* TextBreakIterator.h */; };
+               BC18C5D10B2A886F0018461D /* TextBreakIteratorICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC18C5CF0B2A886F0018461D /* TextBreakIteratorICU.cpp */; };
                BC1A37AD097C715F0019F3D8 /* DOM.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1A3797097C715F0019F3D8 /* DOM.h */; settings = {ATTRIBUTES = (Private, ); }; };
                BC1A37AE097C715F0019F3D8 /* DOM.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC1A3798097C715F0019F3D8 /* DOM.mm */; };
                BC1A37AF097C715F0019F3D8 /* DOMCore.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1A3799097C715F0019F3D8 /* DOMCore.h */; settings = {ATTRIBUTES = (Private, ); }; };
                };
 /* End PBXBuildRule section */
 
+/* Begin PBXBuildStyle section */
+               BC18C5C70B2A883B0018461D /* Development */ = {
+                       isa = PBXBuildStyle;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                       };
+                       name = Development;
+               };
+               BC18C5C80B2A883B0018461D /* Deployment */ = {
+                       isa = PBXBuildStyle;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                       };
+                       name = Deployment;
+               };
+/* End PBXBuildStyle section */
+
 /* Begin PBXContainerItemProxy section */
                DD041FF009D9E3250010AF2A /* PBXContainerItemProxy */ = {
                        isa = PBXContainerItemProxy;
                93B70D5909EB0C7C009D8468 /* kjs_window.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = kjs_window.cpp; sourceTree = "<group>"; };
                93B70D5A09EB0C7C009D8468 /* kjs_window.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_window.h; sourceTree = "<group>"; };
                93B77A370ADD792500EA4B81 /* FrameLoaderTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameLoaderTypes.h; sourceTree = "<group>"; };
-               93B77B1C0ADDA10700EA4B81 /* UChar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UChar.h; sourceTree = "<group>"; };
                93B780C909B3B7FE00690162 /* WidgetClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WidgetClient.h; sourceTree = "<group>"; };
                93C09A520B064DB3005ABD4D /* EventHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventHandler.h; sourceTree = "<group>"; };
                93C09A7E0B064EEF005ABD4D /* EventHandlerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EventHandlerMac.mm; sourceTree = "<group>"; };
                BC06F24A06D18A7E004A6FA3 /* XSLStyleSheet.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = XSLStyleSheet.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BC06F24B06D18A7E004A6FA3 /* XSLTProcessor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XSLTProcessor.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
                BC06F24C06D18A7E004A6FA3 /* XSLTProcessor.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = XSLTProcessor.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; };
+               BC18C5CE0B2A886F0018461D /* TextBreakIterator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TextBreakIterator.h; sourceTree = "<group>"; };
+               BC18C5CF0B2A886F0018461D /* TextBreakIteratorICU.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = TextBreakIteratorICU.cpp; sourceTree = "<group>"; };
                BC1A3797097C715F0019F3D8 /* DOM.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOM.h; sourceTree = "<group>"; };
                BC1A3798097C715F0019F3D8 /* DOM.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOM.mm; sourceTree = "<group>"; };
                BC1A3799097C715F0019F3D8 /* DOMCore.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOMCore.h; sourceTree = "<group>"; };
                                93CD4FDD0995F9EA007ECC97 /* StringImpl.h */,
                                93E62D990985F41600E1B5E3 /* SystemTime.h */,
                                9352071809BD3BA500F2038D /* TextBoundaries.h */,
+                               BC18C5CE0B2A886F0018461D /* TextBreakIterator.h */,
+                               BC18C5CF0B2A886F0018461D /* TextBreakIteratorICU.cpp */,
                                657BD74909AFDC54005A2056 /* TextCodec.cpp */,
                                657BD74A09AFDC54005A2056 /* TextCodec.h */,
                                E14842FE0A674A31007E4D39 /* TextCodecICU.cpp */,
                                93AC8DE00A955FAC00239794 /* TextStyle.h */,
                                93309EA1099EB78C0056E581 /* Timer.cpp */,
                                9305B24C098F1B6B00C28855 /* Timer.h */,
-                               93B77B1C0ADDA10700EA4B81 /* UChar.h */,
                                9380F47109A11AB4001FDB34 /* Widget.cpp */,
                                9380F47209A11AB4001FDB34 /* Widget.h */,
                                93B780C909B3B7FE00690162 /* WidgetClient.h */,
                                656D37480ADBA5DE00A4554D /* SubresourceLoader.h in Headers */,
                                93B77A380ADD792500EA4B81 /* FrameLoaderTypes.h in Headers */,
                                65BAAABE0ADCA015005BB5A4 /* RetainPtr.h in Headers */,
-                               93B77B1D0ADDA10700EA4B81 /* UChar.h in Headers */,
                                0668E18B0ADD9624004128E0 /* PopupMenu.h in Headers */,
                                6563A9A70ADF4094000ED2CD /* LoaderNSURLRequestExtras.h in Headers */,
                                4B3043B60AE0363200A82647 /* EditorClient.h in Headers */,
                                932871C00B20DEB70049035A /* PlatformMenuDescription.h in Headers */,
                                B2BFB5A00B22F76200567E80 /* ImageAnimationObserver.h in Headers */,
                                E1D8E3160B29E39C00F4BAF6 /* HTTPParsers.h in Headers */,
+                               BC18C5D00B2A886F0018461D /* TextBreakIterator.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */;
-                       compatibilityVersion = "Xcode 2.4";
+                       buildSettings = {
+                       };
+                       buildStyles = (
+                               BC18C5C70B2A883B0018461D /* Development */,
+                               BC18C5C80B2A883B0018461D /* Deployment */,
+                       );
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
                        mainGroup = 0867D691FE84028FC02AAC07 /* WebKit */;
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
-                       projectRoot = "";
-                       shouldCheckCompatibility = 1;
                        targets = (
                                93F198A508245E59001E9ABC /* WebCore */,
                                DD041FBE09D9DDBE0010AF2A /* Derived Sources */,
                                ED501DC60B249F2900AE18D9 /* EditorMac.mm in Sources */,
                                93354A3C0B24F8C9003F6DEA /* UIEventWithKeyState.cpp in Sources */,
                                E1D8E31A0B29E3B600F4BAF6 /* HTTPParsers.cpp in Sources */,
+                               BC18C5D10B2A886F0018461D /* TextBreakIteratorICU.cpp in Sources */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 2b0187221d11d6e8ec772ed98f01bde0bacdffb8..3ae786e066f905625cd961e90dad0b65c5cb73b8 100644 (file)
@@ -155,7 +155,7 @@ void ParseString::lower()
         ored |= characters[i];
     if (ored & ~0x7F)
         for (int i = 0; i < length; i++)
-            characters[i] = u_tolower(characters[i]);
+            characters[i] = WTF::Unicode::toLower(characters[i]);
     else
         for (int i = 0; i < length; i++)
             characters[i] = tolower(characters[i]);
index d759612d02c79a159c2ea68e160923fb259ff210..1c6f80636b3f3949e53c14f9f0f242f10d233e22 100644 (file)
@@ -163,8 +163,12 @@ static inline bool isValidNameStart(UChar32 c)
         return true;
 
     // rules (a) and (f) above
-    const uint32_t nameStartMask = U_GC_LL_MASK | U_GC_LU_MASK | U_GC_LO_MASK | U_GC_LT_MASK | U_GC_NL_MASK;
-    if (!(U_GET_GC_MASK(c) & nameStartMask))
+    const uint32_t nameStartMask = WTF::Unicode::Letter_Lowercase |
+                                   WTF::Unicode::Letter_Uppercase |
+                                   WTF::Unicode::Letter_Other |
+                                   WTF::Unicode::Letter_Titlecase |
+                                   WTF::Unicode::Number_Letter;
+    if (!(WTF::Unicode::category(c) & nameStartMask))
         return false;
 
     // rule (c) above
@@ -172,8 +176,8 @@ static inline bool isValidNameStart(UChar32 c)
         return false;
 
     // rule (d) above
-    UDecompositionType decompType = static_cast<UDecompositionType>(u_getIntPropertyValue(c, UCHAR_DECOMPOSITION_TYPE));
-    if (decompType == U_DT_FONT || decompType == U_DT_COMPAT)
+    WTF::Unicode::DecompositionType decompType = WTF::Unicode::decompositionType(c);
+    if (decompType == WTF::Unicode::DecompositionFont || decompType == WTF::Unicode::DecompositionCompat)
         return false;
 
     return true;
@@ -194,8 +198,12 @@ static inline bool isValidNamePart(UChar32 c)
         return true;
 
     // rules (b) and (f) above
-    const uint32_t otherNamePartMask = U_GC_MC_MASK | U_GC_ME_MASK | U_GC_MN_MASK | U_GC_LM_MASK | U_GC_ND_MASK;
-    if (!(U_GET_GC_MASK(c) & otherNamePartMask))
+    const uint32_t otherNamePartMask = WTF::Unicode::Mark_NonSpacing |
+                                       WTF::Unicode::Mark_Enclosing |
+                                       WTF::Unicode::Mark_SpacingCombining |
+                                       WTF::Unicode::Letter_Modifier |
+                                       WTF::Unicode::Number_DecimalDigit;
+    if (!(WTF::Unicode::category(c) & otherNamePartMask))
         return false;
 
     // rule (c) above
@@ -203,8 +211,8 @@ static inline bool isValidNamePart(UChar32 c)
         return false;
 
     // rule (d) above
-    UDecompositionType decompType = static_cast<UDecompositionType>(u_getIntPropertyValue(c, UCHAR_DECOMPOSITION_TYPE));
-    if (decompType == U_DT_FONT || decompType == U_DT_COMPAT)
+    WTF::Unicode::DecompositionType decompType = WTF::Unicode::decompositionType(c);
+    if (decompType == WTF::Unicode::DecompositionFont || decompType == WTF::Unicode::DecompositionCompat)
         return false;
 
     return true;
index 45056e098c358311ae81ed1c8d0c8c1e49cc3be1..7f57a3f6afbadcf48d1bffc6c75ae2d628f1e1fd 100644 (file)
@@ -968,7 +968,7 @@ void CircularSearchBuffer::append(UChar c)
     if (m_isCaseSensitive)
         *m_cursor++ = c == nonBreakingSpace ? ' ' : c;
     else
-        *m_cursor++ = c == nonBreakingSpace ? ' ' : u_foldCase(c, U_FOLD_CASE_DEFAULT);
+        *m_cursor++ = c == nonBreakingSpace ? ' ' : WTF::Unicode::foldCase(c);
     if (m_cursor == m_buffer + length()) {
         m_cursor = m_buffer;
         m_bufferFull = true;
@@ -993,7 +993,7 @@ void CircularSearchBuffer::append(int count, const UChar* characters)
     } else {
         for (int i = 0; i != count; ++i) {
             UChar c = characters[i];
-            m_cursor[i] = c == nonBreakingSpace ? ' ' : u_foldCase(c, U_FOLD_CASE_DEFAULT);
+            m_cursor[i] = c == nonBreakingSpace ? ' ' : WTF::Unicode::foldCase(c);
         }
     }
     if (count < tailSpace)
index 39996f1a170fef5a0434ed931bb5684321f232b6..c315d04ac6463c3919c4cf55ffd8cd867362b43f 100644 (file)
@@ -64,12 +64,12 @@ static bool parseFontSizeNumber(const String& s, int& size)
     }
     
     // Parse a single digit.
-    if (!u_isdigit(s[pos]))
+    if (!WTF::Unicode::isDigit(s[pos]))
         return false;
-    int num = u_charDigitValue(s[pos++]);
+    int num = WTF::Unicode::digitValue(s[pos++]);
     
     // Check for an additional digit.
-    if (u_isdigit(s[pos]))
+    if (WTF::Unicode::isDigit(s[pos]))
         num = 10;
     
     if (sawPlus) {
index 8cf3bb81a536f356da74766587fb27b6ac3beb81..99c6585a2d2639316e1ddd3bd20181049984e955 100644 (file)
@@ -50,7 +50,7 @@
 #include "RenderTheme.h"
 #include "RenderSlider.h"
 #include "SelectionController.h"
-#include <unicode/ubrk.h>
+#include "TextBreakIterator.h"
 
 using namespace std;
 
@@ -61,24 +61,30 @@ using namespace HTMLNames;
 
 static int numGraphemeClusters(const StringImpl* s)
 {
-    UBreakIterator* it = characterBreakIterator(s);
+    if (!s)
+        return 0;
+
+    TextBreakIterator* it = characterBreakIterator(s->characters(), s->length());
     if (!it)
         return 0;
     int num = 0;
-    while (ubrk_next(it) != UBRK_DONE)
+    while (textBreakNext(it) != TextBreakDone)
         ++num;
     return num;
 }
 
 static int numCharactersInGraphemeClusters(const StringImpl* s, int numGraphemeClusters)
 {
-    UBreakIterator* it = characterBreakIterator(s);
+    if (!s)
+        return 0;
+
+    TextBreakIterator* it = characterBreakIterator(s->characters(), s->length());
     if (!it)
         return 0;
     for (int i = 0; i < numGraphemeClusters; ++i)
-        if (ubrk_next(it) == UBRK_DONE)
+        if (textBreakNext(it) == TextBreakDone)
             return s->length();
-    return ubrk_current(it);
+    return textBreakCurrent(it);
 }
 
 HTMLInputElement::HTMLInputElement(Document *doc, HTMLFormElement *f)
index eb17dd1fedd35f3e5eabeb2af0085d006960de42..06ff64d83b044857b35eeeb8faa6b8607c68dab5 100644 (file)
@@ -797,7 +797,8 @@ static String stripLeadingWhiteSpace(const String& string)
     int length = string.length();
     int i;
     for (i = 0; i < length; ++i)
-        if (string[i] != nonBreakingSpace && (string[i] <= 0x7F ? !isspace(string[i]) : (u_charDirection(string[i]) != U_WHITE_SPACE_NEUTRAL)))
+        if (string[i] != nonBreakingSpace &&
+            (string[i] <= 0x7F ? !isspace(string[i]) : (WTF::Unicode::direction(string[i]) != WTF::Unicode::WhiteSpaceNeutral)))
             break;
 
     return string.substring(i, length - i);
index b4b73d8d47a40d2b2d8a7f0e566b2895b8e770c3..eba79f27e14660d307c48e4ac4bb19baedb74f30 100644 (file)
@@ -33,7 +33,7 @@
 #include "RenderLayer.h"
 #include "TextAffinity.h"
 #include "TextGranularity.h"
-#include "UChar.h"
+#include "wtf/unicode/Unicode.h"
 #include <wtf/Forward.h>
 #include <wtf/Vector.h>
 
index 9e3d684c2ab1bba32ab0d8c12136b2c24b48400a..953f7b12c61857932c2e6efdaffcb7151e851607 100644 (file)
@@ -27,7 +27,7 @@
 #define DeprecatedString_h
 
 #include <ctype.h>
-#include <unicode/uchar.h>
+#include <wtf/unicode/Unicode.h>
 #include "DeprecatedCString.h"
 
 #if PLATFORM(CF)
@@ -110,21 +110,33 @@ inline unsigned short DeprecatedChar::unicode() const
 
 inline bool DeprecatedChar::isSpace() const
 {
+#if USE(ICU_UNICODE)
     // Use isspace() for basic Latin-1.
     // This will include newlines, which aren't included in unicode DirWS.
     return c <= 0x7F ? isspace(c) : (u_charDirection(c) == U_WHITE_SPACE_NEUTRAL);
+#elif USE(QT4_UNICODE)
+    return QChar(c).isSpace();
+#endif
 }
 
 inline DeprecatedChar DeprecatedChar::lower() const
 {
+#if USE(ICU_UNICODE)
     // FIXME: If fast enough, we should just call u_tolower directly.
     return c <= 0x7F ? tolower(c) : u_tolower(c);
+#elif USE(QT4_UNICODE)
+    return QChar(c).toLower().unicode();
+#endif
 }
 
 inline DeprecatedChar DeprecatedChar::upper() const
 {
+#if USE(ICU_UNICODE)
     // FIXME: If fast enough, we should just call u_toupper directly.
     return c <= 0x7F ? toupper(c) : u_toupper(c);
+#elif USE(QT4_UNICODE)
+    return QChar(c).toUpper().unicode();
+#endif
 }
 
 inline char DeprecatedChar::latin1() const
index 061d4d70f35d32b534effada5359dbacdfac8eac..f663165f7380537b7beb528058b466130a4281b0 100644 (file)
 #include "IntPoint.h"
 #include "GlyphBuffer.h"
 #include "TextStyle.h"
-#include <unicode/uchar.h>
-#include <unicode/umachine.h>
-#include <unicode/unorm.h>
+#include <wtf/unicode/Unicode.h>
 #include <wtf/MathExtras.h>
+#if USE(ICU_UNICODE)
+#include <unicode/unorm.h>
+#endif
 
 namespace WebCore {
 
@@ -172,11 +173,11 @@ void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer)
 
         if (needCharTransform) {
             if (rtl)
-                c = u_charMirror(c);
+                c = WTF::Unicode::mirroredChar(c);
 
             // If small-caps, convert lowercase to upper.
-            if (m_font->isSmallCaps() && !u_isUUppercase(c)) {
-                UChar32 upperC = u_toupper(c);
+            if (m_font->isSmallCaps() && !WTF::Unicode::isUpper(c)) {
+                UChar32 upperC = WTF::Unicode::toUpper(c);
                 if (upperC != c) {
                     c = upperC;
                     fontData = fontData->smallCapsFontData(m_font->fontDescription());
@@ -298,7 +299,8 @@ bool WidthIterator::advanceOneCharacter(float& width, GlyphBuffer* glyphBuffer)
 UChar32 WidthIterator::normalizeVoicingMarks(int currentCharacter)
 {
     if (currentCharacter + 1 < m_end) {
-        if (u_getCombiningClass(m_run[currentCharacter + 1]) == hiraganaKatakanaVoicingMarksCombiningClass) {
+        if (WTF::Unicode::combiningClass(m_run[currentCharacter + 1]) == hiraganaKatakanaVoicingMarksCombiningClass) {
+#if USE(ICU_UNICODE)
             // Normalize into composed form using 3.2 rules.
             UChar normalizedCharacters[2] = { 0, 0 };
             UErrorCode uStatus = U_ZERO_ERROR;  
@@ -306,6 +308,12 @@ UChar32 WidthIterator::normalizeVoicingMarks(int currentCharacter)
                 UNORM_NFC, UNORM_UNICODE_3_2, &normalizedCharacters[0], 2, &uStatus);
             if (resultLength == 1 && uStatus == 0)
                 return normalizedCharacters[0];
+#elif USE(QT4_UNICODE)
+            QString tmp(reinterpret_cast<const QChar*>(m_run.data(currentCharacter)), 2);
+            QString res = tmp.normalized(QString::NormalizationForm_C, QChar::Unicode_3_2);
+            if (res.length() == 1)
+                return res.at(0).unicode();
+#endif
         }
     }
     return 0;
index a3471c7bceacf2e5cd1e171e5b7f58c04fef025e..b19a0e71a4857b091b2ac39087d1236f9195909e 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef FONTCACHE_H
 #define FONTCACHE_H
 
-#include <unicode/umachine.h>
+#include <wtf/unicode/Unicode.h>
 
 #if PLATFORM(WIN)
 #include <mlang.h>
index a3d8cce1c8cdea26452f1430aa6afbb9ad19fcab..65fa77027821a4f916ca046d1a8244106919975d 100644 (file)
@@ -28,8 +28,7 @@
 #include "GlyphWidthMap.h"
 #include <wtf/Noncopyable.h>
 
-// FIXME: Temporary. Only needed to support API that's going to move.
-#include <unicode/umachine.h>
+#include <wtf/unicode/Unicode.h>
 
 #if PLATFORM(MAC)
 typedef struct OpaqueATSUStyle* ATSUStyle;
index 33562025eb3bb20ce0c3ebf186dd552e44ccf1ae..3ac03e623c4d4b68a5dea4d5cc9017d2c8280ab1 100644 (file)
@@ -30,7 +30,7 @@
 #include "GlyphMap.h"
 
 #include "FontData.h"
-#include <unicode/uchar.h>
+#include <wtf/unicode/Unicode.h>
 
 namespace WebCore {
 
index a8a5356b92e211b989038652fe97b91114d466ee..5dd7bd5dc4bf489bf3adfbf1c15ece60c9d99a91 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef GLYPH_MAP_H
 #define GLYPH_MAP_H
 
-#include <unicode/umachine.h>
+#include <wtf/unicode/Unicode.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/HashMap.h>
 
index afe09289fc551bceb5a3f51ec9923b69b776a1b2..47488832c54939187f5207d8700643e5331fdc9b 100644 (file)
@@ -29,7 +29,7 @@
 #ifndef GLYPH_WIDTH_MAP_H
 #define GLYPH_WIDTH_MAP_H
 
-#include <unicode/umachine.h>
+#include <wtf/unicode/Unicode.h>
 #include <wtf/Noncopyable.h>
 #include <wtf/HashMap.h>
 
index 590c79392eeff59681c3450cad5f19843158705b..4218606e85159d291ca181bf9788dbbb492b397a 100644 (file)
 #include "RegularExpression.h"
 #include "TextEncoding.h"
 #include <wtf/Vector.h>
+#if USE(ICU_UNICODE)
 #include <unicode/uidna.h>
+#elif USE(QT4_UNICODE)
+#include <QUrl>
+#endif
+
 #include <assert.h>
 
 using namespace std;
@@ -1254,6 +1259,7 @@ static DeprecatedString encodeHostname(const DeprecatedString &s)
     if (s.isAllASCII() || s.length() > hostnameBufferLength)
         return s;
 
+#if USE(ICU_UNICODE)
     UChar buffer[hostnameBufferLength];    
     UErrorCode error = U_ZERO_ERROR;
     int32_t numCharactersConverted = uidna_IDNToASCII
@@ -1262,6 +1268,10 @@ static DeprecatedString encodeHostname(const DeprecatedString &s)
         return s;
     }
     return DeprecatedString(reinterpret_cast<DeprecatedChar *>(buffer), numCharactersConverted);
+#elif USE(QT4_UNICODE)
+    QByteArray result = QUrl::toAce(s);
+    return DeprecatedString(result.constData(), result.length());
+#endif
 }
 
 static Vector<pair<int, int> > findHostnamesInMailToURL(const DeprecatedString &s)
index 32e7bd5c81b65e9725732add652650638a87d479..b44d466347d076cb0a14f3dc558cdc79926a4d55 100644 (file)
@@ -24,8 +24,7 @@
 #include "AtomicStringImpl.h"
 #include "PlatformString.h"
 #include <wtf/HashTraits.h>
-#include <unicode/uchar.h>
-#include <unicode/ustring.h>
+#include <wtf/unicode/Unicode.h>
 
 namespace WTF {
 
@@ -99,8 +98,8 @@ namespace WTF {
             
             // Main loop
             for (; l > 0; l--) {
-                hash += u_foldCase(s[0], U_FOLD_CASE_DEFAULT);
-                tmp = (u_foldCase(s[1], U_FOLD_CASE_DEFAULT) << 11) ^ hash;
+                hash += WTF::Unicode::foldCase(s[0]);
+                tmp = (WTF::Unicode::foldCase(s[1]) << 11) ^ hash;
                 hash = (hash << 16) ^ tmp;
                 s += 2;
                 hash += hash >> 11;
@@ -108,7 +107,7 @@ namespace WTF {
             
             // Handle end case
             if (rem) {
-                hash += u_foldCase(s[0], U_FOLD_CASE_DEFAULT);
+                hash += WTF::Unicode::foldCase(s[0]);
                 hash ^= hash << 11;
                 hash += hash >> 17;
             }
@@ -145,8 +144,8 @@ namespace WTF {
             
             // Main loop
             for (; l > 0; l--) {
-                hash += u_foldCase(s[0], U_FOLD_CASE_DEFAULT);
-                tmp = (u_foldCase(s[1], U_FOLD_CASE_DEFAULT) << 11) ^ hash;
+                hash += WTF::Unicode::foldCase(s[0]);
+                tmp = (WTF::Unicode::foldCase(s[1]) << 11) ^ hash;
                 hash = (hash << 16) ^ tmp;
                 s += 2;
                 hash += hash >> 11;
@@ -154,7 +153,7 @@ namespace WTF {
             
             // Handle end case
             if (rem) {
-                hash += u_foldCase(s[0], U_FOLD_CASE_DEFAULT);
+                hash += WTF::Unicode::foldCase(s[0]);
                 hash ^= hash << 11;
                 hash += hash >> 17;
             }
@@ -184,7 +183,7 @@ namespace WTF {
             unsigned length = a->length();
             if (length != b->length())
                 return false;
-            return u_memcasecmp(a->characters(), b->characters(), length, U_FOLD_CASE_DEFAULT) == 0;
+            return WTF::Unicode::strcasecmp(a->characters(), b->characters(), length) == 0;
         }
     };
 
index d8ba0a6c3f8b7dd389a1270c15321c74048b1d89..eead2200d62e50a8e737b321dd1b494c56ba7873 100644 (file)
 #include "Length.h"
 #include "StringHash.h"
 #include "TextEncoding.h"
+#include "TextBreakIterator.h"
 #include <kjs/dtoa.h>
 #include <kjs/identifier.h>
 #include <wtf/Assertions.h>
-#include <unicode/ubrk.h>
-#include <unicode/ustring.h>
+#include <wtf/unicode/Unicode.h>
 #include <assert.h>
 
 using namespace WTF;
@@ -53,7 +53,7 @@ static inline bool isSpace(UChar c)
 {
     // Use isspace() for basic Latin-1.
     // This will include newlines, which aren't included in unicode DirWS.
-    return c <= 0x7F ? isspace(c) : (u_charDirection(c) == U_WHITE_SPACE_NEUTRAL);
+    return c <= 0x7F ? isspace(c) : WTF::Unicode::isSpace(c);
 }    
     
 static inline UChar* newUCharVector(unsigned n)
@@ -283,14 +283,14 @@ static Length parseLength(const UChar* m_data, unsigned int m_length)
         ++i;
     if (i < m_length && (m_data[i] == '+' || m_data[i] == '-'))
         ++i;
-    while (i < m_length && u_isdigit(m_data[i]))
+    while (i < m_length && WTF::Unicode::isDigit(m_data[i]))
         ++i;
 
     bool ok;
     int r = DeprecatedConstString(reinterpret_cast<const DeprecatedChar*>(m_data), i).string().toInt(&ok);
 
     /* Skip over any remaining digits, we are not that accurate (5.5% => 5%) */
-    while (i < m_length && (u_isdigit(m_data[i]) || m_data[i] == '.'))
+    while (i < m_length && (WTF::Unicode::isDigit(m_data[i]) || m_data[i] == '.'))
         ++i;
 
     /* IE Quirk: Skip any whitespace (20 % => 20%) */
@@ -398,9 +398,9 @@ bool StringImpl::isLower() const
         return allLower;
 
     // Do a slower check for the other cases.
-    UBool allLower2 = true;
+    bool allLower2 = true;
     for (unsigned i = 0; i < m_length; i++)
-        allLower2 &= u_islower(m_data[i]);
+        allLower2 &= WTF::Unicode::isLower(m_data[i]);
     return allLower2;
 }
 
@@ -426,9 +426,9 @@ StringImpl* StringImpl::lower() const
     if (!(ored & ~0x7F))
         return c;
 
-    UErrorCode status = U_ZERO_ERROR;
-    int32_t realLength = u_strToLower(data, length, m_data, length, "", &status);
-    if (U_SUCCESS(status) && realLength == length)
+    bool error;
+    int32_t realLength = WTF::Unicode::toLower(data, length, m_data, m_length, &error);
+    if (!error && realLength == length)
         return c;
 
     if (realLength > length) {
@@ -440,9 +440,8 @@ StringImpl* StringImpl::lower() const
     c->m_data = data;
     c->m_length = length;
 
-    status = U_ZERO_ERROR;
-    u_strToLower(data, length, m_data, m_length, "", &status);
-    if (U_FAILURE(status)) {
+    WTF::Unicode::toLower(data, length, m_data, m_length, &error);
+    if (error) {
         c->ref();
         c->deref();
         return copy();
@@ -455,13 +454,12 @@ StringImpl* StringImpl::upper() const
     StringImpl* c = new StringImpl;
     if (!m_length)
         return c;
-    UErrorCode status = U_ZERO_ERROR;
-    int32_t length = u_strToUpper(0, 0, m_data, m_length, "", &status);
+    bool error;
+    int32_t length = WTF::Unicode::toUpper(0, 0, m_data, m_length, &error);
     c->m_data = newUCharVector(length);
     c->m_length = length;
-    status = U_ZERO_ERROR;
-    u_strToUpper(c->m_data, length, m_data, m_length, "", &status);
-    if (U_FAILURE(status)) {
+    WTF::Unicode::toUpper(c->m_data, length, m_data, m_length, &error);
+    if (error) {
         c->ref();
         c->deref();
         return copy();
@@ -474,7 +472,7 @@ StringImpl* StringImpl::secure(UChar aChar) const
     StringImpl* c= new StringImpl;
     c->m_data = newUCharVector(c->m_length= m_length);
     
-    u_memset(c->m_data, aChar, m_length);
+    WTF::Unicode::memset(c->m_data, aChar, m_length);
     
     return c;
 }
@@ -484,13 +482,12 @@ StringImpl* StringImpl::foldCase() const
     StringImpl* c = new StringImpl;
     if (!m_length)
         return c;
-    UErrorCode status = U_ZERO_ERROR;
-    int32_t length = u_strFoldCase(0, 0, m_data, m_length, U_FOLD_CASE_DEFAULT, &status);
+    bool error;
+    int32_t length = WTF::Unicode::foldCase(0, 0, m_data, m_length, &error);
     c->m_data = newUCharVector(length);
     c->m_length = length;
-    status = U_ZERO_ERROR;
-    u_strFoldCase(c->m_data, length, m_data, m_length, U_FOLD_CASE_DEFAULT, &status);
-    if (U_FAILURE(status)) {
+    WTF::Unicode::foldCase(c->m_data, length, m_data, m_length, &error);
+    if (error) {
         c->ref();
         c->deref();
         return copy();
@@ -559,36 +556,12 @@ StringImpl* StringImpl::simplifyWhiteSpace() const
     return c;
 }
 
-// FIXME: this implementation should move to its own file now that StringImpl is not the only class that uses it
-UBreakIterator* getWordBreakIterator(const UChar* string, int length)
-{
-    // The locale is currently ignored when determining character cluster breaks.
-    // This may change in the future, according to Deborah Goldsmith.
-    static bool createdIterator = false;
-    static UBreakIterator* iterator;
-    UErrorCode status;
-    if (!createdIterator) {
-        status = U_ZERO_ERROR;
-        iterator = ubrk_open(UBRK_WORD, "en_us", 0, 0, &status);
-        createdIterator = true;
-    }
-    if (!iterator)
-        return 0;
-
-    status = U_ZERO_ERROR;
-    ubrk_setText(iterator, reinterpret_cast<const ::UChar*>(string), length, &status);
-    if (U_FAILURE(status))
-        return 0;
-
-    return iterator;
-}
-
 StringImpl* StringImpl::capitalize(UChar previous) const
 {
     StringImpl* capitalizedString = new StringImpl;
     if (!m_length)
         return capitalizedString;
-    
+
     UChar* stringWithPrevious = newUCharVector(m_length + 1);
     stringWithPrevious[0] = previous;
     for (unsigned i = 1; i < m_length + 1; i++) {
@@ -599,25 +572,26 @@ StringImpl* StringImpl::capitalize(UChar previous) const
             stringWithPrevious[i] = m_data[i - 1];
     }
 
-    UBreakIterator* boundary = getWordBreakIterator(stringWithPrevious, m_length + 1);
+    TextBreakIterator* boundary = wordBreakIterator(stringWithPrevious, m_length + 1);
     if (!boundary) {
         deleteUCharVector(stringWithPrevious);
         return capitalizedString;
     }
-    
+
     capitalizedString->m_data = newUCharVector(m_length);
     capitalizedString->m_length = m_length;
-    
+
     int32_t endOfWord;
-    int32_t startOfWord = ubrk_first(boundary);
-    for (endOfWord = ubrk_next(boundary); endOfWord != UBRK_DONE; startOfWord = endOfWord, endOfWord = ubrk_next(boundary)) {
+    int32_t startOfWord = textBreakFirst(boundary);
+    for (endOfWord = textBreakNext(boundary); endOfWord != TextBreakDone; startOfWord = endOfWord, endOfWord = textBreakNext(boundary)) {
         if (startOfWord != 0) // Ignore first char of previous string
-            capitalizedString->m_data[startOfWord - 1] = u_totitle(stringWithPrevious[startOfWord]);
+            capitalizedString->m_data[startOfWord - 1] = WTF::Unicode::toTitleCase(stringWithPrevious[startOfWord]);
         for (int i = startOfWord + 1; i < endOfWord; i++)
             capitalizedString->m_data[i - 1] = stringWithPrevious[i];
     }
-    
+
     deleteUCharVector(stringWithPrevious);
+
     return capitalizedString;
 }
 
@@ -636,7 +610,7 @@ int StringImpl::toInt(bool* ok) const
     
     // Allow digits.
     for (; i != m_length; ++i)
-        if (!u_isdigit(m_data[i]))
+        if (!WTF::Unicode::isDigit(m_data[i]))
             break;
     
     return DeprecatedConstString(reinterpret_cast<const DeprecatedChar*>(m_data), i).string().toInt(ok);
@@ -673,7 +647,7 @@ static bool equalIgnoringCase(const UChar* a, const char* b, int length)
     ASSERT(length >= 0);
     while (length--) {
         unsigned char bc = *b++;
-        if (u_foldCase(*a++, U_FOLD_CASE_DEFAULT) != u_foldCase(bc, U_FOLD_CASE_DEFAULT))
+        if (WTF::Unicode::foldCase(*a++) != WTF::Unicode::foldCase(bc))
             return false;
     }
     return true;
@@ -682,7 +656,7 @@ static bool equalIgnoringCase(const UChar* a, const char* b, int length)
 static inline bool equalIgnoringCase(const UChar* a, const UChar* b, int length)
 {
     ASSERT(length >= 0);
-    return u_memcasecmp(a, b, length, U_FOLD_CASE_DEFAULT) == 0;
+    return WTF::Unicode::strcasecmp(a, b, length) == 0;
 }
 
 // This function should be as fast as possible, every little bit helps.
@@ -715,9 +689,9 @@ int StringImpl::find(const char* chs, int index, bool caseSensitive) const
                 return m_length - chsLength - n + 1;
         } while (--n);
     } else {
-        UChar lc = u_foldCase(*chs, U_FOLD_CASE_DEFAULT);
+        UChar lc = WTF::Unicode::foldCase(*chs);
         do {
-            if (u_foldCase(*++ptr, U_FOLD_CASE_DEFAULT) == lc
+            if (WTF::Unicode::foldCase(*++ptr) == lc
                     && equalIgnoringCase(ptr + 1, chsPlusOne, chsLengthMinusOne))
                 return m_length - chsLength - n + 1;
         } while (--n);
@@ -1019,7 +993,7 @@ bool equalIgnoringCase(const StringImpl* a, const char* b)
         equal = true;
         for (unsigned i = 0; i != length; ++i) {
             unsigned char bc = b[i];
-            equal &= u_foldCase(as[i], U_FOLD_CASE_DEFAULT) == u_foldCase(bc, U_FOLD_CASE_DEFAULT);
+            equal &= WTF::Unicode::foldCase(as[i]) == WTF::Unicode::foldCase(bc);
         }
     }
 
index a33fe077c0e60f5b649a983949f3bae459f0872a..db51c2a866e3d62131a3df558b6d8042b44f4831 100644 (file)
 #define StringImpl_h
 
 #include "Shared.h"
-#include "UChar.h"
+#include <wtf/unicode/Unicode.h>
 #include <kjs/identifier.h>
 #include <wtf/Forward.h>
 #include <wtf/Vector.h>
 #include <limits.h>
 
-typedef void UBreakIterator;
-
 #if PLATFORM(CF)
 typedef const struct __CFString * CFStringRef;
 #endif
@@ -170,8 +168,6 @@ bool equalIgnoringCase(const StringImpl*, const StringImpl*);
 bool equalIgnoringCase(const StringImpl*, const char*);
 inline bool equalIgnoringCase(const char* a, const StringImpl* b) { return equalIgnoringCase(b, a); }
 
-UBreakIterator* getWordBreakIterator(const UChar* string, int length);
-
 }
 
 namespace WTF {
index 87a5b7e7011d00555158c13e9cdb8ba2aa7fd46c..0488ea6692c581b52e610bc154ca45197564c338 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef TextBoundaries_h
 #define TextBoundaries_h
 
-#include "UChar.h"
+#include "wtf/unicode/Unicode.h"
 
 namespace WebCore {
 
diff --git a/WebCore/platform/TextBreakIterator.h b/WebCore/platform/TextBreakIterator.h
new file mode 100644 (file)
index 0000000..bcbaa4b
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 2006 Lars Knoll <lars@trolltech.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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+#ifndef TextBreakIterator_h
+#define TextBreakIterator_h
+
+#include "wtf/unicode/Unicode.h"
+
+#if USE(ICU_UNICODE)
+#include <unicode/ubrk.h>
+typedef UBreakIterator TextBreakIterator;
+#elif USE(QT4_UNICODE)
+namespace WebCore {
+    class TextBreakIterator;
+}
+#endif
+
+
+namespace WebCore {
+    TextBreakIterator* wordBreakIterator(const UChar* string, int length);
+    TextBreakIterator* characterBreakIterator(const UChar* string, int length);
+
+    int textBreakFirst(TextBreakIterator*);
+    int textBreakNext(TextBreakIterator*);
+    int textBreakCurrent(TextBreakIterator*);
+    int textBreakPreceding(TextBreakIterator*, int);
+    int textBreakFollowing(TextBreakIterator*, int);
+    enum { TextBreakDone = -1 };
+}
+#endif
diff --git a/WebCore/platform/TextBreakIteratorICU.cpp b/WebCore/platform/TextBreakIteratorICU.cpp
new file mode 100644 (file)
index 0000000..a65d4f0
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 2006 Lars Knoll <lars@trolltech.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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "TextBreakIterator.h"
+
+namespace WebCore {
+
+TextBreakIterator* wordBreakIterator(const UChar* string, int length)
+{
+    // The locale is currently ignored when determining character cluster breaks.
+    // This may change in the future, according to Deborah Goldsmith.
+    static bool createdIterator = false;
+    static UBreakIterator* iterator;
+    UErrorCode status;
+    if (!createdIterator) {
+        status = U_ZERO_ERROR;
+        iterator = ubrk_open(UBRK_WORD, "en_us", 0, 0, &status);
+        createdIterator = true;
+    }
+    if (!iterator)
+        return 0;
+
+    status = U_ZERO_ERROR;
+    ubrk_setText(iterator, string, length, &status);
+    if (U_FAILURE(status))
+        return 0;
+
+    return iterator;
+}
+
+TextBreakIterator* characterBreakIterator(const UChar* string, int length)
+{
+    if (!string)
+        return 0;
+
+    // The locale is currently ignored when determining character cluster breaks.
+    // This may change in the future, according to Deborah Goldsmith.
+    static bool createdIterator = false;
+    static UBreakIterator* iterator;
+    UErrorCode status;
+    if (!createdIterator) {
+        status = U_ZERO_ERROR;
+        iterator = ubrk_open(UBRK_CHARACTER, "en_us", 0, 0, &status);
+        createdIterator = true;
+    }
+    if (!iterator)
+        return 0;
+
+    status = U_ZERO_ERROR;
+    ubrk_setText(iterator, reinterpret_cast<const UChar*>(string), length, &status);
+    if (status != U_ZERO_ERROR)
+        return 0;
+
+    return iterator;
+}
+
+int textBreakFirst(TextBreakIterator* bi)
+{
+    return ubrk_first(bi);
+}
+
+int textBreakNext(TextBreakIterator* bi)
+{
+    return ubrk_next(bi);
+}
+
+int textBreakPreceding(TextBreakIterator* bi, int pos)
+{
+    return ubrk_preceding(bi, pos);
+}
+
+int textBreakFollowing(TextBreakIterator* bi, int pos)
+{
+    return ubrk_following(bi, pos);
+}
+
+int textBreakCurrent(TextBreakIterator* bi)
+{
+    return ubrk_current(bi);
+}
+
+}
index d235e18283f74e8424a52ddb384e685bc21b0ba1..b68246f64cd386289115858f627f4a3be537464e 100644 (file)
@@ -27,7 +27,7 @@
 #ifndef TextCodec_h
 #define TextCodec_h
 
-#include "UChar.h"
+#include "wtf/unicode/Unicode.h"
 #include <memory>
 #include <wtf/Noncopyable.h>
 #include <wtf/Vector.h>
index 8d1945d041b88e1b5c545a9ab21254076572a7f8..5b7ea138b9050bf83bbb4277153d0a83387b3010 100644 (file)
@@ -28,7 +28,7 @@
 
 #include "CString.h"
 #include "PlatformString.h"
-#include <unicode/utf16.h>
+#include "wtf/unicode/Unicode.h"
 
 using std::auto_ptr;
 
index cfa17b40b21bb634c6b4bec9f96e0da08bd2c9e4..beb19e4b0f98e3bda1d99c8e6c047c1deba3a287 100644 (file)
 #include "TextCodec.h"
 #include "TextDecoder.h"
 #include "TextEncodingRegistry.h"
+#if USE(ICU_UNICODE)
 #include <unicode/unorm.h>
+#elif USE(QT4_UNICODE)
+#include <QString>
+#endif
 #include <wtf/HashSet.h>
 #include <wtf/OwnPtr.h>
 
@@ -71,6 +75,7 @@ CString TextEncoding::encode(const UChar* characters, size_t length, bool allowE
     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.
@@ -95,8 +100,12 @@ CString TextEncoding::encode(const UChar* characters, size_t length, bool allowE
         source = normalizedCharacters.data();
         sourceLength = normalizedLength;
     }
-
     return newTextCodec(*this)->encode(source, sourceLength, allowEntities);
+#elif USE(QT4_UNICODE)
+    QString str(reinterpret_cast<const QChar*>(characters), length);
+    str = str.normalized(QString::NormalizationForm_C);
+    return newTextCodec(*this)->encode(str.utf16(), str.length(), allowEntities);
+#endif
 }
 
 bool TextEncoding::usesVisualOrdering() const
index 8af8c97555ceb3511e8a5c553be1c37b8ba82e98..86b3e8606efc65eefc8504e6e06dbf7d275c3f71 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef TextEncoding_h
 #define TextEncoding_h
 
-#include "UChar.h"
+#include "wtf/unicode/Unicode.h"
 
 namespace WebCore {
 
index 85c2256bc0b48f71d088733e6e045543a3acdb90..416bf880f2b8a5dc9bf4ab300c4be288bf5e1418 100644 (file)
@@ -39,6 +39,9 @@
 #if PLATFORM(MAC)
 #include "TextCodecMac.h"
 #endif
+#if PLATFORM(QT)
+#include "qt/TextCodecQt.h"
+#endif
 
 namespace WebCore {
 
@@ -159,6 +162,9 @@ void buildTextEncodingNameMap()
 #if USE(ICU_UNICODE)
     TextCodecICU::registerEncodingNames(addToTextEncodingNameMap);
 #endif
+#if USE(QT4_UNICODE)
+    TextCodecQt::registerEncodingNames(addToTextEncodingNameMap);
+#endif
 #if PLATFORM(MAC)
     TextCodecMac::registerEncodingNames(addToTextEncodingNameMap);
 #endif
@@ -173,6 +179,9 @@ static void buildTextCodecMap()
 #if USE(ICU_UNICODE)
     TextCodecICU::registerCodecs(addToTextCodecMap);
 #endif
+#if USE(QT4_UNICODE)
+    TextCodecQt::registerCodecs(addToTextCodecMap);
+#endif
 #if PLATFORM(MAC)
     TextCodecMac::registerCodecs(addToTextCodecMap);
 #endif
index 5275a730421d082e65e6df2d0c789fb5fb454e89..d6945ca0dad2ed5d2c3d84d691cda8a73c6c2633 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef TextEncodingRegistry_h
 #define TextEncodingRegistry_h
 
-#include "UChar.h"
+#include "wtf/unicode/Unicode.h"
 #include <memory>
 
 namespace WebCore {
index bcf41452a30adbc97e848b6939f87b0a7a4c79fd..609ae615a96cf08887362688830d62774b01c568 100644 (file)
@@ -32,7 +32,6 @@
 #include "Path.h"
 #include "Pen.h"
 #include "TextDirection.h"
-#include "UChar.h"
 #include <wtf/Noncopyable.h>
 #include <wtf/Platform.h>
 
index 9523f1f7d06a1eea1c0d9f54922a05ca2c137e4f..2206cb64cadab1ca461cd138de1a3fc7ad186d12 100644 (file)
@@ -31,7 +31,7 @@
 #include "GlyphMap.h"
 
 #include "FontData.h"
-#include <unicode/utf16.h>
+#include <wtf/unicode/Unicode.h>
 #include <wtf/Assertions.h>
 
 namespace WebCore {
diff --git a/WebCore/platform/qt/TextBreakIteratorQt.cpp b/WebCore/platform/qt/TextBreakIteratorQt.cpp
new file mode 100644 (file)
index 0000000..fad2a13
--- /dev/null
@@ -0,0 +1,172 @@
+/*
+ * This file is part of the DOM implementation for KDE.
+ *
+ * Copyright (C) 2006 Lars Knoll <lars@trolltech.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., 59 Temple Place - Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ */
+
+#include "TextBreakIterator.h"
+#include <qtextlayout.h>
+
+namespace WebCore {
+
+    class TextBreakIterator
+    {
+    public:
+        virtual int first() = 0;
+        virtual int next() = 0;
+        virtual int previous() = 0;
+        inline int following(int pos) {
+            currentPos = pos;
+            return next();
+        }
+        inline int preceding(int pos) {
+            currentPos = pos;
+            return previous();
+        }
+        int currentPos;
+        const UChar *string;
+        int length;
+    };
+
+    class WordBreakIteratorQt : public TextBreakIterator
+    {
+    public:
+        virtual int first();
+        virtual int next();
+        virtual int previous();
+    };
+
+    class CharBreakIteratorQt : public TextBreakIterator
+    {
+    public:
+        virtual int first();
+        virtual int next();
+        virtual int previous();
+        QTextLayout layout;
+    };
+
+    int WordBreakIteratorQt::first() {
+        currentPos = 0;
+        return currentPos;
+    }
+
+    int WordBreakIteratorQt::next() {
+        if (currentPos == length) {
+            currentPos = -1;
+            return currentPos;
+        }
+        bool haveSpace = false;
+        while (currentPos < length) {
+            if (haveSpace && !QChar(string[currentPos]).isSpace())
+                break;
+            if (QChar(string[currentPos]).isSpace())
+                haveSpace = true;
+            ++currentPos;
+        }
+        return currentPos;
+    }
+    int WordBreakIteratorQt::previous() {
+        if (currentPos == 0) {
+            currentPos = -1;
+            return currentPos;
+        }
+        bool haveSpace = false;
+        while (currentPos > 0) {
+            if (haveSpace && !QChar(string[currentPos]).isSpace())
+                break;
+            if (QChar(string[currentPos]).isSpace())
+                haveSpace = true;
+            --currentPos;
+        }
+        return currentPos;
+    }
+
+    int CharBreakIteratorQt::first() {
+        currentPos = 0;
+        return currentPos;
+    }
+
+    int CharBreakIteratorQt::next() {
+        if (currentPos == length)
+            return -1;
+        currentPos = layout.nextCursorPosition(currentPos);
+        return currentPos;
+    }
+    int CharBreakIteratorQt::previous() {
+        if (currentPos == 0)
+            return -1;
+        currentPos = layout.previousCursorPosition(currentPos);
+        return currentPos;
+    }
+
+
+TextBreakIterator* wordBreakIterator(const UChar* string, int length)
+{
+    static WordBreakIteratorQt *iterator = 0;
+    if (!iterator)
+        iterator = new WordBreakIteratorQt;
+
+    iterator->string = string;
+    iterator->length = length;
+    iterator->currentPos = 0;
+
+    return iterator;
+}
+
+TextBreakIterator* characterBreakIterator(const UChar* string, int length)
+{
+    static CharBreakIteratorQt *iterator = 0;
+    if (!iterator)
+        iterator = new CharBreakIteratorQt;
+
+    iterator->string = string;
+    iterator->length = length;
+    iterator->currentPos = 0;
+    iterator->layout.setText(QString(reinterpret_cast<const QChar*>(string), length));
+
+    return iterator;
+}
+
+int textBreakFirst(TextBreakIterator* bi)
+{
+    return bi->first();
+}
+
+int textBreakNext(TextBreakIterator* bi)
+{
+    return bi->next();
+}
+
+int textBreakPreceding(TextBreakIterator* bi, int pos)
+{
+    return bi->preceding(pos);
+}
+
+int textBreakFollowing(TextBreakIterator* bi, int pos)
+{
+    return bi->following(pos);
+}
+
+int textBreakCurrent(TextBreakIterator* bi)
+{
+    return bi->currentPos;
+}
+
+}
+
diff --git a/WebCore/platform/qt/TextCodecQt.cpp b/WebCore/platform/qt/TextCodecQt.cpp
new file mode 100644 (file)
index 0000000..888c6af
--- /dev/null
@@ -0,0 +1,119 @@
+/*
+ * Copyright (C) 2006 Lars Knoll <lars@trolltech.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.
+ *
+ * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``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 COMPUTER, INC. OR
+ * 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 "TextCodecQt.h"
+#include "PlatformString.h"
+#include "CString.h"
+#include <qset.h>
+// #include <QDebug>
+
+namespace WebCore {
+
+static QSet<QByteArray> *unique_names = 0;
+
+static const char *getAtomicName(const QByteArray &name)
+{
+    if (!unique_names)
+        unique_names = new QSet<QByteArray>;
+
+    unique_names->insert(name);
+    return unique_names->find(name)->constData();
+}
+
+void TextCodecQt::registerEncodingNames(EncodingNameRegistrar registrar)
+{
+    QList<int> mibs = QTextCodec::availableMibs();
+//     qDebug() << ">>>>>>>>> registerEncodingNames";
+
+    for (int i = 0; i < mibs.size(); ++i) {
+        QTextCodec *c = QTextCodec::codecForMib(mibs.at(i));
+        const char *name = getAtomicName(c->name());
+        registrar(name, name);
+//         qDebug() << "    " << name << name;
+        QList<QByteArray> aliases = c->aliases();
+        for (int i = 0; i < aliases.size(); ++i) {
+            const char *a = getAtomicName(aliases.at(i));
+//             qDebug() << "     (a) " << a << name;
+            registrar(a, name);
+        }
+    }
+}
+
+static std::auto_ptr<TextCodec> newTextCodecQt(const TextEncoding& encoding, const void*)
+{
+    return std::auto_ptr<TextCodec>(new TextCodecQt(encoding));
+}
+
+void TextCodecQt::registerCodecs(TextCodecRegistrar registrar)
+{
+    QList<int> mibs = QTextCodec::availableMibs();
+//     qDebug() << ">>>>>>>>> registerCodecs";
+
+    for (int i = 0; i < mibs.size(); ++i) {
+        QTextCodec *c = QTextCodec::codecForMib(mibs.at(i));
+        const char *name = getAtomicName(c->name());
+//         qDebug() << "    " << name;
+        registrar(name, newTextCodecQt, 0);
+    }
+}
+
+TextCodecQt::TextCodecQt(const TextEncoding& encoding)
+    : m_encoding(encoding)
+{
+    m_codec = QTextCodec::codecForName(m_encoding.name());
+}
+
+TextCodecQt::~TextCodecQt()
+{
+}
+
+
+String TextCodecQt::decode(const char* bytes, size_t length, bool flush)
+{
+    QString unicode = m_codec->toUnicode(bytes, length, &m_state);
+
+    if (flush) {
+        m_state.flags = QTextCodec::DefaultConversion;
+        m_state.remainingChars = 0;
+        m_state.invalidChars = 0;
+    }
+
+    return unicode;
+}
+
+CString TextCodecQt::encode(const UChar* characters, size_t length, bool allowEntities)
+{
+    if (!length)
+        return "";
+
+    // FIXME: do something sensible with allowEntities
+
+    QByteArray ba = m_codec->fromUnicode(reinterpret_cast<const QChar*>(characters), length, 0);
+    return CString(ba.constData(), ba.length());
+}
+
+
+} // namespace WebCore
similarity index 61%
rename from WebCore/platform/UChar.h
rename to WebCore/platform/qt/TextCodecQt.h
index bd73969930a438805567719ac16be2f8742e649f..9bbb80be574ba8db02644c9d2fcc72b6eca00f46 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * Copyright (C) 2006 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2006 Lars Knoll <lars@trolltech.com>
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * 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. 
+ * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef UChar_h
-#define UChar_h
+#ifndef TextCodecQt_h
+#define TextCodecQt_h
 
-#include <unicode/umachine.h>
+#include "TextCodec.h"
+#include "TextEncoding.h"
+#include <QTextCodec>
 
-#endif // UChar_h
+class QTextCodec;
+
+namespace WebCore {
+
+    class TextCodecQt : public TextCodec {
+    public:
+        static void registerEncodingNames(EncodingNameRegistrar);
+        static void registerCodecs(TextCodecRegistrar);
+
+        TextCodecQt(const TextEncoding&);
+        virtual ~TextCodecQt();
+
+        virtual String decode(const char*, size_t length, bool flush = false);
+        virtual CString encode(const UChar*, size_t length, bool allowEntities = false);
+
+    private:
+        TextEncoding m_encoding;
+        QTextCodec *m_codec;
+        QTextCodec::ConverterState m_state;
+    };
+
+} // namespace WebCore
+
+#endif // TextCodecICU_h
index 77db9381b8477d00a7f5f0ddb120f3878f786f22..8801cccaada226086780a0b3c06f44f2304245ed 100644 (file)
@@ -3495,7 +3495,7 @@ void RenderBlock::updateFirstLetter()
             unsigned int length = 0;
             
             // account for leading spaces and punctuation
-            while (length < oldText->length() && (DeprecatedChar((*oldText)[length]).isSpace() || u_ispunct((*oldText)[length])))
+            while (length < oldText->length() && (DeprecatedChar((*oldText)[length]).isSpace() || WTF::Unicode::isPunct((*oldText)[length])))
                 length++;
             
             // account for first letter
index 61dca3797d89863718307224bac039d459d0674e..15bdf6431665f1018a908159bbd3aefa2da479f3 100644 (file)
 #include "RenderBlock.h"
 #include "TextStyle.h"
 #include "break_lines.h"
-#include <unicode/ubrk.h>
+#include "TextBreakIterator.h"
 #include <wtf/AlwaysInline.h>
 
 using namespace std;
 
 namespace WebCore {
 
-UBreakIterator* characterBreakIterator(const StringImpl* i)
-{
-    if (!i)
-        return 0;
-
-    // The locale is currently ignored when determining character cluster breaks.
-    // This may change in the future, according to Deborah Goldsmith.
-    static bool createdIterator = false;
-    static UBreakIterator* iterator;
-    UErrorCode status;
-    if (!createdIterator) {
-        status = U_ZERO_ERROR;
-        iterator = ubrk_open(UBRK_CHARACTER, "en_us", 0, 0, &status);
-        createdIterator = true;
-    }
-    if (!iterator)
-        return 0;
-
-    status = U_ZERO_ERROR;
-    ubrk_setText(iterator, reinterpret_cast<const UChar*>(i->characters()), i->length(), &status);
-    if (status != U_ZERO_ERROR)
-        return 0;
-
-    return iterator;
-}
-
 int RenderText::previousOffset(int current) const
 {
-    UBreakIterator* iterator = characterBreakIterator(str.get());
+    StringImpl *si = str.get();
+    TextBreakIterator* iterator = characterBreakIterator(si->characters(), si->length());
     if (!iterator)
         return current - 1;
 
-    long result = ubrk_preceding(iterator, current);
-    if (result == UBRK_DONE)
+    long result = textBreakPreceding(iterator, current);
+    if (result == TextBreakDone)
         result = current - 1;
 
     return result;
@@ -83,12 +58,13 @@ int RenderText::previousOffset(int current) const
 
 int RenderText::nextOffset(int current) const
 {
-    UBreakIterator* iterator = characterBreakIterator(str.get());
+    StringImpl *si = str.get();
+    TextBreakIterator* iterator = characterBreakIterator(si->characters(), si->length());
     if (!iterator)
         return current + 1;
     
-    long result = ubrk_following(iterator, current);
-    if (result == UBRK_DONE)
+    long result = textBreakFollowing(iterator, current);
+    if (result == TextBreakDone)
         result = current + 1;
 
     return result;
@@ -493,8 +469,8 @@ ALWAYS_INLINE int RenderText::widthFromCache(const Font* f, int start, int len,
         int i, w = 0;
         for (i = start; i < start+len; i++) {
             UChar c = (*str)[i];
-            UCharDirection dir = u_charDirection(c);
-            if (dir != U_DIR_NON_SPACING_MARK && dir != U_BOUNDARY_NEUTRAL) {
+            WTF::Unicode::Direction dir = WTF::Unicode::direction(c);
+            if (dir != WTF::Unicode::NonSpacingMark && dir != WTF::Unicode::BoundaryNeutral) {
                 if (c == '\t' && tabWidth != 0)
                     w += tabWidth - ((xpos + w) % tabWidth);
                 else
index 64ab60328af1c5a4caa7201ee823e96a15214204..44bd2db31644dd6ba355370ab3c999b2fa8ea6ff 100644 (file)
@@ -28,8 +28,6 @@
 #include "RenderObject.h"
 #include "Text.h"
 
-typedef void UBreakIterator;
-
 namespace WebCore {
 
 // Define a constant for soft hyphen's unicode value.
@@ -186,8 +184,6 @@ protected:
     int m_monospaceCharacterWidth;
 };
 
-UBreakIterator* characterBreakIterator(const StringImpl*);
-
 } // namespace WebCore
 
 #endif // RenderText_h
index 31c264ebfd0ac38fe77f0b627731bea0b1c27e88..a27fa62d82783f67e1ddfd2103073024a4faa5f0 100644 (file)
@@ -48,7 +48,7 @@ struct BidiIterator {
     bool atEnd() const;
     
     UChar current() const;
-    UCharDirection direction() const;
+    WTF::Unicode::Direction direction() const;
 
     RenderBlock* block;
     RenderObject* obj;
@@ -56,7 +56,7 @@ struct BidiIterator {
 };
 
 struct BidiState {
-    BidiState() : context(0), dir(U_OTHER_NEUTRAL), adjustEmbedding(false), reachedEndOfLine(false) {}
+    BidiState() : context(0), dir(WTF::Unicode::OtherNeutral), adjustEmbedding(false), reachedEndOfLine(false) {}
     
     BidiIterator sor;
     BidiIterator eor;
@@ -64,7 +64,7 @@ struct BidiState {
     BidiIterator current;
     RefPtr<BidiContext> context;
     BidiStatus status;
-    UCharDirection dir;
+    WTF::Unicode::Direction dir;
     bool adjustEmbedding;
     BidiIterator endOfLine;
     bool reachedEndOfLine;
@@ -104,7 +104,7 @@ static bool previousLineBrokeCleanly = true;
 static bool emptyRun = true;
 static int numSpaces;
 
-static void embed(UCharDirection, BidiState&);
+static void embed(WTF::Unicode::Direction, BidiState&);
 static void appendRun(BidiState&);
 
 static int getBPMWidth(int childValue, Length cssUnit)
@@ -199,7 +199,7 @@ static void deleteBidiRuns(RenderArena* arena)
    Each line of text caches the embedding level at the start of the line for faster
    relayouting
 */
-BidiContext::BidiContext(unsigned char l, UCharDirection e, BidiContext *p, bool o)
+BidiContext::BidiContext(unsigned char l, WTF::Unicode::Direction e, BidiContext *p, bool o)
     : level(l), override(o), m_dir(e)
 {
     parent = p;
@@ -280,9 +280,9 @@ static inline RenderObject* bidiNext(RenderBlock* block, RenderObject* current,
                 EUnicodeBidi ub = next->style()->unicodeBidi();
                 if (ub != UBNormal) {
                     TextDirection dir = next->style()->direction();
-                    UCharDirection d = (ub == Embed
-                        ? (dir == RTL ? U_RIGHT_TO_LEFT_EMBEDDING : U_LEFT_TO_RIGHT_EMBEDDING)
-                        : (dir == RTL ? U_RIGHT_TO_LEFT_OVERRIDE : U_LEFT_TO_RIGHT_OVERRIDE));
+                    WTF::Unicode::Direction d = (ub == Embed
+                        ? (dir == RTL ? WTF::Unicode::RightToLeftEmbedding : WTF::Unicode::LeftToRightEmbedding)
+                        : (dir == RTL ? WTF::Unicode::RightToLeftOverride : WTF::Unicode::LeftToRightOverride));
                     embed(d, bidi);
                 }
             }
@@ -298,7 +298,7 @@ static inline RenderObject* bidiNext(RenderBlock* block, RenderObject* current,
 
             while (current && current != block) {
                 if (bidi.adjustEmbedding && current->isInlineFlow() && current->style()->unicodeBidi() != UBNormal)
-                    embed(U_POP_DIRECTIONAL_FORMAT, bidi);
+                    embed(WTF::Unicode::PopDirectionalFormat, bidi);
 
                 next = current->nextSibling();
                 if (next) {
@@ -306,9 +306,9 @@ static inline RenderObject* bidiNext(RenderBlock* block, RenderObject* current,
                         EUnicodeBidi ub = next->style()->unicodeBidi();
                         if (ub != UBNormal) {
                             TextDirection dir = next->style()->direction();
-                            UCharDirection d = (ub == Embed
-                                ? (dir == RTL ? U_RIGHT_TO_LEFT_EMBEDDING : U_LEFT_TO_RIGHT_EMBEDDING)
-                                : (dir == RTL ? U_RIGHT_TO_LEFT_OVERRIDE : U_LEFT_TO_RIGHT_OVERRIDE));
+                            WTF::Unicode::Direction d = (ub == Embed
+                                ? (dir == RTL ? WTF::Unicode::RightToLeftEmbedding: WTF::Unicode::LeftToRightEmbedding)
+                                : (dir == RTL ? WTF::Unicode::RightToLeftOverride : WTF::Unicode::LeftToRightOverride));
                             embed(d, bidi);
                         }
                     }
@@ -348,9 +348,9 @@ static RenderObject* bidiFirst(RenderBlock* block, BidiState& bidi, bool skipInl
             EUnicodeBidi ub = o->style()->unicodeBidi();
             if (ub != UBNormal) {
                 TextDirection dir = o->style()->direction();
-                UCharDirection d = (ub == Embed
-                    ? (dir == RTL ? U_RIGHT_TO_LEFT_EMBEDDING : U_LEFT_TO_RIGHT_EMBEDDING)
-                    : (dir == RTL ? U_RIGHT_TO_LEFT_OVERRIDE : U_LEFT_TO_RIGHT_OVERRIDE));
+                WTF::Unicode::Direction d = (ub == Embed
+                    ? (dir == RTL ? WTF::Unicode::RightToLeftEmbedding : WTF::Unicode::LeftToRightEmbedding)
+                    : (dir == RTL ? WTF::Unicode::RightToLeftOverride : WTF::Unicode::LeftToRightOverride));
                 embed(d, bidi);
             }
         }
@@ -398,18 +398,18 @@ UChar BidiIterator::current() const
     return text->text()[pos];
 }
 
-ALWAYS_INLINE UCharDirection BidiIterator::direction() const
+ALWAYS_INLINE WTF::Unicode::Direction BidiIterator::direction() const
 {
     if (!obj)
-        return U_OTHER_NEUTRAL;
+        return WTF::Unicode::OtherNeutral;
     if (obj->isListMarker())
-        return obj->style()->direction() == LTR ? U_LEFT_TO_RIGHT : U_RIGHT_TO_LEFT;
+        return obj->style()->direction() == LTR ? WTF::Unicode::LeftToRight : WTF::Unicode::RightToLeft;
     if (!obj->isText())
-        return U_OTHER_NEUTRAL;
+        return WTF::Unicode::OtherNeutral;
     RenderText* renderTxt = static_cast<RenderText*>(obj);
     if (pos >= renderTxt->stringLength())
-        return U_OTHER_NEUTRAL;
-    return u_charDirection(renderTxt->text()[pos]);
+        return WTF::Unicode::OtherNeutral;
+    return WTF::Unicode::direction(renderTxt->text()[pos]);
 }
 
 // -------------------------------------------------------------------------------------------------
@@ -622,44 +622,44 @@ static void appendRun(BidiState &bidi)
     
     bidi.eor.increment(bidi);
     bidi.sor = bidi.eor;
-    bidi.dir = U_OTHER_NEUTRAL;
-    bidi.status.eor = U_OTHER_NEUTRAL;
+    bidi.dir = WTF::Unicode::OtherNeutral;
+    bidi.status.eor = WTF::Unicode::OtherNeutral;
     bidi.adjustEmbedding = b;
 }
 
-static void embed(UCharDirection d, BidiState& bidi)
+static void embed(WTF::Unicode::Direction d, BidiState& bidi)
 {
     bool b = bidi.adjustEmbedding;
     bidi.adjustEmbedding = false;
-    if (d == U_POP_DIRECTIONAL_FORMAT) {
+    if (d == WTF::Unicode::PopDirectionalFormat) {
         BidiContext *c = bidi.context->parent;
         if (c) {
             if (!emptyRun && bidi.eor != bidi.last) {
-                assert(bidi.status.eor != U_OTHER_NEUTRAL);
+                assert(bidi.status.eor != WTF::Unicode::OtherNeutral);
                 // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last
-                assert(bidi.status.last == U_EUROPEAN_NUMBER_SEPARATOR
-                    || bidi.status.last == U_EUROPEAN_NUMBER_TERMINATOR
-                    || bidi.status.last == U_COMMON_NUMBER_SEPARATOR
-                    || bidi.status.last == U_BOUNDARY_NEUTRAL
-                    || bidi.status.last == U_BLOCK_SEPARATOR
-                    || bidi.status.last == U_SEGMENT_SEPARATOR
-                    || bidi.status.last == U_WHITE_SPACE_NEUTRAL
-                    || bidi.status.last == U_OTHER_NEUTRAL);
-                if (bidi.dir == U_OTHER_NEUTRAL)
+                assert(bidi.status.last == WTF::Unicode::EuropeanNumberSeparator
+                    || bidi.status.last == WTF::Unicode::EuropeanNumberTerminator
+                    || bidi.status.last == WTF::Unicode::CommonNumberSeparator
+                    || bidi.status.last == WTF::Unicode::BoundaryNeutral
+                    || bidi.status.last == WTF::Unicode::BlockSeparator
+                    || bidi.status.last == WTF::Unicode::SegmentSeparator
+                    || bidi.status.last == WTF::Unicode::WhiteSpaceNeutral
+                    || bidi.status.last == WTF::Unicode::OtherNeutral);
+                if (bidi.dir == WTF::Unicode::OtherNeutral)
                     bidi.dir = bidi.context->dir();
-                if (bidi.context->dir() == U_LEFT_TO_RIGHT) {
+                if (bidi.context->dir() == WTF::Unicode::LeftToRight) {
                     // bidi.sor ... bidi.eor ... bidi.last L
-                    if (bidi.status.eor == U_EUROPEAN_NUMBER) {
-                        if (bidi.status.lastStrong != U_LEFT_TO_RIGHT) {
-                            bidi.dir = U_EUROPEAN_NUMBER;
+                    if (bidi.status.eor == WTF::Unicode::EuropeanNumber) {
+                        if (bidi.status.lastStrong != WTF::Unicode::LeftToRight) {
+                            bidi.dir = WTF::Unicode::EuropeanNumber;
                             appendRun(bidi);
                         }
-                    } else if (bidi.status.eor == U_ARABIC_NUMBER) {
-                        bidi.dir = U_ARABIC_NUMBER;
+                    } else if (bidi.status.eor == WTF::Unicode::ArabicNumber) {
+                        bidi.dir = WTF::Unicode::ArabicNumber;
                         appendRun(bidi);
-                    } else if (bidi.status.eor != U_LEFT_TO_RIGHT)
+                    } else if (bidi.status.eor != WTF::Unicode::LeftToRight)
                         appendRun(bidi);
-                } else if (bidi.status.eor != U_RIGHT_TO_LEFT && bidi.status.eor != U_RIGHT_TO_LEFT_ARABIC)
+                } else if (bidi.status.eor != WTF::Unicode::RightToLeft && bidi.status.eor != WTF::Unicode::RightToLeftArabic)
                     appendRun(bidi);
                 bidi.eor = bidi.last;
             }
@@ -673,15 +673,15 @@ static void embed(UCharDirection d, BidiState& bidi)
             bidi.eor.obj = 0;
         }
     } else {
-        UCharDirection runDir;
-        if (d == U_RIGHT_TO_LEFT_EMBEDDING || d == U_RIGHT_TO_LEFT_OVERRIDE)
-            runDir = U_RIGHT_TO_LEFT;
+        WTF::Unicode::Direction runDir;
+        if (d == WTF::Unicode::RightToLeftEmbedding || d == WTF::Unicode::RightToLeftOverride)
+            runDir = WTF::Unicode::RightToLeft;
         else
-            runDir = U_LEFT_TO_RIGHT;
-        bool override = d == U_LEFT_TO_RIGHT_OVERRIDE || d == U_RIGHT_TO_LEFT_OVERRIDE;
+            runDir = WTF::Unicode::LeftToRight;
+        bool override = d == WTF::Unicode::LeftToRightOverride || d == WTF::Unicode::RightToLeftOverride;
 
         unsigned char level = bidi.context->level;
-        if (runDir == U_RIGHT_TO_LEFT) {
+        if (runDir == WTF::Unicode::RightToLeft) {
             if (level%2) // we have an odd level
                 level += 2;
             else
@@ -695,47 +695,47 @@ static void embed(UCharDirection d, BidiState& bidi)
 
         if (level < 61) {
             if (!emptyRun && bidi.eor != bidi.last) {
-                assert(bidi.status.eor != U_OTHER_NEUTRAL);
+                assert(bidi.status.eor != WTF::Unicode::OtherNeutral);
                 // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last
-                assert(bidi.status.last == U_EUROPEAN_NUMBER_SEPARATOR
-                    || bidi.status.last == U_EUROPEAN_NUMBER_TERMINATOR
-                    || bidi.status.last == U_COMMON_NUMBER_SEPARATOR
-                    || bidi.status.last == U_BOUNDARY_NEUTRAL
-                    || bidi.status.last == U_BLOCK_SEPARATOR
-                    || bidi.status.last == U_SEGMENT_SEPARATOR
-                    || bidi.status.last == U_WHITE_SPACE_NEUTRAL
-                    || bidi.status.last == U_OTHER_NEUTRAL);
-                if (bidi.dir == U_OTHER_NEUTRAL)
+                assert(bidi.status.last == WTF::Unicode::EuropeanNumberSeparator
+                    || bidi.status.last == WTF::Unicode::EuropeanNumberTerminator
+                    || bidi.status.last == WTF::Unicode::CommonNumberSeparator
+                    || bidi.status.last == WTF::Unicode::BoundaryNeutral
+                    || bidi.status.last == WTF::Unicode::BlockSeparator
+                    || bidi.status.last == WTF::Unicode::SegmentSeparator
+                    || bidi.status.last == WTF::Unicode::WhiteSpaceNeutral
+                    || bidi.status.last == WTF::Unicode::OtherNeutral);
+                if (bidi.dir == WTF::Unicode::OtherNeutral)
                     bidi.dir = runDir;
-                if (runDir == U_LEFT_TO_RIGHT) {
+                if (runDir == WTF::Unicode::LeftToRight) {
                     // bidi.sor ... bidi.eor ... bidi.last L
-                    if (bidi.status.eor == U_EUROPEAN_NUMBER) {
-                        if (bidi.status.lastStrong != U_LEFT_TO_RIGHT) {
-                            bidi.dir = U_EUROPEAN_NUMBER;
+                    if (bidi.status.eor == WTF::Unicode::EuropeanNumber) {
+                        if (bidi.status.lastStrong != WTF::Unicode::LeftToRight) {
+                            bidi.dir = WTF::Unicode::EuropeanNumber;
                             appendRun(bidi);
-                            if (bidi.context->dir() != U_LEFT_TO_RIGHT)
-                                bidi.dir = U_RIGHT_TO_LEFT;
+                            if (bidi.context->dir() != WTF::Unicode::LeftToRight)
+                                bidi.dir = WTF::Unicode::RightToLeft;
                         }
-                    } else if (bidi.status.eor == U_ARABIC_NUMBER) {
-                        bidi.dir = U_ARABIC_NUMBER;
+                    } else if (bidi.status.eor == WTF::Unicode::ArabicNumber) {
+                        bidi.dir = WTF::Unicode::ArabicNumber;
                         appendRun(bidi);
-                        if (bidi.context->dir() != U_LEFT_TO_RIGHT) {
+                        if (bidi.context->dir() != WTF::Unicode::LeftToRight) {
                             bidi.eor = bidi.last;
-                            bidi.dir = U_RIGHT_TO_LEFT;
+                            bidi.dir = WTF::Unicode::RightToLeft;
                             appendRun(bidi);
                         }
-                    } else if (bidi.status.eor != U_LEFT_TO_RIGHT) {
-                        if (bidi.context->dir() == U_LEFT_TO_RIGHT || bidi.status.lastStrong == U_LEFT_TO_RIGHT)
+                    } else if (bidi.status.eor != WTF::Unicode::LeftToRight) {
+                        if (bidi.context->dir() == WTF::Unicode::LeftToRight || bidi.status.lastStrong == WTF::Unicode::LeftToRight)
                             appendRun(bidi);
                         else
-                            bidi.dir = U_RIGHT_TO_LEFT; 
+                            bidi.dir = WTF::Unicode::RightToLeft;
                     }
-                } else if (bidi.status.eor != U_RIGHT_TO_LEFT && bidi.status.eor != U_RIGHT_TO_LEFT_ARABIC) {
+                } else if (bidi.status.eor != WTF::Unicode::RightToLeft && bidi.status.eor != WTF::Unicode::RightToLeftArabic) {
                     // bidi.sor ... bidi.eor ... bidi.last R; bidi.eor=L/EN/AN; EN,AN behave like R (rule N1)
-                    if (bidi.context->dir() == U_RIGHT_TO_LEFT || bidi.status.lastStrong == U_RIGHT_TO_LEFT || bidi.status.lastStrong == U_RIGHT_TO_LEFT_ARABIC)
+                    if (bidi.context->dir() == WTF::Unicode::RightToLeft || bidi.status.lastStrong == WTF::Unicode::RightToLeft || bidi.status.lastStrong == WTF::Unicode::RightToLeftArabic)
                         appendRun(bidi);
                     else
-                        bidi.dir = U_LEFT_TO_RIGHT;
+                        bidi.dir = WTF::Unicode::LeftToRight;
                 }
                 bidi.eor = bidi.last;
             }
@@ -921,7 +921,7 @@ void RenderBlock::computeHorizontalPositionsForLine(RootInlineBox* lineBox, Bidi
         case TAAUTO:
             numSpaces = 0;
             // for right to left fall through to right aligned
-            if (bidi.context->basicDir() == U_LEFT_TO_RIGHT)
+            if (bidi.context->basicDir() == WTF::Unicode::LeftToRight)
                 break;
         case RIGHT:
         case KHTML_RIGHT:
@@ -1015,7 +1015,7 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
     sLastBidiRun = 0;
     sBidiRunCount = 0;
 
-    assert(bidi.dir == U_OTHER_NEUTRAL);
+    assert(bidi.dir == WTF::Unicode::OtherNeutral);
 
     emptyRun = true;
 
@@ -1029,7 +1029,7 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
     BidiState stateAtEnd;
 
     while (true) {
-        UCharDirection dirCurrent;
+        WTF::Unicode::Direction dirCurrent;
         if (pastEnd && (previousLineBrokeCleanly || bidi.current.atEnd())) {
             BidiContext *c = bidi.context.get();
             while (c->parent)
@@ -1046,75 +1046,75 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
         } else {
             dirCurrent = bidi.current.direction();
             if (bidi.context->override
-                    && dirCurrent != U_RIGHT_TO_LEFT_EMBEDDING
-                    && dirCurrent != U_LEFT_TO_RIGHT_EMBEDDING
-                    && dirCurrent != U_RIGHT_TO_LEFT_OVERRIDE
-                    && dirCurrent != U_LEFT_TO_RIGHT_OVERRIDE
-                    && dirCurrent != U_POP_DIRECTIONAL_FORMAT)
+                    && dirCurrent != WTF::Unicode::RightToLeftEmbedding
+                    && dirCurrent != WTF::Unicode::LeftToRightEmbedding
+                    && dirCurrent != WTF::Unicode::RightToLeftOverride
+                    && dirCurrent != WTF::Unicode::LeftToRightOverride
+                    && dirCurrent != WTF::Unicode::PopDirectionalFormat)
                 dirCurrent = bidi.context->dir();
-            else if (dirCurrent == U_DIR_NON_SPACING_MARK)
+            else if (dirCurrent == WTF::Unicode::NonSpacingMark)
                 dirCurrent = bidi.status.last;
         }
 
-        assert(bidi.status.eor != U_OTHER_NEUTRAL);
+        assert(bidi.status.eor != WTF::Unicode::OtherNeutral);
         switch (dirCurrent) {
 
         // embedding and overrides (X1-X9 in the Bidi specs)
-        case U_RIGHT_TO_LEFT_EMBEDDING:
-        case U_LEFT_TO_RIGHT_EMBEDDING:
-        case U_RIGHT_TO_LEFT_OVERRIDE:
-        case U_LEFT_TO_RIGHT_OVERRIDE:
-        case U_POP_DIRECTIONAL_FORMAT:
+        case WTF::Unicode::RightToLeftEmbedding:
+        case WTF::Unicode::LeftToRightEmbedding:
+        case WTF::Unicode::RightToLeftOverride:
+        case WTF::Unicode::LeftToRightOverride:
+        case WTF::Unicode::PopDirectionalFormat:
             embed(dirCurrent, bidi);
             break;
 
             // strong types
-        case U_LEFT_TO_RIGHT:
+        case WTF::Unicode::LeftToRight:
             switch(bidi.status.last) {
-                case U_RIGHT_TO_LEFT:
-                case U_RIGHT_TO_LEFT_ARABIC:
-                case U_EUROPEAN_NUMBER:
-                case U_ARABIC_NUMBER:
-                    if (bidi.status.last != U_EUROPEAN_NUMBER || bidi.status.lastStrong != U_LEFT_TO_RIGHT)
+                case WTF::Unicode::RightToLeft:
+                case WTF::Unicode::RightToLeftArabic:
+                case WTF::Unicode::EuropeanNumber:
+                case WTF::Unicode::ArabicNumber:
+                    if (bidi.status.last != WTF::Unicode::EuropeanNumber || bidi.status.lastStrong != WTF::Unicode::LeftToRight)
                         appendRun(bidi);
                     break;
-                case U_LEFT_TO_RIGHT:
+                case WTF::Unicode::LeftToRight:
                     break;
-                case U_EUROPEAN_NUMBER_SEPARATOR:
-                case U_EUROPEAN_NUMBER_TERMINATOR:
-                case U_COMMON_NUMBER_SEPARATOR:
-                case U_BOUNDARY_NEUTRAL:
-                case U_BLOCK_SEPARATOR:
-                case U_SEGMENT_SEPARATOR:
-                case U_WHITE_SPACE_NEUTRAL:
-                case U_OTHER_NEUTRAL:
-                    if (bidi.status.eor == U_EUROPEAN_NUMBER) {
-                        if (bidi.status.lastStrong != U_LEFT_TO_RIGHT) {
+                case WTF::Unicode::EuropeanNumberSeparator:
+                case WTF::Unicode::EuropeanNumberTerminator:
+                case WTF::Unicode::CommonNumberSeparator:
+                case WTF::Unicode::BoundaryNeutral:
+                case WTF::Unicode::BlockSeparator:
+                case WTF::Unicode::SegmentSeparator:
+                case WTF::Unicode::WhiteSpaceNeutral:
+                case WTF::Unicode::OtherNeutral:
+                    if (bidi.status.eor == WTF::Unicode::EuropeanNumber) {
+                        if (bidi.status.lastStrong != WTF::Unicode::LeftToRight) {
                             // the numbers need to be on a higher embedding level, so let's close that run
-                            bidi.dir = U_EUROPEAN_NUMBER;
+                            bidi.dir = WTF::Unicode::EuropeanNumber;
                             appendRun(bidi);
-                            if (bidi.context->dir() != U_LEFT_TO_RIGHT) {
+                            if (bidi.context->dir() != WTF::Unicode::LeftToRight) {
                                 // the neutrals take the embedding direction, which is R
                                 bidi.eor = bidi.last;
-                                bidi.dir = U_RIGHT_TO_LEFT;
+                                bidi.dir = WTF::Unicode::RightToLeft;
                                 appendRun(bidi);
                             }
                         }
-                    } else if (bidi.status.eor == U_ARABIC_NUMBER) {
+                    } else if (bidi.status.eor == WTF::Unicode::ArabicNumber) {
                         // Arabic numbers are always on a higher embedding level, so let's close that run
-                        bidi.dir = U_ARABIC_NUMBER;
+                        bidi.dir = WTF::Unicode::ArabicNumber;
                         appendRun(bidi);
-                        if (bidi.context->dir() != U_LEFT_TO_RIGHT) {
+                        if (bidi.context->dir() != WTF::Unicode::LeftToRight) {
                             // the neutrals take the embedding direction, which is R
                             bidi.eor = bidi.last;
-                            bidi.dir = U_RIGHT_TO_LEFT;
+                            bidi.dir = WTF::Unicode::RightToLeft;
                             appendRun(bidi);
                         }
-                    } else if(bidi.status.eor != U_LEFT_TO_RIGHT) {
+                    } else if(bidi.status.eor != WTF::Unicode::LeftToRight) {
                         //last stuff takes embedding dir
-                        if (bidi.context->dir() != U_LEFT_TO_RIGHT && bidi.status.lastStrong != U_LEFT_TO_RIGHT) {
+                        if (bidi.context->dir() != WTF::Unicode::LeftToRight && bidi.status.lastStrong != WTF::Unicode::LeftToRight) {
                             bidi.eor = bidi.last; 
-                            bidi.dir = U_RIGHT_TO_LEFT; 
+                            bidi.dir = WTF::Unicode::RightToLeft;
                         }
                         appendRun(bidi); 
                     }
@@ -1122,34 +1122,34 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
                     break;
             }
             bidi.eor = bidi.current;
-            bidi.status.eor = U_LEFT_TO_RIGHT;
-            bidi.status.lastStrong = U_LEFT_TO_RIGHT;
-            bidi.dir = U_LEFT_TO_RIGHT;
+            bidi.status.eor = WTF::Unicode::LeftToRight;
+            bidi.status.lastStrong = WTF::Unicode::LeftToRight;
+            bidi.dir = WTF::Unicode::LeftToRight;
             break;
-        case U_RIGHT_TO_LEFT_ARABIC:
-        case U_RIGHT_TO_LEFT:
+        case WTF::Unicode::RightToLeftArabic:
+        case WTF::Unicode::RightToLeft:
             switch (bidi.status.last) {
-                case U_LEFT_TO_RIGHT:
-                case U_EUROPEAN_NUMBER:
-                case U_ARABIC_NUMBER:
+                case WTF::Unicode::LeftToRight:
+                case WTF::Unicode::EuropeanNumber:
+                case WTF::Unicode::ArabicNumber:
                     appendRun(bidi);
-                case U_RIGHT_TO_LEFT:
-                case U_RIGHT_TO_LEFT_ARABIC:
+                case WTF::Unicode::RightToLeft:
+                case WTF::Unicode::RightToLeftArabic:
                     break;
-                case U_EUROPEAN_NUMBER_SEPARATOR:
-                case U_EUROPEAN_NUMBER_TERMINATOR:
-                case U_COMMON_NUMBER_SEPARATOR:
-                case U_BOUNDARY_NEUTRAL:
-                case U_BLOCK_SEPARATOR:
-                case U_SEGMENT_SEPARATOR:
-                case U_WHITE_SPACE_NEUTRAL:
-                case U_OTHER_NEUTRAL:
-                    if (bidi.status.eor != U_RIGHT_TO_LEFT && bidi.status.eor != U_RIGHT_TO_LEFT_ARABIC) {
+                case WTF::Unicode::EuropeanNumberSeparator:
+                case WTF::Unicode::EuropeanNumberTerminator:
+                case WTF::Unicode::CommonNumberSeparator:
+                case WTF::Unicode::BoundaryNeutral:
+                case WTF::Unicode::BlockSeparator:
+                case WTF::Unicode::SegmentSeparator:
+                case WTF::Unicode::WhiteSpaceNeutral:
+                case WTF::Unicode::OtherNeutral:
+                    if (bidi.status.eor != WTF::Unicode::RightToLeft && bidi.status.eor != WTF::Unicode::RightToLeftArabic) {
                         //last stuff takes embedding dir
-                        if (bidi.context->dir() != U_RIGHT_TO_LEFT && bidi.status.lastStrong != U_RIGHT_TO_LEFT 
-                            && bidi.status.lastStrong != U_RIGHT_TO_LEFT_ARABIC) {
+                        if (bidi.context->dir() != WTF::Unicode::RightToLeft && bidi.status.lastStrong != WTF::Unicode::RightToLeft
+                            && bidi.status.lastStrong != WTF::Unicode::RightToLeftArabic) {
                             bidi.eor = bidi.last;
-                            bidi.dir = U_LEFT_TO_RIGHT; 
+                            bidi.dir = WTF::Unicode::LeftToRight;
                         }
                         appendRun(bidi);
                     }
@@ -1157,99 +1157,99 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
                     break;
             }
             bidi.eor = bidi.current;
-            bidi.status.eor = U_RIGHT_TO_LEFT;
+            bidi.status.eor = WTF::Unicode::RightToLeft;
             bidi.status.lastStrong = dirCurrent;
-            bidi.dir = U_RIGHT_TO_LEFT;
+            bidi.dir = WTF::Unicode::RightToLeft;
             break;
 
             // weak types:
 
-        case U_EUROPEAN_NUMBER:
-            if (bidi.status.lastStrong != U_RIGHT_TO_LEFT_ARABIC) {
+        case WTF::Unicode::EuropeanNumber:
+            if (bidi.status.lastStrong != WTF::Unicode::RightToLeftArabic) {
                 // if last strong was AL change EN to AN
                 switch (bidi.status.last) {
-                    case U_EUROPEAN_NUMBER:
-                    case U_LEFT_TO_RIGHT:
+                    case WTF::Unicode::EuropeanNumber:
+                    case WTF::Unicode::LeftToRight:
                         break;
-                    case U_RIGHT_TO_LEFT:
-                    case U_RIGHT_TO_LEFT_ARABIC:
-                    case U_ARABIC_NUMBER:
+                    case WTF::Unicode::RightToLeft:
+                    case WTF::Unicode::RightToLeftArabic:
+                    case WTF::Unicode::ArabicNumber:
                         bidi.eor = bidi.last;
                         appendRun(bidi);
-                        bidi.dir = U_EUROPEAN_NUMBER;
+                        bidi.dir = WTF::Unicode::EuropeanNumber;
                         break;
-                    case U_EUROPEAN_NUMBER_SEPARATOR:
-                    case U_COMMON_NUMBER_SEPARATOR:
-                        if (bidi.status.eor == U_EUROPEAN_NUMBER)
+                    case WTF::Unicode::EuropeanNumberSeparator:
+                    case WTF::Unicode::CommonNumberSeparator:
+                        if (bidi.status.eor == WTF::Unicode::EuropeanNumber)
                             break;
-                    case U_EUROPEAN_NUMBER_TERMINATOR:
-                    case U_BOUNDARY_NEUTRAL:
-                    case U_BLOCK_SEPARATOR:
-                    case U_SEGMENT_SEPARATOR:
-                    case U_WHITE_SPACE_NEUTRAL:
-                    case U_OTHER_NEUTRAL:
-                        if (bidi.status.eor == U_RIGHT_TO_LEFT) {
+                    case WTF::Unicode::EuropeanNumberTerminator:
+                    case WTF::Unicode::BoundaryNeutral:
+                    case WTF::Unicode::BlockSeparator:
+                    case WTF::Unicode::SegmentSeparator:
+                    case WTF::Unicode::WhiteSpaceNeutral:
+                    case WTF::Unicode::OtherNeutral:
+                        if (bidi.status.eor == WTF::Unicode::RightToLeft) {
                             // neutrals go to R
-                            bidi.eor = bidi.status.last == U_EUROPEAN_NUMBER_TERMINATOR ? bidi.lastBeforeET : bidi.last;
+                            bidi.eor = bidi.status.last == WTF::Unicode::EuropeanNumberTerminator ? bidi.lastBeforeET : bidi.last;
                             appendRun(bidi);
-                            bidi.dir = U_EUROPEAN_NUMBER;
-                        } else if (bidi.status.eor != U_LEFT_TO_RIGHT &&
-                                 (bidi.status.eor != U_EUROPEAN_NUMBER || bidi.status.lastStrong != U_LEFT_TO_RIGHT) &&
-                                 bidi.dir != U_LEFT_TO_RIGHT) {
+                            bidi.dir = WTF::Unicode::EuropeanNumber;
+                        } else if (bidi.status.eor != WTF::Unicode::LeftToRight &&
+                                 (bidi.status.eor != WTF::Unicode::EuropeanNumber || bidi.status.lastStrong != WTF::Unicode::LeftToRight) &&
+                                 bidi.dir != WTF::Unicode::LeftToRight) {
                             // numbers on both sides, neutrals get right to left direction
                             appendRun(bidi);
-                            bidi.eor = bidi.status.last == U_EUROPEAN_NUMBER_TERMINATOR ? bidi.lastBeforeET : bidi.last;
-                            bidi.dir = U_RIGHT_TO_LEFT;
+                            bidi.eor = bidi.status.last == WTF::Unicode::EuropeanNumberTerminator ? bidi.lastBeforeET : bidi.last;
+                            bidi.dir = WTF::Unicode::RightToLeft;
                             appendRun(bidi);
-                            bidi.dir = U_EUROPEAN_NUMBER;
+                            bidi.dir = WTF::Unicode::EuropeanNumber;
                         }
                     default:
                         break;
                 }
                 bidi.eor = bidi.current;
-                bidi.status.eor = U_EUROPEAN_NUMBER;
-                if (bidi.dir == U_OTHER_NEUTRAL)
-                    bidi.dir = U_LEFT_TO_RIGHT;
+                bidi.status.eor = WTF::Unicode::EuropeanNumber;
+                if (bidi.dir == WTF::Unicode::OtherNeutral)
+                    bidi.dir = WTF::Unicode::LeftToRight;
                 break;
             }
-        case U_ARABIC_NUMBER:
-            dirCurrent = U_ARABIC_NUMBER;
+        case WTF::Unicode::ArabicNumber:
+            dirCurrent = WTF::Unicode::ArabicNumber;
             switch (bidi.status.last) {
-                case U_LEFT_TO_RIGHT:
-                    if (bidi.context->dir() == U_LEFT_TO_RIGHT)
+                case WTF::Unicode::LeftToRight:
+                    if (bidi.context->dir() == WTF::Unicode::LeftToRight)
                         appendRun(bidi);
                     break;
-                case U_ARABIC_NUMBER:
+                case WTF::Unicode::ArabicNumber:
                     break;
-                case U_RIGHT_TO_LEFT:
-                case U_RIGHT_TO_LEFT_ARABIC:
-                case U_EUROPEAN_NUMBER:
+                case WTF::Unicode::RightToLeft:
+                case WTF::Unicode::RightToLeftArabic:
+                case WTF::Unicode::EuropeanNumber:
                     bidi.eor = bidi.last;
                     appendRun(bidi);
                     break;
-                case U_COMMON_NUMBER_SEPARATOR:
-                    if (bidi.status.eor == U_ARABIC_NUMBER)
+                case WTF::Unicode::CommonNumberSeparator:
+                    if (bidi.status.eor == WTF::Unicode::ArabicNumber)
                         break;
-                case U_EUROPEAN_NUMBER_SEPARATOR:
-                case U_EUROPEAN_NUMBER_TERMINATOR:
-                case U_BOUNDARY_NEUTRAL:
-                case U_BLOCK_SEPARATOR:
-                case U_SEGMENT_SEPARATOR:
-                case U_WHITE_SPACE_NEUTRAL:
-                case U_OTHER_NEUTRAL:
-                    if (bidi.status.eor != U_RIGHT_TO_LEFT && bidi.status.eor != U_RIGHT_TO_LEFT_ARABIC) {
+                case WTF::Unicode::EuropeanNumberSeparator:
+                case WTF::Unicode::EuropeanNumberTerminator:
+                case WTF::Unicode::BoundaryNeutral:
+                case WTF::Unicode::BlockSeparator:
+                case WTF::Unicode::SegmentSeparator:
+                case WTF::Unicode::WhiteSpaceNeutral:
+                case WTF::Unicode::OtherNeutral:
+                    if (bidi.status.eor != WTF::Unicode::RightToLeft && bidi.status.eor != WTF::Unicode::RightToLeftArabic) {
                         // run of L before neutrals, neutrals take embedding dir (N2)
-                        if (bidi.context->dir() == U_RIGHT_TO_LEFT || bidi.status.lastStrong == U_RIGHT_TO_LEFT 
-                            || bidi.status.lastStrong == U_RIGHT_TO_LEFT_ARABIC) { 
+                        if (bidi.context->dir() == WTF::Unicode::RightToLeft || bidi.status.lastStrong == WTF::Unicode::RightToLeft
+                            || bidi.status.lastStrong == WTF::Unicode::RightToLeftArabic) {
                             // the embedding direction is R
                             // close the L run
                             appendRun(bidi);
                             // neutrals become an R run
-                            bidi.dir = U_RIGHT_TO_LEFT;
+                            bidi.dir = WTF::Unicode::RightToLeft;
                         } else {
                             // the embedding direction is L
                             // append neutrals to the L run and close it
-                            bidi.dir = U_LEFT_TO_RIGHT; 
+                            bidi.dir = WTF::Unicode::LeftToRight;
                         }
                     }
                     bidi.eor = bidi.last;
@@ -1258,37 +1258,37 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
                     break;
             }
             bidi.eor = bidi.current;
-            bidi.status.eor = U_ARABIC_NUMBER;
-            if (bidi.dir == U_OTHER_NEUTRAL)
-                bidi.dir = U_ARABIC_NUMBER;
+            bidi.status.eor = WTF::Unicode::ArabicNumber;
+            if (bidi.dir == WTF::Unicode::OtherNeutral)
+                bidi.dir = WTF::Unicode::ArabicNumber;
             break;
-        case U_EUROPEAN_NUMBER_SEPARATOR:
-        case U_COMMON_NUMBER_SEPARATOR:
+        case WTF::Unicode::EuropeanNumberSeparator:
+        case WTF::Unicode::CommonNumberSeparator:
             break;
-        case U_EUROPEAN_NUMBER_TERMINATOR:
-            if (bidi.status.last == U_EUROPEAN_NUMBER) {
-                dirCurrent = U_EUROPEAN_NUMBER;
+        case WTF::Unicode::EuropeanNumberTerminator:
+            if (bidi.status.last == WTF::Unicode::EuropeanNumber) {
+                dirCurrent = WTF::Unicode::EuropeanNumber;
                 bidi.eor = bidi.current;
                 bidi.status.eor = dirCurrent;
-            } else if (bidi.status.last != U_EUROPEAN_NUMBER_TERMINATOR)
+            } else if (bidi.status.last != WTF::Unicode::EuropeanNumberTerminator)
                 bidi.lastBeforeET = emptyRun ? bidi.eor : bidi.last;
             break;
 
         // boundary neutrals should be ignored
-        case U_BOUNDARY_NEUTRAL:
+        case WTF::Unicode::BoundaryNeutral:
             if (bidi.eor == bidi.last)
                 bidi.eor = bidi.current;
             break;
             // neutrals
-        case U_BLOCK_SEPARATOR:
+        case WTF::Unicode::BlockSeparator:
             // ### what do we do with newline and paragraph seperators that come to here?
             break;
-        case U_SEGMENT_SEPARATOR:
+        case WTF::Unicode::SegmentSeparator:
             // ### implement rule L1
             break;
-        case U_WHITE_SPACE_NEUTRAL:
+        case WTF::Unicode::WhiteSpaceNeutral:
             break;
-        case U_OTHER_NEUTRAL:
+        case WTF::Unicode::OtherNeutral:
             break;
         default:
             break;
@@ -1299,13 +1299,13 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
                 if (!bidi.reachedEndOfLine) {
                     bidi.eor = bidi.endOfLine;
                     switch (bidi.status.eor) {
-                        case U_LEFT_TO_RIGHT:
-                        case U_RIGHT_TO_LEFT:
-                        case U_ARABIC_NUMBER:
+                        case WTF::Unicode::LeftToRight:
+                        case WTF::Unicode::RightToLeft:
+                        case WTF::Unicode::ArabicNumber:
                             bidi.dir = bidi.status.eor;
                             break;
-                        case U_EUROPEAN_NUMBER:
-                            bidi.dir = bidi.status.lastStrong == U_LEFT_TO_RIGHT ? U_LEFT_TO_RIGHT : U_EUROPEAN_NUMBER;
+                        case WTF::Unicode::EuropeanNumber:
+                            bidi.dir = bidi.status.lastStrong == WTF::Unicode::LeftToRight ? WTF::Unicode::LeftToRight : WTF::Unicode::EuropeanNumber;
                             break;
                         default:
                             assert(false);
@@ -1313,44 +1313,44 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
                     appendRun(bidi);
                 }
                 bidi = stateAtEnd;
-                bidi.dir = U_OTHER_NEUTRAL;
+                bidi.dir = WTF::Unicode::OtherNeutral;
                 break;
             }
         }
 
         // set status.last as needed.
         switch (dirCurrent) {
-            case U_EUROPEAN_NUMBER_TERMINATOR:
-                if (bidi.status.last != U_EUROPEAN_NUMBER)
-                    bidi.status.last = U_EUROPEAN_NUMBER_TERMINATOR;
+            case WTF::Unicode::EuropeanNumberTerminator:
+                if (bidi.status.last != WTF::Unicode::EuropeanNumber)
+                    bidi.status.last = WTF::Unicode::EuropeanNumberTerminator;
                 break;
-            case U_EUROPEAN_NUMBER_SEPARATOR:
-            case U_COMMON_NUMBER_SEPARATOR:
-            case U_SEGMENT_SEPARATOR:
-            case U_WHITE_SPACE_NEUTRAL:
-            case U_OTHER_NEUTRAL:
+            case WTF::Unicode::EuropeanNumberSeparator:
+            case WTF::Unicode::CommonNumberSeparator:
+            case WTF::Unicode::SegmentSeparator:
+            case WTF::Unicode::WhiteSpaceNeutral:
+            case WTF::Unicode::OtherNeutral:
                 switch(bidi.status.last) {
-                    case U_LEFT_TO_RIGHT:
-                    case U_RIGHT_TO_LEFT:
-                    case U_RIGHT_TO_LEFT_ARABIC:
-                    case U_EUROPEAN_NUMBER:
-                    case U_ARABIC_NUMBER:
+                    case WTF::Unicode::LeftToRight:
+                    case WTF::Unicode::RightToLeft:
+                    case WTF::Unicode::RightToLeftArabic:
+                    case WTF::Unicode::EuropeanNumber:
+                    case WTF::Unicode::ArabicNumber:
                         bidi.status.last = dirCurrent;
                         break;
                     default:
-                        bidi.status.last = U_OTHER_NEUTRAL;
+                        bidi.status.last = WTF::Unicode::OtherNeutral;
                     }
                 break;
-            case U_DIR_NON_SPACING_MARK:
-            case U_BOUNDARY_NEUTRAL:
-            case U_RIGHT_TO_LEFT_EMBEDDING:
-            case U_LEFT_TO_RIGHT_EMBEDDING:
-            case U_RIGHT_TO_LEFT_OVERRIDE:
-            case U_LEFT_TO_RIGHT_OVERRIDE:
-            case U_POP_DIRECTIONAL_FORMAT:
+            case WTF::Unicode::NonSpacingMark:
+            case WTF::Unicode::BoundaryNeutral:
+            case WTF::Unicode::RightToLeftEmbedding:
+            case WTF::Unicode::LeftToRightEmbedding:
+            case WTF::Unicode::RightToLeftOverride:
+            case WTF::Unicode::LeftToRightOverride:
+            case WTF::Unicode::PopDirectionalFormat:
                 // ignore these
                 break;
-            case U_EUROPEAN_NUMBER:
+            case WTF::Unicode::EuropeanNumber:
                 // fall through
             default:
                 bidi.status.last = dirCurrent;
@@ -1358,11 +1358,11 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
 
         bidi.last = bidi.current;
 
-        if (emptyRun && !(dirCurrent == U_RIGHT_TO_LEFT_EMBEDDING
-                || dirCurrent == U_LEFT_TO_RIGHT_EMBEDDING
-                || dirCurrent == U_RIGHT_TO_LEFT_OVERRIDE
-                || dirCurrent == U_LEFT_TO_RIGHT_OVERRIDE
-                || dirCurrent == U_POP_DIRECTIONAL_FORMAT)) {
+        if (emptyRun && !(dirCurrent == WTF::Unicode::RightToLeftEmbedding
+                || dirCurrent == WTF::Unicode::LeftToRightEmbedding
+                || dirCurrent == WTF::Unicode::RightToLeftOverride
+                || dirCurrent == WTF::Unicode::LeftToRightOverride
+                || dirCurrent == WTF::Unicode::PopDirectionalFormat)) {
             bidi.sor = bidi.current;
             emptyRun = false;
         }
@@ -1372,11 +1372,11 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
         bidi.adjustEmbedding = true;
         bidi.current.increment(bidi);
         bidi.adjustEmbedding = false;
-        if (emptyRun && (dirCurrent == U_RIGHT_TO_LEFT_EMBEDDING
-                || dirCurrent == U_LEFT_TO_RIGHT_EMBEDDING
-                || dirCurrent == U_RIGHT_TO_LEFT_OVERRIDE
-                || dirCurrent == U_LEFT_TO_RIGHT_OVERRIDE
-                || dirCurrent == U_POP_DIRECTIONAL_FORMAT)) {
+        if (emptyRun && (dirCurrent == WTF::Unicode::RightToLeftEmbedding
+                || dirCurrent == WTF::Unicode::LeftToRightEmbedding
+                || dirCurrent == WTF::Unicode::RightToLeftOverride
+                || dirCurrent == WTF::Unicode::LeftToRightOverride
+                || dirCurrent == WTF::Unicode::PopDirectionalFormat)) {
             // exclude the embedding char itself from the new run so that ATSUI will never see it
             bidi.eor.obj = 0;
             bidi.last = bidi.current;
@@ -1559,18 +1559,18 @@ IntRect RenderBlock::layoutInlineChildren(bool relayoutChildren)
 
         BidiContext *startEmbed;
         if (style()->direction() == LTR) {
-            startEmbed = new BidiContext( 0, U_LEFT_TO_RIGHT, NULL, style()->unicodeBidi() == Override );
-            bidi.status.eor = U_LEFT_TO_RIGHT;
+            startEmbed = new BidiContext( 0, WTF::Unicode::LeftToRight, NULL, style()->unicodeBidi() == Override );
+            bidi.status.eor = WTF::Unicode::LeftToRight;
         } else {
-            startEmbed = new BidiContext( 1, U_RIGHT_TO_LEFT, NULL, style()->unicodeBidi() == Override );
-            bidi.status.eor = U_RIGHT_TO_LEFT;
+            startEmbed = new BidiContext( 1, WTF::Unicode::RightToLeft, NULL, style()->unicodeBidi() == Override );
+            bidi.status.eor = WTF::Unicode::RightToLeft;
         }
 
         bidi.status.lastStrong = startEmbed->dir();
         bidi.status.last = startEmbed->dir();
         bidi.status.eor = startEmbed->dir();
         bidi.context = startEmbed;
-        bidi.dir = U_OTHER_NEUTRAL;
+        bidi.dir = WTF::Unicode::OtherNeutral;
         
         if (!smidpoints)
             smidpoints = new Vector<BidiIterator>();
index acb814544b9268c17c99a1763859933e2c9f8c18..16582307f1a1186b57700082616400522e5e4fe3 100644 (file)
@@ -24,7 +24,7 @@
 #ifndef BIDI_H
 #define BIDI_H
 
-#include <unicode/uchar.h>
+#include <wtf/unicode/Unicode.h>
 
 namespace WebCore {
 
@@ -35,32 +35,32 @@ namespace WebCore {
 
     struct BidiStatus {
         BidiStatus()
-            : eor(U_OTHER_NEUTRAL)
-            , lastStrong(U_OTHER_NEUTRAL)
-            , last(U_OTHER_NEUTRAL)
+            : eor(WTF::Unicode::OtherNeutral)
+            , lastStrong(WTF::Unicode::OtherNeutral)
+            , last(WTF::Unicode::OtherNeutral)
         {
         }
 
-        UCharDirection eor;
-        UCharDirection lastStrong;
-        UCharDirection last;
+        WTF::Unicode::Direction eor;
+        WTF::Unicode::Direction lastStrong;
+        WTF::Unicode::Direction last;
     };
 
     class BidiContext {
     public:
-        BidiContext(unsigned char level, UCharDirection embedding, BidiContext* parent = 0, bool override = false);
+        BidiContext(unsigned char level, WTF::Unicode::Direction embedding, BidiContext* parent = 0, bool override = false);
         ~BidiContext();
 
         void ref() const;
         void deref() const;
 
-        UCharDirection dir() const { return static_cast<UCharDirection>(m_dir); }
-        UCharDirection basicDir() const { return static_cast<UCharDirection>(m_basicDir); }
+        WTF::Unicode::Direction dir() const { return static_cast<WTF::Unicode::Direction>(m_dir); }
+        WTF::Unicode::Direction basicDir() const { return static_cast<WTF::Unicode::Direction>(m_basicDir); }
 
         unsigned char level;
         bool override : 1;
-        unsigned m_dir : 5; // UCharDirection
-        unsigned m_basicDir : 5; // UCharDirection
+        unsigned m_dir : 5; // WTF::Unicode::Direction
+        unsigned m_basicDir : 5; // WTF::Unicode::Direction
 
         BidiContext* parent;
 
@@ -69,7 +69,7 @@ namespace WebCore {
     };
 
     struct BidiRun {
-        BidiRun(int start_, int stop_, RenderObject* o, BidiContext* context, UCharDirection dir)
+        BidiRun(int start_, int stop_, RenderObject* o, BidiContext* context, WTF::Unicode::Direction dir)
             : start(start_)
             , stop(stop_)
             , obj(o)
@@ -77,19 +77,19 @@ namespace WebCore {
             , override(context->override)
             , nextRun(0)
         {
-            if (dir == U_OTHER_NEUTRAL) 
+            if (dir == WTF::Unicode::OtherNeutral)
                 dir = context->dir();
 
             level = context->level;
 
             // add level of run (cases I1 & I2)
             if (level % 2) {
-                if(dir == U_LEFT_TO_RIGHT || dir == U_ARABIC_NUMBER || dir == U_EUROPEAN_NUMBER)
+                if(dir == WTF::Unicode::LeftToRight || dir == WTF::Unicode::ArabicNumber || dir == WTF::Unicode::EuropeanNumber)
                     level++;
             } else {
-                if (dir == U_RIGHT_TO_LEFT)
+                if (dir == WTF::Unicode::RightToLeft)
                     level++;
-                else if (dir == U_ARABIC_NUMBER || dir == U_EUROPEAN_NUMBER)
+                else if (dir == WTF::Unicode::ArabicNumber || dir == WTF::Unicode::EuropeanNumber)
                     level += 2;
             }
         }
index b5c52f1707ea56ccd36a291a2076469fdb9cd274..5149160a135f2886bad8cefd6a7b48dbd828e8cc 100644 (file)
@@ -23,7 +23,7 @@
 #ifndef break_lines_h
 #define break_lines_h
 
-#include "UChar.h"
+#include "wtf/unicode/Unicode.h"
 
 namespace WebCore {
 
index 4e75effb063a43abe45790129db45383990731f1..cdbb415b98e6d7dbc2163565bc6ce84b2032802b 100644 (file)
@@ -1,3 +1,13 @@
+2006-12-08  David Hyatt  <hyatt@apple.com>
+
+        Land new ICU abstraction layer.  Patch by Lars.
+
+        Reviewed by me
+
+        * ForwardingHeaders/wtf/icu/UnicodeIcu.h: Added.
+        * ForwardingHeaders/wtf/unicode/Unicode.h: Added.
+        * WebKit.xcodeproj/project.pbxproj:
+
 === Safari-521.32 ===
 
 2006-12-08  Timothy Hatcher  <timothy@apple.com>
diff --git a/WebKit/ForwardingHeaders/wtf/icu/UnicodeIcu.h b/WebKit/ForwardingHeaders/wtf/icu/UnicodeIcu.h
new file mode 100644 (file)
index 0000000..6b64eb5
--- /dev/null
@@ -0,0 +1 @@
+#include <JavaScriptCore/UnicodeIcu.h>
diff --git a/WebKit/ForwardingHeaders/wtf/unicode/Unicode.h b/WebKit/ForwardingHeaders/wtf/unicode/Unicode.h
new file mode 100644 (file)
index 0000000..623917f
--- /dev/null
@@ -0,0 +1 @@
+#include <JavaScriptCore/Unicode.h>
index 37fa6e151f2dc7035fd0e30a9dbadf363cab4334..f78261eb797020f2590b741c200f8c842a7ae184 100644 (file)
                };
 /* End PBXBuildRule section */
 
+/* Begin PBXBuildStyle section */
+               BC4C659F0B2A487B00E57352 /* Development */ = {
+                       isa = PBXBuildStyle;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                       };
+                       name = Development;
+               };
+               BC4C65A00B2A487B00E57352 /* Deployment */ = {
+                       isa = PBXBuildStyle;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                       };
+                       name = Deployment;
+               };
+/* End PBXBuildStyle section */
+
 /* Begin PBXFileReference section */
                065AD5A10B0C32C7005A2B1D /* WebContextMenuClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WebContextMenuClient.h; sourceTree = "<group>"; };
                065AD5A20B0C32C7005A2B1D /* WebContextMenuClient.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = WebContextMenuClient.mm; sourceTree = "<group>"; };
                0867D690FE84028FC02AAC07 /* Project object */ = {
                        isa = PBXProject;
                        buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */;
+                       buildSettings = {
+                       };
+                       buildStyles = (
+                               BC4C659F0B2A487B00E57352 /* Development */,
+                               BC4C65A00B2A487B00E57352 /* Deployment */,
+                       );
                        hasScannedForEncodings = 1;
                        knownRegions = (
                                English,
                        mainGroup = 0867D691FE84028FC02AAC07 /* WebKit */;
                        productRefGroup = 034768DFFF38A50411DB9C8B /* Products */;
                        projectDirPath = "";
-                       projectRoot = "";
                        targets = (
                                9398100A0824BF01008DF038 /* WebKit */,
                        );