Changeset 172975 in webkit
- Timestamp:
- Aug 26, 2014, 2:06:07 PM (12 years ago)
- Location:
- trunk/Source
- Files:
-
- 2 added
- 19 edited
-
WebCore/ChangeLog (modified) (1 diff)
-
WebCore/WebCore.exp.in (modified) (2 diffs)
-
WebCore/WebCore.order (modified) (1 diff)
-
WebCore/WebCore.xcodeproj/project.pbxproj (modified) (2 diffs)
-
WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm (modified) (1 diff)
-
WebCore/platform/mac/Language.mm (modified) (2 diffs)
-
WebCore/platform/mac/WebCoreNSStringExtras.h (modified) (1 diff)
-
WebCore/platform/mac/WebCoreNSStringExtras.mm (modified) (2 diffs)
-
WebCore/platform/mac/WebCoreSystemInterface.h (modified) (1 diff)
-
WebCore/platform/mac/WebCoreSystemInterface.mm (modified) (1 diff)
-
WebCore/platform/spi/cf (added)
-
WebCore/platform/spi/cf/CFLocaleSPI.h (added)
-
WebKit/mac/ChangeLog (modified) (1 diff)
-
WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm (modified) (2 diffs)
-
WebKit/mac/Plugins/WebBasePluginPackage.mm (modified) (4 diffs)
-
WebKit/mac/WebCoreSupport/WebSystemInterface.mm (modified) (1 diff)
-
WebKit/mac/WebKit.order (modified) (2 diffs)
-
WebKit2/ChangeLog (modified) (1 diff)
-
WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm (modified) (3 diffs)
-
WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm (modified) (1 diff)
-
WebKit2/mac/WebKit2.order (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Source/WebCore/ChangeLog
r172973 r172975 1 2014-08-25 Maciej Stachowiak <mjs@apple.com> 2 3 Replace use of WKCopyCFLocalizationPreferredName with NSLocale public API 4 https://bugs.webkit.org/show_bug.cgi?id=136082 5 6 Reviewed by Alexey Proskuryakov. 7 8 * platform/mac/Language.mm: 9 (WebCore::httpStyleLanguageCode): Replace use of WKCopyCFLocalizationPreferredName 10 with new WebCoreNSStringExtras helper. 11 * platform/mac/WebCoreNSStringExtras.mm: Replacements for the aspects of 12 WKCopyCFLocalizationPreferredName. 13 (preferredBundleLocalizationName): New helper - most preferred localization available 14 in the main bundle, canonicalized the way we like it. 15 (canonicalLocalizationName): Convert a lcalization name to a string with language and 16 country code, using default if necessary (e.g. "en" maps to "en_US"). 17 * WebCore.order: Remove mention of WKCopyCFLocalizationPreferredName. 18 * WebCore.exp.in: ditto; also export preferredBundleLocalizationName for WebKit(2). 19 * platform/ios/WebCoreSystemInterfaceIOS.mm: ditto 20 * platform/mac/WebCoreSystemInterface.h: ditto 21 * platform/mac/WebCoreSystemInterface.mm: ditto 22 * platform/spi/cf: Added. 23 * platform/spi/cf/CFLocaleSPI.h: Added. Declare 24 CFLocaleGetLanguageRegionEncodingForLocaleIdentifier. 25 1 26 2014-08-26 Zoltan Horvath <zoltan@webkit.org> 2 27 -
trunk/Source/WebCore/WebCore.exp.in
r172946 r172975 2078 2078 _hasCaseInsensitiveSubstring 2079 2079 _hasCaseInsensitiveSuffix 2080 _preferredBundleLocalizationName 2080 2081 _stringIsCaseInsensitiveEqualToString 2081 2082 _suggestedFilenameWithMIMEType … … 2088 2089 _wkCGPatternCreateWithImageAndTransform 2089 2090 _wkCTRunGetInitialAdvance 2090 _wkCopyCFLocalizationPreferredName2091 2091 _wkCopyCFURLResponseSuggestedFilename 2092 2092 _wkCopyCONNECTProxyResponse -
trunk/Source/WebCore/WebCore.order
r172930 r172975 30591 30591 _wkCGContextDrawsWithCorrectShadowOffsets 30592 30592 _wkCGPatternCreateWithImageAndTransform 30593 _wkCopyCFLocalizationPreferredName30594 30593 _wkCopyNSURLResponseStatusLine 30595 30594 _wkCopyNSURLResponseCertificateChain -
trunk/Source/WebCore/WebCore.xcodeproj/project.pbxproj
r172963 r172975 9232 9232 637B7ADE0E8767B800E32194 /* ElementRareData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ElementRareData.h; sourceTree = "<group>"; }; 9233 9233 63D7B32C0E78CD3F00F7617C /* NodeRenderStyle.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = NodeRenderStyle.h; sourceTree = "<group>"; }; 9234 65086DA719AC1719009AF46B /* CFLocaleSPI.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CFLocaleSPI.h; sourceTree = "<group>"; }; 9234 9235 650F53DB09D15DDA00C9B0C8 /* CSSGrammar.h */ = {isa = PBXFileReference; fileEncoding = 30; lastKnownFileType = sourcecode.c.h; path = CSSGrammar.h; sourceTree = "<group>"; }; 9235 9236 650FBF270D9AF046008FC292 /* SVGHKernElement.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = SVGHKernElement.cpp; sourceTree = "<group>"; }; … … 16158 16159 sourceTree = "<group>"; 16159 16160 }; 16161 65086DA619AC1719009AF46B /* cf */ = { 16162 isa = PBXGroup; 16163 children = ( 16164 65086DA719AC1719009AF46B /* CFLocaleSPI.h */, 16165 ); 16166 path = cf; 16167 sourceTree = "<group>"; 16168 }; 16160 16169 653EF83619A043AE0052202C /* spi */ = { 16161 16170 isa = PBXGroup; 16162 16171 children = ( 16172 65086DA619AC1719009AF46B /* cf */, 16163 16173 653EF83719A043AE0052202C /* cocoa */, 16164 16174 ); -
trunk/Source/WebCore/platform/ios/WebCoreSystemInterfaceIOS.mm
r172875 r172975 31 31 WEBCORE_EXPORT CGPatternRef (*wkCGPatternCreateWithImageAndTransform)(CGImageRef, CGAffineTransform, int); 32 32 WEBCORE_EXPORT void (*wkCGContextResetClip)(CGContextRef); 33 WEBCORE_EXPORT CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef);34 33 WEBCORE_EXPORT void (*wkClearGlyphVector)(void* glyphs); 35 34 WEBCORE_EXPORT OSStatus (*wkConvertCharToGlyphs)(void* styleGroup, const UniChar*, unsigned numCharacters, void* glyphs); -
trunk/Source/WebCore/platform/mac/Language.mm
r172875 r172975 28 28 29 29 #import "BlockExceptions.h" 30 #import "WebCore SystemInterface.h"30 #import "WebCoreNSStringExtras.h" 31 31 #import <mutex> 32 32 #import <wtf/Assertions.h> … … 78 78 namespace WebCore { 79 79 80 static String httpStyleLanguageCode(NSString *language Code)80 static String httpStyleLanguageCode(NSString *language) 81 81 { 82 // Look up the language code using CFBundle. 83 RetainPtr<CFStringRef> preferredLanguageCode = adoptCF(wkCopyCFLocalizationPreferredName((CFStringRef)languageCode)); 84 85 if (preferredLanguageCode) 86 languageCode = (NSString *)preferredLanguageCode.get(); 87 88 // Make the string lowercase. 89 NSString *lowercaseLanguageCode = [languageCode lowercaseString]; 90 91 // Turn a '_' into a '-' if it appears after a 2-letter language code. 92 if ([lowercaseLanguageCode length] >= 3 && [lowercaseLanguageCode characterAtIndex:2] == '_') { 93 RetainPtr<NSMutableString> mutableLanguageCode = adoptNS([lowercaseLanguageCode mutableCopy]); 94 [mutableLanguageCode.get() replaceCharactersInRange:NSMakeRange(2, 1) withString:@"-"]; 95 return mutableLanguageCode.get(); 96 } 97 98 return lowercaseLanguageCode; 82 return [[NSLocale canonicalLanguageIdentifierFromString:canonicalLocaleName(language)] lowercaseString]; 99 83 } 100 84 -
trunk/Source/WebCore/platform/mac/WebCoreNSStringExtras.h
r172875 r172975 49 49 #endif 50 50 51 NSString *preferredBundleLocalizationName(); 52 NSString *canonicalLocaleName(NSString *); 53 51 54 #ifdef __cplusplus 52 55 } -
trunk/Source/WebCore/platform/mac/WebCoreNSStringExtras.mm
r172875 r172975 29 29 #import "config.h" 30 30 #import "WebCoreNSStringExtras.h" 31 #import "CFLocaleSPI.h" 31 32 32 33 #import <wtf/RetainPtr.h> … … 128 129 129 130 #endif // !PLATFORM(IOS) 131 132 133 134 NSString *preferredBundleLocalizationName() 135 { 136 // FIXME: Any use of this function to pass localizations to another 137 // process is likely not completely right, since it only considers 138 // one localization. 139 NSArray *preferredLocalizations = [[NSBundle mainBundle] preferredLocalizations]; 140 if (!preferredLocalizations || ![preferredLocalizations count]) 141 return @"en_US"; 142 143 return canonicalLocaleName([preferredLocalizations objectAtIndex:0]); 144 } 145 146 NSString *canonicalLocaleName(NSString *language) 147 { 148 // FIXME: <rdar://problem/18083880> Replace use of Script Manager 149 // to canonicalize locales with a custom Web-specific table 150 LangCode languageCode; 151 RegionCode regionCode; 152 153 Boolean success = CFLocaleGetLanguageRegionEncodingForLocaleIdentifier((CFStringRef)language, &languageCode, ®ionCode, nullptr, nullptr); 154 if (!success) 155 return @"en_US"; 156 157 RetainPtr<CFStringRef> code = adoptCF(CFLocaleCreateCanonicalLocaleIdentifierFromScriptManagerCodes(0, languageCode, regionCode)); 158 return (NSString *)code.autorelease(); 159 } -
trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.h
r172875 r172975 150 150 void (*formUnschedule)(CFReadStreamRef, CFRunLoopRef, CFStringRef, void *), 151 151 void *context); 152 extern CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef);153 152 extern NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*); 154 153 extern CFArrayRef (*wkCopyNSURLResponseCertificateChain)(NSURLResponse*); -
trunk/Source/WebCore/platform/mac/WebCoreSystemInterface.mm
r172875 r172975 36 36 #endif 37 37 CGPatternRef (*wkCGPatternCreateWithImageAndTransform)(CGImageRef, CGAffineTransform, int); 38 CFStringRef (*wkCopyCFLocalizationPreferredName)(CFStringRef);39 38 NSString* (*wkCopyNSURLResponseStatusLine)(NSURLResponse*); 40 39 CFArrayRef (*wkCopyNSURLResponseCertificateChain)(NSURLResponse*); -
trunk/Source/WebKit/mac/ChangeLog
r172938 r172975 1 2014-08-25 Maciej Stachowiak <mjs@apple.com> 2 3 Replace use of WKCopyCFLocalizationPreferredName with NSLocale public API 4 https://bugs.webkit.org/show_bug.cgi?id=136082 5 6 Reviewed by Alexey Proskuryakov. 7 8 * Plugins/Hosted/NetscapePluginHostManager.mm: 9 (WebKit::NetscapePluginHostManager::spawnPluginHost): Get current 10 localization name using WebCore helper instead of SPI. 11 * Plugins/WebBasePluginPackage.mm: Fixed the include style for this 12 file. 13 (-[WebBasePluginPackage getPluginInfoFromPLists]): Get current 14 localization name using WebCore helper instead of SPI. 15 (+[WebBasePluginPackage preferredLocalizationName]): Deleted. This 16 helper no longer pulls its weight. 17 * WebCoreSupport/WebSystemInterface.mm: 18 (InitWebCoreSystemInterface): Remove mention of 19 WKCopyCFLocalizationPreferredName. 20 * WebKit.order: ditto 21 1 22 2014-08-25 Daniel Bates <dabates@apple.com> 2 23 -
trunk/Source/WebKit/mac/Plugins/Hosted/NetscapePluginHostManager.mm
r172875 r172975 33 33 #import "WebKitSystemInterface.h" 34 34 #import "WebNetscapePluginPackage.h" 35 #import <WebCore/WebCoreNSStringExtras.h> 35 36 #import <mach/mach_port.h> 36 37 #import <servers/bootstrap.h> … … 114 115 NSString *pluginHostAppExecutablePath = [[NSBundle bundleWithPath:pluginHostAppPath] executablePath]; 115 116 116 RetainPtr<CFStringRef> localization = adoptCF(WKCopyCFLocalizationPreferredName(NULL));117 118 117 NSDictionary *launchProperties = [[NSDictionary alloc] initWithObjectsAndKeys: 119 118 pluginHostAppExecutablePath, @"pluginHostPath", 120 119 [NSNumber numberWithInt:pluginArchitecture], @"cpuType", 121 (NSString *)localization.get(), @"localization",120 preferredBundleLocalizationName(), @"localization", 122 121 nil]; 123 122 -
trunk/Source/WebKit/mac/Plugins/WebBasePluginPackage.mm
r172875 r172975 27 27 */ 28 28 29 #import <WebKitLegacy/WebBasePluginPackage.h> 30 29 #import "WebBasePluginPackage.h" 30 31 #import "WebKitLogging.h" 32 #import "WebKitNSStringExtras.h" 33 #import "WebNetscapePluginPackage.h" 34 #import "WebPluginPackage.h" 35 #import "WebTypesInternal.h" 36 #import <WebCore/WebCoreNSStringExtras.h> 37 #import <WebCore/WebCoreObjCExtras.h> 31 38 #import <algorithm> 32 #import <WebCore/WebCoreObjCExtras.h> 33 #import <WebKitLegacy/WebKitNSStringExtras.h> 34 #import <WebKitLegacy/WebNetscapePluginPackage.h> 35 #import <WebKitLegacy/WebPluginPackage.h> 39 #import <mach-o/arch.h> 40 #import <mach-o/fat.h> 41 #import <mach-o/loader.h> 36 42 #import <runtime/InitializeThreading.h> 37 43 #import <wtf/Assertions.h> … … 42 48 #import <wtf/text/CString.h> 43 49 44 #import <WebKitSystemInterface.h>45 46 #import "WebKitLogging.h"47 #import "WebTypesInternal.h"48 49 #import <mach-o/arch.h>50 #import <mach-o/fat.h>51 #import <mach-o/loader.h>52 50 53 51 #define JavaCocoaPluginIdentifier "com.apple.JavaPluginCocoa" … … 89 87 90 88 return [pluginPackage autorelease]; 91 }92 93 + (NSString *)preferredLocalizationName94 {95 return CFBridgingRelease(WKCopyCFLocalizationPreferredName(NULL));96 89 } 97 90 … … 197 190 // If the plist isn't localized, have the plug-in recreate it in the preferred language. 198 191 NSString *localizationName = [pList objectForKey:WebPluginLocalizationNameKey]; 199 if (![localizationName isEqualToString: [[self class] preferredLocalizationName]])192 if (![localizationName isEqualToString:preferredBundleLocalizationName()]) 200 193 pList = [self pListForPath:pListPath createFile:YES]; 201 194 MIMETypes = [pList objectForKey:WebPluginMIMETypesKey]; -
trunk/Source/WebKit/mac/WebCoreSupport/WebSystemInterface.mm
r172875 r172975 58 58 INIT(CTFontTransformGlyphs); 59 59 #endif 60 INIT(CopyCFLocalizationPreferredName);61 60 INIT(CopyCONNECTProxyResponse); 62 61 INIT(CopyNSURLResponseStatusLine); -
trunk/Source/WebKit/mac/WebKit.order
r172875 r172975 27 27 +[WebView _shouldAutomaticTextReplacementBeEnabled] 28 28 +[WebView _shouldAutomaticSpellingCorrectionBeEnabled] 29 _WKCopyCFLocalizationPreferredName30 29 +[WebView(WebPrivate) _setDomainRelaxationForbidden:forURLScheme:] 31 30 +[WebView(WebPrivate) _registerURLSchemeAsAllowingLocalStorageAccessInPrivateBrowsing:] … … 850 849 -[WebBasePluginPackage isNativeLibraryData:] 851 850 -[WebBasePluginPackage pListForPath:createFile:] 852 +[WebBasePluginPackage preferredLocalizationName]853 851 -[WebPluginDatabase(Internal) _addPlugin:] 854 852 -[WebBasePluginPackage path] -
trunk/Source/WebKit2/ChangeLog
r172974 r172975 1 2014-08-25 Maciej Stachowiak <mjs@apple.com> 2 3 Replace use of WKCopyCFLocalizationPreferredName with NSLocale public API 4 https://bugs.webkit.org/show_bug.cgi?id=136082 5 6 Reviewed by Alexey Proskuryakov. 7 8 * UIProcess/Launcher/mac/ProcessLauncherMac.mm: 9 (WebKit::connectToService): Remove accidental leftover retrieval 10 of the localization. 11 (WebKit::createProcess): Get current localization name from 12 CFBundle API instead of using SPI. 13 * WebProcess/WebCoreSupport/mac/WebSystemInterface.mm: 14 (InitWebCoreSystemInterface): Remove mention of WKCopyCFLocalizationPreferredName 15 * mac/WebKit2.order: ditto 16 1 17 2014-08-26 Dana Burkart <dburkart@apple.com> 2 18 -
trunk/Source/WebKit2/UIProcess/Launcher/mac/ProcessLauncherMac.mm
r172875 r172975 29 29 #import "DynamicLinkerEnvironmentExtractor.h" 30 30 #import "EnvironmentVariables.h" 31 #import "WebKitSystemInterface.h"32 31 #import <WebCore/SoftLinking.h> 32 #import <WebCore/WebCoreNSStringExtras.h> 33 33 #import <crt_externs.h> 34 34 #import <mach-o/dyld.h> … … 211 211 // 1.1. An important case is WebKitTestRunner, where we should use English localizations for all system frameworks. 212 212 // 2. When AppleLanguages is passed as command line argument for UI process, or set in its preferences, we should respect it in child processes. 213 RetainPtr<CFStringRef> localization = adoptCF(WKCopyCFLocalizationPreferredName(0)); 214 if (localization && _CFBundleSetupXPCBootstrapPtr()) { 213 if (_CFBundleSetupXPCBootstrapPtr()) { 215 214 auto initializationMessage = IPC::adoptXPC(xpc_dictionary_create(nullptr, nullptr, 0)); 216 215 _CFBundleSetupXPCBootstrapPtr()(initializationMessage.get()); … … 458 457 // 1.1. An important case is WebKitTestRunner, where we should use English localizations for all system frameworks. 459 458 // 2. When AppleLanguages is passed as command line argument for UI process, or set in its preferences, we should respect it in child processes. 460 CString appleLanguagesArgument = String("('" + String( adoptCF(WKCopyCFLocalizationPreferredName(0)).get()) + "')").utf8();459 CString appleLanguagesArgument = String("('" + String(preferredBundleLocalizationName()) + "')").utf8(); 461 460 462 461 Vector<const char*> args; -
trunk/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebSystemInterface.mm
r172875 r172975 41 41 #endif 42 42 INIT(CALayerEnumerateRectsBeingDrawnWithBlock); 43 INIT(CopyCFLocalizationPreferredName);44 43 INIT(CGContextGetShouldSmoothFonts); 45 44 INIT(CGPatternCreateWithImageAndTransform); -
trunk/Source/WebKit2/mac/WebKit2.order
r172875 r172975 3424 3424 __ZN3WTF6VectorINSt3__14pairINS_7CStringES3_EELm0ENS_15CrashOnOverflowEED2Ev 3425 3425 __ZN3WTF6VectorINSt3__14pairINS_7CStringES3_EELm0ENS_15CrashOnOverflowEE6shrinkEm 3426 _WKCopyCFLocalizationPreferredName3427 3426 __ZN6WebKit15ProcessLauncher19processTypeAsStringENS0_11ProcessTypeE 3428 3427 __ZNK3WTF12StringAppendIPKcNS_6StringEEcvS3_Ev
Note:
See TracChangeset
for help on using the changeset viewer.