[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677
darin
darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:45:00 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit bd1b4a2e486d8bda89e71a1866e2eb168e36b15b
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Fri Sep 27 00:45:32 2002 +0000
Tools:
* HotSpotFinder/HotSpotFinder.pbproj/project.pbxproj:
File encodings.
WebCore:
* kwq/WebCoreBridge.h: Use NSString for encoding name, not CFStringEncoding.
* kwq/WebCoreBridge.mm:
(-[WebCoreBridge addData:withOverrideEncoding:]): Ditto.
WebKit:
* WebCoreSupport.subproj/WebBridge.m:
(-[WebBridge receivedData:withDataSource:]): Use NSString for encoding.
* WebView.subproj/WebController.h: Update names to use separate boolean
for user agent and strings for text encodings instead of CFStringEncoding.
* WebView.subproj/WebController.m:
(-[WebController setCustomUserAgent:]): Name change.
(-[WebController resetUserAgent]): Added.
(-[WebController hasCustomUserAgent]): Added.
(-[WebController customUserAgent]): Name change.
(-[WebController setCustomTextEncodingName:]): Take NSString.
(-[WebController resetTextEncoding]): Update for NSString.
(-[WebController _mainFrameOverrideEncoding]): Ditto.
(-[WebController hasCustomTextEncoding]): Ditto.
(-[WebController customTextEncodingName]): Return NSString.
* WebView.subproj/WebDataSourcePrivate.h: Use NSString instead of
CFStringEncoding.
* WebView.subproj/WebDataSourcePrivate.m:
(-[WebDataSourcePrivate init]): No need to init.
(-[WebDataSource _setContentType:]): Copy, don't retain.
(-[WebDataSource _setEncoding:]): Copy, don't retain.
(-[WebDataSource _setOverrideEncoding:]): Use NSString.
(-[WebDataSource _overrideEncoding]): Use NSString.
* WebView.subproj/WebFramePrivate.h: Use NSString.
* WebView.subproj/WebFramePrivate.m:
(-[WebFrame _reloadAllowingStaleDataWithOverrideEncoding:]): Use NSString.
* WebView.subproj/WebPreferences.h: Use NSString instead of
CFStringEncoding.
* WebView.subproj/WebPreferences.m:
(+[WebPreferences load]): Use NSString.
(-[WebPreferences defaultTextEncodingName]): Use NSString.
(-[WebPreferences setDefaultTextEncodingName:]): Use NSString.
WebBrowser:
* AppController.m:
(-[AppController updateTextEncodingMenu]): Convert to CFStringEncoding.
* BrowserWindowController.m:
(-[BrowserWindowController validateMenuItem:]): Convert to CFStringEncoding.
(-[BrowserWindowController changeTextEncoding:]): Convert to NSString.
* Debug/DebugUtilities.m:
(-[BrowserDocument setUserAgent:]): Update for API change.
(-[BrowserDocument validate_setUserAgent:]): Ditto.
(-[BrowserDocument resetUserAgent:]): Ditto.
(-[BrowserDocument validate_resetUserAgent:]): Ditto.
* Preferences.subproj/TextPreferences.m:
(-[TextPreferences updateDefaultCharacterSetPopup]): Convert to CFStringEncoding.
(-[TextPreferences takeDefaultCharacterSetFrom:]): Convert to NSString.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2179 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index a6f26f1..f2ef301 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,9 @@
+2002-09-26 Darin Adler <darin at apple.com>
+
+ * kwq/WebCoreBridge.h: Use NSString for encoding name, not CFStringEncoding.
+ * kwq/WebCoreBridge.mm:
+ (-[WebCoreBridge addData:withOverrideEncoding:]): Ditto.
+
2002-09-26 Chris Blumenberg <cblu at apple.com>
Added WebCoreElementImageLocationKey to the element dictionary.
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index a6f26f1..f2ef301 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,9 @@
+2002-09-26 Darin Adler <darin at apple.com>
+
+ * kwq/WebCoreBridge.h: Use NSString for encoding name, not CFStringEncoding.
+ * kwq/WebCoreBridge.mm:
+ (-[WebCoreBridge addData:withOverrideEncoding:]): Ditto.
+
2002-09-26 Chris Blumenberg <cblu at apple.com>
Added WebCoreElementImageLocationKey to the element dictionary.
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index a6f26f1..f2ef301 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,9 @@
+2002-09-26 Darin Adler <darin at apple.com>
+
+ * kwq/WebCoreBridge.h: Use NSString for encoding name, not CFStringEncoding.
+ * kwq/WebCoreBridge.mm:
+ (-[WebCoreBridge addData:withOverrideEncoding:]): Ditto.
+
2002-09-26 Chris Blumenberg <cblu at apple.com>
Added WebCoreElementImageLocationKey to the element dictionary.
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index 2fe1a9d..50e5489 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -85,7 +85,7 @@ typedef khtml::RenderPart KHTMLRenderPart;
- (void)openURL:(NSURL *)URL;
- (void)addData:(NSData *)data withEncoding:(NSString *)encoding;
-- (void)addData:(NSData *)data withOverrideEncoding:(CFStringEncoding)encoding;
+- (void)addData:(NSData *)data withOverrideEncoding:(NSString *)encoding;
- (void)closeURL;
- (void)saveDocumentState;
- (void)restoreDocumentState;
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 09e203f..2ef1520 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -110,10 +110,8 @@ using khtml::RenderPart;
part->impl->slotData(encoding, NO, (const char *)[data bytes], [data length], NO);
}
-- (void)addData:(NSData *)data withOverrideEncoding:(CFStringEncoding)overrideEncoding
+- (void)addData:(NSData *)data withOverrideEncoding:(NSString *)encoding
{
- NSString *encoding = (NSString *)KWQCFStringEncodingToIANACharsetName(overrideEncoding);
-
part->impl->slotData(encoding, YES, (const char *)[data bytes], [data length], NO);
}
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index ed5737c..64730b9 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,40 @@
+2002-09-26 Darin Adler <darin at apple.com>
+
+ * WebCoreSupport.subproj/WebBridge.m:
+ (-[WebBridge receivedData:withDataSource:]): Use NSString for encoding.
+ * WebView.subproj/WebController.h: Update names to use separate boolean
+ for user agent and strings for text encodings instead of CFStringEncoding.
+ * WebView.subproj/WebController.m:
+ (-[WebController setCustomUserAgent:]): Name change.
+ (-[WebController resetUserAgent]): Added.
+ (-[WebController hasCustomUserAgent]): Added.
+ (-[WebController customUserAgent]): Name change.
+ (-[WebController setCustomTextEncodingName:]): Take NSString.
+ (-[WebController resetTextEncoding]): Update for NSString.
+ (-[WebController _mainFrameOverrideEncoding]): Ditto.
+ (-[WebController hasCustomTextEncoding]): Ditto.
+ (-[WebController customTextEncodingName]): Return NSString.
+
+ * WebView.subproj/WebDataSourcePrivate.h: Use NSString instead of
+ CFStringEncoding.
+ * WebView.subproj/WebDataSourcePrivate.m:
+ (-[WebDataSourcePrivate init]): No need to init.
+ (-[WebDataSource _setContentType:]): Copy, don't retain.
+ (-[WebDataSource _setEncoding:]): Copy, don't retain.
+ (-[WebDataSource _setOverrideEncoding:]): Use NSString.
+ (-[WebDataSource _overrideEncoding]): Use NSString.
+
+ * WebView.subproj/WebFramePrivate.h: Use NSString.
+ * WebView.subproj/WebFramePrivate.m:
+ (-[WebFrame _reloadAllowingStaleDataWithOverrideEncoding:]): Use NSString.
+
+ * WebView.subproj/WebPreferences.h: Use NSString instead of
+ CFStringEncoding.
+ * WebView.subproj/WebPreferences.m:
+ (+[WebPreferences load]): Use NSString.
+ (-[WebPreferences defaultTextEncodingName]): Use NSString.
+ (-[WebPreferences setDefaultTextEncodingName:]): Use NSString.
+
2002-09-26 Chris Blumenberg <cblu at apple.com>
Made WebTextView super-private.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index ed5737c..64730b9 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,40 @@
+2002-09-26 Darin Adler <darin at apple.com>
+
+ * WebCoreSupport.subproj/WebBridge.m:
+ (-[WebBridge receivedData:withDataSource:]): Use NSString for encoding.
+ * WebView.subproj/WebController.h: Update names to use separate boolean
+ for user agent and strings for text encodings instead of CFStringEncoding.
+ * WebView.subproj/WebController.m:
+ (-[WebController setCustomUserAgent:]): Name change.
+ (-[WebController resetUserAgent]): Added.
+ (-[WebController hasCustomUserAgent]): Added.
+ (-[WebController customUserAgent]): Name change.
+ (-[WebController setCustomTextEncodingName:]): Take NSString.
+ (-[WebController resetTextEncoding]): Update for NSString.
+ (-[WebController _mainFrameOverrideEncoding]): Ditto.
+ (-[WebController hasCustomTextEncoding]): Ditto.
+ (-[WebController customTextEncodingName]): Return NSString.
+
+ * WebView.subproj/WebDataSourcePrivate.h: Use NSString instead of
+ CFStringEncoding.
+ * WebView.subproj/WebDataSourcePrivate.m:
+ (-[WebDataSourcePrivate init]): No need to init.
+ (-[WebDataSource _setContentType:]): Copy, don't retain.
+ (-[WebDataSource _setEncoding:]): Copy, don't retain.
+ (-[WebDataSource _setOverrideEncoding:]): Use NSString.
+ (-[WebDataSource _overrideEncoding]): Use NSString.
+
+ * WebView.subproj/WebFramePrivate.h: Use NSString.
+ * WebView.subproj/WebFramePrivate.m:
+ (-[WebFrame _reloadAllowingStaleDataWithOverrideEncoding:]): Use NSString.
+
+ * WebView.subproj/WebPreferences.h: Use NSString instead of
+ CFStringEncoding.
+ * WebView.subproj/WebPreferences.m:
+ (+[WebPreferences load]): Use NSString.
+ (-[WebPreferences defaultTextEncodingName]): Use NSString.
+ (-[WebPreferences setDefaultTextEncodingName:]): Use NSString.
+
2002-09-26 Chris Blumenberg <cblu at apple.com>
Made WebTextView super-private.
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index 31bdd23..6a18efb 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -150,7 +150,7 @@
{
ASSERT([self dataSource] == withDataSource);
- if ([withDataSource _overrideEncoding] != kCFStringEncodingInvalidId) {
+ if ([withDataSource _overrideEncoding]) {
[self addData:data withOverrideEncoding:[withDataSource _overrideEncoding]];
} else {
[self addData:data withEncoding:[withDataSource encoding]];
diff --git a/WebKit/WebView.subproj/WebController.h b/WebKit/WebView.subproj/WebController.h
index 41588e2..2b5a847 100644
--- a/WebKit/WebView.subproj/WebController.h
+++ b/WebKit/WebView.subproj/WebController.h
@@ -290,20 +290,35 @@ extern NSString *WebElementFrameKey;
/*!
@method setUserAgent:
@abstract Set the user agent.
- @discussion Setting the user-agent string to nil means
- that WebKit should construct the best possible user-agent string for each URL
- for best results rendering web pages. Setting it to any string means
- that WebKit should use that user-agent string for all purposes until it is set
- back to nil.
+ @discussion Setting this means that the controller should use this user-agent string
+ instead of constructing a user-agent string for each URL.
@param userAgentString the user agent description
*/
-- (void)setUserAgent:(NSString *)userAgentString;
+- (void)setCustomUserAgent:(NSString *)userAgentString;
/*!
- @method userAgent
- @result userAgent Returns the userAgent string.
+ @method resetUserAgent
+ @abstract Reset the user agent.
+ @discussion Causes the controller to construct the user-agent string for each URL
+ for best results rendering web pages.
+ @param userAgentString the user agent description
+*/
+- (void)resetUserAgent;
+
+/*!
+ @method hasCustomUserAgent
+ @abstract Determine whether or not a custom user-agent string is in use.
+ @discussion It's an error to call customUserAgent if hasCustomUserAgent is NO.
+ @reselt Returns YES if a custom encoding has been set, NO otherwise.
*/
-- (NSString *)userAgent;
+- (BOOL)hasCustomUserAgent;
+
+/*!
+ @method customUserAgent
+ @result customUserAgent Returns the custom user-agent string. Should only be called
+ if hasCustomUserAgent returns YES.
+*/
+- (NSString *)customUserAgent;
/*!
@method userAgentForURL:
@@ -322,23 +337,15 @@ extern NSString *WebElementFrameKey;
- (BOOL)supportsTextEncoding;
/*!
- @method setCustomTextEncoding:
+ @method setCustomTextEncodingName:
@discussion Make the page display with a different text encoding; stops any load in progress.
The text encoding passed in overrides the normal text encoding smarts including
what's specified in a web page's header or HTTP response.
The text encoding automatically goes back to the default when the top level frame
changes to a new location.
@param encoding
- // FIXME Resolve whether to use NSStringEncoding
*/
-- (void)setCustomTextEncoding:(CFStringEncoding)encoding;
-
-/*!
- @method customTextEncoding
- @result Returns the custom text encoding.
- // FIXME Resolve whether to use NSStringEncoding
-*/
-- (CFStringEncoding)customTextEncoding;
+- (void)setCustomTextEncodingName:(NSString *)encoding;
/*!
@method resetTextEncoding
@@ -354,4 +361,11 @@ extern NSString *WebElementFrameKey;
*/
- (BOOL)hasCustomTextEncoding;
+/*!
+ @method customTextEncoding
+ @result Returns the custom text encoding.
+ // FIXME Resolve whether to use NSStringEncoding
+*/
+- (NSString *)customTextEncodingName;
+
@end
diff --git a/WebKit/WebView.subproj/WebController.m b/WebKit/WebView.subproj/WebController.m
index cab155a..d3bf636 100644
--- a/WebKit/WebView.subproj/WebController.m
+++ b/WebKit/WebView.subproj/WebController.m
@@ -359,13 +359,12 @@ NSString * WebElementFrameKey = @"WebElementFrame";
return [[_private->applicationNameForUserAgent copy] autorelease];
}
-// Set the user agent explicitly. Setting the user-agent string to nil means
-// that WebKit should construct the best possible user-agent string for each URL
-// for best results rendering web pages. Setting it to any string means
-// that WebKit should use that user-agent string for all purposes until it is set
-// back to nil.
-- (void)setUserAgent:(NSString *)userAgentString
+- (void)setCustomUserAgent:(NSString *)userAgentString
{
+ ASSERT_ARG(userAgentString, userAgentString);
+
+ // FIXME: Lock can go away once WebFoundation's user agent callback is replaced with something
+ // that's thread safe.
NSString *override = [userAgentString copy];
[_private->userAgentLock lock];
[_private->userAgentOverride release];
@@ -373,15 +372,34 @@ NSString * WebElementFrameKey = @"WebElementFrame";
[_private->userAgentLock unlock];
}
-- (NSString *)userAgent
+- (void)resetUserAgent
+{
+ // FIXME: Lock can go away once WebFoundation's user agent callback is replaced with something
+ // that's thread safe.
+ [_private->userAgentLock lock];
+ [_private->userAgentOverride release];
+ _private->userAgentOverride = nil;
+ [_private->userAgentLock unlock];
+}
+
+- (BOOL)hasCustomUserAgent
+{
+ return _private->userAgentOverride != nil;
+}
+
+- (NSString *)customUserAgent
{
+ if (_private->userAgentOverride == nil) {
+ ERROR("must not ask for customUserAgent is hasCustomUserAgent is NO");
+ }
+
return [[_private->userAgentOverride copy] autorelease];
}
// Get the appropriate user-agent string for a particular URL.
- (NSString *)userAgentForURL:(NSURL *)URL
{
- // FIXME: Lock can go away once WebFoundation's user agent API is replaced with something
+ // FIXME: Lock can go away once WebFoundation's user agent callback is replaced with something
// that's thread safe.
[_private->userAgentLock lock];
NSString *result = [[_private->userAgentOverride copy] autorelease];
@@ -408,14 +426,11 @@ NSString * WebElementFrameKey = @"WebElementFrame";
&& [documentView supportsTextEncoding];
}
-- (void)setCustomTextEncoding:(CFStringEncoding)encoding
+- (void)setCustomTextEncodingName:(NSString *)encoding
{
- if (encoding == kCFStringEncodingInvalidId) {
- ERROR("setCustomTextEncoding called with kCFStringEncodingInvalidId");
- return;
- }
+ ASSERT_ARG(encoding, encoding);
- if ([self hasCustomTextEncoding] && encoding == [self customTextEncoding]) {
+ if ([self hasCustomTextEncoding] && [encoding isEqualToString:[self customTextEncodingName]]) {
return;
}
@@ -428,31 +443,31 @@ NSString * WebElementFrameKey = @"WebElementFrame";
return;
}
- [[self mainFrame] _reloadAllowingStaleDataWithOverrideEncoding:kCFStringEncodingInvalidId];
+ [[self mainFrame] _reloadAllowingStaleDataWithOverrideEncoding:nil];
}
-- (CFStringEncoding)_mainFrameOverrideEncoding
+- (NSString *)_mainFrameOverrideEncoding
{
WebDataSource *dataSource = [[self mainFrame] provisionalDataSource];
if (dataSource == nil) {
dataSource = [[self mainFrame] dataSource];
}
if (dataSource == nil) {
- return kCFStringEncodingInvalidId;
+ return nil;
}
return [dataSource _overrideEncoding];
}
- (BOOL)hasCustomTextEncoding
{
- return [self _mainFrameOverrideEncoding] != kCFStringEncodingInvalidId;
+ return [self _mainFrameOverrideEncoding] != nil;
}
-- (CFStringEncoding)customTextEncoding
+- (NSString *)customTextEncodingName
{
- CFStringEncoding result = [self _mainFrameOverrideEncoding];
+ NSString *result = [self _mainFrameOverrideEncoding];
- if (result == kCFStringEncodingInvalidId) {
+ if (result == nil) {
ERROR("must not ask for customTextEncoding is hasCustomTextEncoding is NO");
}
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.h b/WebKit/WebView.subproj/WebDataSourcePrivate.h
index bd56adb..32a2db4 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.h
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.h
@@ -56,7 +56,7 @@
NSString *pageTitle;
NSString *encoding;
- CFStringEncoding overrideEncoding;
+ NSString *overrideEncoding;
NSString *contentType;
@@ -110,9 +110,9 @@
- (void)_loadIcon;
- (void)_setIconURL:(NSURL *)URL;
- (void)_setIconURL:(NSURL *)URL withType:(NSString *)iconType;
-- (WebResourceHandle*)_mainHandle;
-- (void)_setOverrideEncoding:(CFStringEncoding)overrideEncoding;
-- (CFStringEncoding)_overrideEncoding;
+- (WebResourceHandle *)_mainHandle;
+- (void)_setOverrideEncoding:(NSString *)overrideEncoding;
+- (NSString *)_overrideEncoding;
// Convenience interface for getting here from an WebDataSource.
// This returns nil if the representation is not an WebHTMLRepresentation.
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index deb9816..33ca2f1 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -44,9 +44,8 @@
- init
{
- encoding = [[WebCoreEncodings charsetNameForEncoding:[[WebPreferences standardPreferences] defaultTextEncoding]] retain];
- overrideEncoding = kCFStringEncodingInvalidId;
-
+ [super init];
+ encoding = [[[WebPreferences standardPreferences] defaultTextEncodingName] copy];
return self;
}
@@ -307,24 +306,28 @@
- (void)_setContentType:(NSString *)type
{
+ NSString *copy = [type copy];
[_private->contentType release];
- _private->contentType = [type retain];
+ _private->contentType = copy;
}
- (void)_setEncoding:(NSString *)encoding
{
+ NSString *copy = [encoding copy];
[_private->encoding release];
- _private->encoding = [encoding retain];
+ _private->encoding = copy;
}
-- (void)_setOverrideEncoding:(CFStringEncoding)overrideEncoding
+- (void)_setOverrideEncoding:(NSString *)overrideEncoding
{
- _private->overrideEncoding = overrideEncoding;
+ NSString *copy = [overrideEncoding copy];
+ [_private->overrideEncoding release];
+ _private->overrideEncoding = copy;
}
-- (CFStringEncoding)_overrideEncoding
+- (NSString *)_overrideEncoding
{
- return _private->overrideEncoding;
+ return [[_private->overrideEncoding copy] autorelease];
}
- (void)_setMainDocumentError: (WebError *)error
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index 53301f5..6301ae6 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -105,6 +105,6 @@ typedef enum {
- (void)_defersCallbacksChanged;
-- (void)_reloadAllowingStaleDataWithOverrideEncoding:(CFStringEncoding)encoding;
+- (void)_reloadAllowingStaleDataWithOverrideEncoding:(NSString *)encoding;
@end
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index fb8cef2..92c0e6e 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -710,7 +710,7 @@ static const char * const stateNames[] = {
[[self dataSource] _defersCallbacksChanged];
}
-- (void)_reloadAllowingStaleDataWithOverrideEncoding:(CFStringEncoding)encoding
+- (void)_reloadAllowingStaleDataWithOverrideEncoding:(NSString *)encoding
{
WebDataSource *dataSource = [self dataSource];
if (dataSource == nil) {
diff --git a/WebKit/WebView.subproj/WebPreferences.h b/WebKit/WebView.subproj/WebPreferences.h
index ab6b40c..8e42295 100644
--- a/WebKit/WebView.subproj/WebPreferences.h
+++ b/WebKit/WebView.subproj/WebPreferences.h
@@ -117,15 +117,15 @@
- (void)setMinimumFontSize:(int)size;
/*!
- @method defaultTextEncoding
+ @method defaultTextEncodingName
*/
-- (CFStringEncoding)defaultTextEncoding;
+- (NSString *)defaultTextEncodingName;
/*!
- @method setDefaultTextEncoding:
+ @method setDefaultTextEncodingName:
@param encoding
*/
-- (void)setDefaultTextEncoding:(CFStringEncoding)encoding;
+- (void)setDefaultTextEncodingName:(NSString *)encoding;
/*!
@method userStyleSheetEnabled
diff --git a/WebKit/WebView.subproj/WebPreferences.m b/WebKit/WebView.subproj/WebPreferences.m
index 60ff54d..3667248 100644
--- a/WebKit/WebView.subproj/WebPreferences.m
+++ b/WebKit/WebView.subproj/WebPreferences.m
@@ -18,7 +18,7 @@
#define WebKitMinimumFontSizePreferenceKey @"WebKitMinimumFontSize"
#define WebKitDefaultFontSizePreferenceKey @"WebKitDefaultFontSize"
#define WebKitDefaultFixedFontSizePreferenceKey @"WebKitDefaultFixedFontSize"
-#define WebKitDefaultTextEncodingPreferenceKey @"WebKitDefaultTextEncoding"
+#define WebKitDefaultTextEncodingNamePreferenceKey @"WebKitDefaultTextEncodingName"
#define WebKitUserStyleSheetEnabledPreferenceKey @"WebKitUserStyleSheetEnabledPreferenceKey"
#define WebKitUserStyleSheetLocationPreferenceKey @"WebKitUserStyleSheetLocationPreferenceKey"
#define WebKitJavaEnabledPreferenceKey @"WebKitJavaEnabled"
@@ -78,8 +78,6 @@
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
- NSNumber *latin1 = [NSNumber numberWithInt:(int)kCFStringEncodingWindowsLatin1];
-
NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
@"0x0", WebKitLogLevelPreferenceKey,
@"Lucida Grande", WebKitStandardFontPreferenceKey,
@@ -91,7 +89,7 @@
@"6", WebKitMinimumFontSizePreferenceKey,
@"14", WebKitDefaultFontSizePreferenceKey,
@"14", WebKitDefaultFixedFontSizePreferenceKey,
- latin1, WebKitDefaultTextEncodingPreferenceKey,
+ @"latin1", WebKitDefaultTextEncodingNamePreferenceKey,
@"1.00", WebKitInitialTimedLayoutDelayPreferenceKey,
@"4096", WebKitInitialTimedLayoutSizePreferenceKey,
@"1.00", WebKitResourceTimedLayoutDelayPreferenceKey,
@@ -220,14 +218,14 @@
[self _updateWebCoreSettings];
}
-- (CFStringEncoding)defaultTextEncoding
+- (NSString *)defaultTextEncodingName
{
- return (CFStringEncoding)[[NSUserDefaults standardUserDefaults] integerForKey:WebKitDefaultTextEncodingPreferenceKey];
+ return [[NSUserDefaults standardUserDefaults] stringForKey:WebKitDefaultTextEncodingNamePreferenceKey];
}
-- (void)setDefaultTextEncoding:(CFStringEncoding)encoding
+- (void)setDefaultTextEncodingName:(NSString *)encoding
{
- [[NSUserDefaults standardUserDefaults] setInteger:(int)encoding forKey:WebKitDefaultTextEncodingPreferenceKey];
+ [[NSUserDefaults standardUserDefaults] setObject:encoding forKey:WebKitDefaultTextEncodingNamePreferenceKey];
}
- (BOOL)userStyleSheetEnabled
diff --git a/WebKit/WebView.subproj/WebView.h b/WebKit/WebView.subproj/WebView.h
index 41588e2..2b5a847 100644
--- a/WebKit/WebView.subproj/WebView.h
+++ b/WebKit/WebView.subproj/WebView.h
@@ -290,20 +290,35 @@ extern NSString *WebElementFrameKey;
/*!
@method setUserAgent:
@abstract Set the user agent.
- @discussion Setting the user-agent string to nil means
- that WebKit should construct the best possible user-agent string for each URL
- for best results rendering web pages. Setting it to any string means
- that WebKit should use that user-agent string for all purposes until it is set
- back to nil.
+ @discussion Setting this means that the controller should use this user-agent string
+ instead of constructing a user-agent string for each URL.
@param userAgentString the user agent description
*/
-- (void)setUserAgent:(NSString *)userAgentString;
+- (void)setCustomUserAgent:(NSString *)userAgentString;
/*!
- @method userAgent
- @result userAgent Returns the userAgent string.
+ @method resetUserAgent
+ @abstract Reset the user agent.
+ @discussion Causes the controller to construct the user-agent string for each URL
+ for best results rendering web pages.
+ @param userAgentString the user agent description
+*/
+- (void)resetUserAgent;
+
+/*!
+ @method hasCustomUserAgent
+ @abstract Determine whether or not a custom user-agent string is in use.
+ @discussion It's an error to call customUserAgent if hasCustomUserAgent is NO.
+ @reselt Returns YES if a custom encoding has been set, NO otherwise.
*/
-- (NSString *)userAgent;
+- (BOOL)hasCustomUserAgent;
+
+/*!
+ @method customUserAgent
+ @result customUserAgent Returns the custom user-agent string. Should only be called
+ if hasCustomUserAgent returns YES.
+*/
+- (NSString *)customUserAgent;
/*!
@method userAgentForURL:
@@ -322,23 +337,15 @@ extern NSString *WebElementFrameKey;
- (BOOL)supportsTextEncoding;
/*!
- @method setCustomTextEncoding:
+ @method setCustomTextEncodingName:
@discussion Make the page display with a different text encoding; stops any load in progress.
The text encoding passed in overrides the normal text encoding smarts including
what's specified in a web page's header or HTTP response.
The text encoding automatically goes back to the default when the top level frame
changes to a new location.
@param encoding
- // FIXME Resolve whether to use NSStringEncoding
*/
-- (void)setCustomTextEncoding:(CFStringEncoding)encoding;
-
-/*!
- @method customTextEncoding
- @result Returns the custom text encoding.
- // FIXME Resolve whether to use NSStringEncoding
-*/
-- (CFStringEncoding)customTextEncoding;
+- (void)setCustomTextEncodingName:(NSString *)encoding;
/*!
@method resetTextEncoding
@@ -354,4 +361,11 @@ extern NSString *WebElementFrameKey;
*/
- (BOOL)hasCustomTextEncoding;
+/*!
+ @method customTextEncoding
+ @result Returns the custom text encoding.
+ // FIXME Resolve whether to use NSStringEncoding
+*/
+- (NSString *)customTextEncodingName;
+
@end
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index cab155a..d3bf636 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -359,13 +359,12 @@ NSString * WebElementFrameKey = @"WebElementFrame";
return [[_private->applicationNameForUserAgent copy] autorelease];
}
-// Set the user agent explicitly. Setting the user-agent string to nil means
-// that WebKit should construct the best possible user-agent string for each URL
-// for best results rendering web pages. Setting it to any string means
-// that WebKit should use that user-agent string for all purposes until it is set
-// back to nil.
-- (void)setUserAgent:(NSString *)userAgentString
+- (void)setCustomUserAgent:(NSString *)userAgentString
{
+ ASSERT_ARG(userAgentString, userAgentString);
+
+ // FIXME: Lock can go away once WebFoundation's user agent callback is replaced with something
+ // that's thread safe.
NSString *override = [userAgentString copy];
[_private->userAgentLock lock];
[_private->userAgentOverride release];
@@ -373,15 +372,34 @@ NSString * WebElementFrameKey = @"WebElementFrame";
[_private->userAgentLock unlock];
}
-- (NSString *)userAgent
+- (void)resetUserAgent
+{
+ // FIXME: Lock can go away once WebFoundation's user agent callback is replaced with something
+ // that's thread safe.
+ [_private->userAgentLock lock];
+ [_private->userAgentOverride release];
+ _private->userAgentOverride = nil;
+ [_private->userAgentLock unlock];
+}
+
+- (BOOL)hasCustomUserAgent
+{
+ return _private->userAgentOverride != nil;
+}
+
+- (NSString *)customUserAgent
{
+ if (_private->userAgentOverride == nil) {
+ ERROR("must not ask for customUserAgent is hasCustomUserAgent is NO");
+ }
+
return [[_private->userAgentOverride copy] autorelease];
}
// Get the appropriate user-agent string for a particular URL.
- (NSString *)userAgentForURL:(NSURL *)URL
{
- // FIXME: Lock can go away once WebFoundation's user agent API is replaced with something
+ // FIXME: Lock can go away once WebFoundation's user agent callback is replaced with something
// that's thread safe.
[_private->userAgentLock lock];
NSString *result = [[_private->userAgentOverride copy] autorelease];
@@ -408,14 +426,11 @@ NSString * WebElementFrameKey = @"WebElementFrame";
&& [documentView supportsTextEncoding];
}
-- (void)setCustomTextEncoding:(CFStringEncoding)encoding
+- (void)setCustomTextEncodingName:(NSString *)encoding
{
- if (encoding == kCFStringEncodingInvalidId) {
- ERROR("setCustomTextEncoding called with kCFStringEncodingInvalidId");
- return;
- }
+ ASSERT_ARG(encoding, encoding);
- if ([self hasCustomTextEncoding] && encoding == [self customTextEncoding]) {
+ if ([self hasCustomTextEncoding] && [encoding isEqualToString:[self customTextEncodingName]]) {
return;
}
@@ -428,31 +443,31 @@ NSString * WebElementFrameKey = @"WebElementFrame";
return;
}
- [[self mainFrame] _reloadAllowingStaleDataWithOverrideEncoding:kCFStringEncodingInvalidId];
+ [[self mainFrame] _reloadAllowingStaleDataWithOverrideEncoding:nil];
}
-- (CFStringEncoding)_mainFrameOverrideEncoding
+- (NSString *)_mainFrameOverrideEncoding
{
WebDataSource *dataSource = [[self mainFrame] provisionalDataSource];
if (dataSource == nil) {
dataSource = [[self mainFrame] dataSource];
}
if (dataSource == nil) {
- return kCFStringEncodingInvalidId;
+ return nil;
}
return [dataSource _overrideEncoding];
}
- (BOOL)hasCustomTextEncoding
{
- return [self _mainFrameOverrideEncoding] != kCFStringEncodingInvalidId;
+ return [self _mainFrameOverrideEncoding] != nil;
}
-- (CFStringEncoding)customTextEncoding
+- (NSString *)customTextEncodingName
{
- CFStringEncoding result = [self _mainFrameOverrideEncoding];
+ NSString *result = [self _mainFrameOverrideEncoding];
- if (result == kCFStringEncodingInvalidId) {
+ if (result == nil) {
ERROR("must not ask for customTextEncoding is hasCustomTextEncoding is NO");
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list