Changeset 18354 in webkit for trunk/JavaScriptCore/kjs
- Timestamp:
- Dec 20, 2006, 12:11:47 PM (18 years ago)
- Location:
- trunk/JavaScriptCore/kjs
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/JavaScriptCore/kjs/string_object.cpp
r17372 r18354 31 31 #include "regexp_object.h" 32 32 #include <wtf/unicode/Unicode.h> 33 34 #if PLATFORM(CF) 35 #include <CoreFoundation/CoreFoundation.h> 36 #endif 33 37 34 38 using namespace KJS; … … 126 130 toLocaleLowerCase StringProtoFunc::ToLocaleLowerCase DontEnum|Function 0 127 131 toLocaleUpperCase StringProtoFunc::ToLocaleUpperCase DontEnum|Function 0 132 localeCompare StringProtoFunc::LocaleCompare DontEnum|Function 1 128 133 # 129 134 # Under here: html extension, should only exist if KJS_PURE_ECMA is not defined … … 277 282 return substitutedReplacement; 278 283 } 284 285 #if PLATFORM(WIN_OS) 286 static inline int localeCompare(const UString& a, const UString& b) 287 { 288 return CompareStringW(LOCALE_USER_DEFAULT, 0, 289 a.data(), a.length(), 290 b.data(), b.length()); 291 } 292 #elif PLATFORM(CF) 293 static inline int localeCompare(const UString& a, const UString& b) 294 { 295 CFStringRef sa = CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, reinterpret_cast<const UniChar*>(a.data()), a.size(), kCFAllocatorNull); 296 CFStringRef sb = CFStringCreateWithCharactersNoCopy(kCFAllocatorDefault, reinterpret_cast<const UniChar*>(b.data()), b.size(), kCFAllocatorNull); 297 298 int retval = CFStringCompare(sa, sb, kCFCompareLocalized); 299 300 CFRelease(sa); 301 CFRelease(sb); 302 303 return retval; 304 } 305 #else 306 static inline int localeCompare(const UString& a, const UString& b) 307 { 308 return compare(a, b); 309 } 310 #endif 279 311 280 312 static JSValue *replace(ExecState *exec, const UString &source, JSValue *pattern, JSValue *replacement) … … 675 707 break; 676 708 } 709 case LocaleCompare: 710 return jsNumber(localeCompare(s, a0->toString(exec))); 677 711 #ifndef KJS_PURE_ECMA 678 712 case Big: -
trunk/JavaScriptCore/kjs/string_object.h
r15846 r18354 84 84 Match, Replace, Search, Slice, Split, 85 85 Substr, Substring, FromCharCode, ToLowerCase, ToUpperCase, 86 ToLocaleLowerCase, ToLocaleUpperCase 86 ToLocaleLowerCase, ToLocaleUpperCase, LocaleCompare 87 87 #ifndef KJS_PURE_ECMA 88 88 , Big, Small, Blink, Bold, Fixed, Italics, Strike, Sub, Sup,
Note:
See TracChangeset
for help on using the changeset viewer.