Changeset 18098 in webkit
- Timestamp:
- Dec 8, 2006 9:54:29 PM (17 years ago)
- Location:
- trunk
- Files:
-
- 13 added
- 5 deleted
- 42 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/ChangeLog
r18093 r18098 1 2006-12-08 David Hyatt <hyatt@apple.com> 2 3 Land the new ICU abstraction layer. Patch by Lars. 4 5 Reviewed by me 6 7 * JavaScriptCore.xcodeproj/project.pbxproj: 8 * wtf/Platform.h: 9 * wtf/unicode/UnicodeCategory.h: Removed. 10 * wtf/unicode/UnicodeDecomposition.h: Removed. 11 * wtf/unicode/UnicodeDirection.h: Removed. 12 * wtf/unicode/icu/UnicodeIcu.h: 13 (WTF::Unicode::): 14 (WTF::Unicode::foldCase): 15 (WTF::Unicode::toLower): 16 (WTF::Unicode::toUpper): 17 (WTF::Unicode::toTitleCase): 18 (WTF::Unicode::isDigit): 19 (WTF::Unicode::isSpace): 20 (WTF::Unicode::isPunct): 21 (WTF::Unicode::mirroredChar): 22 (WTF::Unicode::category): 23 (WTF::Unicode::direction): 24 (WTF::Unicode::isLower): 25 (WTF::Unicode::isUpper): 26 (WTF::Unicode::digitValue): 27 (WTF::Unicode::combiningClass): 28 (WTF::Unicode::decompositionType): 29 (WTF::Unicode::strcasecmp): 30 (WTF::Unicode::memset): 31 * wtf/unicode/qt4/UnicodeQt4.cpp: Removed. 32 * wtf/unicode/qt4/UnicodeQt4.h: 33 (WTF::Unicode::): 34 (WTF::Unicode::toLower): 35 (WTF::Unicode::toUpper): 36 (WTF::Unicode::toTitleCase): 37 (WTF::Unicode::foldCase): 38 (WTF::Unicode::isPrintableChar): 39 (WTF::Unicode::isLower): 40 (WTF::Unicode::isUpper): 41 (WTF::Unicode::digitValue): 42 (WTF::Unicode::combiningClass): 43 (WTF::Unicode::decompositionType): 44 (WTF::Unicode::strcasecmp): 45 (WTF::Unicode::memset): 46 (WTF::Unicode::direction): 47 (WTF::Unicode::category): 48 1 49 === Safari-521.32 === 2 50 -
trunk/JavaScriptCore/JavaScriptCore.xcodeproj/project.pbxproj
r17787 r18098 263 263 D212022A0AD4310D00ED79B6 /* DateMath.cpp in Sources */ = {isa = PBXBuildFile; fileRef = D21202280AD4310C00ED79B6 /* DateMath.cpp */; }; 264 264 D212022B0AD4310D00ED79B6 /* DateMath.h in Headers */ = {isa = PBXBuildFile; fileRef = D21202290AD4310C00ED79B6 /* DateMath.h */; }; 265 E195679609E7CF1200B89D13 /* UnicodeIcu.h in Headers */ = {isa = PBXBuildFile; fileRef = E195678F09E7CF1200B89D13 /* UnicodeIcu.h */; }; 266 E195679809E7CF1200B89D13 /* Unicode.h in Headers */ = {isa = PBXBuildFile; fileRef = E195679409E7CF1200B89D13 /* Unicode.h */; }; 267 E195679909E7CF1200B89D13 /* UnicodeCategory.h in Headers */ = {isa = PBXBuildFile; fileRef = E195679509E7CF1200B89D13 /* UnicodeCategory.h */; }; 265 E195679609E7CF1200B89D13 /* UnicodeIcu.h in Headers */ = {isa = PBXBuildFile; fileRef = E195678F09E7CF1200B89D13 /* UnicodeIcu.h */; settings = {ATTRIBUTES = (Private, ); }; }; 266 E195679809E7CF1200B89D13 /* Unicode.h in Headers */ = {isa = PBXBuildFile; fileRef = E195679409E7CF1200B89D13 /* Unicode.h */; settings = {ATTRIBUTES = (Private, ); }; }; 268 267 /* End PBXBuildFile section */ 269 268 … … 286 285 }; 287 286 /* End PBXBuildRule section */ 287 288 /* Begin PBXBuildStyle section */ 289 BC4C649B0B2A359400E57352 /* Development */ = { 290 isa = PBXBuildStyle; 291 buildSettings = { 292 COPY_PHASE_STRIP = NO; 293 }; 294 name = Development; 295 }; 296 BC4C649C0B2A359400E57352 /* Deployment */ = { 297 isa = PBXBuildStyle; 298 buildSettings = { 299 COPY_PHASE_STRIP = YES; 300 }; 301 name = Deployment; 302 }; 303 /* End PBXBuildStyle section */ 288 304 289 305 /* Begin PBXContainerItemProxy section */ … … 541 557 E195678F09E7CF1200B89D13 /* UnicodeIcu.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnicodeIcu.h; sourceTree = "<group>"; }; 542 558 E195679409E7CF1200B89D13 /* Unicode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Unicode.h; sourceTree = "<group>"; }; 543 E195679509E7CF1200B89D13 /* UnicodeCategory.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UnicodeCategory.h; sourceTree = "<group>"; };544 559 F5BB2BC5030F772101FCFE1D /* completion.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = completion.h; sourceTree = "<group>"; tabWidth = 8; }; 545 560 F5C290E60284F98E018635CA /* JavaScriptCorePrefix.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; name = JavaScriptCorePrefix.h; path = ../JavaScriptCorePrefix.h; sourceTree = "<group>"; tabWidth = 8; }; … … 993 1008 E195678E09E7CF1200B89D13 /* icu */, 994 1009 E195679409E7CF1200B89D13 /* Unicode.h */, 995 E195679509E7CF1200B89D13 /* UnicodeCategory.h */,996 1010 ); 997 1011 path = unicode; … … 1126 1140 E195679609E7CF1200B89D13 /* UnicodeIcu.h in Headers */, 1127 1141 E195679809E7CF1200B89D13 /* Unicode.h in Headers */, 1128 E195679909E7CF1200B89D13 /* UnicodeCategory.h in Headers */,1129 1142 935AF46C09E9D9DB00ACD1D8 /* Forward.h in Headers */, 1130 1143 935AF46E09E9D9DB00ACD1D8 /* UnusedParam.h in Headers */, … … 1255 1268 isa = PBXProject; 1256 1269 buildConfigurationList = 149C277108902AFE008A9EFC /* Build configuration list for PBXProject "JavaScriptCore" */; 1257 compatibilityVersion = "Xcode 2.4"; 1270 buildSettings = { 1271 }; 1272 buildStyles = ( 1273 BC4C649B0B2A359400E57352 /* Development */, 1274 BC4C649C0B2A359400E57352 /* Deployment */, 1275 ); 1258 1276 hasScannedForEncodings = 1; 1259 1277 mainGroup = 0867D691FE84028FC02AAC07 /* JavaScriptCore */; 1260 1278 productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; 1261 1279 projectDirPath = ""; 1262 projectRoot = "";1263 shouldCheckCompatibility = 1;1264 1280 targets = ( 1265 1281 932F5B3E0822A1C700736975 /* JavaScriptCore */, -
trunk/JavaScriptCore/wtf/Platform.h
r17722 r18098 177 177 178 178 /* for Unicode, KDE uses Qt, everything else uses ICU */ 179 #if PLATFORM(KDE) 180 /* FIXME: Not using Qt4 unicode for now! */ 181 #define WTF_USE_ICU_UNICODE 1 179 #if PLATFORM(KDE) || PLATFORM(QT) 180 #define WTF_USE_QT4_UNICODE 1 182 181 #elif PLATFORM(SYMBIAN) 183 182 #define WTF_USE_SYMBIAN_UNICODE 1 -
trunk/JavaScriptCore/wtf/unicode/icu/UnicodeIcu.h
r17372 r18098 27 27 #include <unicode/uchar.h> 28 28 #include <unicode/ustring.h> 29 30 #include "../UnicodeCategory.h" 29 #include <unicode/utf16.h> 30 31 #include <stdlib.h> 31 32 32 33 namespace WTF { 33 34 namespace Unicode { 35 36 enum Direction { 37 LeftToRight = U_LEFT_TO_RIGHT, 38 RightToLeft = U_RIGHT_TO_LEFT, 39 EuropeanNumber = U_EUROPEAN_NUMBER, 40 EuropeanNumberSeparator = U_EUROPEAN_NUMBER_SEPARATOR, 41 EuropeanNumberTerminator = U_EUROPEAN_NUMBER_TERMINATOR, 42 ArabicNumber = U_ARABIC_NUMBER, 43 CommonNumberSeparator = U_COMMON_NUMBER_SEPARATOR, 44 BlockSeparator = U_BLOCK_SEPARATOR, 45 SegmentSeparator = U_SEGMENT_SEPARATOR, 46 WhiteSpaceNeutral = U_WHITE_SPACE_NEUTRAL, 47 OtherNeutral = U_OTHER_NEUTRAL, 48 LeftToRightEmbedding = U_LEFT_TO_RIGHT_EMBEDDING, 49 LeftToRightOverride = U_LEFT_TO_RIGHT_OVERRIDE, 50 RightToLeftArabic = U_RIGHT_TO_LEFT_ARABIC, 51 RightToLeftEmbedding = U_RIGHT_TO_LEFT_EMBEDDING, 52 RightToLeftOverride = U_RIGHT_TO_LEFT_OVERRIDE, 53 PopDirectionalFormat = U_POP_DIRECTIONAL_FORMAT, 54 NonSpacingMark = U_DIR_NON_SPACING_MARK, 55 BoundaryNeutral = U_BOUNDARY_NEUTRAL 56 }; 57 58 enum DecompositionType { 59 DecompositionNone = U_DT_NONE, 60 DecompositionCanonical = U_DT_CANONICAL, 61 DecompositionCompat = U_DT_COMPAT, 62 DecompositionCircle = U_DT_CIRCLE, 63 DecompositionFinal = U_DT_FINAL, 64 DecompositionFont = U_DT_FONT, 65 DecompositionFraction = U_DT_FRACTION, 66 DecompositionInitial = U_DT_INITIAL, 67 DecompositionIsolated = U_DT_ISOLATED, 68 DecompositionMedial = U_DT_MEDIAL, 69 DecompositionNarrow = U_DT_NARROW, 70 DecompositionNoBreak = U_DT_NOBREAK, 71 DecompositionSmall = U_DT_SMALL, 72 DecompositionSquare = U_DT_SQUARE, 73 DecompositionSub = U_DT_SUB, 74 DecompositionSuper = U_DT_SUPER, 75 DecompositionVertical = U_DT_VERTICAL, 76 DecompositionWide = U_DT_WIDE, 77 }; 78 79 enum CharCategory { 80 NoCategory = 0, 81 Other_NotAssigned = U_MASK(U_GENERAL_OTHER_TYPES), 82 Letter_Uppercase = U_MASK(U_UPPERCASE_LETTER), 83 Letter_Lowercase = U_MASK(U_LOWERCASE_LETTER), 84 Letter_Titlecase = U_MASK(U_TITLECASE_LETTER), 85 Letter_Modifier = U_MASK(U_MODIFIER_LETTER), 86 Letter_Other = U_MASK(U_OTHER_LETTER), 87 88 Mark_NonSpacing = U_MASK(U_NON_SPACING_MARK), 89 Mark_Enclosing = U_MASK(U_ENCLOSING_MARK), 90 Mark_SpacingCombining = U_MASK(U_COMBINING_SPACING_MARK), 91 92 Number_DecimalDigit = U_MASK(U_DECIMAL_DIGIT_NUMBER), 93 Number_Letter = U_MASK(U_LETTER_NUMBER), 94 Number_Other = U_MASK(U_OTHER_NUMBER), 95 96 Separator_Space = U_MASK(U_SPACE_SEPARATOR), 97 Separator_Line = U_MASK(U_LINE_SEPARATOR), 98 Separator_Paragraph = U_MASK(U_PARAGRAPH_SEPARATOR), 99 100 Other_Control = U_MASK(U_CONTROL_CHAR), 101 Other_Format = U_MASK(U_FORMAT_CHAR), 102 Other_PrivateUse = U_MASK(U_PRIVATE_USE_CHAR), 103 Other_Surrogate = U_MASK(U_SURROGATE), 104 105 Punctuation_Dash = U_MASK(U_DASH_PUNCTUATION), 106 Punctuation_Open = U_MASK(U_START_PUNCTUATION), 107 Punctuation_Close = U_MASK(U_END_PUNCTUATION), 108 Punctuation_Connector = U_MASK(U_CONNECTOR_PUNCTUATION), 109 Punctuation_Other = U_MASK(U_OTHER_PUNCTUATION), 110 111 Symbol_Math = U_MASK(U_MATH_SYMBOL), 112 Symbol_Currency = U_MASK(U_CURRENCY_SYMBOL), 113 Symbol_Modifier = U_MASK(U_MODIFIER_SYMBOL), 114 Symbol_Other = U_MASK(U_OTHER_SYMBOL), 115 116 Punctuation_InitialQuote = U_MASK(U_INITIAL_PUNCTUATION), 117 Punctuation_FinalQuote = U_MASK(U_FINAL_PUNCTUATION) 118 }; 119 120 inline uint32_t foldCase(uint32_t c) 121 { 122 return u_foldCase(c, U_FOLD_CASE_DEFAULT); 123 } 124 125 inline int foldCase(UChar* result, int resultLength, UChar* src, int srcLength, bool* error) 126 { 127 UErrorCode status = U_ZERO_ERROR; 128 int32_t realLength = u_strFoldCase(result, resultLength, src, srcLength, U_FOLD_CASE_DEFAULT, &status); 129 *error = !(U_SUCCESS(status) && realLength < resultLength); 130 return realLength; 131 } 34 132 35 133 inline int toLower(uint16_t* str, int strLength, uint16_t*& destIfNeeded) … … 53 151 } 54 152 153 inline int toLower(UChar* result, int resultLength, UChar* src, int srcLength, bool* error) 154 { 155 UErrorCode status = U_ZERO_ERROR; 156 int32_t realLength = u_strToLower(result, resultLength, src, srcLength, "", &status); 157 *error = U_FAILURE(status); 158 return realLength; 159 } 160 161 inline int32_t toLower(int32_t c) 162 { 163 return u_tolower(c); 164 } 165 166 inline int32_t toUpper(int32_t c) 167 { 168 return u_toupper(c); 169 } 170 55 171 inline int toUpper(uint16_t* str, int strLength, uint16_t*& destIfNeeded) 56 172 { … … 73 189 } 74 190 191 inline int toUpper(UChar* result, int resultLength, UChar* src, int srcLength, bool* error) 192 { 193 UErrorCode status = U_ZERO_ERROR; 194 int32_t realLength = u_strToUpper(result, resultLength, src, srcLength, "", &status); 195 *error = U_FAILURE(status); 196 return realLength; 197 } 198 199 inline int toTitleCase (uint32_t c) 200 { 201 return u_totitle(c); 202 } 203 75 204 inline bool isFormatChar(int32_t c) 76 205 { … … 88 217 } 89 218 219 inline bool isDigit(int32_t c) 220 { 221 return u_isdigit(c); 222 } 223 224 inline bool isSpace(int32_t c) 225 { 226 return u_isspace(c); 227 } 228 229 inline bool isPunct(int32_t c) 230 { 231 return u_ispunct(c); 232 } 233 234 inline int32_t mirroredChar(int32_t c) 235 { 236 return u_charMirror(c); 237 } 238 90 239 inline CharCategory category(int32_t c) 91 240 { 92 switch (u_charType(c)) { 93 case U_NON_SPACING_MARK: 94 return Mark_NonSpacing; 95 case U_COMBINING_SPACING_MARK: 96 return Mark_SpacingCombining; 97 case U_ENCLOSING_MARK: 98 return Mark_Enclosing; 99 case U_DECIMAL_DIGIT_NUMBER: 100 return Number_DecimalDigit; 101 case U_LETTER_NUMBER: 102 return Number_Letter; 103 case U_OTHER_NUMBER: 104 return Number_Other; 105 case U_SPACE_SEPARATOR: 106 return Separator_Space; 107 case U_LINE_SEPARATOR: 108 return Separator_Line; 109 case U_PARAGRAPH_SEPARATOR: 110 return Separator_Paragraph; 111 case U_CONTROL_CHAR: 112 return Other_Control; 113 case U_FORMAT_CHAR: 114 return Other_Format; 115 case U_SURROGATE: 116 return Other_Surrogate; 117 case U_PRIVATE_USE_CHAR: 118 return Other_PrivateUse; 119 case U_GENERAL_OTHER_TYPES: 120 return Other_NotAssigned; 121 case U_UPPERCASE_LETTER: 122 return Letter_Uppercase; 123 case U_LOWERCASE_LETTER: 124 return Letter_Lowercase; 125 case U_TITLECASE_LETTER: 126 return Letter_Titlecase; 127 case U_MODIFIER_LETTER: 128 return Letter_Modifier; 129 case U_OTHER_LETTER: 130 return Letter_Other; 131 case U_CONNECTOR_PUNCTUATION: 132 return Punctuation_Connector; 133 case U_DASH_PUNCTUATION: 134 return Punctuation_Dash; 135 case U_START_PUNCTUATION: 136 return Punctuation_Open; 137 case U_END_PUNCTUATION: 138 return Punctuation_Close; 139 case U_INITIAL_PUNCTUATION: 140 return Punctuation_InitialQuote; 141 case U_FINAL_PUNCTUATION: 142 return Punctuation_FinalQuote; 143 case U_OTHER_PUNCTUATION: 144 return Punctuation_Other; 145 case U_MATH_SYMBOL: 146 return Symbol_Math; 147 case U_CURRENCY_SYMBOL: 148 return Symbol_Currency; 149 case U_MODIFIER_SYMBOL: 150 return Symbol_Modifier; 151 case U_OTHER_SYMBOL: 152 return Symbol_Other; 153 default: 154 return NoCategory; 241 return static_cast<CharCategory>(U_GET_GC_MASK(c)); 242 } 243 244 inline Direction direction(int c) { 245 return (Direction)u_charDirection(c); 246 } 247 248 inline bool isLower(int32_t c) 249 { 250 return u_islower(c); 251 } 252 253 inline bool isUpper(int32_t c) 254 { 255 return u_isUUppercase(c); 155 256 } 257 258 inline int digitValue(int32_t c) 259 { 260 return u_charDigitValue(c); 261 } 262 263 inline uint8_t combiningClass(UChar32 c) 264 { 265 return u_getCombiningClass(c); 266 } 267 268 inline DecompositionType decompositionType(UChar32 c) 269 { 270 return static_cast<DecompositionType>(u_getIntPropertyValue(c, UCHAR_DECOMPOSITION_TYPE)); 271 } 272 273 inline int strcasecmp(const UChar *a, const UChar *b, int len) 274 { 275 return u_memcasecmp(a, b, len, U_FOLD_CASE_DEFAULT); 276 } 277 278 inline void memset(UChar* dest, UChar ch, int32_t count) 279 { 280 u_memset(dest, ch, count); 156 281 } 157 282 } -
trunk/JavaScriptCore/wtf/unicode/qt4/UnicodeQt4.h
r15937 r18098 29 29 30 30 #include <config.h> 31 #include <kjs/ustring.h>32 33 #include "../UnicodeCategory.h"34 #include "../UnicodeDecomposition.h"35 #include "../UnicodeDirection.h"36 31 37 32 #include <stdint.h> 33 34 typedef uint16_t UChar; 35 typedef uint32_t UChar32; 36 37 // some defines from ICU needed one or two places 38 39 #define U16_IS_LEAD(c) (((c)&0xfffffc00)==0xd800) 40 #define U16_IS_TRAIL(c) (((c)&0xfffffc00)==0xdc00) 41 #define U16_SURROGATE_OFFSET ((0xd800<<10UL)+0xdc00-0x10000) 42 #define U16_GET_SUPPLEMENTARY(lead, trail) \ 43 (((UChar32)(lead)<<10UL)+(UChar32)(trail)-U16_SURROGATE_OFFSET) 44 45 #define U16_LEAD(supplementary) (UChar)(((supplementary)>>10)+0xd7c0) 46 #define U16_TRAIL(supplementary) (UChar)(((supplementary)&0x3ff)|0xdc00) 47 48 #define U_IS_SURROGATE(c) (((c)&0xfffff800)==0xd800) 49 #define U16_IS_SURROGATE(c) U_IS_SURROGATE(c) 50 #define U16_IS_SURROGATE_LEAD(c) (((c)&0x400)==0) 51 52 #define U16_NEXT(s, i, length, c) { \ 53 (c)=(s)[(i)++]; \ 54 if(U16_IS_LEAD(c)) { \ 55 uint16_t __c2; \ 56 if((i)<(length) && U16_IS_TRAIL(__c2=(s)[(i)])) { \ 57 ++(i); \ 58 (c)=U16_GET_SUPPLEMENTARY((c), __c2); \ 59 } \ 60 } \ 61 } 62 63 #define U_MASK(x) ((uint32_t)1<<(x)) 38 64 39 65 namespace WTF { 40 66 namespace Unicode { 67 68 enum Direction { 69 LeftToRight = QChar::DirL, 70 RightToLeft = QChar::DirR, 71 EuropeanNumber = QChar::DirEN, 72 EuropeanNumberSeparator = QChar::DirES, 73 EuropeanNumberTerminator = QChar::DirET, 74 ArabicNumber = QChar::DirAN, 75 CommonNumberSeparator = QChar::DirCS, 76 BlockSeparator = QChar::DirB, 77 SegmentSeparator = QChar::DirS, 78 WhiteSpaceNeutral = QChar::DirWS, 79 OtherNeutral = QChar::DirON, 80 LeftToRightEmbedding = QChar::DirLRE, 81 LeftToRightOverride = QChar::DirLRO, 82 RightToLeftArabic = QChar::DirAL, 83 RightToLeftEmbedding = QChar::DirRLE, 84 RightToLeftOverride = QChar::DirRLO, 85 PopDirectionalFormat = QChar::DirPDF, 86 NonSpacingMark = QChar::DirNSM, 87 BoundaryNeutral = QChar::DirBN 88 }; 89 90 enum DecompositionType { 91 DecompositionNone = QChar::NoDecomposition, 92 DecompositionCanonical = QChar::Canonical, 93 DecompositionCompat = QChar::Compat, 94 DecompositionCircle = QChar::Circle, 95 DecompositionFinal = QChar::Final, 96 DecompositionFont = QChar::Font, 97 DecompositionFraction = QChar::Fraction, 98 DecompositionInitial = QChar::Initial, 99 DecompositionIsolated = QChar::Isolated, 100 DecompositionMedial = QChar::Medial, 101 DecompositionNarrow = QChar::Narrow, 102 DecompositionNoBreak = QChar::NoBreak, 103 DecompositionSmall = QChar::Small, 104 DecompositionSquare = QChar::Square, 105 DecompositionSub = QChar::Sub, 106 DecompositionSuper = QChar::Super, 107 DecompositionVertical = QChar::Vertical, 108 DecompositionWide = QChar::Wide 109 }; 110 111 enum CharCategory { 112 NoCategory = 0, 113 Mark_NonSpacing = U_MASK(QChar::Mark_NonSpacing), 114 Mark_SpacingCombining = U_MASK(QChar::Mark_SpacingCombining), 115 Mark_Enclosing = U_MASK(QChar::Mark_Enclosing), 116 Number_DecimalDigit = U_MASK(QChar::Number_DecimalDigit), 117 Number_Letter = U_MASK(QChar::Number_Letter), 118 Number_Other = U_MASK(QChar::Number_Other), 119 Separator_Space = U_MASK(QChar::Separator_Space), 120 Separator_Line = U_MASK(QChar::Separator_Line), 121 Separator_Paragraph = U_MASK(QChar::Separator_Paragraph), 122 Other_Control = U_MASK(QChar::Other_Control), 123 Other_Format = U_MASK(QChar::Other_Format), 124 Other_Surrogate = U_MASK(QChar::Other_Surrogate), 125 Other_PrivateUse = U_MASK(QChar::Other_PrivateUse), 126 Other_NotAssigned = U_MASK(QChar::Other_NotAssigned), 127 Letter_Uppercase = U_MASK(QChar::Letter_Uppercase), 128 Letter_Lowercase = U_MASK(QChar::Letter_Lowercase), 129 Letter_Titlecase = U_MASK(QChar::Letter_Titlecase), 130 Letter_Modifier = U_MASK(QChar::Letter_Modifier), 131 Letter_Other = U_MASK(QChar::Letter_Other), 132 Punctuation_Connector = U_MASK(QChar::Punctuation_Connector), 133 Punctuation_Dash = U_MASK(QChar::Punctuation_Dash), 134 Punctuation_Open = U_MASK(QChar::Punctuation_Open), 135 Punctuation_Close = U_MASK(QChar::Punctuation_Close), 136 Punctuation_InitialQuote = U_MASK(QChar::Punctuation_InitialQuote), 137 Punctuation_FinalQuote = U_MASK(QChar::Punctuation_FinalQuote), 138 Punctuation_Other = U_MASK(QChar::Punctuation_Other), 139 Symbol_Math = U_MASK(QChar::Symbol_Math), 140 Symbol_Currency = U_MASK(QChar::Symbol_Currency), 141 Symbol_Modifier = U_MASK(QChar::Symbol_Modifier), 142 Symbol_Other = U_MASK(QChar::Symbol_Other), 143 }; 144 41 145 inline int toLower(uint16_t* str, int strLength, uint16_t*& destIfNeeded) 42 146 { … … 54 158 } 55 159 160 inline int toLower(UChar* result, int resultLength, UChar* src, int srcLength, bool* error) 161 { 162 *error = false; 163 if (resultLength < srcLength) { 164 *error = true; 165 return srcLength; 166 } 167 for (int i = 0; i < srcLength; ++i) 168 result[i] = QChar(src[i]).toLower().unicode(); 169 } 170 56 171 inline int toUpper(uint16_t* str, int strLength, uint16_t*& destIfNeeded) 57 172 { … … 69 184 } 70 185 186 inline int toUpper(UChar* result, int resultLength, UChar* src, int srcLength, bool* error) 187 { 188 *error = false; 189 if (resultLength < srcLength) { 190 *error = true; 191 return srcLength; 192 } 193 for (int i = 0; i < srcLength; ++i) 194 result[i] = QChar(src[i]).toUpper().unicode(); 195 } 196 197 inline int toTitleCase (uint32_t c) 198 { 199 if (c > 0xffff) 200 return c; 201 return QChar(c).toUpper().unicode(); 202 } 203 204 inline uint32_t foldCase(uint32_t c) 205 { 206 if (c > 0xffff) 207 return c; 208 return QChar(c).toLower().unicode(); 209 } 210 211 inline int foldCase(UChar* result, int resultLength, UChar* src, int srcLength, bool* error) 212 { 213 return toLower(result, resultLength, src, srcLength, error); 214 } 215 71 216 inline bool isFormatChar(int32_t c) 72 217 { … … 76 221 inline bool isPrintableChar(int32_t c) 77 222 { 78 return (c & 0xffff0000) == 0 && QChar((unsigned short)c).isPrint(); 223 return (c & 0xffff0000) == 0 && QChar((unsigned short)c).isPrint(); 79 224 } 80 225 … … 99 244 } 100 245 246 inline bool isLower(int32_t c) 247 { 248 return (c & 0xffff0000) == 0 && QChar((unsigned short)c).category() == QChar::Letter_Lowercase; 249 } 250 251 inline bool isUpper(int32_t c) 252 { 253 return (c & 0xffff0000) == 0 && QChar((unsigned short)c).category() == QChar::Letter_Uppercase; 254 } 255 256 inline int digitValue(int32_t c) 257 { 258 if (c > 0xffff) 259 return 0; 260 return QChar(c).digitValue(); 261 } 262 101 263 inline uint16_t mirroredChar(uint16_t c) 102 264 { … … 104 266 } 105 267 106 inline int compare(const KJS::UChar *a, const KJS::UChar *b, int len, bool caseSensitive = true) 107 { 108 const QString left(reinterpret_cast<const QChar *>(a), len); 109 const QString right(reinterpret_cast<const QChar *>(b), len); 110 return left.compare(right, caseSensitive ? Qt::CaseSensitive : Qt::CaseInsensitive); 111 } 112 113 Direction direction(int c); 114 115 CharCategory category(int c); 116 117 Decomposition decomposition(int c); 268 inline uint8_t combiningClass(UChar32 c) 269 { 270 if (c > 0xffff) 271 return 0; 272 return QChar((unsigned short)c).combiningClass(); 273 } 274 275 inline DecompositionType decompositionType(UChar32 c) 276 { 277 if (c > 0xffff) 278 return DecompositionNone; 279 return (DecompositionType)QChar(c).decompositionTag(); 280 } 281 282 283 inline int strcasecmp(const UChar *a, const UChar *b, int len) 284 { 285 for (int i = 0; i < len; ++i) { 286 QChar c1 = QChar(a[i]).toLower(); 287 QChar c2 = QChar(b[i]).toLower(); 288 if (c1 != c2) 289 return c1 < c2; 290 } 291 return 0; 292 } 293 294 inline void memset(UChar* dest, UChar ch, int32_t count) 295 { 296 UChar *end = dest + count; 297 while (dest < end) 298 *dest++ = ch; 299 } 300 301 inline Direction direction(int c) { 302 if (c > 0xffff) 303 return LeftToRight; 304 return (Direction)QChar(c).direction(); 305 } 306 307 inline CharCategory category(int c) { 308 if (c > 0xffff) 309 return (CharCategory) U_MASK(QChar::Letter_Other); 310 return (CharCategory) U_MASK(QChar(c).category()); 311 } 118 312 } 119 313 } -
trunk/WebCore/ChangeLog
r18097 r18098 1 2006-12-08 David Hyatt <hyatt@apple.com> 2 3 Land the new ICU abstraction layer (WTF::Unicode). Patch 4 by Lars with a couple of fixes thrown in by me. 5 6 Reviewed by hyatt 7 8 * ForwardingHeaders/wtf/icu/UnicodeIcu.h: Added. 9 * ForwardingHeaders/wtf/unicode/Unicode.h: Added. 10 * WebCore.xcodeproj/project.pbxproj: 11 * css/cssparser.cpp: 12 (WebCore::ParseString::lower): 13 * dom/Document.cpp: 14 (WebCore::isValidNameStart): 15 (WebCore::isValidNamePart): 16 * editing/TextIterator.cpp: 17 (WebCore::CircularSearchBuffer::append): 18 * html/HTMLFontElement.cpp: 19 (WebCore::parseFontSizeNumber): 20 * html/HTMLInputElement.cpp: 21 (WebCore::numGraphemeClusters): 22 (WebCore::numCharactersInGraphemeClusters): 23 * html/HTMLSelectElement.cpp: 24 (WebCore::stripLeadingWhiteSpace): 25 * page/Frame.h: 26 * platform/DeprecatedString.h: 27 (WebCore::DeprecatedChar::isSpace): 28 (WebCore::DeprecatedChar::lower): 29 (WebCore::DeprecatedChar::upper): 30 * platform/Font.cpp: 31 (WebCore::WidthIterator::advance): 32 (WebCore::WidthIterator::normalizeVoicingMarks): 33 * platform/FontCache.h: 34 * platform/FontData.h: 35 * platform/GlyphMap.cpp: 36 * platform/GlyphMap.h: 37 * platform/GlyphWidthMap.h: 38 * platform/KURL.cpp: 39 (WebCore::encodeHostname): 40 * platform/StringHash.h: 41 (WTF::): 42 * platform/StringImpl.cpp: 43 (WebCore::isSpace): 44 (WebCore::parseLength): 45 (WebCore::StringImpl::isLower): 46 (WebCore::StringImpl::lower): 47 (WebCore::StringImpl::upper): 48 (WebCore::StringImpl::secure): 49 (WebCore::StringImpl::foldCase): 50 (WebCore::StringImpl::capitalize): 51 (WebCore::StringImpl::toInt): 52 (WebCore::equalIgnoringCase): 53 (WebCore::StringImpl::find): 54 * platform/StringImpl.h: 55 * platform/TextBoundaries.h: 56 * platform/TextBreakIterator.h: Added. 57 (WebCore::): 58 * platform/TextBreakIteratorICU.cpp: Added. 59 (WebCore::wordBreakIterator): 60 (WebCore::characterBreakIterator): 61 (WebCore::textBreakFirst): 62 (WebCore::textBreakNext): 63 (WebCore::textBreakPreceding): 64 (WebCore::textBreakFollowing): 65 (WebCore::textBreakCurrent): 66 * platform/TextCodec.h: 67 * platform/TextCodecLatin1.cpp: 68 * platform/TextEncoding.cpp: 69 (WebCore::TextEncoding::encode): 70 * platform/TextEncoding.h: 71 * platform/TextEncodingRegistry.cpp: 72 (WebCore::buildTextEncodingNameMap): 73 (WebCore::buildTextCodecMap): 74 * platform/TextEncodingRegistry.h: 75 * platform/UChar.h: Removed. 76 * platform/graphics/GraphicsContext.h: 77 * platform/qt/GlyphMapQt.cpp: 78 * platform/qt/TextBreakIteratorQt.cpp: Added. 79 (WebCore::TextBreakIterator::following): 80 (WebCore::TextBreakIterator::preceding): 81 (WebCore::WordBreakIteratorQt::first): 82 (WebCore::WordBreakIteratorQt::next): 83 (WebCore::WordBreakIteratorQt::previous): 84 (WebCore::CharBreakIteratorQt::first): 85 (WebCore::CharBreakIteratorQt::next): 86 (WebCore::CharBreakIteratorQt::previous): 87 (WebCore::wordBreakIterator): 88 (WebCore::characterBreakIterator): 89 (WebCore::textBreakFirst): 90 (WebCore::textBreakNext): 91 (WebCore::textBreakPreceding): 92 (WebCore::textBreakFollowing): 93 (WebCore::textBreakCurrent): 94 * platform/qt/TextCodecQt.cpp: Added. 95 (WebCore::getAtomicName): 96 (WebCore::TextCodecQt::registerEncodingNames): 97 (WebCore::newTextCodecQt): 98 (WebCore::TextCodecQt::registerCodecs): 99 (WebCore::TextCodecQt::TextCodecQt): 100 (WebCore::TextCodecQt::~TextCodecQt): 101 (WebCore::TextCodecQt::decode): 102 (WebCore::TextCodecQt::encode): 103 * platform/qt/TextCodecQt.h: Added. 104 * rendering/RenderBlock.cpp: 105 (WebCore::RenderBlock::updateFirstLetter): 106 * rendering/RenderText.cpp: 107 (WebCore::RenderText::previousOffset): 108 (WebCore::RenderText::nextOffset): 109 (WebCore::RenderText::widthFromCache): 110 * rendering/RenderText.h: 111 * rendering/bidi.cpp: 112 (WebCore::BidiState::BidiState): 113 (WebCore::BidiContext::BidiContext): 114 (WebCore::bidiNext): 115 (WebCore::bidiFirst): 116 (WebCore::BidiIterator::direction): 117 (WebCore::appendRun): 118 (WebCore::embed): 119 (WebCore::RenderBlock::computeHorizontalPositionsForLine): 120 (WebCore::RenderBlock::bidiReorderLine): 121 (WebCore::RenderBlock::layoutInlineChildren): 122 * rendering/bidi.h: 123 (WebCore::BidiStatus::BidiStatus): 124 (WebCore::BidiContext::dir): 125 (WebCore::BidiContext::basicDir): 126 (WebCore::BidiRun::BidiRun): 127 * rendering/break_lines.h: 128 1 129 2006-12-08 Adam Roben <aroben@apple.com> 2 130 -
trunk/WebCore/WebCore.xcodeproj/project.pbxproj
r18093 r18098 1502 1502 93B70D7609EB0C7C009D8468 /* kjs_window.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B70D5A09EB0C7C009D8468 /* kjs_window.h */; }; 1503 1503 93B77A380ADD792500EA4B81 /* FrameLoaderTypes.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B77A370ADD792500EA4B81 /* FrameLoaderTypes.h */; settings = {ATTRIBUTES = (Private, ); }; }; 1504 93B77B1D0ADDA10700EA4B81 /* UChar.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B77B1C0ADDA10700EA4B81 /* UChar.h */; settings = {ATTRIBUTES = (Private, ); }; };1505 1504 93B780CA09B3B7FE00690162 /* WidgetClient.h in Headers */ = {isa = PBXBuildFile; fileRef = 93B780C909B3B7FE00690162 /* WidgetClient.h */; }; 1506 1505 93C09A530B064DB3005ABD4D /* EventHandler.h in Headers */ = {isa = PBXBuildFile; fileRef = 93C09A520B064DB3005ABD4D /* EventHandler.h */; settings = {ATTRIBUTES = (Private, ); }; }; … … 2639 2638 B2FA3E190AB75A6F000E5AC4 /* JSSVGZoomEvent.h in Headers */ = {isa = PBXBuildFile; fileRef = B2FA3D310AB75A6F000E5AC4 /* JSSVGZoomEvent.h */; }; 2640 2639 BC066F6F09FEB2FA00C589A7 /* WebCoreTextRenderer.h in Headers */ = {isa = PBXBuildFile; fileRef = BC066F6C09FEB2FA00C589A7 /* WebCoreTextRenderer.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2640 BC18C5D00B2A886F0018461D /* TextBreakIterator.h in Headers */ = {isa = PBXBuildFile; fileRef = BC18C5CE0B2A886F0018461D /* TextBreakIterator.h */; }; 2641 BC18C5D10B2A886F0018461D /* TextBreakIteratorICU.cpp in Sources */ = {isa = PBXBuildFile; fileRef = BC18C5CF0B2A886F0018461D /* TextBreakIteratorICU.cpp */; }; 2641 2642 BC1A37AD097C715F0019F3D8 /* DOM.h in Headers */ = {isa = PBXBuildFile; fileRef = BC1A3797097C715F0019F3D8 /* DOM.h */; settings = {ATTRIBUTES = (Private, ); }; }; 2642 2643 BC1A37AE097C715F0019F3D8 /* DOM.mm in Sources */ = {isa = PBXBuildFile; fileRef = BC1A3798097C715F0019F3D8 /* DOM.mm */; }; … … 2823 2824 }; 2824 2825 /* End PBXBuildRule section */ 2826 2827 /* Begin PBXBuildStyle section */ 2828 BC18C5C70B2A883B0018461D /* Development */ = { 2829 isa = PBXBuildStyle; 2830 buildSettings = { 2831 COPY_PHASE_STRIP = NO; 2832 }; 2833 name = Development; 2834 }; 2835 BC18C5C80B2A883B0018461D /* Deployment */ = { 2836 isa = PBXBuildStyle; 2837 buildSettings = { 2838 COPY_PHASE_STRIP = YES; 2839 }; 2840 name = Deployment; 2841 }; 2842 /* End PBXBuildStyle section */ 2825 2843 2826 2844 /* Begin PBXContainerItemProxy section */ … … 4485 4503 93B70D5A09EB0C7C009D8468 /* kjs_window.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = kjs_window.h; sourceTree = "<group>"; }; 4486 4504 93B77A370ADD792500EA4B81 /* FrameLoaderTypes.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = FrameLoaderTypes.h; sourceTree = "<group>"; }; 4487 93B77B1C0ADDA10700EA4B81 /* UChar.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = UChar.h; sourceTree = "<group>"; };4488 4505 93B780C909B3B7FE00690162 /* WidgetClient.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = WidgetClient.h; sourceTree = "<group>"; }; 4489 4506 93C09A520B064DB3005ABD4D /* EventHandler.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = EventHandler.h; sourceTree = "<group>"; }; … … 5717 5734 BC06F24B06D18A7E004A6FA3 /* XSLTProcessor.cpp */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.cpp.cpp; path = XSLTProcessor.cpp; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 5718 5735 BC06F24C06D18A7E004A6FA3 /* XSLTProcessor.h */ = {isa = PBXFileReference; fileEncoding = 30; indentWidth = 4; lastKnownFileType = sourcecode.c.h; path = XSLTProcessor.h; sourceTree = "<group>"; tabWidth = 8; usesTabs = 0; }; 5736 BC18C5CE0B2A886F0018461D /* TextBreakIterator.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = TextBreakIterator.h; sourceTree = "<group>"; }; 5737 BC18C5CF0B2A886F0018461D /* TextBreakIteratorICU.cpp */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.cpp; path = TextBreakIteratorICU.cpp; sourceTree = "<group>"; }; 5719 5738 BC1A3797097C715F0019F3D8 /* DOM.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = DOM.h; sourceTree = "<group>"; }; 5720 5739 BC1A3798097C715F0019F3D8 /* DOM.mm */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.cpp.objcpp; path = DOM.mm; sourceTree = "<group>"; }; … … 8866 8885 93E62D990985F41600E1B5E3 /* SystemTime.h */, 8867 8886 9352071809BD3BA500F2038D /* TextBoundaries.h */, 8887 BC18C5CE0B2A886F0018461D /* TextBreakIterator.h */, 8888 BC18C5CF0B2A886F0018461D /* TextBreakIteratorICU.cpp */, 8868 8889 657BD74909AFDC54005A2056 /* TextCodec.cpp */, 8869 8890 657BD74A09AFDC54005A2056 /* TextCodec.h */, … … 8889 8910 93309EA1099EB78C0056E581 /* Timer.cpp */, 8890 8911 9305B24C098F1B6B00C28855 /* Timer.h */, 8891 93B77B1C0ADDA10700EA4B81 /* UChar.h */,8892 8912 9380F47109A11AB4001FDB34 /* Widget.cpp */, 8893 8913 9380F47209A11AB4001FDB34 /* Widget.h */, … … 10694 10714 93B77A380ADD792500EA4B81 /* FrameLoaderTypes.h in Headers */, 10695 10715 65BAAABE0ADCA015005BB5A4 /* RetainPtr.h in Headers */, 10696 93B77B1D0ADDA10700EA4B81 /* UChar.h in Headers */,10697 10716 0668E18B0ADD9624004128E0 /* PopupMenu.h in Headers */, 10698 10717 6563A9A70ADF4094000ED2CD /* LoaderNSURLRequestExtras.h in Headers */, … … 10821 10840 B2BFB5A00B22F76200567E80 /* ImageAnimationObserver.h in Headers */, 10822 10841 E1D8E3160B29E39C00F4BAF6 /* HTTPParsers.h in Headers */, 10842 BC18C5D00B2A886F0018461D /* TextBreakIterator.h in Headers */, 10823 10843 ); 10824 10844 runOnlyForDeploymentPostprocessing = 0; … … 10858 10878 isa = PBXProject; 10859 10879 buildConfigurationList = 149C284308902B11008A9EFC /* Build configuration list for PBXProject "WebCore" */; 10860 compatibilityVersion = "Xcode 2.4"; 10880 buildSettings = { 10881 }; 10882 buildStyles = ( 10883 BC18C5C70B2A883B0018461D /* Development */, 10884 BC18C5C80B2A883B0018461D /* Deployment */, 10885 ); 10861 10886 hasScannedForEncodings = 1; 10862 10887 knownRegions = ( … … 10872 10897 productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; 10873 10898 projectDirPath = ""; 10874 projectRoot = "";10875 shouldCheckCompatibility = 1;10876 10899 targets = ( 10877 10900 93F198A508245E59001E9ABC /* WebCore */, … … 12140 12163 93354A3C0B24F8C9003F6DEA /* UIEventWithKeyState.cpp in Sources */, 12141 12164 E1D8E31A0B29E3B600F4BAF6 /* HTTPParsers.cpp in Sources */, 12165 BC18C5D10B2A886F0018461D /* TextBreakIteratorICU.cpp in Sources */, 12142 12166 ); 12143 12167 runOnlyForDeploymentPostprocessing = 0; -
trunk/WebCore/css/cssparser.cpp
r17700 r18098 156 156 if (ored & ~0x7F) 157 157 for (int i = 0; i < length; i++) 158 characters[i] = u_tolower(characters[i]);158 characters[i] = WTF::Unicode::toLower(characters[i]); 159 159 else 160 160 for (int i = 0; i < length; i++) -
trunk/WebCore/dom/Document.cpp
r18077 r18098 164 164 165 165 // rules (a) and (f) above 166 const uint32_t nameStartMask = U_GC_LL_MASK | U_GC_LU_MASK | U_GC_LO_MASK | U_GC_LT_MASK | U_GC_NL_MASK; 167 if (!(U_GET_GC_MASK(c) & nameStartMask)) 166 const uint32_t nameStartMask = WTF::Unicode::Letter_Lowercase | 167 WTF::Unicode::Letter_Uppercase | 168 WTF::Unicode::Letter_Other | 169 WTF::Unicode::Letter_Titlecase | 170 WTF::Unicode::Number_Letter; 171 if (!(WTF::Unicode::category(c) & nameStartMask)) 168 172 return false; 169 173 … … 173 177 174 178 // rule (d) above 175 UDecompositionType decompType = static_cast<UDecompositionType>(u_getIntPropertyValue(c, UCHAR_DECOMPOSITION_TYPE));176 if (decompType == U_DT_FONT || decompType == U_DT_COMPAT)179 WTF::Unicode::DecompositionType decompType = WTF::Unicode::decompositionType(c); 180 if (decompType == WTF::Unicode::DecompositionFont || decompType == WTF::Unicode::DecompositionCompat) 177 181 return false; 178 182 … … 195 199 196 200 // rules (b) and (f) above 197 const uint32_t otherNamePartMask = U_GC_MC_MASK | U_GC_ME_MASK | U_GC_MN_MASK | U_GC_LM_MASK | U_GC_ND_MASK; 198 if (!(U_GET_GC_MASK(c) & otherNamePartMask)) 201 const uint32_t otherNamePartMask = WTF::Unicode::Mark_NonSpacing | 202 WTF::Unicode::Mark_Enclosing | 203 WTF::Unicode::Mark_SpacingCombining | 204 WTF::Unicode::Letter_Modifier | 205 WTF::Unicode::Number_DecimalDigit; 206 if (!(WTF::Unicode::category(c) & otherNamePartMask)) 199 207 return false; 200 208 … … 204 212 205 213 // rule (d) above 206 UDecompositionType decompType = static_cast<UDecompositionType>(u_getIntPropertyValue(c, UCHAR_DECOMPOSITION_TYPE));207 if (decompType == U_DT_FONT || decompType == U_DT_COMPAT)214 WTF::Unicode::DecompositionType decompType = WTF::Unicode::decompositionType(c); 215 if (decompType == WTF::Unicode::DecompositionFont || decompType == WTF::Unicode::DecompositionCompat) 208 216 return false; 209 217 -
trunk/WebCore/editing/TextIterator.cpp
r17980 r18098 969 969 *m_cursor++ = c == nonBreakingSpace ? ' ' : c; 970 970 else 971 *m_cursor++ = c == nonBreakingSpace ? ' ' : u_foldCase(c, U_FOLD_CASE_DEFAULT);971 *m_cursor++ = c == nonBreakingSpace ? ' ' : WTF::Unicode::foldCase(c); 972 972 if (m_cursor == m_buffer + length()) { 973 973 m_cursor = m_buffer; … … 994 994 for (int i = 0; i != count; ++i) { 995 995 UChar c = characters[i]; 996 m_cursor[i] = c == nonBreakingSpace ? ' ' : u_foldCase(c, U_FOLD_CASE_DEFAULT);996 m_cursor[i] = c == nonBreakingSpace ? ' ' : WTF::Unicode::foldCase(c); 997 997 } 998 998 } -
trunk/WebCore/html/HTMLFontElement.cpp
r15253 r18098 65 65 66 66 // Parse a single digit. 67 if (! u_isdigit(s[pos]))67 if (!WTF::Unicode::isDigit(s[pos])) 68 68 return false; 69 int num = u_charDigitValue(s[pos++]);69 int num = WTF::Unicode::digitValue(s[pos++]); 70 70 71 71 // Check for an additional digit. 72 if ( u_isdigit(s[pos]))72 if (WTF::Unicode::isDigit(s[pos])) 73 73 num = 10; 74 74 -
trunk/WebCore/html/HTMLInputElement.cpp
r18073 r18098 51 51 #include "RenderSlider.h" 52 52 #include "SelectionController.h" 53 #include <unicode/ubrk.h>53 #include "TextBreakIterator.h" 54 54 55 55 using namespace std; … … 62 62 static int numGraphemeClusters(const StringImpl* s) 63 63 { 64 UBreakIterator* it = characterBreakIterator(s); 64 if (!s) 65 return 0; 66 67 TextBreakIterator* it = characterBreakIterator(s->characters(), s->length()); 65 68 if (!it) 66 69 return 0; 67 70 int num = 0; 68 while ( ubrk_next(it) != UBRK_DONE)71 while (textBreakNext(it) != TextBreakDone) 69 72 ++num; 70 73 return num; … … 73 76 static int numCharactersInGraphemeClusters(const StringImpl* s, int numGraphemeClusters) 74 77 { 75 UBreakIterator* it = characterBreakIterator(s); 78 if (!s) 79 return 0; 80 81 TextBreakIterator* it = characterBreakIterator(s->characters(), s->length()); 76 82 if (!it) 77 83 return 0; 78 84 for (int i = 0; i < numGraphemeClusters; ++i) 79 if ( ubrk_next(it) == UBRK_DONE)85 if (textBreakNext(it) == TextBreakDone) 80 86 return s->length(); 81 return ubrk_current(it);87 return textBreakCurrent(it); 82 88 } 83 89 -
trunk/WebCore/html/HTMLSelectElement.cpp
r18019 r18098 798 798 int i; 799 799 for (i = 0; i < length; ++i) 800 if (string[i] != nonBreakingSpace && (string[i] <= 0x7F ? !isspace(string[i]) : (u_charDirection(string[i]) != U_WHITE_SPACE_NEUTRAL))) 800 if (string[i] != nonBreakingSpace && 801 (string[i] <= 0x7F ? !isspace(string[i]) : (WTF::Unicode::direction(string[i]) != WTF::Unicode::WhiteSpaceNeutral))) 801 802 break; 802 803 -
trunk/WebCore/page/Frame.h
r18041 r18098 34 34 #include "TextAffinity.h" 35 35 #include "TextGranularity.h" 36 #include " UChar.h"36 #include "wtf/unicode/Unicode.h" 37 37 #include <wtf/Forward.h> 38 38 #include <wtf/Vector.h> -
trunk/WebCore/platform/DeprecatedString.h
r17722 r18098 28 28 29 29 #include <ctype.h> 30 #include < unicode/uchar.h>30 #include <wtf/unicode/Unicode.h> 31 31 #include "DeprecatedCString.h" 32 32 … … 111 111 inline bool DeprecatedChar::isSpace() const 112 112 { 113 #if USE(ICU_UNICODE) 113 114 // Use isspace() for basic Latin-1. 114 115 // This will include newlines, which aren't included in unicode DirWS. 115 116 return c <= 0x7F ? isspace(c) : (u_charDirection(c) == U_WHITE_SPACE_NEUTRAL); 117 #elif USE(QT4_UNICODE) 118 return QChar(c).isSpace(); 119 #endif 116 120 } 117 121 118 122 inline DeprecatedChar DeprecatedChar::lower() const 119 123 { 124 #if USE(ICU_UNICODE) 120 125 // FIXME: If fast enough, we should just call u_tolower directly. 121 126 return c <= 0x7F ? tolower(c) : u_tolower(c); 127 #elif USE(QT4_UNICODE) 128 return QChar(c).toLower().unicode(); 129 #endif 122 130 } 123 131 124 132 inline DeprecatedChar DeprecatedChar::upper() const 125 133 { 134 #if USE(ICU_UNICODE) 126 135 // FIXME: If fast enough, we should just call u_toupper directly. 127 136 return c <= 0x7F ? toupper(c) : u_toupper(c); 137 #elif USE(QT4_UNICODE) 138 return QChar(c).toUpper().unicode(); 139 #endif 128 140 } 129 141 -
trunk/WebCore/platform/Font.cpp
r16594 r18098 32 32 #include "GlyphBuffer.h" 33 33 #include "TextStyle.h" 34 #include <unicode/uchar.h> 35 #include <unicode/umachine.h> 34 #include <wtf/unicode/Unicode.h> 35 #include <wtf/MathExtras.h> 36 #if USE(ICU_UNICODE) 36 37 #include <unicode/unorm.h> 37 # include <wtf/MathExtras.h>38 #endif 38 39 39 40 namespace WebCore { … … 173 174 if (needCharTransform) { 174 175 if (rtl) 175 c = u_charMirror(c);176 c = WTF::Unicode::mirroredChar(c); 176 177 177 178 // If small-caps, convert lowercase to upper. 178 if (m_font->isSmallCaps() && ! u_isUUppercase(c)) {179 UChar32 upperC = u_toupper(c);179 if (m_font->isSmallCaps() && !WTF::Unicode::isUpper(c)) { 180 UChar32 upperC = WTF::Unicode::toUpper(c); 180 181 if (upperC != c) { 181 182 c = upperC; … … 299 300 { 300 301 if (currentCharacter + 1 < m_end) { 301 if (u_getCombiningClass(m_run[currentCharacter + 1]) == hiraganaKatakanaVoicingMarksCombiningClass) { 302 if (WTF::Unicode::combiningClass(m_run[currentCharacter + 1]) == hiraganaKatakanaVoicingMarksCombiningClass) { 303 #if USE(ICU_UNICODE) 302 304 // Normalize into composed form using 3.2 rules. 303 305 UChar normalizedCharacters[2] = { 0, 0 }; … … 307 309 if (resultLength == 1 && uStatus == 0) 308 310 return normalizedCharacters[0]; 311 #elif USE(QT4_UNICODE) 312 QString tmp(reinterpret_cast<const QChar*>(m_run.data(currentCharacter)), 2); 313 QString res = tmp.normalized(QString::NormalizationForm_C, QChar::Unicode_3_2); 314 if (res.length() == 1) 315 return res.at(0).unicode(); 316 #endif 309 317 } 310 318 } -
trunk/WebCore/platform/FontCache.h
r14582 r18098 30 30 #define FONTCACHE_H 31 31 32 #include < unicode/umachine.h>32 #include <wtf/unicode/Unicode.h> 33 33 34 34 #if PLATFORM(WIN) -
trunk/WebCore/platform/FontData.h
r16489 r18098 29 29 #include <wtf/Noncopyable.h> 30 30 31 // FIXME: Temporary. Only needed to support API that's going to move. 32 #include <unicode/umachine.h> 31 #include <wtf/unicode/Unicode.h> 33 32 34 33 #if PLATFORM(MAC) -
trunk/WebCore/platform/GlyphMap.cpp
r16250 r18098 31 31 32 32 #include "FontData.h" 33 #include < unicode/uchar.h>33 #include <wtf/unicode/Unicode.h> 34 34 35 35 namespace WebCore { -
trunk/WebCore/platform/GlyphMap.h
r16250 r18098 30 30 #define GLYPH_MAP_H 31 31 32 #include < unicode/umachine.h>32 #include <wtf/unicode/Unicode.h> 33 33 #include <wtf/Noncopyable.h> 34 34 #include <wtf/HashMap.h> -
trunk/WebCore/platform/GlyphWidthMap.h
r16250 r18098 30 30 #define GLYPH_WIDTH_MAP_H 31 31 32 #include < unicode/umachine.h>32 #include <wtf/unicode/Unicode.h> 33 33 #include <wtf/Noncopyable.h> 34 34 #include <wtf/HashMap.h> -
trunk/WebCore/platform/KURL.cpp
r16300 r18098 32 32 #include "TextEncoding.h" 33 33 #include <wtf/Vector.h> 34 #if USE(ICU_UNICODE) 34 35 #include <unicode/uidna.h> 36 #elif USE(QT4_UNICODE) 37 #include <QUrl> 38 #endif 39 35 40 #include <assert.h> 36 41 … … 1255 1260 return s; 1256 1261 1262 #if USE(ICU_UNICODE) 1257 1263 UChar buffer[hostnameBufferLength]; 1258 1264 UErrorCode error = U_ZERO_ERROR; … … 1263 1269 } 1264 1270 return DeprecatedString(reinterpret_cast<DeprecatedChar *>(buffer), numCharactersConverted); 1271 #elif USE(QT4_UNICODE) 1272 QByteArray result = QUrl::toAce(s); 1273 return DeprecatedString(result.constData(), result.length()); 1274 #endif 1265 1275 } 1266 1276 -
trunk/WebCore/platform/StringHash.h
r17144 r18098 25 25 #include "PlatformString.h" 26 26 #include <wtf/HashTraits.h> 27 #include <unicode/uchar.h> 28 #include <unicode/ustring.h> 27 #include <wtf/unicode/Unicode.h> 29 28 30 29 namespace WTF { … … 100 99 // Main loop 101 100 for (; l > 0; l--) { 102 hash += u_foldCase(s[0], U_FOLD_CASE_DEFAULT);103 tmp = ( u_foldCase(s[1], U_FOLD_CASE_DEFAULT) << 11) ^ hash;101 hash += WTF::Unicode::foldCase(s[0]); 102 tmp = (WTF::Unicode::foldCase(s[1]) << 11) ^ hash; 104 103 hash = (hash << 16) ^ tmp; 105 104 s += 2; … … 109 108 // Handle end case 110 109 if (rem) { 111 hash += u_foldCase(s[0], U_FOLD_CASE_DEFAULT);110 hash += WTF::Unicode::foldCase(s[0]); 112 111 hash ^= hash << 11; 113 112 hash += hash >> 17; … … 146 145 // Main loop 147 146 for (; l > 0; l--) { 148 hash += u_foldCase(s[0], U_FOLD_CASE_DEFAULT);149 tmp = ( u_foldCase(s[1], U_FOLD_CASE_DEFAULT) << 11) ^ hash;147 hash += WTF::Unicode::foldCase(s[0]); 148 tmp = (WTF::Unicode::foldCase(s[1]) << 11) ^ hash; 150 149 hash = (hash << 16) ^ tmp; 151 150 s += 2; … … 155 154 // Handle end case 156 155 if (rem) { 157 hash += u_foldCase(s[0], U_FOLD_CASE_DEFAULT);156 hash += WTF::Unicode::foldCase(s[0]); 158 157 hash ^= hash << 11; 159 158 hash += hash >> 17; … … 185 184 if (length != b->length()) 186 185 return false; 187 return u_memcasecmp(a->characters(), b->characters(), length, U_FOLD_CASE_DEFAULT) == 0;186 return WTF::Unicode::strcasecmp(a->characters(), b->characters(), length) == 0; 188 187 } 189 188 }; -
trunk/WebCore/platform/StringImpl.cpp
r17346 r18098 34 34 #include "StringHash.h" 35 35 #include "TextEncoding.h" 36 #include "TextBreakIterator.h" 36 37 #include <kjs/dtoa.h> 37 38 #include <kjs/identifier.h> 38 39 #include <wtf/Assertions.h> 39 #include <unicode/ubrk.h> 40 #include <unicode/ustring.h> 40 #include <wtf/unicode/Unicode.h> 41 41 #include <assert.h> 42 42 … … 54 54 // Use isspace() for basic Latin-1. 55 55 // This will include newlines, which aren't included in unicode DirWS. 56 return c <= 0x7F ? isspace(c) : (u_charDirection(c) == U_WHITE_SPACE_NEUTRAL);56 return c <= 0x7F ? isspace(c) : WTF::Unicode::isSpace(c); 57 57 } 58 58 … … 284 284 if (i < m_length && (m_data[i] == '+' || m_data[i] == '-')) 285 285 ++i; 286 while (i < m_length && u_isdigit(m_data[i]))286 while (i < m_length && WTF::Unicode::isDigit(m_data[i])) 287 287 ++i; 288 288 … … 291 291 292 292 /* Skip over any remaining digits, we are not that accurate (5.5% => 5%) */ 293 while (i < m_length && ( u_isdigit(m_data[i]) || m_data[i] == '.'))293 while (i < m_length && (WTF::Unicode::isDigit(m_data[i]) || m_data[i] == '.')) 294 294 ++i; 295 295 … … 399 399 400 400 // Do a slower check for the other cases. 401 UBool allLower2 = true;401 bool allLower2 = true; 402 402 for (unsigned i = 0; i < m_length; i++) 403 allLower2 &= u_islower(m_data[i]);403 allLower2 &= WTF::Unicode::isLower(m_data[i]); 404 404 return allLower2; 405 405 } … … 427 427 return c; 428 428 429 UErrorCode status = U_ZERO_ERROR;430 int32_t realLength = u_strToLower(data, length, m_data, length, "", &status);431 if ( U_SUCCESS(status)&& realLength == length)429 bool error; 430 int32_t realLength = WTF::Unicode::toLower(data, length, m_data, m_length, &error); 431 if (!error && realLength == length) 432 432 return c; 433 433 … … 441 441 c->m_length = length; 442 442 443 status = U_ZERO_ERROR; 444 u_strToLower(data, length, m_data, m_length, "", &status); 445 if (U_FAILURE(status)) { 443 WTF::Unicode::toLower(data, length, m_data, m_length, &error); 444 if (error) { 446 445 c->ref(); 447 446 c->deref(); … … 456 455 if (!m_length) 457 456 return c; 458 UErrorCode status = U_ZERO_ERROR;459 int32_t length = u_strToUpper(0, 0, m_data, m_length, "", &status);457 bool error; 458 int32_t length = WTF::Unicode::toUpper(0, 0, m_data, m_length, &error); 460 459 c->m_data = newUCharVector(length); 461 460 c->m_length = length; 462 status = U_ZERO_ERROR; 463 u_strToUpper(c->m_data, length, m_data, m_length, "", &status); 464 if (U_FAILURE(status)) { 461 WTF::Unicode::toUpper(c->m_data, length, m_data, m_length, &error); 462 if (error) { 465 463 c->ref(); 466 464 c->deref(); … … 475 473 c->m_data = newUCharVector(c->m_length= m_length); 476 474 477 u_memset(c->m_data, aChar, m_length);475 WTF::Unicode::memset(c->m_data, aChar, m_length); 478 476 479 477 return c; … … 485 483 if (!m_length) 486 484 return c; 487 UErrorCode status = U_ZERO_ERROR;488 int32_t length = u_strFoldCase(0, 0, m_data, m_length, U_FOLD_CASE_DEFAULT, &status);485 bool error; 486 int32_t length = WTF::Unicode::foldCase(0, 0, m_data, m_length, &error); 489 487 c->m_data = newUCharVector(length); 490 488 c->m_length = length; 491 status = U_ZERO_ERROR; 492 u_strFoldCase(c->m_data, length, m_data, m_length, U_FOLD_CASE_DEFAULT, &status); 493 if (U_FAILURE(status)) { 489 WTF::Unicode::foldCase(c->m_data, length, m_data, m_length, &error); 490 if (error) { 494 491 c->ref(); 495 492 c->deref(); … … 560 557 } 561 558 562 // FIXME: this implementation should move to its own file now that StringImpl is not the only class that uses it563 UBreakIterator* getWordBreakIterator(const UChar* string, int length)564 {565 // The locale is currently ignored when determining character cluster breaks.566 // This may change in the future, according to Deborah Goldsmith.567 static bool createdIterator = false;568 static UBreakIterator* iterator;569 UErrorCode status;570 if (!createdIterator) {571 status = U_ZERO_ERROR;572 iterator = ubrk_open(UBRK_WORD, "en_us", 0, 0, &status);573 createdIterator = true;574 }575 if (!iterator)576 return 0;577 578 status = U_ZERO_ERROR;579 ubrk_setText(iterator, reinterpret_cast<const ::UChar*>(string), length, &status);580 if (U_FAILURE(status))581 return 0;582 583 return iterator;584 }585 586 559 StringImpl* StringImpl::capitalize(UChar previous) const 587 560 { … … 589 562 if (!m_length) 590 563 return capitalizedString; 591 564 592 565 UChar* stringWithPrevious = newUCharVector(m_length + 1); 593 566 stringWithPrevious[0] = previous; … … 600 573 } 601 574 602 UBreakIterator* boundary = getWordBreakIterator(stringWithPrevious, m_length + 1);575 TextBreakIterator* boundary = wordBreakIterator(stringWithPrevious, m_length + 1); 603 576 if (!boundary) { 604 577 deleteUCharVector(stringWithPrevious); 605 578 return capitalizedString; 606 579 } 607 580 608 581 capitalizedString->m_data = newUCharVector(m_length); 609 582 capitalizedString->m_length = m_length; 610 583 611 584 int32_t endOfWord; 612 int32_t startOfWord = ubrk_first(boundary);613 for (endOfWord = ubrk_next(boundary); endOfWord != UBRK_DONE; startOfWord = endOfWord, endOfWord = ubrk_next(boundary)) {585 int32_t startOfWord = textBreakFirst(boundary); 586 for (endOfWord = textBreakNext(boundary); endOfWord != TextBreakDone; startOfWord = endOfWord, endOfWord = textBreakNext(boundary)) { 614 587 if (startOfWord != 0) // Ignore first char of previous string 615 capitalizedString->m_data[startOfWord - 1] = u_totitle(stringWithPrevious[startOfWord]);588 capitalizedString->m_data[startOfWord - 1] = WTF::Unicode::toTitleCase(stringWithPrevious[startOfWord]); 616 589 for (int i = startOfWord + 1; i < endOfWord; i++) 617 590 capitalizedString->m_data[i - 1] = stringWithPrevious[i]; 618 591 } 619 592 620 593 deleteUCharVector(stringWithPrevious); 594 621 595 return capitalizedString; 622 596 } … … 637 611 // Allow digits. 638 612 for (; i != m_length; ++i) 639 if (! u_isdigit(m_data[i]))613 if (!WTF::Unicode::isDigit(m_data[i])) 640 614 break; 641 615 … … 674 648 while (length--) { 675 649 unsigned char bc = *b++; 676 if ( u_foldCase(*a++, U_FOLD_CASE_DEFAULT) != u_foldCase(bc, U_FOLD_CASE_DEFAULT))650 if (WTF::Unicode::foldCase(*a++) != WTF::Unicode::foldCase(bc)) 677 651 return false; 678 652 } … … 683 657 { 684 658 ASSERT(length >= 0); 685 return u_memcasecmp(a, b, length, U_FOLD_CASE_DEFAULT) == 0;659 return WTF::Unicode::strcasecmp(a, b, length) == 0; 686 660 } 687 661 … … 716 690 } while (--n); 717 691 } else { 718 UChar lc = u_foldCase(*chs, U_FOLD_CASE_DEFAULT);692 UChar lc = WTF::Unicode::foldCase(*chs); 719 693 do { 720 if ( u_foldCase(*++ptr, U_FOLD_CASE_DEFAULT) == lc694 if (WTF::Unicode::foldCase(*++ptr) == lc 721 695 && equalIgnoringCase(ptr + 1, chsPlusOne, chsLengthMinusOne)) 722 696 return m_length - chsLength - n + 1; … … 1020 994 for (unsigned i = 0; i != length; ++i) { 1021 995 unsigned char bc = b[i]; 1022 equal &= u_foldCase(as[i], U_FOLD_CASE_DEFAULT) == u_foldCase(bc, U_FOLD_CASE_DEFAULT);996 equal &= WTF::Unicode::foldCase(as[i]) == WTF::Unicode::foldCase(bc); 1023 997 } 1024 998 } -
trunk/WebCore/platform/StringImpl.h
r17722 r18098 26 26 27 27 #include "Shared.h" 28 #include "UChar.h"28 #include <wtf/unicode/Unicode.h> 29 29 #include <kjs/identifier.h> 30 30 #include <wtf/Forward.h> 31 31 #include <wtf/Vector.h> 32 32 #include <limits.h> 33 34 typedef void UBreakIterator;35 33 36 34 #if PLATFORM(CF) … … 171 169 inline bool equalIgnoringCase(const char* a, const StringImpl* b) { return equalIgnoringCase(b, a); } 172 170 173 UBreakIterator* getWordBreakIterator(const UChar* string, int length);174 175 171 } 176 172 -
trunk/WebCore/platform/TextBoundaries.h
r16245 r18098 27 27 #define TextBoundaries_h 28 28 29 #include " UChar.h"29 #include "wtf/unicode/Unicode.h" 30 30 31 31 namespace WebCore { -
trunk/WebCore/platform/TextCodec.h
r17431 r18098 28 28 #define TextCodec_h 29 29 30 #include " UChar.h"30 #include "wtf/unicode/Unicode.h" 31 31 #include <memory> 32 32 #include <wtf/Noncopyable.h> -
trunk/WebCore/platform/TextCodecLatin1.cpp
r16245 r18098 29 29 #include "CString.h" 30 30 #include "PlatformString.h" 31 #include <unicode/utf16.h>31 #include "wtf/unicode/Unicode.h" 32 32 33 33 using std::auto_ptr; -
trunk/WebCore/platform/TextEncoding.cpp
r17431 r18098 33 33 #include "TextDecoder.h" 34 34 #include "TextEncodingRegistry.h" 35 #if USE(ICU_UNICODE) 35 36 #include <unicode/unorm.h> 37 #elif USE(QT4_UNICODE) 38 #include <QString> 39 #endif 36 40 #include <wtf/HashSet.h> 37 41 #include <wtf/OwnPtr.h> … … 72 76 return ""; 73 77 78 #if USE(ICU_UNICODE) 74 79 // FIXME: What's the right place to do normalization? 75 80 // It's a little strange to do it inside the encode function. … … 96 101 sourceLength = normalizedLength; 97 102 } 98 99 103 return newTextCodec(*this)->encode(source, sourceLength, allowEntities); 104 #elif USE(QT4_UNICODE) 105 QString str(reinterpret_cast<const QChar*>(characters), length); 106 str = str.normalized(QString::NormalizationForm_C); 107 return newTextCodec(*this)->encode(str.utf16(), str.length(), allowEntities); 108 #endif 100 109 } 101 110 -
trunk/WebCore/platform/TextEncoding.h
r16245 r18098 27 27 #define TextEncoding_h 28 28 29 #include " UChar.h"29 #include "wtf/unicode/Unicode.h" 30 30 31 31 namespace WebCore { -
trunk/WebCore/platform/TextEncodingRegistry.cpp
r17431 r18098 40 40 #include "TextCodecMac.h" 41 41 #endif 42 #if PLATFORM(QT) 43 #include "qt/TextCodecQt.h" 44 #endif 42 45 43 46 namespace WebCore { … … 160 163 TextCodecICU::registerEncodingNames(addToTextEncodingNameMap); 161 164 #endif 165 #if USE(QT4_UNICODE) 166 TextCodecQt::registerEncodingNames(addToTextEncodingNameMap); 167 #endif 162 168 #if PLATFORM(MAC) 163 169 TextCodecMac::registerEncodingNames(addToTextEncodingNameMap); … … 173 179 #if USE(ICU_UNICODE) 174 180 TextCodecICU::registerCodecs(addToTextCodecMap); 181 #endif 182 #if USE(QT4_UNICODE) 183 TextCodecQt::registerCodecs(addToTextCodecMap); 175 184 #endif 176 185 #if PLATFORM(MAC) -
trunk/WebCore/platform/TextEncodingRegistry.h
r16245 r18098 27 27 #define TextEncodingRegistry_h 28 28 29 #include " UChar.h"29 #include "wtf/unicode/Unicode.h" 30 30 #include <memory> 31 31 -
trunk/WebCore/platform/graphics/GraphicsContext.h
r17989 r18098 33 33 #include "Pen.h" 34 34 #include "TextDirection.h" 35 #include "UChar.h"36 35 #include <wtf/Noncopyable.h> 37 36 #include <wtf/Platform.h> -
trunk/WebCore/platform/qt/GlyphMapQt.cpp
r16944 r18098 32 32 33 33 #include "FontData.h" 34 #include < unicode/utf16.h>34 #include <wtf/unicode/Unicode.h> 35 35 #include <wtf/Assertions.h> 36 36 -
trunk/WebCore/rendering/RenderBlock.cpp
r17824 r18098 3496 3496 3497 3497 // account for leading spaces and punctuation 3498 while (length < oldText->length() && (DeprecatedChar((*oldText)[length]).isSpace() || u_ispunct((*oldText)[length])))3498 while (length < oldText->length() && (DeprecatedChar((*oldText)[length]).isSpace() || WTF::Unicode::isPunct((*oldText)[length]))) 3499 3499 length++; 3500 3500 -
trunk/WebCore/rendering/RenderText.cpp
r17726 r18098 36 36 #include "TextStyle.h" 37 37 #include "break_lines.h" 38 #include <unicode/ubrk.h>38 #include "TextBreakIterator.h" 39 39 #include <wtf/AlwaysInline.h> 40 40 … … 43 43 namespace WebCore { 44 44 45 UBreakIterator* characterBreakIterator(const StringImpl* i)46 {47 if (!i)48 return 0;49 50 // The locale is currently ignored when determining character cluster breaks.51 // This may change in the future, according to Deborah Goldsmith.52 static bool createdIterator = false;53 static UBreakIterator* iterator;54 UErrorCode status;55 if (!createdIterator) {56 status = U_ZERO_ERROR;57 iterator = ubrk_open(UBRK_CHARACTER, "en_us", 0, 0, &status);58 createdIterator = true;59 }60 if (!iterator)61 return 0;62 63 status = U_ZERO_ERROR;64 ubrk_setText(iterator, reinterpret_cast<const UChar*>(i->characters()), i->length(), &status);65 if (status != U_ZERO_ERROR)66 return 0;67 68 return iterator;69 }70 71 45 int RenderText::previousOffset(int current) const 72 46 { 73 UBreakIterator* iterator = characterBreakIterator(str.get()); 47 StringImpl *si = str.get(); 48 TextBreakIterator* iterator = characterBreakIterator(si->characters(), si->length()); 74 49 if (!iterator) 75 50 return current - 1; 76 51 77 long result = ubrk_preceding(iterator, current);78 if (result == UBRK_DONE)52 long result = textBreakPreceding(iterator, current); 53 if (result == TextBreakDone) 79 54 result = current - 1; 80 55 … … 84 59 int RenderText::nextOffset(int current) const 85 60 { 86 UBreakIterator* iterator = characterBreakIterator(str.get()); 61 StringImpl *si = str.get(); 62 TextBreakIterator* iterator = characterBreakIterator(si->characters(), si->length()); 87 63 if (!iterator) 88 64 return current + 1; 89 65 90 long result = ubrk_following(iterator, current);91 if (result == UBRK_DONE)66 long result = textBreakFollowing(iterator, current); 67 if (result == TextBreakDone) 92 68 result = current + 1; 93 69 … … 494 470 for (i = start; i < start+len; i++) { 495 471 UChar c = (*str)[i]; 496 UCharDirection dir = u_charDirection(c);497 if (dir != U_DIR_NON_SPACING_MARK && dir != U_BOUNDARY_NEUTRAL) {472 WTF::Unicode::Direction dir = WTF::Unicode::direction(c); 473 if (dir != WTF::Unicode::NonSpacingMark && dir != WTF::Unicode::BoundaryNeutral) { 498 474 if (c == '\t' && tabWidth != 0) 499 475 w += tabWidth - ((xpos + w) % tabWidth); -
trunk/WebCore/rendering/RenderText.h
r17667 r18098 28 28 #include "RenderObject.h" 29 29 #include "Text.h" 30 31 typedef void UBreakIterator;32 30 33 31 namespace WebCore { … … 187 185 }; 188 186 189 UBreakIterator* characterBreakIterator(const StringImpl*);190 191 187 } // namespace WebCore 192 188 -
trunk/WebCore/rendering/bidi.cpp
r17524 r18098 49 49 50 50 UChar current() const; 51 UCharDirection direction() const;51 WTF::Unicode::Direction direction() const; 52 52 53 53 RenderBlock* block; … … 57 57 58 58 struct BidiState { 59 BidiState() : context(0), dir( U_OTHER_NEUTRAL), adjustEmbedding(false), reachedEndOfLine(false) {}59 BidiState() : context(0), dir(WTF::Unicode::OtherNeutral), adjustEmbedding(false), reachedEndOfLine(false) {} 60 60 61 61 BidiIterator sor; … … 65 65 RefPtr<BidiContext> context; 66 66 BidiStatus status; 67 UCharDirection dir;67 WTF::Unicode::Direction dir; 68 68 bool adjustEmbedding; 69 69 BidiIterator endOfLine; … … 105 105 static int numSpaces; 106 106 107 static void embed( UCharDirection, BidiState&);107 static void embed(WTF::Unicode::Direction, BidiState&); 108 108 static void appendRun(BidiState&); 109 109 … … 200 200 relayouting 201 201 */ 202 BidiContext::BidiContext(unsigned char l, UCharDirection e, BidiContext *p, bool o)202 BidiContext::BidiContext(unsigned char l, WTF::Unicode::Direction e, BidiContext *p, bool o) 203 203 : level(l), override(o), m_dir(e) 204 204 { … … 281 281 if (ub != UBNormal) { 282 282 TextDirection dir = next->style()->direction(); 283 UCharDirection d = (ub == Embed284 ? (dir == RTL ? U_RIGHT_TO_LEFT_EMBEDDING : U_LEFT_TO_RIGHT_EMBEDDING)285 : (dir == RTL ? U_RIGHT_TO_LEFT_OVERRIDE : U_LEFT_TO_RIGHT_OVERRIDE));283 WTF::Unicode::Direction d = (ub == Embed 284 ? (dir == RTL ? WTF::Unicode::RightToLeftEmbedding : WTF::Unicode::LeftToRightEmbedding) 285 : (dir == RTL ? WTF::Unicode::RightToLeftOverride : WTF::Unicode::LeftToRightOverride)); 286 286 embed(d, bidi); 287 287 } … … 299 299 while (current && current != block) { 300 300 if (bidi.adjustEmbedding && current->isInlineFlow() && current->style()->unicodeBidi() != UBNormal) 301 embed( U_POP_DIRECTIONAL_FORMAT, bidi);301 embed(WTF::Unicode::PopDirectionalFormat, bidi); 302 302 303 303 next = current->nextSibling(); … … 307 307 if (ub != UBNormal) { 308 308 TextDirection dir = next->style()->direction(); 309 UCharDirection d = (ub == Embed310 ? (dir == RTL ? U_RIGHT_TO_LEFT_EMBEDDING : U_LEFT_TO_RIGHT_EMBEDDING)311 : (dir == RTL ? U_RIGHT_TO_LEFT_OVERRIDE : U_LEFT_TO_RIGHT_OVERRIDE));309 WTF::Unicode::Direction d = (ub == Embed 310 ? (dir == RTL ? WTF::Unicode::RightToLeftEmbedding: WTF::Unicode::LeftToRightEmbedding) 311 : (dir == RTL ? WTF::Unicode::RightToLeftOverride : WTF::Unicode::LeftToRightOverride)); 312 312 embed(d, bidi); 313 313 } … … 349 349 if (ub != UBNormal) { 350 350 TextDirection dir = o->style()->direction(); 351 UCharDirection d = (ub == Embed352 ? (dir == RTL ? U_RIGHT_TO_LEFT_EMBEDDING : U_LEFT_TO_RIGHT_EMBEDDING)353 : (dir == RTL ? U_RIGHT_TO_LEFT_OVERRIDE : U_LEFT_TO_RIGHT_OVERRIDE));351 WTF::Unicode::Direction d = (ub == Embed 352 ? (dir == RTL ? WTF::Unicode::RightToLeftEmbedding : WTF::Unicode::LeftToRightEmbedding) 353 : (dir == RTL ? WTF::Unicode::RightToLeftOverride : WTF::Unicode::LeftToRightOverride)); 354 354 embed(d, bidi); 355 355 } … … 399 399 } 400 400 401 ALWAYS_INLINE UCharDirection BidiIterator::direction() const401 ALWAYS_INLINE WTF::Unicode::Direction BidiIterator::direction() const 402 402 { 403 403 if (!obj) 404 return U_OTHER_NEUTRAL;404 return WTF::Unicode::OtherNeutral; 405 405 if (obj->isListMarker()) 406 return obj->style()->direction() == LTR ? U_LEFT_TO_RIGHT : U_RIGHT_TO_LEFT;406 return obj->style()->direction() == LTR ? WTF::Unicode::LeftToRight : WTF::Unicode::RightToLeft; 407 407 if (!obj->isText()) 408 return U_OTHER_NEUTRAL;408 return WTF::Unicode::OtherNeutral; 409 409 RenderText* renderTxt = static_cast<RenderText*>(obj); 410 410 if (pos >= renderTxt->stringLength()) 411 return U_OTHER_NEUTRAL;412 return u_charDirection(renderTxt->text()[pos]);411 return WTF::Unicode::OtherNeutral; 412 return WTF::Unicode::direction(renderTxt->text()[pos]); 413 413 } 414 414 … … 623 623 bidi.eor.increment(bidi); 624 624 bidi.sor = bidi.eor; 625 bidi.dir = U_OTHER_NEUTRAL;626 bidi.status.eor = U_OTHER_NEUTRAL;625 bidi.dir = WTF::Unicode::OtherNeutral; 626 bidi.status.eor = WTF::Unicode::OtherNeutral; 627 627 bidi.adjustEmbedding = b; 628 628 } 629 629 630 static void embed( UCharDirection d, BidiState& bidi)630 static void embed(WTF::Unicode::Direction d, BidiState& bidi) 631 631 { 632 632 bool b = bidi.adjustEmbedding; 633 633 bidi.adjustEmbedding = false; 634 if (d == U_POP_DIRECTIONAL_FORMAT) {634 if (d == WTF::Unicode::PopDirectionalFormat) { 635 635 BidiContext *c = bidi.context->parent; 636 636 if (c) { 637 637 if (!emptyRun && bidi.eor != bidi.last) { 638 assert(bidi.status.eor != U_OTHER_NEUTRAL);638 assert(bidi.status.eor != WTF::Unicode::OtherNeutral); 639 639 // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last 640 assert(bidi.status.last == U_EUROPEAN_NUMBER_SEPARATOR641 || bidi.status.last == U_EUROPEAN_NUMBER_TERMINATOR642 || bidi.status.last == U_COMMON_NUMBER_SEPARATOR643 || bidi.status.last == U_BOUNDARY_NEUTRAL644 || bidi.status.last == U_BLOCK_SEPARATOR645 || bidi.status.last == U_SEGMENT_SEPARATOR646 || bidi.status.last == U_WHITE_SPACE_NEUTRAL647 || bidi.status.last == U_OTHER_NEUTRAL);648 if (bidi.dir == U_OTHER_NEUTRAL)640 assert(bidi.status.last == WTF::Unicode::EuropeanNumberSeparator 641 || bidi.status.last == WTF::Unicode::EuropeanNumberTerminator 642 || bidi.status.last == WTF::Unicode::CommonNumberSeparator 643 || bidi.status.last == WTF::Unicode::BoundaryNeutral 644 || bidi.status.last == WTF::Unicode::BlockSeparator 645 || bidi.status.last == WTF::Unicode::SegmentSeparator 646 || bidi.status.last == WTF::Unicode::WhiteSpaceNeutral 647 || bidi.status.last == WTF::Unicode::OtherNeutral); 648 if (bidi.dir == WTF::Unicode::OtherNeutral) 649 649 bidi.dir = bidi.context->dir(); 650 if (bidi.context->dir() == U_LEFT_TO_RIGHT) {650 if (bidi.context->dir() == WTF::Unicode::LeftToRight) { 651 651 // bidi.sor ... bidi.eor ... bidi.last L 652 if (bidi.status.eor == U_EUROPEAN_NUMBER) {653 if (bidi.status.lastStrong != U_LEFT_TO_RIGHT) {654 bidi.dir = U_EUROPEAN_NUMBER;652 if (bidi.status.eor == WTF::Unicode::EuropeanNumber) { 653 if (bidi.status.lastStrong != WTF::Unicode::LeftToRight) { 654 bidi.dir = WTF::Unicode::EuropeanNumber; 655 655 appendRun(bidi); 656 656 } 657 } else if (bidi.status.eor == U_ARABIC_NUMBER) {658 bidi.dir = U_ARABIC_NUMBER;657 } else if (bidi.status.eor == WTF::Unicode::ArabicNumber) { 658 bidi.dir = WTF::Unicode::ArabicNumber; 659 659 appendRun(bidi); 660 } else if (bidi.status.eor != U_LEFT_TO_RIGHT)660 } else if (bidi.status.eor != WTF::Unicode::LeftToRight) 661 661 appendRun(bidi); 662 } else if (bidi.status.eor != U_RIGHT_TO_LEFT && bidi.status.eor != U_RIGHT_TO_LEFT_ARABIC)662 } else if (bidi.status.eor != WTF::Unicode::RightToLeft && bidi.status.eor != WTF::Unicode::RightToLeftArabic) 663 663 appendRun(bidi); 664 664 bidi.eor = bidi.last; … … 674 674 } 675 675 } else { 676 UCharDirection runDir;677 if (d == U_RIGHT_TO_LEFT_EMBEDDING || d == U_RIGHT_TO_LEFT_OVERRIDE)678 runDir = U_RIGHT_TO_LEFT;676 WTF::Unicode::Direction runDir; 677 if (d == WTF::Unicode::RightToLeftEmbedding || d == WTF::Unicode::RightToLeftOverride) 678 runDir = WTF::Unicode::RightToLeft; 679 679 else 680 runDir = U_LEFT_TO_RIGHT;681 bool override = d == U_LEFT_TO_RIGHT_OVERRIDE || d == U_RIGHT_TO_LEFT_OVERRIDE;680 runDir = WTF::Unicode::LeftToRight; 681 bool override = d == WTF::Unicode::LeftToRightOverride || d == WTF::Unicode::RightToLeftOverride; 682 682 683 683 unsigned char level = bidi.context->level; 684 if (runDir == U_RIGHT_TO_LEFT) {684 if (runDir == WTF::Unicode::RightToLeft) { 685 685 if (level%2) // we have an odd level 686 686 level += 2; … … 696 696 if (level < 61) { 697 697 if (!emptyRun && bidi.eor != bidi.last) { 698 assert(bidi.status.eor != U_OTHER_NEUTRAL);698 assert(bidi.status.eor != WTF::Unicode::OtherNeutral); 699 699 // bidi.sor ... bidi.eor ... bidi.last eor; need to append the bidi.sor-bidi.eor run or extend it through bidi.last 700 assert(bidi.status.last == U_EUROPEAN_NUMBER_SEPARATOR701 || bidi.status.last == U_EUROPEAN_NUMBER_TERMINATOR702 || bidi.status.last == U_COMMON_NUMBER_SEPARATOR703 || bidi.status.last == U_BOUNDARY_NEUTRAL704 || bidi.status.last == U_BLOCK_SEPARATOR705 || bidi.status.last == U_SEGMENT_SEPARATOR706 || bidi.status.last == U_WHITE_SPACE_NEUTRAL707 || bidi.status.last == U_OTHER_NEUTRAL);708 if (bidi.dir == U_OTHER_NEUTRAL)700 assert(bidi.status.last == WTF::Unicode::EuropeanNumberSeparator 701 || bidi.status.last == WTF::Unicode::EuropeanNumberTerminator 702 || bidi.status.last == WTF::Unicode::CommonNumberSeparator 703 || bidi.status.last == WTF::Unicode::BoundaryNeutral 704 || bidi.status.last == WTF::Unicode::BlockSeparator 705 || bidi.status.last == WTF::Unicode::SegmentSeparator 706 || bidi.status.last == WTF::Unicode::WhiteSpaceNeutral 707 || bidi.status.last == WTF::Unicode::OtherNeutral); 708 if (bidi.dir == WTF::Unicode::OtherNeutral) 709 709 bidi.dir = runDir; 710 if (runDir == U_LEFT_TO_RIGHT) {710 if (runDir == WTF::Unicode::LeftToRight) { 711 711 // bidi.sor ... bidi.eor ... bidi.last L 712 if (bidi.status.eor == U_EUROPEAN_NUMBER) {713 if (bidi.status.lastStrong != U_LEFT_TO_RIGHT) {714 bidi.dir = U_EUROPEAN_NUMBER;712 if (bidi.status.eor == WTF::Unicode::EuropeanNumber) { 713 if (bidi.status.lastStrong != WTF::Unicode::LeftToRight) { 714 bidi.dir = WTF::Unicode::EuropeanNumber; 715 715 appendRun(bidi); 716 if (bidi.context->dir() != U_LEFT_TO_RIGHT)717 bidi.dir = U_RIGHT_TO_LEFT;716 if (bidi.context->dir() != WTF::Unicode::LeftToRight) 717 bidi.dir = WTF::Unicode::RightToLeft; 718 718 } 719 } else if (bidi.status.eor == U_ARABIC_NUMBER) {720 bidi.dir = U_ARABIC_NUMBER;719 } else if (bidi.status.eor == WTF::Unicode::ArabicNumber) { 720 bidi.dir = WTF::Unicode::ArabicNumber; 721 721 appendRun(bidi); 722 if (bidi.context->dir() != U_LEFT_TO_RIGHT) {722 if (bidi.context->dir() != WTF::Unicode::LeftToRight) { 723 723 bidi.eor = bidi.last; 724 bidi.dir = U_RIGHT_TO_LEFT;724 bidi.dir = WTF::Unicode::RightToLeft; 725 725 appendRun(bidi); 726 726 } 727 } else if (bidi.status.eor != U_LEFT_TO_RIGHT) {728 if (bidi.context->dir() == U_LEFT_TO_RIGHT || bidi.status.lastStrong == U_LEFT_TO_RIGHT)727 } else if (bidi.status.eor != WTF::Unicode::LeftToRight) { 728 if (bidi.context->dir() == WTF::Unicode::LeftToRight || bidi.status.lastStrong == WTF::Unicode::LeftToRight) 729 729 appendRun(bidi); 730 730 else 731 bidi.dir = U_RIGHT_TO_LEFT;731 bidi.dir = WTF::Unicode::RightToLeft; 732 732 } 733 } else if (bidi.status.eor != U_RIGHT_TO_LEFT && bidi.status.eor != U_RIGHT_TO_LEFT_ARABIC) {733 } else if (bidi.status.eor != WTF::Unicode::RightToLeft && bidi.status.eor != WTF::Unicode::RightToLeftArabic) { 734 734 // bidi.sor ... bidi.eor ... bidi.last R; bidi.eor=L/EN/AN; EN,AN behave like R (rule N1) 735 if (bidi.context->dir() == U_RIGHT_TO_LEFT || bidi.status.lastStrong == U_RIGHT_TO_LEFT || bidi.status.lastStrong == U_RIGHT_TO_LEFT_ARABIC)735 if (bidi.context->dir() == WTF::Unicode::RightToLeft || bidi.status.lastStrong == WTF::Unicode::RightToLeft || bidi.status.lastStrong == WTF::Unicode::RightToLeftArabic) 736 736 appendRun(bidi); 737 737 else 738 bidi.dir = U_LEFT_TO_RIGHT;738 bidi.dir = WTF::Unicode::LeftToRight; 739 739 } 740 740 bidi.eor = bidi.last; … … 922 922 numSpaces = 0; 923 923 // for right to left fall through to right aligned 924 if (bidi.context->basicDir() == U_LEFT_TO_RIGHT)924 if (bidi.context->basicDir() == WTF::Unicode::LeftToRight) 925 925 break; 926 926 case RIGHT: … … 1016 1016 sBidiRunCount = 0; 1017 1017 1018 assert(bidi.dir == U_OTHER_NEUTRAL);1018 assert(bidi.dir == WTF::Unicode::OtherNeutral); 1019 1019 1020 1020 emptyRun = true; … … 1030 1030 1031 1031 while (true) { 1032 UCharDirection dirCurrent;1032 WTF::Unicode::Direction dirCurrent; 1033 1033 if (pastEnd && (previousLineBrokeCleanly || bidi.current.atEnd())) { 1034 1034 BidiContext *c = bidi.context.get(); … … 1047 1047 dirCurrent = bidi.current.direction(); 1048 1048 if (bidi.context->override 1049 && dirCurrent != U_RIGHT_TO_LEFT_EMBEDDING1050 && dirCurrent != U_LEFT_TO_RIGHT_EMBEDDING1051 && dirCurrent != U_RIGHT_TO_LEFT_OVERRIDE1052 && dirCurrent != U_LEFT_TO_RIGHT_OVERRIDE1053 && dirCurrent != U_POP_DIRECTIONAL_FORMAT)1049 && dirCurrent != WTF::Unicode::RightToLeftEmbedding 1050 && dirCurrent != WTF::Unicode::LeftToRightEmbedding 1051 && dirCurrent != WTF::Unicode::RightToLeftOverride 1052 && dirCurrent != WTF::Unicode::LeftToRightOverride 1053 && dirCurrent != WTF::Unicode::PopDirectionalFormat) 1054 1054 dirCurrent = bidi.context->dir(); 1055 else if (dirCurrent == U_DIR_NON_SPACING_MARK)1055 else if (dirCurrent == WTF::Unicode::NonSpacingMark) 1056 1056 dirCurrent = bidi.status.last; 1057 1057 } 1058 1058 1059 assert(bidi.status.eor != U_OTHER_NEUTRAL);1059 assert(bidi.status.eor != WTF::Unicode::OtherNeutral); 1060 1060 switch (dirCurrent) { 1061 1061 1062 1062 // embedding and overrides (X1-X9 in the Bidi specs) 1063 case U_RIGHT_TO_LEFT_EMBEDDING:1064 case U_LEFT_TO_RIGHT_EMBEDDING:1065 case U_RIGHT_TO_LEFT_OVERRIDE:1066 case U_LEFT_TO_RIGHT_OVERRIDE:1067 case U_POP_DIRECTIONAL_FORMAT:1063 case WTF::Unicode::RightToLeftEmbedding: 1064 case WTF::Unicode::LeftToRightEmbedding: 1065 case WTF::Unicode::RightToLeftOverride: 1066 case WTF::Unicode::LeftToRightOverride: 1067 case WTF::Unicode::PopDirectionalFormat: 1068 1068 embed(dirCurrent, bidi); 1069 1069 break; 1070 1070 1071 1071 // strong types 1072 case U_LEFT_TO_RIGHT:1072 case WTF::Unicode::LeftToRight: 1073 1073 switch(bidi.status.last) { 1074 case U_RIGHT_TO_LEFT:1075 case U_RIGHT_TO_LEFT_ARABIC:1076 case U_EUROPEAN_NUMBER:1077 case U_ARABIC_NUMBER:1078 if (bidi.status.last != U_EUROPEAN_NUMBER || bidi.status.lastStrong != U_LEFT_TO_RIGHT)1074 case WTF::Unicode::RightToLeft: 1075 case WTF::Unicode::RightToLeftArabic: 1076 case WTF::Unicode::EuropeanNumber: 1077 case WTF::Unicode::ArabicNumber: 1078 if (bidi.status.last != WTF::Unicode::EuropeanNumber || bidi.status.lastStrong != WTF::Unicode::LeftToRight) 1079 1079 appendRun(bidi); 1080 1080 break; 1081 case U_LEFT_TO_RIGHT:1081 case WTF::Unicode::LeftToRight: 1082 1082 break; 1083 case U_EUROPEAN_NUMBER_SEPARATOR:1084 case U_EUROPEAN_NUMBER_TERMINATOR:1085 case U_COMMON_NUMBER_SEPARATOR:1086 case U_BOUNDARY_NEUTRAL:1087 case U_BLOCK_SEPARATOR:1088 case U_SEGMENT_SEPARATOR:1089 case U_WHITE_SPACE_NEUTRAL:1090 case U_OTHER_NEUTRAL:1091 if (bidi.status.eor == U_EUROPEAN_NUMBER) {1092 if (bidi.status.lastStrong != U_LEFT_TO_RIGHT) {1083 case WTF::Unicode::EuropeanNumberSeparator: 1084 case WTF::Unicode::EuropeanNumberTerminator: 1085 case WTF::Unicode::CommonNumberSeparator: 1086 case WTF::Unicode::BoundaryNeutral: 1087 case WTF::Unicode::BlockSeparator: 1088 case WTF::Unicode::SegmentSeparator: 1089 case WTF::Unicode::WhiteSpaceNeutral: 1090 case WTF::Unicode::OtherNeutral: 1091 if (bidi.status.eor == WTF::Unicode::EuropeanNumber) { 1092 if (bidi.status.lastStrong != WTF::Unicode::LeftToRight) { 1093 1093 // the numbers need to be on a higher embedding level, so let's close that run 1094 bidi.dir = U_EUROPEAN_NUMBER;1094 bidi.dir = WTF::Unicode::EuropeanNumber; 1095 1095 appendRun(bidi); 1096 if (bidi.context->dir() != U_LEFT_TO_RIGHT) {1096 if (bidi.context->dir() != WTF::Unicode::LeftToRight) { 1097 1097 // the neutrals take the embedding direction, which is R 1098 1098 bidi.eor = bidi.last; 1099 bidi.dir = U_RIGHT_TO_LEFT;1099 bidi.dir = WTF::Unicode::RightToLeft; 1100 1100 appendRun(bidi); 1101 1101 } 1102 1102 } 1103 } else if (bidi.status.eor == U_ARABIC_NUMBER) {1103 } else if (bidi.status.eor == WTF::Unicode::ArabicNumber) { 1104 1104 // Arabic numbers are always on a higher embedding level, so let's close that run 1105 bidi.dir = U_ARABIC_NUMBER;1105 bidi.dir = WTF::Unicode::ArabicNumber; 1106 1106 appendRun(bidi); 1107 if (bidi.context->dir() != U_LEFT_TO_RIGHT) {1107 if (bidi.context->dir() != WTF::Unicode::LeftToRight) { 1108 1108 // the neutrals take the embedding direction, which is R 1109 1109 bidi.eor = bidi.last; 1110 bidi.dir = U_RIGHT_TO_LEFT;1110 bidi.dir = WTF::Unicode::RightToLeft; 1111 1111 appendRun(bidi); 1112 1112 } 1113 } else if(bidi.status.eor != U_LEFT_TO_RIGHT) {1113 } else if(bidi.status.eor != WTF::Unicode::LeftToRight) { 1114 1114 //last stuff takes embedding dir 1115 if (bidi.context->dir() != U_LEFT_TO_RIGHT && bidi.status.lastStrong != U_LEFT_TO_RIGHT) {1115 if (bidi.context->dir() != WTF::Unicode::LeftToRight && bidi.status.lastStrong != WTF::Unicode::LeftToRight) { 1116 1116 bidi.eor = bidi.last; 1117 bidi.dir = U_RIGHT_TO_LEFT;1117 bidi.dir = WTF::Unicode::RightToLeft; 1118 1118 } 1119 1119 appendRun(bidi); … … 1123 1123 } 1124 1124 bidi.eor = bidi.current; 1125 bidi.status.eor = U_LEFT_TO_RIGHT;1126 bidi.status.lastStrong = U_LEFT_TO_RIGHT;1127 bidi.dir = U_LEFT_TO_RIGHT;1125 bidi.status.eor = WTF::Unicode::LeftToRight; 1126 bidi.status.lastStrong = WTF::Unicode::LeftToRight; 1127 bidi.dir = WTF::Unicode::LeftToRight; 1128 1128 break; 1129 case U_RIGHT_TO_LEFT_ARABIC:1130 case U_RIGHT_TO_LEFT:1129 case WTF::Unicode::RightToLeftArabic: 1130 case WTF::Unicode::RightToLeft: 1131 1131 switch (bidi.status.last) { 1132 case U_LEFT_TO_RIGHT:1133 case U_EUROPEAN_NUMBER:1134 case U_ARABIC_NUMBER:1132 case WTF::Unicode::LeftToRight: 1133 case WTF::Unicode::EuropeanNumber: 1134 case WTF::Unicode::ArabicNumber: 1135 1135 appendRun(bidi); 1136 case U_RIGHT_TO_LEFT:1137 case U_RIGHT_TO_LEFT_ARABIC:1136 case WTF::Unicode::RightToLeft: 1137 case WTF::Unicode::RightToLeftArabic: 1138 1138 break; 1139 case U_EUROPEAN_NUMBER_SEPARATOR:1140 case U_EUROPEAN_NUMBER_TERMINATOR:1141 case U_COMMON_NUMBER_SEPARATOR:1142 case U_BOUNDARY_NEUTRAL:1143 case U_BLOCK_SEPARATOR:1144 case U_SEGMENT_SEPARATOR:1145 case U_WHITE_SPACE_NEUTRAL:1146 case U_OTHER_NEUTRAL:1147 if (bidi.status.eor != U_RIGHT_TO_LEFT && bidi.status.eor != U_RIGHT_TO_LEFT_ARABIC) {1139 case WTF::Unicode::EuropeanNumberSeparator: 1140 case WTF::Unicode::EuropeanNumberTerminator: 1141 case WTF::Unicode::CommonNumberSeparator: 1142 case WTF::Unicode::BoundaryNeutral: 1143 case WTF::Unicode::BlockSeparator: 1144 case WTF::Unicode::SegmentSeparator: 1145 case WTF::Unicode::WhiteSpaceNeutral: 1146 case WTF::Unicode::OtherNeutral: 1147 if (bidi.status.eor != WTF::Unicode::RightToLeft && bidi.status.eor != WTF::Unicode::RightToLeftArabic) { 1148 1148 //last stuff takes embedding dir 1149 if (bidi.context->dir() != U_RIGHT_TO_LEFT && bidi.status.lastStrong != U_RIGHT_TO_LEFT1150 && bidi.status.lastStrong != U_RIGHT_TO_LEFT_ARABIC) {1149 if (bidi.context->dir() != WTF::Unicode::RightToLeft && bidi.status.lastStrong != WTF::Unicode::RightToLeft 1150 && bidi.status.lastStrong != WTF::Unicode::RightToLeftArabic) { 1151 1151 bidi.eor = bidi.last; 1152 bidi.dir = U_LEFT_TO_RIGHT;1152 bidi.dir = WTF::Unicode::LeftToRight; 1153 1153 } 1154 1154 appendRun(bidi); … … 1158 1158 } 1159 1159 bidi.eor = bidi.current; 1160 bidi.status.eor = U_RIGHT_TO_LEFT;1160 bidi.status.eor = WTF::Unicode::RightToLeft; 1161 1161 bidi.status.lastStrong = dirCurrent; 1162 bidi.dir = U_RIGHT_TO_LEFT;1162 bidi.dir = WTF::Unicode::RightToLeft; 1163 1163 break; 1164 1164 1165 1165 // weak types: 1166 1166 1167 case U_EUROPEAN_NUMBER:1168 if (bidi.status.lastStrong != U_RIGHT_TO_LEFT_ARABIC) {1167 case WTF::Unicode::EuropeanNumber: 1168 if (bidi.status.lastStrong != WTF::Unicode::RightToLeftArabic) { 1169 1169 // if last strong was AL change EN to AN 1170 1170 switch (bidi.status.last) { 1171 case U_EUROPEAN_NUMBER:1172 case U_LEFT_TO_RIGHT:1171 case WTF::Unicode::EuropeanNumber: 1172 case WTF::Unicode::LeftToRight: 1173 1173 break; 1174 case U_RIGHT_TO_LEFT:1175 case U_RIGHT_TO_LEFT_ARABIC:1176 case U_ARABIC_NUMBER:1174 case WTF::Unicode::RightToLeft: 1175 case WTF::Unicode::RightToLeftArabic: 1176 case WTF::Unicode::ArabicNumber: 1177 1177 bidi.eor = bidi.last; 1178 1178 appendRun(bidi); 1179 bidi.dir = U_EUROPEAN_NUMBER;1179 bidi.dir = WTF::Unicode::EuropeanNumber; 1180 1180 break; 1181 case U_EUROPEAN_NUMBER_SEPARATOR:1182 case U_COMMON_NUMBER_SEPARATOR:1183 if (bidi.status.eor == U_EUROPEAN_NUMBER)1181 case WTF::Unicode::EuropeanNumberSeparator: 1182 case WTF::Unicode::CommonNumberSeparator: 1183 if (bidi.status.eor == WTF::Unicode::EuropeanNumber) 1184 1184 break; 1185 case U_EUROPEAN_NUMBER_TERMINATOR:1186 case U_BOUNDARY_NEUTRAL:1187 case U_BLOCK_SEPARATOR:1188 case U_SEGMENT_SEPARATOR:1189 case U_WHITE_SPACE_NEUTRAL:1190 case U_OTHER_NEUTRAL:1191 if (bidi.status.eor == U_RIGHT_TO_LEFT) {1185 case WTF::Unicode::EuropeanNumberTerminator: 1186 case WTF::Unicode::BoundaryNeutral: 1187 case WTF::Unicode::BlockSeparator: 1188 case WTF::Unicode::SegmentSeparator: 1189 case WTF::Unicode::WhiteSpaceNeutral: 1190 case WTF::Unicode::OtherNeutral: 1191 if (bidi.status.eor == WTF::Unicode::RightToLeft) { 1192 1192 // neutrals go to R 1193 bidi.eor = bidi.status.last == U_EUROPEAN_NUMBER_TERMINATOR? bidi.lastBeforeET : bidi.last;1193 bidi.eor = bidi.status.last == WTF::Unicode::EuropeanNumberTerminator ? bidi.lastBeforeET : bidi.last; 1194 1194 appendRun(bidi); 1195 bidi.dir = U_EUROPEAN_NUMBER;1196 } else if (bidi.status.eor != U_LEFT_TO_RIGHT&&1197 (bidi.status.eor != U_EUROPEAN_NUMBER || bidi.status.lastStrong != U_LEFT_TO_RIGHT) &&1198 bidi.dir != U_LEFT_TO_RIGHT) {1195 bidi.dir = WTF::Unicode::EuropeanNumber; 1196 } else if (bidi.status.eor != WTF::Unicode::LeftToRight && 1197 (bidi.status.eor != WTF::Unicode::EuropeanNumber || bidi.status.lastStrong != WTF::Unicode::LeftToRight) && 1198 bidi.dir != WTF::Unicode::LeftToRight) { 1199 1199 // numbers on both sides, neutrals get right to left direction 1200 1200 appendRun(bidi); 1201 bidi.eor = bidi.status.last == U_EUROPEAN_NUMBER_TERMINATOR? bidi.lastBeforeET : bidi.last;1202 bidi.dir = U_RIGHT_TO_LEFT;1201 bidi.eor = bidi.status.last == WTF::Unicode::EuropeanNumberTerminator ? bidi.lastBeforeET : bidi.last; 1202 bidi.dir = WTF::Unicode::RightToLeft; 1203 1203 appendRun(bidi); 1204 bidi.dir = U_EUROPEAN_NUMBER;1204 bidi.dir = WTF::Unicode::EuropeanNumber; 1205 1205 } 1206 1206 default: … … 1208 1208 } 1209 1209 bidi.eor = bidi.current; 1210 bidi.status.eor = U_EUROPEAN_NUMBER;1211 if (bidi.dir == U_OTHER_NEUTRAL)1212 bidi.dir = U_LEFT_TO_RIGHT;1210 bidi.status.eor = WTF::Unicode::EuropeanNumber; 1211 if (bidi.dir == WTF::Unicode::OtherNeutral) 1212 bidi.dir = WTF::Unicode::LeftToRight; 1213 1213 break; 1214 1214 } 1215 case U_ARABIC_NUMBER:1216 dirCurrent = U_ARABIC_NUMBER;1215 case WTF::Unicode::ArabicNumber: 1216 dirCurrent = WTF::Unicode::ArabicNumber; 1217 1217 switch (bidi.status.last) { 1218 case U_LEFT_TO_RIGHT:1219 if (bidi.context->dir() == U_LEFT_TO_RIGHT)1218 case WTF::Unicode::LeftToRight: 1219 if (bidi.context->dir() == WTF::Unicode::LeftToRight) 1220 1220 appendRun(bidi); 1221 1221 break; 1222 case U_ARABIC_NUMBER:1222 case WTF::Unicode::ArabicNumber: 1223 1223 break; 1224 case U_RIGHT_TO_LEFT:1225 case U_RIGHT_TO_LEFT_ARABIC:1226 case U_EUROPEAN_NUMBER:1224 case WTF::Unicode::RightToLeft: 1225 case WTF::Unicode::RightToLeftArabic: 1226 case WTF::Unicode::EuropeanNumber: 1227 1227 bidi.eor = bidi.last; 1228 1228 appendRun(bidi); 1229 1229 break; 1230 case U_COMMON_NUMBER_SEPARATOR:1231 if (bidi.status.eor == U_ARABIC_NUMBER)1230 case WTF::Unicode::CommonNumberSeparator: 1231 if (bidi.status.eor == WTF::Unicode::ArabicNumber) 1232 1232 break; 1233 case U_EUROPEAN_NUMBER_SEPARATOR:1234 case U_EUROPEAN_NUMBER_TERMINATOR:1235 case U_BOUNDARY_NEUTRAL:1236 case U_BLOCK_SEPARATOR:1237 case U_SEGMENT_SEPARATOR:1238 case U_WHITE_SPACE_NEUTRAL:1239 case U_OTHER_NEUTRAL:1240 if (bidi.status.eor != U_RIGHT_TO_LEFT && bidi.status.eor != U_RIGHT_TO_LEFT_ARABIC) {1233 case WTF::Unicode::EuropeanNumberSeparator: 1234 case WTF::Unicode::EuropeanNumberTerminator: 1235 case WTF::Unicode::BoundaryNeutral: 1236 case WTF::Unicode::BlockSeparator: 1237 case WTF::Unicode::SegmentSeparator: 1238 case WTF::Unicode::WhiteSpaceNeutral: 1239 case WTF::Unicode::OtherNeutral: 1240 if (bidi.status.eor != WTF::Unicode::RightToLeft && bidi.status.eor != WTF::Unicode::RightToLeftArabic) { 1241 1241 // run of L before neutrals, neutrals take embedding dir (N2) 1242 if (bidi.context->dir() == U_RIGHT_TO_LEFT || bidi.status.lastStrong == U_RIGHT_TO_LEFT1243 || bidi.status.lastStrong == U_RIGHT_TO_LEFT_ARABIC) {1242 if (bidi.context->dir() == WTF::Unicode::RightToLeft || bidi.status.lastStrong == WTF::Unicode::RightToLeft 1243 || bidi.status.lastStrong == WTF::Unicode::RightToLeftArabic) { 1244 1244 // the embedding direction is R 1245 1245 // close the L run 1246 1246 appendRun(bidi); 1247 1247 // neutrals become an R run 1248 bidi.dir = U_RIGHT_TO_LEFT;1248 bidi.dir = WTF::Unicode::RightToLeft; 1249 1249 } else { 1250 1250 // the embedding direction is L 1251 1251 // append neutrals to the L run and close it 1252 bidi.dir = U_LEFT_TO_RIGHT;1252 bidi.dir = WTF::Unicode::LeftToRight; 1253 1253 } 1254 1254 } … … 1259 1259 } 1260 1260 bidi.eor = bidi.current; 1261 bidi.status.eor = U_ARABIC_NUMBER;1262 if (bidi.dir == U_OTHER_NEUTRAL)1263 bidi.dir = U_ARABIC_NUMBER;1261 bidi.status.eor = WTF::Unicode::ArabicNumber; 1262 if (bidi.dir == WTF::Unicode::OtherNeutral) 1263 bidi.dir = WTF::Unicode::ArabicNumber; 1264 1264 break; 1265 case U_EUROPEAN_NUMBER_SEPARATOR:1266 case U_COMMON_NUMBER_SEPARATOR:1265 case WTF::Unicode::EuropeanNumberSeparator: 1266 case WTF::Unicode::CommonNumberSeparator: 1267 1267 break; 1268 case U_EUROPEAN_NUMBER_TERMINATOR:1269 if (bidi.status.last == U_EUROPEAN_NUMBER) {1270 dirCurrent = U_EUROPEAN_NUMBER;1268 case WTF::Unicode::EuropeanNumberTerminator: 1269 if (bidi.status.last == WTF::Unicode::EuropeanNumber) { 1270 dirCurrent = WTF::Unicode::EuropeanNumber; 1271 1271 bidi.eor = bidi.current; 1272 1272 bidi.status.eor = dirCurrent; 1273 } else if (bidi.status.last != U_EUROPEAN_NUMBER_TERMINATOR)1273 } else if (bidi.status.last != WTF::Unicode::EuropeanNumberTerminator) 1274 1274 bidi.lastBeforeET = emptyRun ? bidi.eor : bidi.last; 1275 1275 break; 1276 1276 1277 1277 // boundary neutrals should be ignored 1278 case U_BOUNDARY_NEUTRAL:1278 case WTF::Unicode::BoundaryNeutral: 1279 1279 if (bidi.eor == bidi.last) 1280 1280 bidi.eor = bidi.current; 1281 1281 break; 1282 1282 // neutrals 1283 case U_BLOCK_SEPARATOR:1283 case WTF::Unicode::BlockSeparator: 1284 1284 // ### what do we do with newline and paragraph seperators that come to here? 1285 1285 break; 1286 case U_SEGMENT_SEPARATOR:1286 case WTF::Unicode::SegmentSeparator: 1287 1287 // ### implement rule L1 1288 1288 break; 1289 case U_WHITE_SPACE_NEUTRAL:1289 case WTF::Unicode::WhiteSpaceNeutral: 1290 1290 break; 1291 case U_OTHER_NEUTRAL:1291 case WTF::Unicode::OtherNeutral: 1292 1292 break; 1293 1293 default: … … 1300 1300 bidi.eor = bidi.endOfLine; 1301 1301 switch (bidi.status.eor) { 1302 case U_LEFT_TO_RIGHT:1303 case U_RIGHT_TO_LEFT:1304 case U_ARABIC_NUMBER:1302 case WTF::Unicode::LeftToRight: 1303 case WTF::Unicode::RightToLeft: 1304 case WTF::Unicode::ArabicNumber: 1305 1305 bidi.dir = bidi.status.eor; 1306 1306 break; 1307 case U_EUROPEAN_NUMBER:1308 bidi.dir = bidi.status.lastStrong == U_LEFT_TO_RIGHT ? U_LEFT_TO_RIGHT : U_EUROPEAN_NUMBER;1307 case WTF::Unicode::EuropeanNumber: 1308 bidi.dir = bidi.status.lastStrong == WTF::Unicode::LeftToRight ? WTF::Unicode::LeftToRight : WTF::Unicode::EuropeanNumber; 1309 1309 break; 1310 1310 default: … … 1314 1314 } 1315 1315 bidi = stateAtEnd; 1316 bidi.dir = U_OTHER_NEUTRAL;1316 bidi.dir = WTF::Unicode::OtherNeutral; 1317 1317 break; 1318 1318 } … … 1321 1321 // set status.last as needed. 1322 1322 switch (dirCurrent) { 1323 case U_EUROPEAN_NUMBER_TERMINATOR:1324 if (bidi.status.last != U_EUROPEAN_NUMBER)1325 bidi.status.last = U_EUROPEAN_NUMBER_TERMINATOR;1323 case WTF::Unicode::EuropeanNumberTerminator: 1324 if (bidi.status.last != WTF::Unicode::EuropeanNumber) 1325 bidi.status.last = WTF::Unicode::EuropeanNumberTerminator; 1326 1326 break; 1327 case U_EUROPEAN_NUMBER_SEPARATOR:1328 case U_COMMON_NUMBER_SEPARATOR:1329 case U_SEGMENT_SEPARATOR:1330 case U_WHITE_SPACE_NEUTRAL:1331 case U_OTHER_NEUTRAL:1327 case WTF::Unicode::EuropeanNumberSeparator: 1328 case WTF::Unicode::CommonNumberSeparator: 1329 case WTF::Unicode::SegmentSeparator: 1330 case WTF::Unicode::WhiteSpaceNeutral: 1331 case WTF::Unicode::OtherNeutral: 1332 1332 switch(bidi.status.last) { 1333 case U_LEFT_TO_RIGHT:1334 case U_RIGHT_TO_LEFT:1335 case U_RIGHT_TO_LEFT_ARABIC:1336 case U_EUROPEAN_NUMBER:1337 case U_ARABIC_NUMBER:1333 case WTF::Unicode::LeftToRight: 1334 case WTF::Unicode::RightToLeft: 1335 case WTF::Unicode::RightToLeftArabic: 1336 case WTF::Unicode::EuropeanNumber: 1337 case WTF::Unicode::ArabicNumber: 1338 1338 bidi.status.last = dirCurrent; 1339 1339 break; 1340 1340 default: 1341 bidi.status.last = U_OTHER_NEUTRAL;1341 bidi.status.last = WTF::Unicode::OtherNeutral; 1342 1342 } 1343 1343 break; 1344 case U_DIR_NON_SPACING_MARK:1345 case U_BOUNDARY_NEUTRAL:1346 case U_RIGHT_TO_LEFT_EMBEDDING:1347 case U_LEFT_TO_RIGHT_EMBEDDING:1348 case U_RIGHT_TO_LEFT_OVERRIDE:1349 case U_LEFT_TO_RIGHT_OVERRIDE:1350 case U_POP_DIRECTIONAL_FORMAT:1344 case WTF::Unicode::NonSpacingMark: 1345 case WTF::Unicode::BoundaryNeutral: 1346 case WTF::Unicode::RightToLeftEmbedding: 1347 case WTF::Unicode::LeftToRightEmbedding: 1348 case WTF::Unicode::RightToLeftOverride: 1349 case WTF::Unicode::LeftToRightOverride: 1350 case WTF::Unicode::PopDirectionalFormat: 1351 1351 // ignore these 1352 1352 break; 1353 case U_EUROPEAN_NUMBER:1353 case WTF::Unicode::EuropeanNumber: 1354 1354 // fall through 1355 1355 default: … … 1359 1359 bidi.last = bidi.current; 1360 1360 1361 if (emptyRun && !(dirCurrent == U_RIGHT_TO_LEFT_EMBEDDING1362 || dirCurrent == U_LEFT_TO_RIGHT_EMBEDDING1363 || dirCurrent == U_RIGHT_TO_LEFT_OVERRIDE1364 || dirCurrent == U_LEFT_TO_RIGHT_OVERRIDE1365 || dirCurrent == U_POP_DIRECTIONAL_FORMAT)) {1361 if (emptyRun && !(dirCurrent == WTF::Unicode::RightToLeftEmbedding 1362 || dirCurrent == WTF::Unicode::LeftToRightEmbedding 1363 || dirCurrent == WTF::Unicode::RightToLeftOverride 1364 || dirCurrent == WTF::Unicode::LeftToRightOverride 1365 || dirCurrent == WTF::Unicode::PopDirectionalFormat)) { 1366 1366 bidi.sor = bidi.current; 1367 1367 emptyRun = false; … … 1373 1373 bidi.current.increment(bidi); 1374 1374 bidi.adjustEmbedding = false; 1375 if (emptyRun && (dirCurrent == U_RIGHT_TO_LEFT_EMBEDDING1376 || dirCurrent == U_LEFT_TO_RIGHT_EMBEDDING1377 || dirCurrent == U_RIGHT_TO_LEFT_OVERRIDE1378 || dirCurrent == U_LEFT_TO_RIGHT_OVERRIDE1379 || dirCurrent == U_POP_DIRECTIONAL_FORMAT)) {1375 if (emptyRun && (dirCurrent == WTF::Unicode::RightToLeftEmbedding 1376 || dirCurrent == WTF::Unicode::LeftToRightEmbedding 1377 || dirCurrent == WTF::Unicode::RightToLeftOverride 1378 || dirCurrent == WTF::Unicode::LeftToRightOverride 1379 || dirCurrent == WTF::Unicode::PopDirectionalFormat)) { 1380 1380 // exclude the embedding char itself from the new run so that ATSUI will never see it 1381 1381 bidi.eor.obj = 0; … … 1560 1560 BidiContext *startEmbed; 1561 1561 if (style()->direction() == LTR) { 1562 startEmbed = new BidiContext( 0, U_LEFT_TO_RIGHT, NULL, style()->unicodeBidi() == Override );1563 bidi.status.eor = U_LEFT_TO_RIGHT;1562 startEmbed = new BidiContext( 0, WTF::Unicode::LeftToRight, NULL, style()->unicodeBidi() == Override ); 1563 bidi.status.eor = WTF::Unicode::LeftToRight; 1564 1564 } else { 1565 startEmbed = new BidiContext( 1, U_RIGHT_TO_LEFT, NULL, style()->unicodeBidi() == Override );1566 bidi.status.eor = U_RIGHT_TO_LEFT;1565 startEmbed = new BidiContext( 1, WTF::Unicode::RightToLeft, NULL, style()->unicodeBidi() == Override ); 1566 bidi.status.eor = WTF::Unicode::RightToLeft; 1567 1567 } 1568 1568 … … 1571 1571 bidi.status.eor = startEmbed->dir(); 1572 1572 bidi.context = startEmbed; 1573 bidi.dir = U_OTHER_NEUTRAL;1573 bidi.dir = WTF::Unicode::OtherNeutral; 1574 1574 1575 1575 if (!smidpoints) -
trunk/WebCore/rendering/bidi.h
r17338 r18098 25 25 #define BIDI_H 26 26 27 #include < unicode/uchar.h>27 #include <wtf/unicode/Unicode.h> 28 28 29 29 namespace WebCore { … … 36 36 struct BidiStatus { 37 37 BidiStatus() 38 : eor( U_OTHER_NEUTRAL)39 , lastStrong( U_OTHER_NEUTRAL)40 , last( U_OTHER_NEUTRAL)38 : eor(WTF::Unicode::OtherNeutral) 39 , lastStrong(WTF::Unicode::OtherNeutral) 40 , last(WTF::Unicode::OtherNeutral) 41 41 { 42 42 } 43 43 44 UCharDirection eor;45 UCharDirection lastStrong;46 UCharDirection last;44 WTF::Unicode::Direction eor; 45 WTF::Unicode::Direction lastStrong; 46 WTF::Unicode::Direction last; 47 47 }; 48 48 49 49 class BidiContext { 50 50 public: 51 BidiContext(unsigned char level, UCharDirection embedding, BidiContext* parent = 0, bool override = false);51 BidiContext(unsigned char level, WTF::Unicode::Direction embedding, BidiContext* parent = 0, bool override = false); 52 52 ~BidiContext(); 53 53 … … 55 55 void deref() const; 56 56 57 UCharDirection dir() const { return static_cast<UCharDirection>(m_dir); }58 UCharDirection basicDir() const { return static_cast<UCharDirection>(m_basicDir); }57 WTF::Unicode::Direction dir() const { return static_cast<WTF::Unicode::Direction>(m_dir); } 58 WTF::Unicode::Direction basicDir() const { return static_cast<WTF::Unicode::Direction>(m_basicDir); } 59 59 60 60 unsigned char level; 61 61 bool override : 1; 62 unsigned m_dir : 5; // UCharDirection63 unsigned m_basicDir : 5; // UCharDirection62 unsigned m_dir : 5; // WTF::Unicode::Direction 63 unsigned m_basicDir : 5; // WTF::Unicode::Direction 64 64 65 65 BidiContext* parent; … … 70 70 71 71 struct BidiRun { 72 BidiRun(int start_, int stop_, RenderObject* o, BidiContext* context, UCharDirection dir)72 BidiRun(int start_, int stop_, RenderObject* o, BidiContext* context, WTF::Unicode::Direction dir) 73 73 : start(start_) 74 74 , stop(stop_) … … 78 78 , nextRun(0) 79 79 { 80 if (dir == U_OTHER_NEUTRAL)80 if (dir == WTF::Unicode::OtherNeutral) 81 81 dir = context->dir(); 82 82 … … 85 85 // add level of run (cases I1 & I2) 86 86 if (level % 2) { 87 if(dir == U_LEFT_TO_RIGHT || dir == U_ARABIC_NUMBER || dir == U_EUROPEAN_NUMBER)87 if(dir == WTF::Unicode::LeftToRight || dir == WTF::Unicode::ArabicNumber || dir == WTF::Unicode::EuropeanNumber) 88 88 level++; 89 89 } else { 90 if (dir == U_RIGHT_TO_LEFT)90 if (dir == WTF::Unicode::RightToLeft) 91 91 level++; 92 else if (dir == U_ARABIC_NUMBER || dir == U_EUROPEAN_NUMBER)92 else if (dir == WTF::Unicode::ArabicNumber || dir == WTF::Unicode::EuropeanNumber) 93 93 level += 2; 94 94 } -
trunk/WebCore/rendering/break_lines.h
r17338 r18098 24 24 #define break_lines_h 25 25 26 #include " UChar.h"26 #include "wtf/unicode/Unicode.h" 27 27 28 28 namespace WebCore { -
trunk/WebKit/ChangeLog
r18093 r18098 1 2006-12-08 David Hyatt <hyatt@apple.com> 2 3 Land new ICU abstraction layer. Patch by Lars. 4 5 Reviewed by me 6 7 * ForwardingHeaders/wtf/icu/UnicodeIcu.h: Added. 8 * ForwardingHeaders/wtf/unicode/Unicode.h: Added. 9 * WebKit.xcodeproj/project.pbxproj: 10 1 11 === Safari-521.32 === 2 12 -
trunk/WebKit/WebKit.xcodeproj/project.pbxproj
r18057 r18098 303 303 }; 304 304 /* End PBXBuildRule section */ 305 306 /* Begin PBXBuildStyle section */ 307 BC4C659F0B2A487B00E57352 /* Development */ = { 308 isa = PBXBuildStyle; 309 buildSettings = { 310 COPY_PHASE_STRIP = NO; 311 }; 312 name = Development; 313 }; 314 BC4C65A00B2A487B00E57352 /* Deployment */ = { 315 isa = PBXBuildStyle; 316 buildSettings = { 317 COPY_PHASE_STRIP = YES; 318 }; 319 name = Deployment; 320 }; 321 /* End PBXBuildStyle section */ 305 322 306 323 /* Begin PBXFileReference section */ … … 1263 1280 isa = PBXProject; 1264 1281 buildConfigurationList = 149C283208902B0F008A9EFC /* Build configuration list for PBXProject "WebKit" */; 1282 buildSettings = { 1283 }; 1284 buildStyles = ( 1285 BC4C659F0B2A487B00E57352 /* Development */, 1286 BC4C65A00B2A487B00E57352 /* Deployment */, 1287 ); 1265 1288 hasScannedForEncodings = 1; 1266 1289 knownRegions = ( … … 1276 1299 productRefGroup = 034768DFFF38A50411DB9C8B /* Products */; 1277 1300 projectDirPath = ""; 1278 projectRoot = "";1279 1301 targets = ( 1280 1302 9398100A0824BF01008DF038 /* WebKit */,
Note: See TracChangeset
for help on using the changeset viewer.