JavaScriptCore:
authordarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Jan 2007 14:54:26 +0000 (14:54 +0000)
committerdarin <darin@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 9 Jan 2007 14:54:26 +0000 (14:54 +0000)
        Reviewed by Maciej.

        - fix http://bugs.webkit.org/show_bug.cgi?id=12174
          improve Unicode use (less WTF::Unicode:: prefix, centralized character names)

        * wtf/unicode/icu/UnicodeIcu.h: Change parameter and return types
        to UChar32 and UChar. Removed unneeded type casts and added some
        const to functions that lacked it. Removed WTF::Unicode::memcmp.
        (WTF::Unicode::umemcasecmp): Renamed from strcasecmp since this
        doesn't work on 0-terminated strings as the str functions do.
        * wtf/unicode/qt4/UnicodeQt4.h: Ditto.

        - got rid of namespace prefixes from most uses of WTF::Unicode

        * kjs/function.cpp:
        (KJS::isStrWhiteSpace):
        (KJS::escapeStringForPrettyPrinting):
        * kjs/lexer.cpp:
        (KJS::Lexer::isWhiteSpace):
        (KJS::Lexer::isIdentStart):
        (KJS::Lexer::isIdentPart):
        * kjs/string_object.cpp:
        (KJS::StringProtoFunc::callAsFunction):

WebCore:

        Reviewed by Maciej.

        - fix http://bugs.webkit.org/show_bug.cgi?id=12174
          improve Unicode use (less WTF::Unicode:: prefix, centralized character names)

        - got rid of namespace prefixes from most uses of WTF::Unicode

        - updated for removal of WTF::Unicode::memcmp
        - updated for renaming of WTF::Unicode::strcasecmp to umemcasecmp.

        - unified constants for special Unicode characters in a new
          CharacterNames.h header

        * WebCore.xcodeproj/project.pbxproj:
        * css/cssparser.cpp:
        (WebCore::ParseString::lower):
        * dom/Document.cpp:
        (WebCore::isValidNameStart):
        (WebCore::isValidNamePart):
        * dom/Position.cpp:
        (WebCore::Position::leadingWhitespacePosition):
        (WebCore::Position::trailingWhitespacePosition):
        * editing/CompositeEditCommand.cpp:
        (WebCore::isWhitespace):
        * editing/HTMLInterchange.cpp:
        * editing/TextIterator.cpp:
        (WebCore::CircularSearchBuffer::CircularSearchBuffer):
        (WebCore::CircularSearchBuffer::append):
        * editing/htmlediting.cpp:
        (WebCore::stringWithRebalancedWhitespace):
        (WebCore::nonBreakingSpaceString):
        * editing/htmlediting.h:
        * html/HTMLFontElement.cpp:
        (WebCore::parseFontSizeNumber):
        * html/HTMLParser.cpp:
        (WebCore::HTMLParser::handleError):
        * html/HTMLSelectElement.cpp:
        (WebCore::stripLeadingWhiteSpace):
        * platform/Font.cpp:
        (WebCore::WidthIterator::advance):
        (WebCore::WidthIterator::normalizeVoicingMarks):
        * platform/GlyphMap.cpp:
        (WebCore::GlyphMap::locatePage):
        * platform/MimeTypeRegistry.h:
        * platform/StringHash.h:
        * platform/StringImpl.cpp:
        (WebCore::isSpace):
        (WebCore::StringImpl::append):
        (WebCore::StringImpl::insert):
        (WebCore::StringImpl::truncate):
        (WebCore::StringImpl::remove):
        (WebCore::parseLength):
        (WebCore::StringImpl::isLower):
        (WebCore::StringImpl::lower):
        (WebCore::StringImpl::upper):
        (WebCore::StringImpl::secure):
        (WebCore::StringImpl::foldCase):
        (WebCore::StringImpl::capitalize):t
        (WebCore::StringImpl::toInt):
        (WebCore::equalIgnoringCase):
        (WebCore::StringImpl::find):
        * platform/TextBoundaries.h:
        * platform/TextCodec.h:
        * platform/TextCodecLatin1.cpp:
        * platform/TextEncoding.h:
        * platform/TextEncodingRegistry.h:
        * platform/mac/PasteboardMac.mm:
        (WebCore::Pasteboard::writeSelection):
        * platform/mac/TextCodecMac.cpp:
        (WebCore::TextCodecMac::decode):
        * rendering/RenderBlock.cpp:
        (WebCore::RenderBlock::updateFirstLetter):
        * rendering/RenderListMarker.cpp:
        (WebCore::listMarkerText):
        (WebCore::RenderListMarker::paint):
        * rendering/RenderText.cpp:
        (WebCore::RenderText::widthFromCache):
        (WebCore::isSpaceAccordingToStyle):
        (WebCore::RenderText::setInternalString):
        * rendering/RenderTreeAsText.cpp:
        (WebCore::quoteAndEscapeNonPrintables):
        (WebCore::operator<<):
        * rendering/bidi.cpp:
        (WebCore::BidiState::BidiState):
        (WebCore::BidiContext::BidiContext):
        (WebCore::bidiNext):
        (WebCore::bidiFirst):
        (WebCore::BidiIterator::direction):
        (WebCore::appendRun):
        (WebCore::embed):
        (WebCore::RenderBlock::bidiReorderLine):
        (WebCore::RenderBlock::layoutInlineChildren):
        (WebCore::skipNonBreakingSpace):
        (WebCore::RenderBlock::findNextLineBreak):
        * rendering/break_lines.cpp:
        (WebCore::nextBreakablePosition):
        * rendering/break_lines.h:
        * xml/XPathParser.cpp:
        (WebCore::XPath::charCat):

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

40 files changed:
JavaScriptCore/ChangeLog
JavaScriptCore/kjs/function.cpp
JavaScriptCore/kjs/lexer.cpp
JavaScriptCore/kjs/string_object.cpp
JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h
JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
WebCore/ChangeLog
WebCore/WebCore.xcodeproj/project.pbxproj
WebCore/css/cssparser.cpp
WebCore/dom/Document.cpp
WebCore/dom/Position.cpp
WebCore/editing/CompositeEditCommand.cpp
WebCore/editing/HTMLInterchange.cpp
WebCore/editing/TextIterator.cpp
WebCore/editing/htmlediting.cpp
WebCore/editing/htmlediting.h
WebCore/html/HTMLFontElement.cpp
WebCore/html/HTMLParser.cpp
WebCore/html/HTMLSelectElement.cpp
WebCore/platform/CharacterNames.h [new file with mode: 0644]
WebCore/platform/Font.cpp
WebCore/platform/GlyphMap.cpp
WebCore/platform/MimeTypeRegistry.h
WebCore/platform/StringHash.h
WebCore/platform/StringImpl.cpp
WebCore/platform/TextBoundaries.h
WebCore/platform/TextCodec.h
WebCore/platform/TextCodecLatin1.cpp
WebCore/platform/TextEncoding.h
WebCore/platform/TextEncodingRegistry.h
WebCore/platform/mac/PasteboardMac.mm
WebCore/platform/mac/TextCodecMac.cpp
WebCore/rendering/RenderBlock.cpp
WebCore/rendering/RenderListMarker.cpp
WebCore/rendering/RenderText.cpp
WebCore/rendering/RenderTreeAsText.cpp
WebCore/rendering/bidi.cpp
WebCore/rendering/break_lines.cpp
WebCore/rendering/break_lines.h
WebCore/xml/XPathParser.cpp

index 8fc67c116358fe60d89b11704527dccbc54b0d76..748a1a4e9bb57b1669bed64b33d88cf1afb06dbc 100644 (file)
@@ -1,3 +1,29 @@
+2007-01-09  Darin Adler  <darin@apple.com>
+
+        Reviewed by Maciej.
+
+        - fix http://bugs.webkit.org/show_bug.cgi?id=12174
+          improve Unicode use (less WTF::Unicode:: prefix, centralized character names)
+
+        * wtf/unicode/icu/UnicodeIcu.h: Change parameter and return types
+        to UChar32 and UChar. Removed unneeded type casts and added some
+        const to functions that lacked it. Removed WTF::Unicode::memcmp.
+        (WTF::Unicode::umemcasecmp): Renamed from strcasecmp since this
+        doesn't work on 0-terminated strings as the str functions do.
+        * wtf/unicode/qt4/UnicodeQt4.h: Ditto.
+
+        - got rid of namespace prefixes from most uses of WTF::Unicode
+
+        * kjs/function.cpp:
+        (KJS::isStrWhiteSpace):
+        (KJS::escapeStringForPrettyPrinting):
+        * kjs/lexer.cpp:
+        (KJS::Lexer::isWhiteSpace):
+        (KJS::Lexer::isIdentStart):
+        (KJS::Lexer::isIdentPart):
+        * kjs/string_object.cpp:
+        (KJS::StringProtoFunc::callAsFunction):
+
 2007-01-07  David Kilzer  <ddkilzer@webkit.org>
 
         Reviewed by Darin.
index c2c44558188bdf338f762aa77887dabeebff01dc..7a8d12b87f060f1c515e63205f4110b2ae48bfef 100644 (file)
@@ -42,6 +42,9 @@
 
 #include <wtf/unicode/Unicode.h>
 
+using namespace WTF;
+using namespace Unicode;
+
 namespace KJS {
 
 // ----------------------------- FunctionImp ----------------------------------
@@ -690,7 +693,7 @@ static bool isStrWhiteSpace(unsigned short c)
         case 0x2029:
             return true;
         default:
-            return WTF::Unicode::isSeparatorSpace(c);
+            return isSeparatorSpace(c);
     }
 }
 
@@ -965,7 +968,7 @@ UString escapeStringForPrettyPrinting(const UString& s)
             escapedString += "\\\\";
             break;
         default:
-            if (c < 128 && WTF::Unicode::isPrintableChar(c))
+            if (c < 128 && isPrintableChar(c))
                 escapedString.append(c);
             else {
                 char hexValue[7];
index b6a84e92503420849f91380f1cd35e3c4ad92635..ed6c78818b8e298f2563da52604b6159a64d4e28 100644 (file)
 #include "nodes.h"
 #include <wtf/unicode/Unicode.h>
 
-static bool isDecimalDigit(int);
+using namespace WTF;
+using namespace Unicode;
 
 // we can't specify the namespace in yacc's C output, so do it here
 using namespace KJS;
 
-static Lexer *currLexer = 0;
-
 #ifndef KDE_USE_FINAL
 #include "grammar.h"
 #endif
@@ -53,6 +52,12 @@ int kjsyylex()
   return Lexer::curr()->lex();
 }
 
+namespace KJS {
+
+static Lexer* currLexer = 0;
+
+static bool isDecimalDigit(int);
+
 Lexer::Lexer()
   : yylineno(1),
     size8(128), size16(128), restrKeyword(false),
@@ -565,7 +570,7 @@ int Lexer::lex()
 
 bool Lexer::isWhiteSpace() const
 {
-  return current == '\t' || current == 0x0b || current == 0x0c || WTF::Unicode::isSeparatorSpace(current);
+  return current == '\t' || current == 0x0b || current == 0x0c || isSeparatorSpace(current);
 }
 
 bool Lexer::isLineTerminator()
@@ -581,25 +586,14 @@ bool Lexer::isLineTerminator()
 
 bool Lexer::isIdentStart(int c)
 {
-  return (WTF::Unicode::category(c) & (WTF::Unicode::Letter_Uppercase
-        | WTF::Unicode::Letter_Lowercase
-        | WTF::Unicode::Letter_Titlecase
-        | WTF::Unicode::Letter_Modifier
-        | WTF::Unicode::Letter_Other))
+  return (category(c) & (Letter_Uppercase | Letter_Lowercase | Letter_Titlecase | Letter_Modifier | Letter_Other))
     || c == '$' || c == '_';
 }
 
 bool Lexer::isIdentPart(int c)
 {
-  return (WTF::Unicode::category(c) & (WTF::Unicode::Letter_Uppercase
-        | WTF::Unicode::Letter_Lowercase
-        | WTF::Unicode::Letter_Titlecase
-        | WTF::Unicode::Letter_Modifier
-        | WTF::Unicode::Letter_Other
-        | WTF::Unicode::Mark_NonSpacing
-        | WTF::Unicode::Mark_SpacingCombining
-        | WTF::Unicode::Number_DecimalDigit
-        | WTF::Unicode::Punctuation_Connector))
+  return (category(c) & (Letter_Uppercase | Letter_Lowercase | Letter_Titlecase | Letter_Modifier | Letter_Other
+        | Mark_NonSpacing | Mark_SpacingCombining | Number_DecimalDigit | Punctuation_Connector))
     || c == '$' || c == '_';
 }
 
@@ -911,3 +905,5 @@ UString *Lexer::makeUString(KJS::UChar*, unsigned int)
   strings[numStrings++] = string;
   return string;
 }
+
+}
index 8a8d23bac6716e1c5e4a11adfac1230b13fd1d07..68e497faca45aee811e2d0594ec00a7fb4f57a22 100644 (file)
@@ -37,7 +37,9 @@
 #include <windows.h>
 #endif
 
-using namespace KJS;
+using namespace WTF;
+
+namespace KJS {
 
 // ------------------------------ StringInstance ----------------------------
 
@@ -683,7 +685,7 @@ JSValue *StringProtoFunc::callAsFunction(ExecState *exec, JSObject *thisObj, con
     uint16_t* dataPtr = reinterpret_cast<uint16_t*>(u.rep()->data());
     uint16_t* destIfNeeded;
 
-    int len = WTF::Unicode::toLower(dataPtr, u.size(), destIfNeeded);
+    int len = Unicode::toLower(dataPtr, u.size(), destIfNeeded);
     if (len >= 0)
         result = jsString(UString(reinterpret_cast<UChar *>(destIfNeeded ? destIfNeeded : dataPtr), len));
     else
@@ -699,7 +701,7 @@ JSValue *StringProtoFunc::callAsFunction(ExecState *exec, JSObject *thisObj, con
     uint16_t* dataPtr = reinterpret_cast<uint16_t*>(u.rep()->data());
     uint16_t* destIfNeeded;
 
-    int len = WTF::Unicode::toUpper(dataPtr, u.size(), destIfNeeded);
+    int len = Unicode::toUpper(dataPtr, u.size(), destIfNeeded);
     if (len >= 0)
         result = jsString(UString(reinterpret_cast<UChar *>(destIfNeeded ? destIfNeeded : dataPtr), len));
     else
@@ -825,3 +827,5 @@ JSValue *StringObjectFuncImp::callAsFunction(ExecState *exec, JSObject* /*thisOb
 
   return jsString(s);
 }
+
+}
index ac9530fa228c85cb8a9e7e5b1d84325940c38b43..82e59deb594c00881d5a7180820d946e959c012d 100644 (file)
@@ -3,6 +3,7 @@
  *  This file is part of the KDE libraries
  *  Copyright (C) 2006 George Staikos <staikos@kde.org>
  *  Copyright (C) 2006 Alexey Proskuryakov <ap@nypop.com>
+ *  Copyright (C) 2007 Apple Computer, Inc. All rights reserved.
  *
  *  This library is free software; you can redistribute it and/or
  *  modify it under the terms of the GNU Library General Public
@@ -117,140 +118,141 @@ namespace WTF {
       Punctuation_FinalQuote = U_MASK(U_FINAL_PUNCTUATION)
     };
 
-    inline uint32_t foldCase(uint32_t c)
+    inline UChar32 foldCase(UChar32 c)
     {
       return u_foldCase(c, U_FOLD_CASE_DEFAULT);
     }
 
-    inline int foldCase(UChar* result, int resultLength, UChar* src, int srcLength,  bool* error)
+    inline int foldCase(UChar* result, int resultLength, const 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);
+      int realLength = u_strFoldCase(result, resultLength, src, srcLength, U_FOLD_CASE_DEFAULT, &status);
       *error = !U_SUCCESS(status);
       return realLength;
     }
 
-    inline int toLower(uint16_t* str, int strLength, uint16_t*& destIfNeeded)
+    inline int toLower(UChar* str, int strLength, UChar*& destIfNeeded)
     {
       UErrorCode err = U_ZERO_ERROR;
       int resultLength;
       destIfNeeded = 0;
 
-      resultLength = u_strToLower(0, 0, reinterpret_cast< ::UChar*>(str), strLength, "", &err);
+      resultLength = u_strToLower(0, 0, str, strLength, "", &err);
 
       if (resultLength <= strLength) {
         err = U_ZERO_ERROR;
-        u_strToLower(reinterpret_cast< ::UChar*>(str), resultLength, reinterpret_cast< ::UChar*>(str), strLength, "", &err);
+        u_strToLower(str, resultLength, str, strLength, "", &err);
       } else {
         err = U_ZERO_ERROR;
-        destIfNeeded = (uint16_t*)malloc(resultLength * sizeof(uint16_t));
-        u_strToLower(reinterpret_cast< ::UChar*>(destIfNeeded), resultLength, reinterpret_cast< ::UChar*>(str), strLength, "", &err);
+        destIfNeeded = static_cast<UChar*>(malloc(resultLength * sizeof(UChar)));
+        u_strToLower(destIfNeeded, resultLength, str, strLength, "", &err);
       }
 
       return U_FAILURE(err) ? -1 : resultLength;
     }
 
-    inline int toLower(UChar* result, int resultLength, UChar* src, int srcLength,  bool* error)
+    inline int toLower(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
     {
       UErrorCode status = U_ZERO_ERROR;
-      int32_t realLength = u_strToLower(result, resultLength, src, srcLength, "", &status);
+      int realLength = u_strToLower(result, resultLength, src, srcLength, "", &status);
       *error = !!U_FAILURE(status);
       return realLength;
     }
 
-    inline int32_t toLower(int32_t c)
+    inline UChar32 toLower(UChar32 c)
     {
       return u_tolower(c);
     }
 
-    inline int32_t toUpper(int32_t c)
+    inline UChar32 toUpper(UChar32 c)
     {
       return u_toupper(c);
     }
 
-    inline int toUpper(uint16_t* str, int strLength, uint16_t*& destIfNeeded)
+    inline int toUpper(UChar* str, int strLength, UChar*& destIfNeeded)
     {
       UErrorCode err = U_ZERO_ERROR;
       int resultLength;
       destIfNeeded = 0;
 
-      resultLength = u_strToUpper(0, 0, reinterpret_cast< ::UChar*>(str), strLength, "", &err);
+      resultLength = u_strToUpper(0, 0, str, strLength, "", &err);
 
       if (resultLength <= strLength) {
         err = U_ZERO_ERROR;
-        u_strToUpper(reinterpret_cast< ::UChar*>(str), resultLength, reinterpret_cast< ::UChar*>(str), strLength, "", &err);
+        u_strToUpper(str, resultLength, str, strLength, "", &err);
       } else {
         err = U_ZERO_ERROR;
-        destIfNeeded = (uint16_t*)malloc(resultLength * sizeof(uint16_t));
-        u_strToUpper(reinterpret_cast< ::UChar*>(destIfNeeded), resultLength, reinterpret_cast< ::UChar*>(str), strLength, "", &err);
+        destIfNeeded = (UChar*)malloc(resultLength * sizeof(UChar));
+        u_strToUpper(destIfNeeded, resultLength, str, strLength, "", &err);
       }
 
       return U_FAILURE(err) ? -1 : resultLength;
     }
 
-    inline int toUpper(UChar* result, int resultLength, UChar* src, int srcLength,  bool* error)
+    inline int toUpper(UChar* result, int resultLength, const UChar* src, int srcLength, bool* error)
     {
       UErrorCode status = U_ZERO_ERROR;
-      int32_t realLength = u_strToUpper(result, resultLength, src, srcLength, "", &status);
+      int realLength = u_strToUpper(result, resultLength, src, srcLength, "", &status);
       *error = !!U_FAILURE(status);
       return realLength;
     }
 
-    inline int toTitleCase (uint32_t c)
+    inline UChar32 toTitleCase(UChar32 c)
     {
       return u_totitle(c);
     }
 
-    inline bool isFormatChar(int32_t c)
+    inline bool isFormatChar(UChar32 c)
     {
       return u_charType(c) == U_FORMAT_CHAR;
     }
 
-    inline bool isSeparatorSpace(int32_t c)
+    inline bool isSeparatorSpace(UChar32 c)
     {
       return u_charType(c) == U_SPACE_SEPARATOR;
     }
 
-    inline bool isPrintableChar(int32_t c)
+    inline bool isPrintableChar(UChar32 c)
     {
       return !!u_isprint(c);
     }
     
-    inline bool isDigit(int32_t c)
+    inline bool isDigit(UChar32 c)
     {
       return !!u_isdigit(c);
     }
 
-    inline bool isPunct(int32_t c)
+    inline bool isPunct(UChar32 c)
     {
       return !!u_ispunct(c);
     }
 
-    inline int32_t mirroredChar(int32_t c)
+    inline UChar32 mirroredChar(UChar32 c)
     {
       return u_charMirror(c);
     }
 
-    inline CharCategory category(int32_t c)
+    inline CharCategory category(UChar32 c)
     {
       return static_cast<CharCategory>(U_GET_GC_MASK(c));
     }
 
-    inline Direction direction(int c) {
-      return (Direction)u_charDirection(c);
+    inline Direction direction(UChar32 c)
+    {
+      return static_cast<Direction>(u_charDirection(c));
     }
 
-    inline bool isLower(int32_t c)
+    inline bool isLower(UChar32 c)
     {
       return !!u_islower(c);
     }
 
-    inline bool isUpper(int32_t c)
+    inline bool isUpper(UChar32 c)
     {
       return !!u_isUUppercase(c);
       }
 
-    inline int digitValue(int32_t c)
+    inline int digitValue(UChar32 c)
     {
       return u_charDigitValue(c);
     }
@@ -265,15 +267,11 @@ namespace WTF {
       return static_cast<DecompositionType>(u_getIntPropertyValue(c, UCHAR_DECOMPOSITION_TYPE));
     }
 
-    inline int strcasecmp(const UChar *a, const UChar *b, int len)
+    inline int umemcasecmp(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);
-    }
   }
 }
 
index f439a0e3236062e3643e72ed6bfb978eb6cc4917..86884a0b1e807bd9ca0a7c2d69f59d1fa983eb85 100644 (file)
@@ -142,7 +142,7 @@ namespace WTF {
       Symbol_Other = U_MASK(QChar::Symbol_Other),
     };
 
-    inline int toLower(uint16_t* str, int strLength, uint16_t*& destIfNeeded)
+    inline int toLower(UChar* str, int strLength, UChar*& destIfNeeded)
     {
       destIfNeeded = 0;
 
@@ -152,12 +152,14 @@ namespace WTF {
       return strLength;
     }
 
-    inline uint16_t toLower(uint16_t ch)
+    inline UChar32 toLower(UChar32 ch)
     {
-      return QChar(ch).toLower().unicode();
+      if (ch > 0xffff)
+        return ch;
+      return QChar((unsigned short)ch).toLower().unicode();
     }
 
-    inline int toLower(UChar* result, int resultLength, UChar* src, int srcLength,  bool* error)
+    inline int toLower(UChar* result, int resultLength, const UChar* src, int srcLength,  bool* error)
     {
       *error = false;
       if (resultLength < srcLength) {
@@ -168,7 +170,7 @@ namespace WTF {
         result[i] = QChar(src[i]).toLower().unicode();
     }
 
-    inline int toUpper(uint16_t* str, int strLength, uint16_t*& destIfNeeded)
+    inline int toUpper(UChar* str, int strLength, UChar*& destIfNeeded)
     {
       destIfNeeded = 0;
 
@@ -178,9 +180,11 @@ namespace WTF {
       return strLength;
     }
 
-    inline uint16_t toUpper(uint16_t ch)
+    inline UChar32 toUpper(UChar32 ch)
     {
-      return QChar(ch).toUpper().unicode();
+      if (ch > 0xffff)
+        return ch;
+      return QChar((unsigned short)ch).toUpper().unicode();
     }
 
     inline int toUpper(UChar* result, int resultLength, UChar* src, int srcLength,  bool* error)
@@ -194,18 +198,18 @@ namespace WTF {
         result[i] = QChar(src[i]).toUpper().unicode();
     }
 
-    inline int toTitleCase (uint32_t c)
+    inline int toTitleCase(UChar32 c)
     {
       if (c > 0xffff)
         return c;
-      return QChar(c).toUpper().unicode();
+      return QChar((unsigned short)c).toUpper().unicode();
     }
 
-    inline uint32_t foldCase(uint32_t c)
+    inline UChar32 foldCase(UChar32 c)
     {
       if (c > 0xffff)
         return c;
-      return QChar(c).toLower().unicode();
+      return QChar((unsigned short)c).toLower().unicode();
     }
 
     inline int foldCase(UChar* result, int resultLength, UChar* src, int srcLength,  bool* error)
@@ -213,50 +217,52 @@ namespace WTF {
       return toLower(result, resultLength, src, srcLength, error);
     }
 
-    inline bool isFormatChar(int32_t c)
+    inline bool isFormatChar(UChar32 c)
     {
       return (c & 0xffff0000) == 0 && QChar((unsigned short)c).category() == QChar::Other_Format;
     }
 
-    inline bool isPrintableChar(int32_t c)
+    inline bool isPrintableChar(UChar32 c)
     {
       return (c & 0xffff0000) == 0 && QChar((unsigned short)c).isPrint();
     }
 
-    inline bool isSeparatorSpace(int32_t c)
+    inline bool isSeparatorSpace(UChar32 c)
     {
       return (c & 0xffff0000) == 0 && QChar((unsigned short)c).category() == QChar::Separator_Space;
     }
 
-    inline bool isPunct(int32_t c)
+    inline bool isPunct(UChar32 c)
     {
       return (c & 0xffff0000) == 0 && QChar((unsigned short)c).isPunct();
     }
 
-    inline bool isDigit(int32_t c)
+    inline bool isDigit(UChar32 c)
     {
       return (c & 0xffff0000) == 0 && QChar((unsigned short)c).isDigit();
     }
 
-    inline bool isLower(int32_t c)
+    inline bool isLower(UChar32 c)
     {
       return (c & 0xffff0000) == 0 && QChar((unsigned short)c).category() == QChar::Letter_Lowercase;
     }
 
-    inline bool isUpper(int32_t c)
+    inline bool isUpper(UChar32 c)
     {
       return (c & 0xffff0000) == 0 && QChar((unsigned short)c).category() == QChar::Letter_Uppercase;
     }
 
-    inline int digitValue(int32_t c)
+    inline int digitValue(UChar32 c)
     {
       if (c > 0xffff)
         return 0;
       return QChar(c).digitValue();
     }
 
-    inline uint16_t mirroredChar(uint16_t c)
+    inline UChar32 mirroredChar(UChar32 c)
     {
+      if (c > 0xffff)
+        return c;
       return QChar(c).mirroredChar().unicode();
     }
 
@@ -274,8 +280,7 @@ namespace WTF {
       return (DecompositionType)QChar(c).decompositionTag();
     }
 
-
-    inline int strcasecmp(const UChar *a, const UChar *b, int len)
+    inline int umemcasecmp(const UChar* a, const UChar* b, int len)
     {
       for (int i = 0; i < len; ++i) {
         QChar c1 = QChar(a[i]).toLower();
@@ -286,24 +291,18 @@ namespace WTF {
       return 0;
     }
 
-    inline void memset(UChar* dest, UChar ch, int32_t count)
-    {
-      UChar *end = dest + count;
-      while (dest < end)
-        *dest++ = ch;
-    }
-
-    inline Direction direction(int c) {
+    inline Direction direction(UChar32 c) {
       if (c > 0xffff)
         return LeftToRight;
       return (Direction)QChar(c).direction();
     }
 
-    inline CharCategory category(int c) {
+    inline CharCategory category(UChar32 c) {
       if (c > 0xffff)
         return (CharCategory) U_MASK(QChar::Letter_Other);
       return (CharCategory) U_MASK(QChar(c).category());
     }
+
   }
 }
 
index 17afb231c5ebbc18fc98555fec5061f7c6d4792a..dcc90e74df11a8e44461d5cb1e77f4ddc5fe25e8 100644 (file)
@@ -1,3 +1,105 @@
+2007-01-09  Darin Adler  <darin@apple.com>
+
+        Reviewed by Maciej.
+
+        - fix http://bugs.webkit.org/show_bug.cgi?id=12174
+          improve Unicode use (less WTF::Unicode:: prefix, centralized character names)
+
+        - got rid of namespace prefixes from most uses of WTF::Unicode
+
+        - updated for removal of WTF::Unicode::memcmp
+        - updated for renaming of WTF::Unicode::strcasecmp to umemcasecmp.
+
+        - unified constants for special Unicode characters in a new
+          CharacterNames.h header
+
+        * WebCore.xcodeproj/project.pbxproj:
+        * css/cssparser.cpp:
+        (WebCore::ParseString::lower):
+        * dom/Document.cpp:
+        (WebCore::isValidNameStart):
+        (WebCore::isValidNamePart):
+        * dom/Position.cpp:
+        (WebCore::Position::leadingWhitespacePosition):
+        (WebCore::Position::trailingWhitespacePosition):
+        * editing/CompositeEditCommand.cpp:
+        (WebCore::isWhitespace):
+        * editing/HTMLInterchange.cpp:
+        * editing/TextIterator.cpp:
+        (WebCore::CircularSearchBuffer::CircularSearchBuffer):
+        (WebCore::CircularSearchBuffer::append):
+        * editing/htmlediting.cpp:
+        (WebCore::stringWithRebalancedWhitespace):
+        (WebCore::nonBreakingSpaceString):
+        * editing/htmlediting.h:
+        * html/HTMLFontElement.cpp:
+        (WebCore::parseFontSizeNumber):
+        * html/HTMLParser.cpp:
+        (WebCore::HTMLParser::handleError):
+        * html/HTMLSelectElement.cpp:
+        (WebCore::stripLeadingWhiteSpace):
+        * platform/Font.cpp:
+        (WebCore::WidthIterator::advance):
+        (WebCore::WidthIterator::normalizeVoicingMarks):
+        * platform/GlyphMap.cpp:
+        (WebCore::GlyphMap::locatePage):
+        * platform/MimeTypeRegistry.h:
+        * platform/StringHash.h:
+        * platform/StringImpl.cpp:
+        (WebCore::isSpace):
+        (WebCore::StringImpl::append):
+        (WebCore::StringImpl::insert):
+        (WebCore::StringImpl::truncate):
+        (WebCore::StringImpl::remove):
+        (WebCore::parseLength):
+        (WebCore::StringImpl::isLower):
+        (WebCore::StringImpl::lower):
+        (WebCore::StringImpl::upper):
+        (WebCore::StringImpl::secure):
+        (WebCore::StringImpl::foldCase):
+        (WebCore::StringImpl::capitalize):t
+        (WebCore::StringImpl::toInt):
+        (WebCore::equalIgnoringCase):
+        (WebCore::StringImpl::find):
+        * platform/TextBoundaries.h:
+        * platform/TextCodec.h:
+        * platform/TextCodecLatin1.cpp:
+        * platform/TextEncoding.h:
+        * platform/TextEncodingRegistry.h:
+        * platform/mac/PasteboardMac.mm:
+        (WebCore::Pasteboard::writeSelection):
+        * platform/mac/TextCodecMac.cpp:
+        (WebCore::TextCodecMac::decode):
+        * rendering/RenderBlock.cpp:
+        (WebCore::RenderBlock::updateFirstLetter):
+        * rendering/RenderListMarker.cpp:
+        (WebCore::listMarkerText):
+        (WebCore::RenderListMarker::paint):
+        * rendering/RenderText.cpp:
+        (WebCore::RenderText::widthFromCache):
+        (WebCore::isSpaceAccordingToStyle):
+        (WebCore::RenderText::setInternalString):
+        * rendering/RenderTreeAsText.cpp:
+        (WebCore::quoteAndEscapeNonPrintables):
+        (WebCore::operator<<):
+        * rendering/bidi.cpp:
+        (WebCore::BidiState::BidiState):
+        (WebCore::BidiContext::BidiContext):
+        (WebCore::bidiNext):
+        (WebCore::bidiFirst):
+        (WebCore::BidiIterator::direction):
+        (WebCore::appendRun):
+        (WebCore::embed):
+        (WebCore::RenderBlock::bidiReorderLine):
+        (WebCore::RenderBlock::layoutInlineChildren):
+        (WebCore::skipNonBreakingSpace):
+        (WebCore::RenderBlock::findNextLineBreak):
+        * rendering/break_lines.cpp:
+        (WebCore::nextBreakablePosition):
+        * rendering/break_lines.h:
+        * xml/XPathParser.cpp:
+        (WebCore::XPath::charCat):
+
 2007-01-09  Dex Deacon  <occupant4@gmail.com>
 
         Reviewed by Darin.
index f9dcab3c78f0cf4a3cdf957013a626ea708d2632..fe087fe512eaa7612e6f1b004a79d1d67ee5425b 100644 (file)
                93C09A7F0B064EEF005ABD4D /* EventHandlerMac.mm in Sources */ = {isa = PBXBuildFile; fileRef = 93C09A7E0B064EEF005ABD4D /* EventHandlerMac.mm */; };
                93C09A810B064F00005ABD4D /* EventHandler.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93C09A800B064F00005ABD4D /* EventHandler.cpp */; };
                93C09C860B0657AA005ABD4D /* ScrollTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 93C09C850B0657AA005ABD4D /* ScrollTypes.h */; settings = {ATTRIBUTES = (Private, ); }; };
+               93C7B5F40B52D89100B5477E /* CharacterNames.h in Headers */ = {isa = PBXBuildFile; fileRef = 93C7B5F30B52D89100B5477E /* CharacterNames.h */; };
                93C841F809CE855C00DFF5E5 /* DOMImplementationFront.h in Headers */ = {isa = PBXBuildFile; fileRef = 93C841F709CE855C00DFF5E5 /* DOMImplementationFront.h */; };
                93C841FF09CE858300DFF5E5 /* DOMImplementationFront.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 93C841FE09CE858300DFF5E5 /* DOMImplementationFront.cpp */; };
                93CCF0270AF6C52900018E89 /* NavigationAction.h in Headers */ = {isa = PBXBuildFile; fileRef = 93CCF0260AF6C52900018E89 /* NavigationAction.h */; settings = {ATTRIBUTES = (Private, ); }; };
                93C09A7E0B064EEF005ABD4D /* EventHandlerMac.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = EventHandlerMac.mm; sourceTree = "<group>"; };
                93C09A800B064F00005ABD4D /* EventHandler.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = EventHandler.cpp; sourceTree = "<group>"; };
                93C09C850B0657AA005ABD4D /* ScrollTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScrollTypes.h; sourceTree = "<group>"; };
+               93C7B5F30B52D89100B5477E /* CharacterNames.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CharacterNames.h; sourceTree = "<group>"; };
                93C841F709CE855C00DFF5E5 /* DOMImplementationFront.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DOMImplementationFront.h; sourceTree = "<group>"; };
                93C841FE09CE858300DFF5E5 /* DOMImplementationFront.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = DOMImplementationFront.cpp; sourceTree = "<group>"; };
                93CA4C9909DF93FA00DF8677 /* html4.css */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; path = html4.css; sourceTree = "<group>"; };
                                E11D51910B2E7A5F0056C188 /* Base64.h */,
                                E11D51920B2E7A5F0056C188 /* Base64.cpp */,
                                65F5382009B2B55700F3DC4A /* character-sets.txt */,
+                               93C7B5F30B52D89100B5477E /* CharacterNames.h */,
                                9326DC0A09DAD5BE00AFC847 /* CharsetData.h */,
                                BCC8CFCA0986CD2400140BF2 /* ColorData.gperf */,
                                93B6A0E70B0BCA6700F5027A /* ContextMenu.cpp */,
                                1A4A954E0B4EDCCB002D8C3C /* SharedBuffer.h in Headers */,
                                BCCFBAE80B5152ED0001F1D7 /* Tokenizer.h in Headers */,
                                AA882B300B4EF5EB006D26D1 /* PointerEventsHitRules.h in Headers */,
+                               93C7B5F40B52D89100B5477E /* CharacterNames.h in Headers */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
index 4903863e43df2319320201f4a558ac427065c947..c58c4115aa873f59c785a11ad9ffbe7b3b739a45 100644 (file)
@@ -64,6 +64,7 @@ extern int cssyydebug;
 extern int cssyyparse(void* parser);
 
 using namespace std;
+using namespace WTF;
 
 namespace WebCore {
 
@@ -155,7 +156,7 @@ void ParseString::lower()
         ored |= characters[i];
     if (ored & ~0x7F)
         for (int i = 0; i < length; i++)
-            characters[i] = WTF::Unicode::toLower(characters[i]);
+            characters[i] = Unicode::toLower(characters[i]);
     else
         for (int i = 0; i < length; i++)
             characters[i] = tolower(characters[i]);
index 37bb180391b23a3deba1850d9977bcd410114b66..edceefa62b25287a3d5910544462c157086308e0 100644 (file)
 #endif
 
 using namespace std;
+using namespace WTF;
+using namespace Unicode;
 
 namespace WebCore {
 
@@ -131,10 +133,10 @@ using namespace HTMLNames;
 // This amount of time must have elapsed before we will even consider scheduling a layout without a delay.
 // FIXME: For faster machines this value can really be lowered to 200.  250 is adequate, but a little high
 // for dual G5s. :)
-const int cLayoutScheduleThreshold = 250;
+static const int cLayoutScheduleThreshold = 250;
 
 // Use 1 to represent the document's default form.
-HTMLFormElement* const defaultForm = (HTMLFormElement*) 1;
+static HTMLFormElement* const defaultForm = reinterpret_cast<HTMLFormElement*>(1);
 
 // Golden ratio - arbitrary start value to avoid mapping all 0's to all 0's
 static const unsigned PHI = 0x9e3779b9U;
@@ -165,12 +167,8 @@ static inline bool isValidNameStart(UChar32 c)
         return true;
 
     // rules (a) and (f) above
-    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))
+    const uint32_t nameStartMask = Letter_Lowercase | Letter_Uppercase | Letter_Other | Letter_Titlecase | Number_Letter;
+    if (!(Unicode::category(c) & nameStartMask))
         return false;
 
     // rule (c) above
@@ -178,8 +176,8 @@ static inline bool isValidNameStart(UChar32 c)
         return false;
 
     // rule (d) above
-    WTF::Unicode::DecompositionType decompType = WTF::Unicode::decompositionType(c);
-    if (decompType == WTF::Unicode::DecompositionFont || decompType == WTF::Unicode::DecompositionCompat)
+    DecompositionType decompType = decompositionType(c);
+    if (decompType == DecompositionFont || decompType == DecompositionCompat)
         return false;
 
     return true;
@@ -200,12 +198,8 @@ static inline bool isValidNamePart(UChar32 c)
         return true;
 
     // rules (b) and (f) above
-    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))
+    const uint32_t otherNamePartMask = Mark_NonSpacing | Mark_Enclosing | Mark_SpacingCombining | Letter_Modifier | Number_DecimalDigit;
+    if (!(Unicode::category(c) & otherNamePartMask))
         return false;
 
     // rule (c) above
@@ -213,8 +207,8 @@ static inline bool isValidNamePart(UChar32 c)
         return false;
 
     // rule (d) above
-    WTF::Unicode::DecompositionType decompType = WTF::Unicode::decompositionType(c);
-    if (decompType == WTF::Unicode::DecompositionFont || decompType == WTF::Unicode::DecompositionCompat)
+    DecompositionType decompType = decompositionType(c);
+    if (decompType == DecompositionFont || decompType == DecompositionCompat)
         return false;
 
     return true;
index 85a9548ebda019249b04351be61850197cf4efe0..ccb69dd2761474fe4ca327a71a5ab53eb93007ba 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "Position.h"
 
+#include "CharacterNames.h"
 #include "Document.h"
 #include "Element.h"
 #include "Logging.h"
@@ -40,8 +41,6 @@ namespace WebCore {
 
 using namespace HTMLNames;
 
-const UChar nonBreakingSpace = 0xa0;
-
 static Node *nextRenderedEditable(Node *node)
 {
     while (1) {
@@ -616,7 +615,7 @@ Position Position::leadingWhitespacePosition(EAffinity affinity, bool considerNo
     if (prev != *this && prev.node()->inSameContainingBlockFlowElement(node()) && prev.node()->isTextNode()) {
         String string = static_cast<Text *>(prev.node())->data();
         UChar c = string[prev.offset()];
-        if (considerNonCollapsibleWhitespace ? (DeprecatedChar(c).isSpace() || c == nonBreakingSpace) : isCollapsibleWhitespace(c))
+        if (considerNonCollapsibleWhitespace ? (DeprecatedChar(c).isSpace() || c == noBreakSpace) : isCollapsibleWhitespace(c))
             return prev;
     }
 
@@ -633,7 +632,7 @@ Position Position::trailingWhitespacePosition(EAffinity affinity, bool considerN
         if (offset() < (int)textNode->length()) {
             String string = textNode->data();
             UChar c = string[offset()];
-            if (considerNonCollapsibleWhitespace ? (DeprecatedChar(c).isSpace() || c == nonBreakingSpace) : isCollapsibleWhitespace(c))
+            if (considerNonCollapsibleWhitespace ? (DeprecatedChar(c).isSpace() || c == noBreakSpace) : isCollapsibleWhitespace(c))
                 return *this;
             return Position();
         }
@@ -646,7 +645,7 @@ Position Position::trailingWhitespacePosition(EAffinity affinity, bool considerN
     if (next != *this && next.node()->inSameContainingBlockFlowElement(node()) && next.node()->isTextNode()) {
         String string = static_cast<Text*>(next.node())->data();
         UChar c = string[0];
-        if (considerNonCollapsibleWhitespace ? (DeprecatedChar(c).isSpace() || c == nonBreakingSpace) : isCollapsibleWhitespace(c))
+        if (considerNonCollapsibleWhitespace ? (DeprecatedChar(c).isSpace() || c == noBreakSpace) : isCollapsibleWhitespace(c))
             return next;
     }
 
index 99cc7973fbc4de58a626ed0d11a31f02852add26..2117f98d82f1f3eeb197469419fce30f27fc22e3 100644 (file)
@@ -30,6 +30,7 @@
 #include "ApplyStyleCommand.h"
 #include "CSSComputedStyleDeclaration.h"
 #include "CSSMutableStyleDeclaration.h"
+#include "CharacterNames.h"
 #include "DeleteFromTextNodeCommand.h"
 #include "DeleteSelectionCommand.h"
 #include "Document.h"
@@ -42,7 +43,6 @@
 #include "InsertParagraphSeparatorCommand.h"
 #include "InsertTextCommand.h"
 #include "JoinTextNodesCommand.h"
-#include "markup.h"
 #include "MergeIdenticalElementsCommand.h"
 #include "Range.h"
 #include "RemoveCSSPropertyCommand.h"
@@ -57,6 +57,7 @@
 #include "TextIterator.h"
 #include "WrapContentsInDummySpanCommand.h"
 #include "htmlediting.h"
+#include "markup.h"
 #include "visible_units.h"
 
 using namespace std;
@@ -328,7 +329,7 @@ void CompositeEditCommand::setNodeAttribute(Element* element, const QualifiedNam
 
 static inline bool isWhitespace(UChar c)
 {
-    return c == NON_BREAKING_SPACE || c == ' ' || c == '\n' || c == '\t';
+    return c == noBreakSpace || c == ' ' || c == '\n' || c == '\t';
 }
 
 // FIXME: Doesn't go into text nodes that contribute adjacent text (siblings, cousins, etc).
index ea0ecf702e6abf0e4672eb08991a038f5ef8ae68..a421171d33a3b9fa82190a65853edde89d5d48f1 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "HTMLInterchange.h"
 
+#include "CharacterNames.h"
 #include "Document.h"
 #include "TextIterator.h"
 
@@ -40,7 +41,7 @@ DeprecatedString convertedSpaceString()
         convertedSpaceString = "<span class=\"";
         convertedSpaceString += AppleConvertedSpace;
         convertedSpaceString += "\">";
-        convertedSpaceString += DeprecatedChar(0xa0);
+        convertedSpaceString += DeprecatedChar(noBreakSpace);
         convertedSpaceString += "</span>";
     }
     return convertedSpaceString;
index 7f57a3f6afbadcf48d1bffc6c75ae2d628f1e1fd..e1538f9af54d3a1bf15fb3efd7fe035f20fb6724 100644 (file)
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "TextIterator.h"
 
+#include "CharacterNames.h"
 #include "Document.h"
 #include "Element.h"
 #include "HTMLNames.h"
 #include "RenderTableRow.h"
 
 using namespace std;
+using namespace WTF::Unicode;
 
 namespace WebCore {
 
 using namespace HTMLNames;
 
-const UChar nonBreakingSpace = 0xA0;
-
 // Buffer that knows how to compare with a search target.
 // Keeps enough of the previous text to be able to search in the future,
 // but no more.
@@ -955,7 +955,7 @@ CircularSearchBuffer::CircularSearchBuffer(const String& s, bool isCaseSensitive
 
     if (!isCaseSensitive)
         m_target = s.foldCase();
-    m_target.replace(nonBreakingSpace, ' ');
+    m_target.replace(noBreakSpace, ' ');
     m_isCaseSensitive = isCaseSensitive;
 
     m_buffer = static_cast<UChar*>(fastMalloc(s.length() * sizeof(UChar)));
@@ -966,9 +966,9 @@ CircularSearchBuffer::CircularSearchBuffer(const String& s, bool isCaseSensitive
 void CircularSearchBuffer::append(UChar c)
 {
     if (m_isCaseSensitive)
-        *m_cursor++ = c == nonBreakingSpace ? ' ' : c;
+        *m_cursor++ = c == noBreakSpace ? ' ' : c;
     else
-        *m_cursor++ = c == nonBreakingSpace ? ' ' : WTF::Unicode::foldCase(c);
+        *m_cursor++ = c == noBreakSpace ? ' ' : foldCase(c);
     if (m_cursor == m_buffer + length()) {
         m_cursor = m_buffer;
         m_bufferFull = true;
@@ -988,12 +988,12 @@ void CircularSearchBuffer::append(int count, const UChar* characters)
     if (m_isCaseSensitive) {
         for (int i = 0; i != count; ++i) {
             UChar c = characters[i];
-            m_cursor[i] = c == nonBreakingSpace ? ' ' : c;
+            m_cursor[i] = c == noBreakSpace ? ' ' : c;
         }
     } else {
         for (int i = 0; i != count; ++i) {
             UChar c = characters[i];
-            m_cursor[i] = c == nonBreakingSpace ? ' ' : WTF::Unicode::foldCase(c);
+            m_cursor[i] = c == noBreakSpace ? ' ' : foldCase(c);
         }
     }
     if (count < tailSpace)
index d6d5aaf6f7944f273fe98e9b0b4584356f4f1e56..4da550640694c4d1ba34999b35b8c2437390aae5 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "htmlediting.h"
 
+#include "CharacterNames.h"
 #include "Document.h"
 #include "EditingText.h"
 #include "HTMLElement.h"
@@ -362,7 +363,7 @@ String stringWithRebalancedWhitespace(const String& string, bool startIsStartOfP
 
     DeprecatedString rebalancedString = string.copy().deprecatedString();
 
-    rebalancedString.replace(NON_BREAKING_SPACE, ' ');
+    rebalancedString.replace(noBreakSpace, ' ');
     rebalancedString.replace('\n', ' ');
     rebalancedString.replace('\t', ' ');
     
@@ -385,7 +386,7 @@ bool isTableStructureNode(const Node *node)
 
 const String& nonBreakingSpaceString()
 {
-    static String nonBreakingSpaceString = DeprecatedString(DeprecatedChar(NON_BREAKING_SPACE));
+    static String nonBreakingSpaceString = String(&noBreakSpace, 1);
     return nonBreakingSpaceString;
 }
 
index 538513d60ad22d4f945512ea28975e2f3bd523af..f5e8796f0ff67fcd8df30dc3353044de997319ab 100644 (file)
@@ -38,8 +38,6 @@ class Position;
 class String;
 class VisiblePosition;
 
-const UChar NON_BREAKING_SPACE = 0xa0;
-
 Position rangeCompliantEquivalent(const Position&);
 Position rangeCompliantEquivalent(const VisiblePosition&);
 int maxDeepOffset(const Node*);
index c315d04ac6463c3919c4cf55ffd8cd867362b43f..2ed90c5bc31fd6f793b045649a9c265416c54482 100644 (file)
@@ -21,6 +21,7 @@
  * the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  * Boston, MA 02111-1307, USA.
  */
+
 #include "config.h"
 #include "HTMLFontElement.h"
 
@@ -28,6 +29,8 @@
 #include "CSSValueKeywords.h"
 #include "HTMLNames.h"
 
+using namespace WTF;
+
 namespace WebCore {
 
 using namespace HTMLNames;
@@ -64,12 +67,12 @@ static bool parseFontSizeNumber(const String& s, int& size)
     }
     
     // Parse a single digit.
-    if (!WTF::Unicode::isDigit(s[pos]))
+    if (!Unicode::isDigit(s[pos]))
         return false;
-    int num = WTF::Unicode::digitValue(s[pos++]);
+    int num = Unicode::digitValue(s[pos++]);
     
     // Check for an additional digit.
-    if (WTF::Unicode::isDigit(s[pos]))
+    if (Unicode::isDigit(s[pos]))
         num = 10;
     
     if (sawPlus) {
index 0b30d3bf08020f5e578d67509d710b9be042eb03..885523a9ec6c9761759044f31ef0df9b306fb749 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "HTMLParser.h"
 
+#include "CharacterNames.h"
 #include "CSSPropertyNames.h"
 #include "CSSValueKeywords.h"
 #include "Comment.h"
@@ -55,8 +56,6 @@ namespace WebCore {
 
 using namespace HTMLNames;
 
-const UChar nonBreakingSpace = 0xa0;
-
 /**
  * @internal
  */
@@ -504,7 +503,7 @@ bool HTMLParser::handleError(Node* n, bool flat, const AtomicString& localName,
                         return false;
                     StringImpl *i = t->string();
                     unsigned int pos = 0;
-                    while (pos < i->length() && ((*i)[pos] == ' ' || (*i)[pos] == nonBreakingSpace))
+                    while (pos < i->length() && ((*i)[pos] == ' ' || (*i)[pos] == noBreakSpace))
                         pos++;
                     if (pos == i->length())
                         possiblyMoveStrayContent = false;
index dafa8d47d34e683d6f14e78e754f86f1e36d2f75..e3e32338f612285ecd792738c267d6d5d7bbf5da 100644 (file)
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "HTMLSelectElement.h"
 
+#include "CharacterNames.h"
 #include "CSSPropertyNames.h"
 #include "Document.h"
 #include "Event.h"
 #endif
 
 using namespace std;
+using namespace WTF;
+using namespace Unicode;
 
 namespace WebCore {
 
 using namespace EventNames;
 using namespace HTMLNames;
 
+const DOMTimeStamp typeAheadTimeout = 1000;
+
 HTMLSelectElement::HTMLSelectElement(Document* doc, HTMLFormElement* f)
     : HTMLGenericFormElement(selectTag, doc, f)
     , m_minwidth(0)
@@ -819,19 +824,16 @@ void HTMLSelectElement::listBoxOnChange()
 
 static String stripLeadingWhiteSpace(const String& string)
 {
-    const UChar nonBreakingSpace = 0xA0;
-
     int length = string.length();
     int i;
     for (i = 0; i < length; ++i)
-        if (string[i] != nonBreakingSpace &&
-            (string[i] <= 0x7F ? !isspace(string[i]) : (WTF::Unicode::direction(string[i]) != WTF::Unicode::WhiteSpaceNeutral)))
+        if (string[i] != noBreakSpace &&
+            (string[i] <= 0x7F ? !isspace(string[i]) : (direction(string[i]) != WhiteSpaceNeutral)))
             break;
 
     return string.substring(i, length - i);
 }
 
-const DOMTimeStamp typeAheadTimeout = 1000;
 void HTMLSelectElement::typeAheadFind(KeyboardEvent* event)
 {
     if (event->timeStamp() < m_lastCharTime)
diff --git a/WebCore/platform/CharacterNames.h b/WebCore/platform/CharacterNames.h
new file mode 100644 (file)
index 0000000..6efbbc3
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2007 Apple Computer, Inc. All rights reserved.
+ *
+ * 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. 
+ */
+
+#ifndef CharacterNames_h
+#define CharacterNames_h
+
+#include <wtf/unicode/Unicode.h>
+
+namespace WebCore {
+
+    // Names here are taken from the Unicode standard.
+
+    // Note, these are UChar constants, not UChar32, which makes them
+    // more convenient for our code that mostly uses UTF-16.
+
+    const UChar ideographicSpace = 0x3000;
+    const UChar noBreakSpace = 0x00A0;
+    const UChar bullet = 0x2022;
+    const UChar blackSquare = 0x25A0;
+    const UChar whiteBullet = 0x25E6;
+    const UChar softHyphen = 0x00AD;
+    const UChar zeroWidthSpace = 0x200B;
+
+}
+
+#endif // CharacterNames_h
index f663165f7380537b7beb528058b466130a4281b0..3926c37d615cb7707bb68834afcf5159159e984e 100644 (file)
 #include "TextStyle.h"
 #include <wtf/unicode/Unicode.h>
 #include <wtf/MathExtras.h>
+
 #if USE(ICU_UNICODE)
 #include <unicode/unorm.h>
 #endif
 
+using namespace WTF;
+using namespace Unicode;
+
 namespace WebCore {
 
 // According to http://www.unicode.org/Public/UNIDATA/UCD.html#Canonical_Combining_Class_Values
@@ -173,11 +177,11 @@ void WidthIterator::advance(int offset, GlyphBuffer* glyphBuffer)
 
         if (needCharTransform) {
             if (rtl)
-                c = WTF::Unicode::mirroredChar(c);
+                c = mirroredChar(c);
 
             // If small-caps, convert lowercase to upper.
-            if (m_font->isSmallCaps() && !WTF::Unicode::isUpper(c)) {
-                UChar32 upperC = WTF::Unicode::toUpper(c);
+            if (m_font->isSmallCaps() && !Unicode::isUpper(c)) {
+                UChar32 upperC = Unicode::toUpper(c);
                 if (upperC != c) {
                     c = upperC;
                     fontData = fontData->smallCapsFontData(m_font->fontDescription());
@@ -299,7 +303,7 @@ bool WidthIterator::advanceOneCharacter(float& width, GlyphBuffer* glyphBuffer)
 UChar32 WidthIterator::normalizeVoicingMarks(int currentCharacter)
 {
     if (currentCharacter + 1 < m_end) {
-        if (WTF::Unicode::combiningClass(m_run[currentCharacter + 1]) == hiraganaKatakanaVoicingMarksCombiningClass) {
+        if (combiningClass(m_run[currentCharacter + 1]) == hiraganaKatakanaVoicingMarksCombiningClass) {
 #if USE(ICU_UNICODE)
             // Normalize into composed form using 3.2 rules.
             UChar normalizedCharacters[2] = { 0, 0 };
index 3ac03e623c4d4b68a5dea4d5cc9017d2c8280ab1..a018ba8440dc85d4fbb9c5323ca4a906bc512a80 100644 (file)
 #include "config.h"
 #include "GlyphMap.h"
 
+#include "CharacterNames.h"
 #include "FontData.h"
 #include <wtf/unicode/Unicode.h>
 
 namespace WebCore {
 
-const UChar nonBreakingSpace = 0x00A0;
-const UChar zeroWidthSpace = 0x200B;
-
 GlyphData GlyphMap::glyphDataForCharacter(UChar32 c, const FontData* fontData)
 {
     unsigned pageNumber = (c / GlyphPage::size);
@@ -92,7 +90,7 @@ inline GlyphMap::GlyphPage* GlyphMap::locatePage(unsigned pageNumber, const Font
             // \n, \t, and nonbreaking space must render as a space.
             buffer[(int)'\n'] = ' ';
             buffer[(int)'\t'] = ' ';
-            buffer[nonBreakingSpace] = ' ';
+            buffer[noBreakSpace] = ' ';
         }
     } else {
         bufferLength = GlyphPage::size * 2;
index e9d8dd2c80c3d9173624e8961701dc725c6c42de..aeb9f8e7754f1a798c127ab19d50fa115ba86706 100644 (file)
 #define MimeTypeRegistry_h
 
 #include "PlatformString.h"
-#include "wtf/HashSet.h"
 #include "StringHash.h"
+#include <wtf/HashSet.h>
 
-namespace WebCore 
-{
+namespace WebCore {
 
 class MimeTypeRegistry {
 public:
-    static String getMIMETypeForExtension(const String &ext);
+    static String getMIMETypeForExtension(const Stringext);
     
     // Check to see if a mime type is suitable for being loaded inline as an
     // image (e.g., <img> tags).
-    static bool  isSupportedImageMIMEType(const String &mimeType);   
+    static bool isSupportedImageMIMEType(const String& mimeType);   
 
     // Check to see if a mime type is suitable for being loaded as an image
     // document in a frame.
-    static bool  isSupportedImageResourceMIMEType(const String &mimeType);    
+    static bool isSupportedImageResourceMIMEType(const String& mimeType);    
 
     // Check to see if a non-image mime type is suitable for being loaded as a
     // document in a frame.
-    static bool  isSupportedNonImageMIMEType(const String &mimeType);
+    static bool isSupportedNonImageMIMEType(const String& mimeType);
 
-    static const HashSet<String> &getSupportedImageMIMETypes();
-    static const HashSet<String> &getSupportedImageResourceMIMETypes();
-    static const HashSet<String> &getSupportedNonImageMIMETypes();
+    static const HashSet<String>getSupportedImageMIMETypes();
+    static const HashSet<String>getSupportedImageResourceMIMETypes();
+    static const HashSet<String>getSupportedNonImageMIMETypes();
 };
 
 }
index b44d466347d076cb0a14f3dc558cdc79926a4d55..a9bbffa3dcc5f91c7a8d4b75f0c22b83dbe09675 100644 (file)
@@ -183,7 +183,7 @@ namespace WTF {
             unsigned length = a->length();
             if (length != b->length())
                 return false;
-            return WTF::Unicode::strcasecmp(a->characters(), b->characters(), length) == 0;
+            return WTF::Unicode::umemcasecmp(a->characters(), b->characters(), length) == 0;
         }
     };
 
index 29651be1748ceab2e88861e0fef3f72cca24efc1..16fb475fd9d1f891a5310a6e7181e3e361a34373 100644 (file)
 
 #include "AtomicString.h"
 #include "CString.h"
+#include "CharacterNames.h"
 #include "DeprecatedString.h"
 #include "Length.h"
 #include "StringHash.h"
-#include "TextEncoding.h"
 #include "TextBreakIterator.h"
+#include "TextEncoding.h"
 #include <kjs/dtoa.h>
 #include <kjs/identifier.h>
 #include <wtf/Assertions.h>
 #include <wtf/unicode/Unicode.h>
-#include <assert.h>
 
 using namespace WTF;
+using namespace Unicode;
 
 using KJS::Identifier;
 using KJS::UString;
 
 namespace WebCore {
 
-const UChar nonBreakingSpace = 0xA0;
-
 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) : Unicode::direction(c) == Unicode::WhiteSpaceNeutral;
+    return c <= 0x7F ? isspace(c) : direction(c) == WhiteSpaceNeutral;
 }    
     
 static inline UChar* newUCharVector(unsigned n)
@@ -175,7 +174,7 @@ void StringImpl::append(char c)
 
 void StringImpl::append(UChar c)
 {
-    assert(!m_inTable);
+    ASSERT(!m_inTable);
     UChar* nc = newUCharVector(m_length + 1);
     memcpy(nc, m_data, m_length * sizeof(UChar));
     nc[m_length] = c;
@@ -187,7 +186,7 @@ void StringImpl::append(UChar c)
 
 void StringImpl::insert(const UChar* str, unsigned length, unsigned pos)
 {
-    assert(!m_inTable);
+    ASSERT(!m_inTable);
     if (pos >= m_length) {
         append(str, length);
         return;
@@ -214,7 +213,7 @@ void StringImpl::insert(const StringImpl* str, unsigned pos)
 
 void StringImpl::truncate(int len)
 {
-    assert(!m_inTable);
+    ASSERT(!m_inTable);
     if (len >= (int)m_length)
         return;
     int nl = len < 1 ? 1 : len;
@@ -228,7 +227,7 @@ void StringImpl::truncate(int len)
 
 void StringImpl::remove(unsigned pos, int len)
 {
-    assert(!m_inTable);
+    ASSERT(!m_inTable);
     if (len <= 0)
         return;
     if (pos >= m_length)
@@ -283,14 +282,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 && WTF::Unicode::isDigit(m_data[i]))
+    while (i < m_length && 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 && (WTF::Unicode::isDigit(m_data[i]) || m_data[i] == '.'))
+    while (i < m_length && (Unicode::isDigit(m_data[i]) || m_data[i] == '.'))
         ++i;
 
     /* IE Quirk: Skip any whitespace (20 % => 20%) */
@@ -400,7 +399,7 @@ bool StringImpl::isLower() const
     // Do a slower check for the other cases.
     bool allLower2 = true;
     for (unsigned i = 0; i < m_length; i++)
-        allLower2 &= WTF::Unicode::isLower(m_data[i]);
+        allLower2 &= Unicode::isLower(m_data[i]);
     return allLower2;
 }
 
@@ -427,7 +426,7 @@ StringImpl* StringImpl::lower() const
         return c;
 
     bool error;
-    int32_t realLength = WTF::Unicode::toLower(data, length, m_data, m_length, &error);
+    int32_t realLength = Unicode::toLower(data, length, m_data, m_length, &error);
     if (!error && realLength == length)
         return c;
 
@@ -440,7 +439,7 @@ StringImpl* StringImpl::lower() const
     c->m_data = data;
     c->m_length = length;
 
-    WTF::Unicode::toLower(data, length, m_data, m_length, &error);
+    Unicode::toLower(data, length, m_data, m_length, &error);
     if (error) {
         c->ref();
         c->deref();
@@ -455,10 +454,10 @@ StringImpl* StringImpl::upper() const
     if (!m_length)
         return c;
     bool error;
-    int32_t length = WTF::Unicode::toUpper(0, 0, m_data, m_length, &error);
+    int32_t length = Unicode::toUpper(0, 0, m_data, m_length, &error);
     c->m_data = newUCharVector(length);
     c->m_length = length;
-    WTF::Unicode::toUpper(c->m_data, length, m_data, m_length, &error);
+    Unicode::toUpper(c->m_data, length, m_data, m_length, &error);
     if (error) {
         c->ref();
         c->deref();
@@ -469,11 +468,14 @@ StringImpl* StringImpl::upper() const
 
 StringImpl* StringImpl::secure(UChar aChar) const
 {
-    StringImpl* c= new StringImpl;
-    c->m_data = newUCharVector(c->m_length= m_length);
-    
-    WTF::Unicode::memset(c->m_data, aChar, m_length);
-    
+    int length = m_length;
+    UChar* data = newUCharVector(length);
+    for (int i = 0; i < length; ++i)
+        data[i] = aChar;
+
+    StringImpl* c = new StringImpl;
+    c->m_data = data;
+    c->m_length = length;
     return c;
 }
 
@@ -483,10 +485,10 @@ StringImpl* StringImpl::foldCase() const
     if (!m_length)
         return c;
     bool error;
-    int32_t length = WTF::Unicode::foldCase(0, 0, m_data, m_length, &error);
+    int32_t length = Unicode::foldCase(0, 0, m_data, m_length, &error);
     c->m_data = newUCharVector(length);
     c->m_length = length;
-    WTF::Unicode::foldCase(c->m_data, length, m_data, m_length, &error);
+    Unicode::foldCase(c->m_data, length, m_data, m_length, &error);
     if (error) {
         c->ref();
         c->deref();
@@ -563,10 +565,10 @@ StringImpl* StringImpl::capitalize(UChar previous) const
         return capitalizedString;
 
     UChar* stringWithPrevious = newUCharVector(m_length + 1);
-    stringWithPrevious[0] = previous == nonBreakingSpace ? ' ' : previous;
+    stringWithPrevious[0] = previous == noBreakSpace ? ' ' : previous;
     for (unsigned i = 1; i < m_length + 1; i++) {
         // Replace &nbsp with a real space since ICU no longer treats &nbsp as a word separator.
-        if (m_data[i - 1] == nonBreakingSpace)
+        if (m_data[i - 1] == noBreakSpace)
             stringWithPrevious[i] = ' ';
         else
             stringWithPrevious[i] = m_data[i - 1];
@@ -585,7 +587,7 @@ StringImpl* StringImpl::capitalize(UChar previous) const
     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] = m_data[startOfWord - 1] == nonBreakingSpace ? nonBreakingSpace : WTF::Unicode::toTitleCase(stringWithPrevious[startOfWord]);
+            capitalizedString->m_data[startOfWord - 1] = m_data[startOfWord - 1] == noBreakSpace ? noBreakSpace : toTitleCase(stringWithPrevious[startOfWord]);
         for (int i = startOfWord + 1; i < endOfWord; i++)
             capitalizedString->m_data[i - 1] = m_data[i - 1];
     }
@@ -610,7 +612,7 @@ int StringImpl::toInt(bool* ok) const
     
     // Allow digits.
     for (; i != m_length; ++i)
-        if (!WTF::Unicode::isDigit(m_data[i]))
+        if (!Unicode::isDigit(m_data[i]))
             break;
     
     return DeprecatedConstString(reinterpret_cast<const DeprecatedChar*>(m_data), i).string().toInt(ok);
@@ -647,7 +649,7 @@ static bool equalIgnoringCase(const UChar* a, const char* b, int length)
     ASSERT(length >= 0);
     while (length--) {
         unsigned char bc = *b++;
-        if (WTF::Unicode::foldCase(*a++) != WTF::Unicode::foldCase(bc))
+        if (foldCase(*a++) != foldCase(bc))
             return false;
     }
     return true;
@@ -656,7 +658,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 WTF::Unicode::strcasecmp(a, b, length) == 0;
+    return umemcasecmp(a, b, length) == 0;
 }
 
 // This function should be as fast as possible, every little bit helps.
@@ -689,10 +691,9 @@ int StringImpl::find(const char* chs, int index, bool caseSensitive) const
                 return m_length - chsLength - n + 1;
         } while (--n);
     } else {
-        UChar lc = WTF::Unicode::foldCase(*chs);
+        UChar lc = Unicode::foldCase(*chs);
         do {
-            if (WTF::Unicode::foldCase(*++ptr) == lc
-                    && equalIgnoringCase(ptr + 1, chsPlusOne, chsLengthMinusOne))
+            if (Unicode::foldCase(*++ptr) == lc && equalIgnoringCase(ptr + 1, chsPlusOne, chsLengthMinusOne))
                 return m_length - chsLength - n + 1;
         } while (--n);
     }
@@ -993,7 +994,7 @@ bool equalIgnoringCase(const StringImpl* a, const char* b)
         equal = true;
         for (unsigned i = 0; i != length; ++i) {
             unsigned char bc = b[i];
-            equal &= WTF::Unicode::foldCase(as[i]) == WTF::Unicode::foldCase(bc);
+            equal &= foldCase(as[i]) == foldCase(bc);
         }
     }
 
index 0488ea6692c581b52e610bc154ca45197564c338..972c17c6ee9cd12741a138f1d8e30c915a5c647e 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef TextBoundaries_h
 #define TextBoundaries_h
 
-#include "wtf/unicode/Unicode.h"
+#include <wtf/unicode/Unicode.h>
 
 namespace WebCore {
 
index b68246f64cd386289115858f627f4a3be537464e..77ffcf45a1480909273d241029348c713ed43358 100644 (file)
 #ifndef TextCodec_h
 #define TextCodec_h
 
-#include "wtf/unicode/Unicode.h"
 #include <memory>
 #include <wtf/Noncopyable.h>
 #include <wtf/Vector.h>
+#include <wtf/unicode/Unicode.h>
 
 namespace WebCore {
 
index 5b7ea138b9050bf83bbb4277153d0a83387b3010..74693c6be6f0bc52acba5e27a95c906acc1b7085 100644 (file)
@@ -28,7 +28,6 @@
 
 #include "CString.h"
 #include "PlatformString.h"
-#include "wtf/unicode/Unicode.h"
 
 using std::auto_ptr;
 
index 86b3e8606efc65eefc8504e6e06dbf7d275c3f71..89b276be0d21c4e2720e9a46a782a1b5b7d0a4eb 100644 (file)
@@ -26,7 +26,7 @@
 #ifndef TextEncoding_h
 #define TextEncoding_h
 
-#include "wtf/unicode/Unicode.h"
+#include <wtf/unicode/Unicode.h>
 
 namespace WebCore {
 
index d6945ca0dad2ed5d2c3d84d691cda8a73c6c2633..6e006a76b67d48cc373a71cbd117e2aba101dca3 100644 (file)
@@ -26,8 +26,8 @@
 #ifndef TextEncodingRegistry_h
 #define TextEncodingRegistry_h
 
-#include "wtf/unicode/Unicode.h"
 #include <memory>
+#include <wtf/unicode/Unicode.h>
 
 namespace WebCore {
 
index dbd1a8873927550f4470741722448fd5ba24bab8..422ac311271acb188ced918ffb498a61ef2049fc 100644 (file)
@@ -26,6 +26,7 @@
 #import "config.h"
 #import "Pasteboard.h"
 
+#import "CharacterNames.h"
 #import "DOMRangeInternal.h"
 #import "DocumentFragment.h"
 #import "Editor.h"
@@ -131,8 +132,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
         text.replace('\\', frame->backslashAsCurrencySymbol());
         NSMutableString *s = [[[(NSString*)text copy] autorelease] mutableCopy];
         
-        const unichar NonBreakingSpaceCharacter = 0xA0;
-        NSString *NonBreakingSpaceString = [NSString stringWithCharacters:&NonBreakingSpaceCharacter length:1];
+        NSString *NonBreakingSpaceString = [NSString stringWithCharacters:&noBreakSpace length:1];
         [s replaceOccurrencesOfString:NonBreakingSpaceString withString:@" " options:0 range:NSMakeRange(0, [s length])];
         [m_pasteboard setString:s forType:NSStringPboardType];
         [s release];
index dec6fa937bbe401b3913639bde0cda40734598cc..fc6d71b78e44d084571d1aed3b7a0187688432b9 100644 (file)
@@ -27,8 +27,9 @@
 #include "config.h"
 #include "TextCodecMac.h"
 
-#include "CharsetData.h"
 #include "CString.h"
+#include "CharacterNames.h"
+#include "CharsetData.h"
 #include "PlatformString.h"
 #include <wtf/Assertions.h>
 
@@ -260,7 +261,7 @@ String TextCodecMac::decode(const char* bytes, size_t length, bool flush)
     // But GB18030 decodes it to U+E5E5, which is correct in theory but not in practice.
     // To work around, just change all occurences of U+E5E5 to U+3000 (ideographic space).
     if (m_encoding == kCFStringEncodingGB_18030_2000)
-        resultString.replace(0xE5E5, 0x3000);
+        resultString.replace(0xE5E5, ideographicSpace);
     
     return resultString;
 }
index bfe45301d5ae566cef49566c40a60665aa89d326..c705a31d4f9fdf3b1e2156e26f6ca26845ef2d10 100644 (file)
@@ -40,6 +40,8 @@
 #include "TextStream.h"
 
 using namespace std;
+using namespace WTF;
+using namespace Unicode;
 
 namespace WebCore {
 
@@ -3557,7 +3559,7 @@ void RenderBlock::updateFirstLetter()
             unsigned int length = 0;
             
             // account for leading spaces and punctuation
-            while (length < oldText->length() && (DeprecatedChar((*oldText)[length]).isSpace() || WTF::Unicode::isPunct((*oldText)[length])))
+            while (length < oldText->length() && (DeprecatedChar((*oldText)[length]).isSpace() || Unicode::isPunct((*oldText)[length])))
                 length++;
             
             // account for first letter
index 084e34976219c03cb29184c6502a8398325cecb9..21c975c5649780c2622661ede71fd6b0b1cdb3b6 100644 (file)
@@ -27,6 +27,7 @@
 #include "RenderListMarker.h"
 
 #include "CachedImage.h"
+#include "CharacterNames.h"
 #include "Document.h"
 #include "GraphicsContext.h"
 #include "ListMarkerBox.h"
@@ -35,7 +36,8 @@
 #include "RenderView.h"
 
 using namespace std;
-namespace Unicode = WTF::Unicode;
+using namespace WTF;
+using namespace Unicode;
 
 namespace WebCore {
 
@@ -335,20 +337,14 @@ String listMarkerText(EListStyleType type, int value)
 
         // We use the same characters for text security.
         // See RenderText::setInternalString.
-        case CIRCLE: {
-            const UChar whiteBullet = 0x25E6;
+        case CIRCLE:
             return String(&whiteBullet, 1);
-        }
-        case DISC: {
-            const UChar bullet = 0x2022;
+        case DISC:
             return String(&bullet, 1);
-        }
-        case SQUARE: {
+        case SQUARE:
             // The CSS 2.1 test suite uses U+25EE BLACK MEDIUM SMALL SQUARE
             // instead, but I think this looks better.
-            const UChar blackSquare = 0x25A0;
             return String(&blackSquare, 1);
-        }
 
         case LDECIMAL:
             return String::number(value);
@@ -618,7 +614,7 @@ void RenderListMarker::paint(PaintInfo& paintInfo, int tx, int ty)
 
     // Text is not arbitrary. We can judge whether it's RTL from the first character,
     // and we only need to handle the direction RightToLeft for now.
-    bool textNeedsReversing = Unicode::direction(m_text[0]) == Unicode::RightToLeft;
+    bool textNeedsReversing = direction(m_text[0]) == RightToLeft;
     Vector<UChar> reversedText;
     if (textNeedsReversing) {
         int length = m_text.length();
index fd5b64bb0c84973edf5ff3d5dc8b59b06d99934c..c65b3ef72e4c808ab0c0372535c3d5cb80d04e7d 100644 (file)
@@ -27,6 +27,7 @@
 #include "config.h"
 #include "RenderText.h"
 
+#include "CharacterNames.h"
 #include "InlineTextBox.h"
 #include "Range.h"
 #include "RenderArena.h"
@@ -38,6 +39,8 @@
 #include <wtf/AlwaysInline.h>
 
 using namespace std;
+using namespace WTF;
+using namespace Unicode;
 
 namespace WebCore {
 
@@ -424,8 +427,8 @@ ALWAYS_INLINE int RenderText::widthFromCache(const Font* f, int start, int len,
         int w = 0;
         for (i = start; i < start + len; i++) {
             UChar c = (*m_str)[i];
-            WTF::Unicode::Direction dir = WTF::Unicode::direction(c);
-            if (dir != WTF::Unicode::NonSpacingMark && dir != WTF::Unicode::BoundaryNeutral) {
+            Direction dir = direction(c);
+            if (dir != NonSpacingMark && dir != BoundaryNeutral) {
                 if (c == '\t' && tabWidth)
                     w += tabWidth - ((xPos + w) % tabWidth);
                 else
@@ -528,7 +531,7 @@ void RenderText::calcMinMaxWidth()
 
 inline bool isSpaceAccordingToStyle(UChar c, RenderStyle* style)
 {
-    return c == ' ' || (c == 0xa0 && style->nbspMode() == SPACE);
+    return c == ' ' || (c == noBreakSpace && style->nbspMode() == SPACE);
 }
 
 void RenderText::calcMinMaxWidth(int leadWidth)
@@ -876,21 +879,14 @@ void RenderText::setInternalString(PassRefPtr<StringImpl> text)
             switch (style()->textSecurity()) {
                 case TSNONE:
                     break;
-                case TSCIRCLE: {
-                    const UChar whiteBullet = 0x25E6;
+                case TSCIRCLE:
                     m_str = m_str->secure(whiteBullet);
                     break;
-                }
-                case TSDISC: {
-                    const UChar bullet = 0x2022;
+                case TSDISC:
                     m_str = m_str->secure(bullet);
                     break;
-                }
-                case TSSQUARE: {
-                    const UChar blackSquare = 0x25A0;
+                case TSSQUARE:
                     m_str = m_str->secure(blackSquare);
-                    break;
-                }
             }
         }
     }
index 94a945bc9fd57596b9fae9d3939dd4f4c541b504..ad291e41324af37602c3046db765bbaba0bb5d1c 100644 (file)
@@ -26,6 +26,7 @@
 #include "config.h"
 #include "RenderTreeAsText.h"
 
+#include "CharacterNames.h"
 #include "Document.h"
 #include "Frame.h"
 #include "FrameView.h"
@@ -140,7 +141,7 @@ static String quoteAndEscapeNonPrintables(const String& s)
         } else if (c == '"') {
             result.append('\\');
             result.append('"');
-        } else if (c == '\n' || c == 0x00A0)
+        } else if (c == '\n' || c == noBreakSpace)
             result.append(' ');
         else {
             if (c >= 0x20 && c < 0x7F)
@@ -278,13 +279,13 @@ static TextStream &operator<<(TextStream& ts, const RenderObject& o)
                 text = quoteAndEscapeNonPrintables(text);
             else {
                 switch (text[0]) {
-                    case 0x2022:
+                    case bullet:
                         text = "bullet";
                         break;
-                    case 0x25A0:
+                    case blackSquare:
                         text = "black square";
                         break;
-                    case 0x25E6:
+                    case whiteBullet:
                         text = "white bullet";
                         break;
                     default:
index 8df50a58a487c622985e14244a23ab101663bb16..7a9edec737cc202de84122e085c4d459cd594759 100644 (file)
@@ -24,6 +24,7 @@
 #include "config.h"
 #include "bidi.h"
 
+#include "CharacterNames.h"
 #include "Document.h"
 #include "Element.h"
 #include "FrameView.h"
@@ -36,6 +37,8 @@
 #include <wtf/Vector.h>
 
 using namespace std;
+using namespace WTF;
+using namespace Unicode;
 
 namespace WebCore {
 
@@ -49,7 +52,7 @@ struct BidiIterator {
     bool atEnd() const;
     
     UChar current() const;
-    WTF::Unicode::Direction direction() const;
+    Direction direction() const;
 
     RenderBlock* block;
     RenderObject* obj;
@@ -57,7 +60,7 @@ struct BidiIterator {
 };
 
 struct BidiState {
-    BidiState() : context(0), dir(WTF::Unicode::OtherNeutral), adjustEmbedding(false), reachedEndOfLine(false) {}
+    BidiState() : context(0), dir(OtherNeutral), adjustEmbedding(false), reachedEndOfLine(false) {}
     
     BidiIterator sor;
     BidiIterator eor;
@@ -65,7 +68,7 @@ struct BidiState {
     BidiIterator current;
     RefPtr<BidiContext> context;
     BidiStatus status;
-    WTF::Unicode::Direction dir;
+    Direction dir;
     bool adjustEmbedding;
     BidiIterator endOfLine;
     bool reachedEndOfLine;
@@ -105,7 +108,7 @@ static bool previousLineBrokeCleanly = true;
 static bool emptyRun = true;
 static int numSpaces;
 
-static void embed(WTF::Unicode::Direction, BidiState&);
+static void embed(Direction, BidiState&);
 static void appendRun(BidiState&);
 
 static int getBPMWidth(int childValue, Length cssUnit)
@@ -200,7 +203,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, WTF::Unicode::Direction e, BidiContext *p, bool o)
+BidiContext::BidiContext(unsigned char l, Direction e, BidiContext *p, bool o)
     : level(l), override(o), m_dir(e)
 {
     parent = p;
@@ -278,9 +281,9 @@ static inline RenderObject* bidiNext(RenderBlock* block, RenderObject* current,
                 EUnicodeBidi ub = next->style()->unicodeBidi();
                 if (ub != UBNormal) {
                     TextDirection dir = next->style()->direction();
-                    WTF::Unicode::Direction d = (ub == Embed
-                        ? (dir == RTL ? WTF::Unicode::RightToLeftEmbedding : WTF::Unicode::LeftToRightEmbedding)
-                        : (dir == RTL ? WTF::Unicode::RightToLeftOverride : WTF::Unicode::LeftToRightOverride));
+                    Direction d = (ub == Embed
+                        ? (dir == RTL ? RightToLeftEmbedding : LeftToRightEmbedding)
+                        : (dir == RTL ? RightToLeftOverride : LeftToRightOverride));
                     embed(d, bidi);
                 }
             }
@@ -296,7 +299,7 @@ static inline RenderObject* bidiNext(RenderBlock* block, RenderObject* current,
 
             while (current && current != block) {
                 if (bidi.adjustEmbedding && current->isInlineFlow() && current->style()->unicodeBidi() != UBNormal)
-                    embed(WTF::Unicode::PopDirectionalFormat, bidi);
+                    embed(PopDirectionalFormat, bidi);
 
                 next = current->nextSibling();
                 if (next) {
@@ -304,9 +307,9 @@ static inline RenderObject* bidiNext(RenderBlock* block, RenderObject* current,
                         EUnicodeBidi ub = next->style()->unicodeBidi();
                         if (ub != UBNormal) {
                             TextDirection dir = next->style()->direction();
-                            WTF::Unicode::Direction d = (ub == Embed
-                                ? (dir == RTL ? WTF::Unicode::RightToLeftEmbedding: WTF::Unicode::LeftToRightEmbedding)
-                                : (dir == RTL ? WTF::Unicode::RightToLeftOverride : WTF::Unicode::LeftToRightOverride));
+                            Direction d = (ub == Embed
+                                ? (dir == RTL ? RightToLeftEmbedding: LeftToRightEmbedding)
+                                : (dir == RTL ? RightToLeftOverride : LeftToRightOverride));
                             embed(d, bidi);
                         }
                     }
@@ -346,9 +349,9 @@ static RenderObject* bidiFirst(RenderBlock* block, BidiState& bidi, bool skipInl
             EUnicodeBidi ub = o->style()->unicodeBidi();
             if (ub != UBNormal) {
                 TextDirection dir = o->style()->direction();
-                WTF::Unicode::Direction d = (ub == Embed
-                    ? (dir == RTL ? WTF::Unicode::RightToLeftEmbedding : WTF::Unicode::LeftToRightEmbedding)
-                    : (dir == RTL ? WTF::Unicode::RightToLeftOverride : WTF::Unicode::LeftToRightOverride));
+                Direction d = (ub == Embed
+                    ? (dir == RTL ? RightToLeftEmbedding : LeftToRightEmbedding)
+                    : (dir == RTL ? RightToLeftOverride : LeftToRightOverride));
                 embed(d, bidi);
             }
         }
@@ -396,18 +399,18 @@ UChar BidiIterator::current() const
     return text->text()[pos];
 }
 
-ALWAYS_INLINE WTF::Unicode::Direction BidiIterator::direction() const
+ALWAYS_INLINE Direction BidiIterator::direction() const
 {
     if (!obj)
-        return WTF::Unicode::OtherNeutral;
+        return OtherNeutral;
     if (obj->isListMarker())
-        return obj->style()->direction() == LTR ? WTF::Unicode::LeftToRight : WTF::Unicode::RightToLeft;
+        return obj->style()->direction() == LTR ? LeftToRight : RightToLeft;
     if (!obj->isText())
-        return WTF::Unicode::OtherNeutral;
+        return OtherNeutral;
     RenderText* renderTxt = static_cast<RenderText*>(obj);
     if (pos >= renderTxt->stringLength())
-        return WTF::Unicode::OtherNeutral;
-    return WTF::Unicode::direction(renderTxt->text()[pos]);
+        return OtherNeutral;
+    return Unicode::direction(renderTxt->text()[pos]);
 }
 
 // -------------------------------------------------------------------------------------------------
@@ -620,44 +623,44 @@ static void appendRun(BidiState &bidi)
     
     bidi.eor.increment(bidi);
     bidi.sor = bidi.eor;
-    bidi.dir = WTF::Unicode::OtherNeutral;
-    bidi.status.eor = WTF::Unicode::OtherNeutral;
+    bidi.dir = OtherNeutral;
+    bidi.status.eor = OtherNeutral;
     bidi.adjustEmbedding = b;
 }
 
-static void embed(WTF::Unicode::Direction d, BidiState& bidi)
+static void embed(Direction d, BidiState& bidi)
 {
     bool b = bidi.adjustEmbedding;
     bidi.adjustEmbedding = false;
-    if (d == WTF::Unicode::PopDirectionalFormat) {
+    if (d == PopDirectionalFormat) {
         BidiContext *c = bidi.context->parent;
         if (c) {
             if (!emptyRun && bidi.eor != bidi.last) {
-                assert(bidi.status.eor != WTF::Unicode::OtherNeutral);
+                assert(bidi.status.eor != 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 == 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)
+                assert(bidi.status.last == EuropeanNumberSeparator
+                    || bidi.status.last == EuropeanNumberTerminator
+                    || bidi.status.last == CommonNumberSeparator
+                    || bidi.status.last == BoundaryNeutral
+                    || bidi.status.last == BlockSeparator
+                    || bidi.status.last == SegmentSeparator
+                    || bidi.status.last == WhiteSpaceNeutral
+                    || bidi.status.last == OtherNeutral);
+                if (bidi.dir == OtherNeutral)
                     bidi.dir = bidi.context->dir();
-                if (bidi.context->dir() == WTF::Unicode::LeftToRight) {
+                if (bidi.context->dir() == LeftToRight) {
                     // bidi.sor ... bidi.eor ... bidi.last L
-                    if (bidi.status.eor == WTF::Unicode::EuropeanNumber) {
-                        if (bidi.status.lastStrong != WTF::Unicode::LeftToRight) {
-                            bidi.dir = WTF::Unicode::EuropeanNumber;
+                    if (bidi.status.eor == EuropeanNumber) {
+                        if (bidi.status.lastStrong != LeftToRight) {
+                            bidi.dir = EuropeanNumber;
                             appendRun(bidi);
                         }
-                    } else if (bidi.status.eor == WTF::Unicode::ArabicNumber) {
-                        bidi.dir = WTF::Unicode::ArabicNumber;
+                    } else if (bidi.status.eor == ArabicNumber) {
+                        bidi.dir = ArabicNumber;
                         appendRun(bidi);
-                    } else if (bidi.status.eor != WTF::Unicode::LeftToRight)
+                    } else if (bidi.status.eor != LeftToRight)
                         appendRun(bidi);
-                } else if (bidi.status.eor != WTF::Unicode::RightToLeft && bidi.status.eor != WTF::Unicode::RightToLeftArabic)
+                } else if (bidi.status.eor != RightToLeft && bidi.status.eor != RightToLeftArabic)
                     appendRun(bidi);
                 bidi.eor = bidi.last;
             }
@@ -671,15 +674,15 @@ static void embed(WTF::Unicode::Direction d, BidiState& bidi)
             bidi.eor.obj = 0;
         }
     } else {
-        WTF::Unicode::Direction runDir;
-        if (d == WTF::Unicode::RightToLeftEmbedding || d == WTF::Unicode::RightToLeftOverride)
-            runDir = WTF::Unicode::RightToLeft;
+        Direction runDir;
+        if (d == RightToLeftEmbedding || d == RightToLeftOverride)
+            runDir = RightToLeft;
         else
-            runDir = WTF::Unicode::LeftToRight;
-        bool override = d == WTF::Unicode::LeftToRightOverride || d == WTF::Unicode::RightToLeftOverride;
+            runDir = LeftToRight;
+        bool override = d == LeftToRightOverride || d == RightToLeftOverride;
 
         unsigned char level = bidi.context->level;
-        if (runDir == WTF::Unicode::RightToLeft) {
+        if (runDir == RightToLeft) {
             if (level%2) // we have an odd level
                 level += 2;
             else
@@ -693,47 +696,47 @@ static void embed(WTF::Unicode::Direction d, BidiState& bidi)
 
         if (level < 61) {
             if (!emptyRun && bidi.eor != bidi.last) {
-                assert(bidi.status.eor != WTF::Unicode::OtherNeutral);
+                assert(bidi.status.eor != 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 == 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)
+                assert(bidi.status.last == EuropeanNumberSeparator
+                    || bidi.status.last == EuropeanNumberTerminator
+                    || bidi.status.last == CommonNumberSeparator
+                    || bidi.status.last == BoundaryNeutral
+                    || bidi.status.last == BlockSeparator
+                    || bidi.status.last == SegmentSeparator
+                    || bidi.status.last == WhiteSpaceNeutral
+                    || bidi.status.last == OtherNeutral);
+                if (bidi.dir == OtherNeutral)
                     bidi.dir = runDir;
-                if (runDir == WTF::Unicode::LeftToRight) {
+                if (runDir == LeftToRight) {
                     // bidi.sor ... bidi.eor ... bidi.last L
-                    if (bidi.status.eor == WTF::Unicode::EuropeanNumber) {
-                        if (bidi.status.lastStrong != WTF::Unicode::LeftToRight) {
-                            bidi.dir = WTF::Unicode::EuropeanNumber;
+                    if (bidi.status.eor == EuropeanNumber) {
+                        if (bidi.status.lastStrong != LeftToRight) {
+                            bidi.dir = EuropeanNumber;
                             appendRun(bidi);
-                            if (bidi.context->dir() != WTF::Unicode::LeftToRight)
-                                bidi.dir = WTF::Unicode::RightToLeft;
+                            if (bidi.context->dir() != LeftToRight)
+                                bidi.dir = RightToLeft;
                         }
-                    } else if (bidi.status.eor == WTF::Unicode::ArabicNumber) {
-                        bidi.dir = WTF::Unicode::ArabicNumber;
+                    } else if (bidi.status.eor == ArabicNumber) {
+                        bidi.dir = ArabicNumber;
                         appendRun(bidi);
-                        if (bidi.context->dir() != WTF::Unicode::LeftToRight) {
+                        if (bidi.context->dir() != LeftToRight) {
                             bidi.eor = bidi.last;
-                            bidi.dir = WTF::Unicode::RightToLeft;
+                            bidi.dir = RightToLeft;
                             appendRun(bidi);
                         }
-                    } else if (bidi.status.eor != WTF::Unicode::LeftToRight) {
-                        if (bidi.context->dir() == WTF::Unicode::LeftToRight || bidi.status.lastStrong == WTF::Unicode::LeftToRight)
+                    } else if (bidi.status.eor != LeftToRight) {
+                        if (bidi.context->dir() == LeftToRight || bidi.status.lastStrong == LeftToRight)
                             appendRun(bidi);
                         else
-                            bidi.dir = WTF::Unicode::RightToLeft;
+                            bidi.dir = RightToLeft;
                     }
-                } else if (bidi.status.eor != WTF::Unicode::RightToLeft && bidi.status.eor != WTF::Unicode::RightToLeftArabic) {
+                } else if (bidi.status.eor != RightToLeft && bidi.status.eor != RightToLeftArabic) {
                     // bidi.sor ... bidi.eor ... bidi.last R; bidi.eor=L/EN/AN; EN,AN behave like R (rule N1)
-                    if (bidi.context->dir() == WTF::Unicode::RightToLeft || bidi.status.lastStrong == WTF::Unicode::RightToLeft || bidi.status.lastStrong == WTF::Unicode::RightToLeftArabic)
+                    if (bidi.context->dir() == RightToLeft || bidi.status.lastStrong == RightToLeft || bidi.status.lastStrong == RightToLeftArabic)
                         appendRun(bidi);
                     else
-                        bidi.dir = WTF::Unicode::LeftToRight;
+                        bidi.dir = LeftToRight;
                 }
                 bidi.eor = bidi.last;
             }
@@ -1013,7 +1016,7 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
     sLastBidiRun = 0;
     sBidiRunCount = 0;
 
-    assert(bidi.dir == WTF::Unicode::OtherNeutral);
+    assert(bidi.dir == OtherNeutral);
 
     emptyRun = true;
 
@@ -1027,7 +1030,7 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
     BidiState stateAtEnd;
 
     while (true) {
-        WTF::Unicode::Direction dirCurrent;
+        Direction dirCurrent;
         if (pastEnd && (previousLineBrokeCleanly || bidi.current.atEnd())) {
             BidiContext *c = bidi.context.get();
             while (c->parent)
@@ -1044,75 +1047,75 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
         } else {
             dirCurrent = bidi.current.direction();
             if (bidi.context->override
-                    && dirCurrent != WTF::Unicode::RightToLeftEmbedding
-                    && dirCurrent != WTF::Unicode::LeftToRightEmbedding
-                    && dirCurrent != WTF::Unicode::RightToLeftOverride
-                    && dirCurrent != WTF::Unicode::LeftToRightOverride
-                    && dirCurrent != WTF::Unicode::PopDirectionalFormat)
+                    && dirCurrent != RightToLeftEmbedding
+                    && dirCurrent != LeftToRightEmbedding
+                    && dirCurrent != RightToLeftOverride
+                    && dirCurrent != LeftToRightOverride
+                    && dirCurrent != PopDirectionalFormat)
                 dirCurrent = bidi.context->dir();
-            else if (dirCurrent == WTF::Unicode::NonSpacingMark)
+            else if (dirCurrent == NonSpacingMark)
                 dirCurrent = bidi.status.last;
         }
 
-        assert(bidi.status.eor != WTF::Unicode::OtherNeutral);
+        assert(bidi.status.eor != OtherNeutral);
         switch (dirCurrent) {
 
         // embedding and overrides (X1-X9 in the Bidi specs)
-        case WTF::Unicode::RightToLeftEmbedding:
-        case WTF::Unicode::LeftToRightEmbedding:
-        case WTF::Unicode::RightToLeftOverride:
-        case WTF::Unicode::LeftToRightOverride:
-        case WTF::Unicode::PopDirectionalFormat:
+        case RightToLeftEmbedding:
+        case LeftToRightEmbedding:
+        case RightToLeftOverride:
+        case LeftToRightOverride:
+        case PopDirectionalFormat:
             embed(dirCurrent, bidi);
             break;
 
             // strong types
-        case WTF::Unicode::LeftToRight:
+        case LeftToRight:
             switch(bidi.status.last) {
-                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)
+                case RightToLeft:
+                case RightToLeftArabic:
+                case EuropeanNumber:
+                case ArabicNumber:
+                    if (bidi.status.last != EuropeanNumber || bidi.status.lastStrong != LeftToRight)
                         appendRun(bidi);
                     break;
-                case WTF::Unicode::LeftToRight:
+                case LeftToRight:
                     break;
-                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) {
+                case EuropeanNumberSeparator:
+                case EuropeanNumberTerminator:
+                case CommonNumberSeparator:
+                case BoundaryNeutral:
+                case BlockSeparator:
+                case SegmentSeparator:
+                case WhiteSpaceNeutral:
+                case OtherNeutral:
+                    if (bidi.status.eor == EuropeanNumber) {
+                        if (bidi.status.lastStrong != LeftToRight) {
                             // the numbers need to be on a higher embedding level, so let's close that run
-                            bidi.dir = WTF::Unicode::EuropeanNumber;
+                            bidi.dir = EuropeanNumber;
                             appendRun(bidi);
-                            if (bidi.context->dir() != WTF::Unicode::LeftToRight) {
+                            if (bidi.context->dir() != LeftToRight) {
                                 // the neutrals take the embedding direction, which is R
                                 bidi.eor = bidi.last;
-                                bidi.dir = WTF::Unicode::RightToLeft;
+                                bidi.dir = RightToLeft;
                                 appendRun(bidi);
                             }
                         }
-                    } else if (bidi.status.eor == WTF::Unicode::ArabicNumber) {
+                    } else if (bidi.status.eor == ArabicNumber) {
                         // Arabic numbers are always on a higher embedding level, so let's close that run
-                        bidi.dir = WTF::Unicode::ArabicNumber;
+                        bidi.dir = ArabicNumber;
                         appendRun(bidi);
-                        if (bidi.context->dir() != WTF::Unicode::LeftToRight) {
+                        if (bidi.context->dir() != LeftToRight) {
                             // the neutrals take the embedding direction, which is R
                             bidi.eor = bidi.last;
-                            bidi.dir = WTF::Unicode::RightToLeft;
+                            bidi.dir = RightToLeft;
                             appendRun(bidi);
                         }
-                    } else if(bidi.status.eor != WTF::Unicode::LeftToRight) {
+                    } else if(bidi.status.eor != LeftToRight) {
                         //last stuff takes embedding dir
-                        if (bidi.context->dir() != WTF::Unicode::LeftToRight && bidi.status.lastStrong != WTF::Unicode::LeftToRight) {
+                        if (bidi.context->dir() != LeftToRight && bidi.status.lastStrong != LeftToRight) {
                             bidi.eor = bidi.last; 
-                            bidi.dir = WTF::Unicode::RightToLeft;
+                            bidi.dir = RightToLeft;
                         }
                         appendRun(bidi); 
                     }
@@ -1120,34 +1123,34 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
                     break;
             }
             bidi.eor = bidi.current;
-            bidi.status.eor = WTF::Unicode::LeftToRight;
-            bidi.status.lastStrong = WTF::Unicode::LeftToRight;
-            bidi.dir = WTF::Unicode::LeftToRight;
+            bidi.status.eor = LeftToRight;
+            bidi.status.lastStrong = LeftToRight;
+            bidi.dir = LeftToRight;
             break;
-        case WTF::Unicode::RightToLeftArabic:
-        case WTF::Unicode::RightToLeft:
+        case RightToLeftArabic:
+        case RightToLeft:
             switch (bidi.status.last) {
-                case WTF::Unicode::LeftToRight:
-                case WTF::Unicode::EuropeanNumber:
-                case WTF::Unicode::ArabicNumber:
+                case LeftToRight:
+                case EuropeanNumber:
+                case ArabicNumber:
                     appendRun(bidi);
-                case WTF::Unicode::RightToLeft:
-                case WTF::Unicode::RightToLeftArabic:
+                case RightToLeft:
+                case RightToLeftArabic:
                     break;
-                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) {
+                case EuropeanNumberSeparator:
+                case EuropeanNumberTerminator:
+                case CommonNumberSeparator:
+                case BoundaryNeutral:
+                case BlockSeparator:
+                case SegmentSeparator:
+                case WhiteSpaceNeutral:
+                case OtherNeutral:
+                    if (bidi.status.eor != RightToLeft && bidi.status.eor != RightToLeftArabic) {
                         //last stuff takes embedding dir
-                        if (bidi.context->dir() != WTF::Unicode::RightToLeft && bidi.status.lastStrong != WTF::Unicode::RightToLeft
-                            && bidi.status.lastStrong != WTF::Unicode::RightToLeftArabic) {
+                        if (bidi.context->dir() != RightToLeft && bidi.status.lastStrong != RightToLeft
+                            && bidi.status.lastStrong != RightToLeftArabic) {
                             bidi.eor = bidi.last;
-                            bidi.dir = WTF::Unicode::LeftToRight;
+                            bidi.dir = LeftToRight;
                         }
                         appendRun(bidi);
                     }
@@ -1155,99 +1158,99 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
                     break;
             }
             bidi.eor = bidi.current;
-            bidi.status.eor = WTF::Unicode::RightToLeft;
+            bidi.status.eor = RightToLeft;
             bidi.status.lastStrong = dirCurrent;
-            bidi.dir = WTF::Unicode::RightToLeft;
+            bidi.dir = RightToLeft;
             break;
 
             // weak types:
 
-        case WTF::Unicode::EuropeanNumber:
-            if (bidi.status.lastStrong != WTF::Unicode::RightToLeftArabic) {
+        case EuropeanNumber:
+            if (bidi.status.lastStrong != RightToLeftArabic) {
                 // if last strong was AL change EN to AN
                 switch (bidi.status.last) {
-                    case WTF::Unicode::EuropeanNumber:
-                    case WTF::Unicode::LeftToRight:
+                    case EuropeanNumber:
+                    case LeftToRight:
                         break;
-                    case WTF::Unicode::RightToLeft:
-                    case WTF::Unicode::RightToLeftArabic:
-                    case WTF::Unicode::ArabicNumber:
+                    case RightToLeft:
+                    case RightToLeftArabic:
+                    case ArabicNumber:
                         bidi.eor = bidi.last;
                         appendRun(bidi);
-                        bidi.dir = WTF::Unicode::EuropeanNumber;
+                        bidi.dir = EuropeanNumber;
                         break;
-                    case WTF::Unicode::EuropeanNumberSeparator:
-                    case WTF::Unicode::CommonNumberSeparator:
-                        if (bidi.status.eor == WTF::Unicode::EuropeanNumber)
+                    case EuropeanNumberSeparator:
+                    case CommonNumberSeparator:
+                        if (bidi.status.eor == EuropeanNumber)
                             break;
-                    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) {
+                    case EuropeanNumberTerminator:
+                    case BoundaryNeutral:
+                    case BlockSeparator:
+                    case SegmentSeparator:
+                    case WhiteSpaceNeutral:
+                    case OtherNeutral:
+                        if (bidi.status.eor == RightToLeft) {
                             // neutrals go to R
-                            bidi.eor = bidi.status.last == WTF::Unicode::EuropeanNumberTerminator ? bidi.lastBeforeET : bidi.last;
+                            bidi.eor = bidi.status.last == EuropeanNumberTerminator ? bidi.lastBeforeET : bidi.last;
                             appendRun(bidi);
-                            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) {
+                            bidi.dir = EuropeanNumber;
+                        } else if (bidi.status.eor != LeftToRight &&
+                                 (bidi.status.eor != EuropeanNumber || bidi.status.lastStrong != LeftToRight) &&
+                                 bidi.dir != LeftToRight) {
                             // numbers on both sides, neutrals get right to left direction
                             appendRun(bidi);
-                            bidi.eor = bidi.status.last == WTF::Unicode::EuropeanNumberTerminator ? bidi.lastBeforeET : bidi.last;
-                            bidi.dir = WTF::Unicode::RightToLeft;
+                            bidi.eor = bidi.status.last == EuropeanNumberTerminator ? bidi.lastBeforeET : bidi.last;
+                            bidi.dir = RightToLeft;
                             appendRun(bidi);
-                            bidi.dir = WTF::Unicode::EuropeanNumber;
+                            bidi.dir = EuropeanNumber;
                         }
                     default:
                         break;
                 }
                 bidi.eor = bidi.current;
-                bidi.status.eor = WTF::Unicode::EuropeanNumber;
-                if (bidi.dir == WTF::Unicode::OtherNeutral)
-                    bidi.dir = WTF::Unicode::LeftToRight;
+                bidi.status.eor = EuropeanNumber;
+                if (bidi.dir == OtherNeutral)
+                    bidi.dir = LeftToRight;
                 break;
             }
-        case WTF::Unicode::ArabicNumber:
-            dirCurrent = WTF::Unicode::ArabicNumber;
+        case ArabicNumber:
+            dirCurrent = ArabicNumber;
             switch (bidi.status.last) {
-                case WTF::Unicode::LeftToRight:
-                    if (bidi.context->dir() == WTF::Unicode::LeftToRight)
+                case LeftToRight:
+                    if (bidi.context->dir() == LeftToRight)
                         appendRun(bidi);
                     break;
-                case WTF::Unicode::ArabicNumber:
+                case ArabicNumber:
                     break;
-                case WTF::Unicode::RightToLeft:
-                case WTF::Unicode::RightToLeftArabic:
-                case WTF::Unicode::EuropeanNumber:
+                case RightToLeft:
+                case RightToLeftArabic:
+                case EuropeanNumber:
                     bidi.eor = bidi.last;
                     appendRun(bidi);
                     break;
-                case WTF::Unicode::CommonNumberSeparator:
-                    if (bidi.status.eor == WTF::Unicode::ArabicNumber)
+                case CommonNumberSeparator:
+                    if (bidi.status.eor == ArabicNumber)
                         break;
-                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) {
+                case EuropeanNumberSeparator:
+                case EuropeanNumberTerminator:
+                case BoundaryNeutral:
+                case BlockSeparator:
+                case SegmentSeparator:
+                case WhiteSpaceNeutral:
+                case OtherNeutral:
+                    if (bidi.status.eor != RightToLeft && bidi.status.eor != RightToLeftArabic) {
                         // run of L before neutrals, neutrals take embedding dir (N2)
-                        if (bidi.context->dir() == WTF::Unicode::RightToLeft || bidi.status.lastStrong == WTF::Unicode::RightToLeft
-                            || bidi.status.lastStrong == WTF::Unicode::RightToLeftArabic) {
+                        if (bidi.context->dir() == RightToLeft || bidi.status.lastStrong == RightToLeft
+                            || bidi.status.lastStrong == RightToLeftArabic) {
                             // the embedding direction is R
                             // close the L run
                             appendRun(bidi);
                             // neutrals become an R run
-                            bidi.dir = WTF::Unicode::RightToLeft;
+                            bidi.dir = RightToLeft;
                         } else {
                             // the embedding direction is L
                             // append neutrals to the L run and close it
-                            bidi.dir = WTF::Unicode::LeftToRight;
+                            bidi.dir = LeftToRight;
                         }
                     }
                     bidi.eor = bidi.last;
@@ -1256,37 +1259,37 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
                     break;
             }
             bidi.eor = bidi.current;
-            bidi.status.eor = WTF::Unicode::ArabicNumber;
-            if (bidi.dir == WTF::Unicode::OtherNeutral)
-                bidi.dir = WTF::Unicode::ArabicNumber;
+            bidi.status.eor = ArabicNumber;
+            if (bidi.dir == OtherNeutral)
+                bidi.dir = ArabicNumber;
             break;
-        case WTF::Unicode::EuropeanNumberSeparator:
-        case WTF::Unicode::CommonNumberSeparator:
+        case EuropeanNumberSeparator:
+        case CommonNumberSeparator:
             break;
-        case WTF::Unicode::EuropeanNumberTerminator:
-            if (bidi.status.last == WTF::Unicode::EuropeanNumber) {
-                dirCurrent = WTF::Unicode::EuropeanNumber;
+        case EuropeanNumberTerminator:
+            if (bidi.status.last == EuropeanNumber) {
+                dirCurrent = EuropeanNumber;
                 bidi.eor = bidi.current;
                 bidi.status.eor = dirCurrent;
-            } else if (bidi.status.last != WTF::Unicode::EuropeanNumberTerminator)
+            } else if (bidi.status.last != EuropeanNumberTerminator)
                 bidi.lastBeforeET = emptyRun ? bidi.eor : bidi.last;
             break;
 
         // boundary neutrals should be ignored
-        case WTF::Unicode::BoundaryNeutral:
+        case BoundaryNeutral:
             if (bidi.eor == bidi.last)
                 bidi.eor = bidi.current;
             break;
             // neutrals
-        case WTF::Unicode::BlockSeparator:
+        case BlockSeparator:
             // ### what do we do with newline and paragraph seperators that come to here?
             break;
-        case WTF::Unicode::SegmentSeparator:
+        case SegmentSeparator:
             // ### implement rule L1
             break;
-        case WTF::Unicode::WhiteSpaceNeutral:
+        case WhiteSpaceNeutral:
             break;
-        case WTF::Unicode::OtherNeutral:
+        case OtherNeutral:
             break;
         default:
             break;
@@ -1297,13 +1300,13 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
                 if (!bidi.reachedEndOfLine) {
                     bidi.eor = bidi.endOfLine;
                     switch (bidi.status.eor) {
-                        case WTF::Unicode::LeftToRight:
-                        case WTF::Unicode::RightToLeft:
-                        case WTF::Unicode::ArabicNumber:
+                        case LeftToRight:
+                        case RightToLeft:
+                        case ArabicNumber:
                             bidi.dir = bidi.status.eor;
                             break;
-                        case WTF::Unicode::EuropeanNumber:
-                            bidi.dir = bidi.status.lastStrong == WTF::Unicode::LeftToRight ? WTF::Unicode::LeftToRight : WTF::Unicode::EuropeanNumber;
+                        case EuropeanNumber:
+                            bidi.dir = bidi.status.lastStrong == LeftToRight ? LeftToRight : EuropeanNumber;
                             break;
                         default:
                             assert(false);
@@ -1311,44 +1314,44 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
                     appendRun(bidi);
                 }
                 bidi = stateAtEnd;
-                bidi.dir = WTF::Unicode::OtherNeutral;
+                bidi.dir = OtherNeutral;
                 break;
             }
         }
 
         // set status.last as needed.
         switch (dirCurrent) {
-            case WTF::Unicode::EuropeanNumberTerminator:
-                if (bidi.status.last != WTF::Unicode::EuropeanNumber)
-                    bidi.status.last = WTF::Unicode::EuropeanNumberTerminator;
+            case EuropeanNumberTerminator:
+                if (bidi.status.last != EuropeanNumber)
+                    bidi.status.last = EuropeanNumberTerminator;
                 break;
-            case WTF::Unicode::EuropeanNumberSeparator:
-            case WTF::Unicode::CommonNumberSeparator:
-            case WTF::Unicode::SegmentSeparator:
-            case WTF::Unicode::WhiteSpaceNeutral:
-            case WTF::Unicode::OtherNeutral:
+            case EuropeanNumberSeparator:
+            case CommonNumberSeparator:
+            case SegmentSeparator:
+            case WhiteSpaceNeutral:
+            case OtherNeutral:
                 switch(bidi.status.last) {
-                    case WTF::Unicode::LeftToRight:
-                    case WTF::Unicode::RightToLeft:
-                    case WTF::Unicode::RightToLeftArabic:
-                    case WTF::Unicode::EuropeanNumber:
-                    case WTF::Unicode::ArabicNumber:
+                    case LeftToRight:
+                    case RightToLeft:
+                    case RightToLeftArabic:
+                    case EuropeanNumber:
+                    case ArabicNumber:
                         bidi.status.last = dirCurrent;
                         break;
                     default:
-                        bidi.status.last = WTF::Unicode::OtherNeutral;
+                        bidi.status.last = OtherNeutral;
                     }
                 break;
-            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:
+            case NonSpacingMark:
+            case BoundaryNeutral:
+            case RightToLeftEmbedding:
+            case LeftToRightEmbedding:
+            case RightToLeftOverride:
+            case LeftToRightOverride:
+            case PopDirectionalFormat:
                 // ignore these
                 break;
-            case WTF::Unicode::EuropeanNumber:
+            case EuropeanNumber:
                 // fall through
             default:
                 bidi.status.last = dirCurrent;
@@ -1356,11 +1359,11 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
 
         bidi.last = bidi.current;
 
-        if (emptyRun && !(dirCurrent == WTF::Unicode::RightToLeftEmbedding
-                || dirCurrent == WTF::Unicode::LeftToRightEmbedding
-                || dirCurrent == WTF::Unicode::RightToLeftOverride
-                || dirCurrent == WTF::Unicode::LeftToRightOverride
-                || dirCurrent == WTF::Unicode::PopDirectionalFormat)) {
+        if (emptyRun && !(dirCurrent == RightToLeftEmbedding
+                || dirCurrent == LeftToRightEmbedding
+                || dirCurrent == RightToLeftOverride
+                || dirCurrent == LeftToRightOverride
+                || dirCurrent == PopDirectionalFormat)) {
             bidi.sor = bidi.current;
             emptyRun = false;
         }
@@ -1370,11 +1373,11 @@ void RenderBlock::bidiReorderLine(const BidiIterator& start, const BidiIterator&
         bidi.adjustEmbedding = true;
         bidi.current.increment(bidi);
         bidi.adjustEmbedding = false;
-        if (emptyRun && (dirCurrent == WTF::Unicode::RightToLeftEmbedding
-                || dirCurrent == WTF::Unicode::LeftToRightEmbedding
-                || dirCurrent == WTF::Unicode::RightToLeftOverride
-                || dirCurrent == WTF::Unicode::LeftToRightOverride
-                || dirCurrent == WTF::Unicode::PopDirectionalFormat)) {
+        if (emptyRun && (dirCurrent == RightToLeftEmbedding
+                || dirCurrent == LeftToRightEmbedding
+                || dirCurrent == RightToLeftOverride
+                || dirCurrent == LeftToRightOverride
+                || dirCurrent == 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;
@@ -1557,18 +1560,18 @@ IntRect RenderBlock::layoutInlineChildren(bool relayoutChildren)
 
         BidiContext *startEmbed;
         if (style()->direction() == LTR) {
-            startEmbed = new BidiContext( 0, WTF::Unicode::LeftToRight, NULL, style()->unicodeBidi() == Override );
-            bidi.status.eor = WTF::Unicode::LeftToRight;
+            startEmbed = new BidiContext(0, LeftToRight, NULL, style()->unicodeBidi() == Override);
+            bidi.status.eor = LeftToRight;
         } else {
-            startEmbed = new BidiContext( 1, WTF::Unicode::RightToLeft, NULL, style()->unicodeBidi() == Override );
-            bidi.status.eor = WTF::Unicode::RightToLeft;
+            startEmbed = new BidiContext(1, RightToLeft, NULL, style()->unicodeBidi() == Override);
+            bidi.status.eor = RightToLeft;
         }
 
         bidi.status.lastStrong = startEmbed->dir();
         bidi.status.last = startEmbed->dir();
         bidi.status.eor = startEmbed->dir();
         bidi.context = startEmbed;
-        bidi.dir = WTF::Unicode::OtherNeutral;
+        bidi.dir = OtherNeutral;
         
         if (!smidpoints)
             smidpoints = new Vector<BidiIterator>();
@@ -1890,11 +1893,9 @@ bool RenderBlock::matchedEndLine(const BidiIterator& start, const BidiStatus& st
     return false;
 }
 
-static const unsigned short nonBreakingSpace = 0xa0;
-
 static inline bool skipNonBreakingSpace(BidiIterator &it)
 {
-    if (it.obj->style()->nbspMode() != SPACE || it.current() != nonBreakingSpace)
+    if (it.obj->style()->nbspMode() != SPACE || it.current() != noBreakSpace)
         return false;
  
     // FIXME: This is bad.  It makes nbsp inconsistent with space and won't work correctly
@@ -2201,7 +2202,7 @@ BidiIterator RenderBlock::findNextLineBreak(BidiIterator &start, BidiState &bidi
                 // FIXME: This check looks suspicious. Why does w have to be 0?  
                 bool breakWords = o->style()->wordWrap() == BREAK_WORD && ((allowBreak && w == 0) || o->style()->whiteSpace() == PRE);
 
-                currentCharacterIsWS = currentCharacterIsSpace || (breakNBSP && c == nonBreakingSpace);
+                currentCharacterIsWS = currentCharacterIsSpace || (breakNBSP && c == noBreakSpace);
 
                 if (breakWords)
                     wrapW += t->width(pos, 1, f, w+wrapW);
index 83d7991e78315feda41b550b92116e1c9ed7fd6a..fdbc351419b25b691f1301438255bb3c55d9c328 100644 (file)
@@ -21,6 +21,7 @@
 #include "config.h"
 #include "break_lines.h"
 
+#include "CharacterNames.h"
 #include "TextBreakIterator.h"
 
 #if PLATFORM(MAC)
@@ -29,9 +30,6 @@
 
 namespace WebCore {
 
-const UChar noBreakSpace = 0x00A0;
-const UChar softHyphen = 0x00AD;
-
 static inline bool isBreakableSpace(UChar ch, bool treatNoBreakSpaceAsBreak)
 {
     switch (ch) {
index 5149160a135f2886bad8cefd6a7b48dbd828e8cc..6634a2b2bde809c7f0ad22ace0d8748952c2f926 100644 (file)
@@ -23,7 +23,7 @@
 #ifndef break_lines_h
 #define break_lines_h
 
-#include "wtf/unicode/Unicode.h"
+#include <wtf/unicode/Unicode.h>
 
 namespace WebCore {
 
index e99cac603da11adaf46e5470fe4dd4bc44ab0ce4..bc2c5af5371f3b174afc5400d993f4d86eb43eb8 100644 (file)
@@ -37,6 +37,9 @@
 
 int xpathyyparse(void*);
 
+using namespace WTF;
+using namespace Unicode;
+
 namespace WebCore {
 namespace XPath {
 
@@ -57,18 +60,10 @@ static XMLCat charCat(UChar aChar)
 
     if (aChar == '.' || aChar == '-')
         return NameCont;
-    unsigned category = WTF::Unicode::category(aChar);
-    if (category & (WTF::Unicode::Letter_Uppercase|
-                    WTF::Unicode::Letter_Lowercase|
-                    WTF::Unicode::Letter_Other|
-                    WTF::Unicode::Letter_Titlecase|
-                    WTF::Unicode::Number_Letter))
+    CharCategory category = Unicode::category(aChar);
+    if (category & (Letter_Uppercase | Letter_Lowercase | Letter_Other | Letter_Titlecase | Number_Letter))
         return NameStart;
-    if (category & (WTF::Unicode::Mark_NonSpacing|
-                    WTF::Unicode::Mark_SpacingCombining|
-                    WTF::Unicode::Mark_Enclosing|
-                    WTF::Unicode::Letter_Modifier|
-                    WTF::Unicode::Number_DecimalDigit))
+    if (category & (Mark_NonSpacing | Mark_SpacingCombining | Mark_Enclosing | Letter_Modifier | Number_DecimalDigit))
         return NameCont;
     return NotPartOfName;
 }