[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:39:06 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 284e61bc75f09e7b6df4ff606d23f1f3639f1c00
Author: darin <darin at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Fri Sep 13 22:57:49 2002 +0000

    WebKit:
    
    	- fixed 3031685 -- The text encoding setting is not propagated to subframes
    
            * WebView.subproj/WebDocument.h: Remove old WebDocumentTextEncoding methods,
    	add supportsTextEncoding.
            * WebView.subproj/WebController.m:
            (-[WebController supportsTextEncoding]): Check the document view to see if
    	it supports WebDocumentTextEncoding and returns YES.
            (-[WebController setCustomTextEncoding:]): Call _reloadAllowingStaleDataWithOverrideEncoding.
            (-[WebController resetTextEncoding]): Ditto.
            (-[WebController _mainFrameOverrideEncoding]): Added. Gets encoding from the data source
    	of the main frame; provisional if there, main if not.
            (-[WebController hasCustomTextEncoding]): Call _mainFrameOverrideEncoding.
            (-[WebController customTextEncoding]): Ditto.
    
            * WebView.subproj/WebDataSourcePrivate.m:
            (-[WebDataSource _setParent:]): Set the override encoding to the parent's.
    
            * WebView.subproj/WebFrame.m:
            (-[WebFrame reload]): Release request to fix storage leak. Set the override encoding
    	on the new data source to match the old.
    
            * WebView.subproj/WebFramePrivate.h: New name for stale data reload method.
            * WebView.subproj/WebFramePrivate.m:
            (-[WebFrame _reloadAllowingStaleDataWithOverrideEncoding:]): Do pretty much the
    	same thing reload does with a few differences. Get the encoding from the parameter
    	rather than the old data source, and set the policy to the one that uses data from
    	the cache, even stale data, if present
    
            * WebView.subproj/WebHTMLView.m:  (-[WebHTMLView supportsTextEncoding]): Return YES.
    
    WebBrowser:
    
    	WebCore part of text encoding fix.
    
            * BrowserWindowController.m:
            (-[BrowserWindowController validateMenuItem:]): Call the new WebKit methods.
            (-[BrowserWindowController changeTextEncoding:]): Ditto.
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2063 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 53e534d..3a65742 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,35 @@
+2002-09-13  Darin Adler  <darin at apple.com>
+
+	- fixed 3031685 -- The text encoding setting is not propagated to subframes
+
+        * WebView.subproj/WebDocument.h: Remove old WebDocumentTextEncoding methods,
+	add supportsTextEncoding.
+        * WebView.subproj/WebController.m:
+        (-[WebController supportsTextEncoding]): Check the document view to see if
+	it supports WebDocumentTextEncoding and returns YES.
+        (-[WebController setCustomTextEncoding:]): Call _reloadAllowingStaleDataWithOverrideEncoding.
+        (-[WebController resetTextEncoding]): Ditto.
+        (-[WebController _mainFrameOverrideEncoding]): Added. Gets encoding from the data source
+	of the main frame; provisional if there, main if not.
+        (-[WebController hasCustomTextEncoding]): Call _mainFrameOverrideEncoding.
+        (-[WebController customTextEncoding]): Ditto.
+
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSource _setParent:]): Set the override encoding to the parent's.
+
+        * WebView.subproj/WebFrame.m:
+        (-[WebFrame reload]): Release request to fix storage leak. Set the override encoding
+	on the new data source to match the old.
+
+        * WebView.subproj/WebFramePrivate.h: New name for stale data reload method.
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFrame _reloadAllowingStaleDataWithOverrideEncoding:]): Do pretty much the
+	same thing reload does with a few differences. Get the encoding from the parameter
+	rather than the old data source, and set the policy to the one that uses data from
+	the cache, even stale data, if present
+
+        * WebView.subproj/WebHTMLView.m:  (-[WebHTMLView supportsTextEncoding]): Return YES.
+
 2002-09-13  Richard Williamson (Home)  <rjw at apple.com>
 
         Adding padding and widths buffer to our canonical measurement
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 53e534d..3a65742 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,35 @@
+2002-09-13  Darin Adler  <darin at apple.com>
+
+	- fixed 3031685 -- The text encoding setting is not propagated to subframes
+
+        * WebView.subproj/WebDocument.h: Remove old WebDocumentTextEncoding methods,
+	add supportsTextEncoding.
+        * WebView.subproj/WebController.m:
+        (-[WebController supportsTextEncoding]): Check the document view to see if
+	it supports WebDocumentTextEncoding and returns YES.
+        (-[WebController setCustomTextEncoding:]): Call _reloadAllowingStaleDataWithOverrideEncoding.
+        (-[WebController resetTextEncoding]): Ditto.
+        (-[WebController _mainFrameOverrideEncoding]): Added. Gets encoding from the data source
+	of the main frame; provisional if there, main if not.
+        (-[WebController hasCustomTextEncoding]): Call _mainFrameOverrideEncoding.
+        (-[WebController customTextEncoding]): Ditto.
+
+        * WebView.subproj/WebDataSourcePrivate.m:
+        (-[WebDataSource _setParent:]): Set the override encoding to the parent's.
+
+        * WebView.subproj/WebFrame.m:
+        (-[WebFrame reload]): Release request to fix storage leak. Set the override encoding
+	on the new data source to match the old.
+
+        * WebView.subproj/WebFramePrivate.h: New name for stale data reload method.
+        * WebView.subproj/WebFramePrivate.m:
+        (-[WebFrame _reloadAllowingStaleDataWithOverrideEncoding:]): Do pretty much the
+	same thing reload does with a few differences. Get the encoding from the parameter
+	rather than the old data source, and set the policy to the one that uses data from
+	the cache, even stale data, if present
+
+        * WebView.subproj/WebHTMLView.m:  (-[WebHTMLView supportsTextEncoding]): Return YES.
+
 2002-09-13  Richard Williamson (Home)  <rjw at apple.com>
 
         Adding padding and widths buffer to our canonical measurement
diff --git a/WebKit/WebView.subproj/WebController.m b/WebKit/WebView.subproj/WebController.m
index 6147c90..e160ad5 100644
--- a/WebKit/WebView.subproj/WebController.m
+++ b/WebKit/WebView.subproj/WebController.m
@@ -427,6 +427,8 @@ NSString * WebContextMenuElementFrameKey = @"WebContextFrame";
 // 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
+    // that's thread safe.
     [_private->userAgentLock lock];
     NSString *result = [[_private->userAgentOverride copy] autorelease];
     [_private->userAgentLock unlock];
@@ -435,46 +437,72 @@ NSString * WebContextMenuElementFrameKey = @"WebContextFrame";
     }
 
     // Note that we currently don't look at the URL.
-    // If we find that we need different user agent strings for different web pages
+    // If we find that we need to spoof different user agent strings for different web pages
     // for best results, then that logic will go here.
 
     // FIXME: Incorporate applicationNameForUserAgent in this string so that people
-    // can tell that they are talking to Alexander. Maybe also incorporate something
-    // that identifies WebKit's involvement.
+    // can tell that they are talking to Alexander and not another WebKit client.
+    // Maybe also incorporate something that identifies WebKit's involvement.
+    
     return @"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.0.0) Gecko/20020715";
 }
 
 - (BOOL)supportsTextEncoding
 {
-    // FIXME: Implement this.
-    return YES;
+    id documentView = [[[self mainFrame] webView] documentView];
+    return [documentView conformsToProtocol:@protocol(WebDocumentTextEncoding)]
+        && [documentView supportsTextEncoding];
 }
 
 - (void)setCustomTextEncoding:(CFStringEncoding)encoding
 {
-    // FIXME: Implement this.
+    if (encoding == kCFStringEncodingInvalidId) {
+        ERROR("setCustomTextEncoding called with kCFStringEncodingInvalidId");
+        return;
+    }
+    
+    if ([self hasCustomTextEncoding] && encoding == [self customTextEncoding]) {
+        return;
+    }
+
+    [[self mainFrame] _reloadAllowingStaleDataWithOverrideEncoding:encoding];
 }
 
 - (void)resetTextEncoding
 {
-    // FIXME: Implement this.
+    if (![self hasCustomTextEncoding]) {
+        return;
+    }
+    
+    [[self mainFrame] _reloadAllowingStaleDataWithOverrideEncoding:kCFStringEncodingInvalidId];
+}
+
+- (CFStringEncoding)_mainFrameOverrideEncoding
+{
+    WebDataSource *dataSource = [[self mainFrame] provisionalDataSource];
+    if (dataSource == nil) {
+        dataSource = [[self mainFrame] dataSource];
+    }
+    if (dataSource == nil) {
+        return kCFStringEncodingInvalidId;
+    }
+    return [dataSource _overrideEncoding];
 }
 
 - (BOOL)hasCustomTextEncoding
 {
-    // FIXME: Implement this.
-    return NO;
+    return [self _mainFrameOverrideEncoding] != kCFStringEncodingInvalidId;
 }
 
 - (CFStringEncoding)customTextEncoding
 {
-    if (![self hasCustomTextEncoding]) {
+    CFStringEncoding result = [self _mainFrameOverrideEncoding];
+    
+    if (result == kCFStringEncodingInvalidId) {
         ERROR("must not ask for customTextEncoding is hasCustomTextEncoding is NO");
-        return kCFStringEncodingInvalidId;
     }
 
-    // FIXME: Implement this.
-    return kCFStringEncodingInvalidId;
+    return result;
 }
 
 @end
diff --git a/WebKit/WebView.subproj/WebDataSourcePrivate.m b/WebKit/WebView.subproj/WebDataSourcePrivate.m
index 8f44d0e..76e454a 100644
--- a/WebKit/WebView.subproj/WebDataSourcePrivate.m
+++ b/WebKit/WebView.subproj/WebDataSourcePrivate.m
@@ -140,6 +140,11 @@
 {
     // Non-retained.
     _private->parent = p;
+    
+    // Inherit the override encoding setting from the parent.
+    if (p) {
+        _private->overrideEncoding = p->_private->overrideEncoding;
+    }
 }
 
 - (void)_setPrimaryLoadComplete: (BOOL)flag
diff --git a/WebKit/WebView.subproj/WebDocument.h b/WebKit/WebView.subproj/WebDocument.h
index 6dcb0c0..45f2e9f 100644
--- a/WebKit/WebView.subproj/WebDocument.h
+++ b/WebKit/WebView.subproj/WebDocument.h
@@ -26,10 +26,7 @@
 @end
 
 @protocol WebDocumentTextEncoding <NSObject>
-- (CFStringEncoding)textEncoding;
-- (void)setTextEncoding: (CFStringEncoding)encoding;
-- (void)setDefaultTextEncoding;
-- (BOOL)usingDefaultTextEncoding;
+- (BOOL)supportsTextEncoding;
 @end
 
 @protocol WebDocumentRepresentation <NSObject>
diff --git a/WebKit/WebView.subproj/WebFrame.m b/WebKit/WebView.subproj/WebFrame.m
index 8d76858..4fdf2e8 100644
--- a/WebKit/WebView.subproj/WebFrame.m
+++ b/WebKit/WebView.subproj/WebFrame.m
@@ -190,21 +190,23 @@
 - (void)reload
 {
     WebDataSource *dataSource = [self dataSource];
-    WebResourceRequest *request;
-    
     if (dataSource == nil) {
 	return;
     }
 
-    request = [[dataSource request] copy];
+    WebResourceRequest *request = [[dataSource request] copy];
     [request setRequestCachePolicy:WebRequestCachePolicyLoadFromOrigin];
-
     WebDataSource *newDataSource = [[WebDataSource alloc] initWithRequest:request];
+    [request release];
+    
     [newDataSource _setParent:[dataSource parent]];
+    [newDataSource _setOverrideEncoding:[dataSource _overrideEncoding]];
+    
     if ([self setProvisionalDataSource:newDataSource]) {
 	[self _setLoadType:WebFrameLoadTypeReload];
         [self startLoading];
     }
+    
     [newDataSource release];
 }
 
diff --git a/WebKit/WebView.subproj/WebFramePrivate.h b/WebKit/WebView.subproj/WebFramePrivate.h
index 5d3df40..ff860a1 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.h
+++ b/WebKit/WebView.subproj/WebFramePrivate.h
@@ -97,6 +97,6 @@ typedef enum {
 
 - (void)_defersCallbacksChanged;
 
-- (void)_reloadAllowingStaleData;
+- (void)_reloadAllowingStaleDataWithOverrideEncoding:(CFStringEncoding)encoding;
 
 @end
diff --git a/WebKit/WebView.subproj/WebFramePrivate.m b/WebKit/WebView.subproj/WebFramePrivate.m
index 6d0d992..53dc757 100644
--- a/WebKit/WebView.subproj/WebFramePrivate.m
+++ b/WebKit/WebView.subproj/WebFramePrivate.m
@@ -700,9 +700,27 @@ static const char * const stateNames[] = {
     [[self dataSource] _defersCallbacksChanged];
 }
 
-- (void)_reloadAllowingStaleData
+- (void)_reloadAllowingStaleDataWithOverrideEncoding:(CFStringEncoding)encoding
 {
-    // FIXME: Implement.
+    WebDataSource *dataSource = [self dataSource];
+    if (dataSource == nil) {
+	return;
+    }
+
+    WebResourceRequest *request = [[dataSource request] copy];
+    [request setRequestCachePolicy:WebRequestCachePolicyReturnCacheObjectLoadFromOriginIfNoCacheObject];
+    WebDataSource *newDataSource = [[WebDataSource alloc] initWithRequest:request];
+    [request release];
+    
+    [newDataSource _setParent:[dataSource parent]];
+    [newDataSource _setOverrideEncoding:encoding];
+    
+    if ([self setProvisionalDataSource:newDataSource]) {
+	[self _setLoadType:WebFrameLoadTypeReloadAllowingStaleData];
+        [self startLoading];
+    }
+    
+    [newDataSource release];
 }
 
 @end
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 6df0807..06bbf92 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -630,28 +630,9 @@
     return [NSArray arrayWithObject:filename];
 }
 
-- (CFStringEncoding)textEncoding
+- (BOOL)supportsTextEncoding
 {
-    return [[self _bridge] textEncoding];
-}
-
-- (void)setTextEncoding:(CFStringEncoding)encoding
-{
-    WebFrame *frame = [self _frame];
-    [frame reload];
-    [[frame provisionalDataSource] _setOverrideEncoding:encoding];
-}
-
-- (void)setDefaultTextEncoding
-{
-    WebFrame *frame = [self _frame];
-    [frame reload];
-    [[frame provisionalDataSource] _setOverrideEncoding:kCFStringEncodingInvalidId];
-}
-
-- (BOOL)usingDefaultTextEncoding
-{
-    return [[[self _frame] dataSource] _overrideEncoding] == kCFStringEncodingInvalidId;
+    return YES;
 }
 
 - (NSView *)nextKeyView
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index 6147c90..e160ad5 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -427,6 +427,8 @@ NSString * WebContextMenuElementFrameKey = @"WebContextFrame";
 // 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
+    // that's thread safe.
     [_private->userAgentLock lock];
     NSString *result = [[_private->userAgentOverride copy] autorelease];
     [_private->userAgentLock unlock];
@@ -435,46 +437,72 @@ NSString * WebContextMenuElementFrameKey = @"WebContextFrame";
     }
 
     // Note that we currently don't look at the URL.
-    // If we find that we need different user agent strings for different web pages
+    // If we find that we need to spoof different user agent strings for different web pages
     // for best results, then that logic will go here.
 
     // FIXME: Incorporate applicationNameForUserAgent in this string so that people
-    // can tell that they are talking to Alexander. Maybe also incorporate something
-    // that identifies WebKit's involvement.
+    // can tell that they are talking to Alexander and not another WebKit client.
+    // Maybe also incorporate something that identifies WebKit's involvement.
+    
     return @"Mozilla/5.0 (Macintosh; U; PPC Mac OS X; en-US; rv:1.0.0) Gecko/20020715";
 }
 
 - (BOOL)supportsTextEncoding
 {
-    // FIXME: Implement this.
-    return YES;
+    id documentView = [[[self mainFrame] webView] documentView];
+    return [documentView conformsToProtocol:@protocol(WebDocumentTextEncoding)]
+        && [documentView supportsTextEncoding];
 }
 
 - (void)setCustomTextEncoding:(CFStringEncoding)encoding
 {
-    // FIXME: Implement this.
+    if (encoding == kCFStringEncodingInvalidId) {
+        ERROR("setCustomTextEncoding called with kCFStringEncodingInvalidId");
+        return;
+    }
+    
+    if ([self hasCustomTextEncoding] && encoding == [self customTextEncoding]) {
+        return;
+    }
+
+    [[self mainFrame] _reloadAllowingStaleDataWithOverrideEncoding:encoding];
 }
 
 - (void)resetTextEncoding
 {
-    // FIXME: Implement this.
+    if (![self hasCustomTextEncoding]) {
+        return;
+    }
+    
+    [[self mainFrame] _reloadAllowingStaleDataWithOverrideEncoding:kCFStringEncodingInvalidId];
+}
+
+- (CFStringEncoding)_mainFrameOverrideEncoding
+{
+    WebDataSource *dataSource = [[self mainFrame] provisionalDataSource];
+    if (dataSource == nil) {
+        dataSource = [[self mainFrame] dataSource];
+    }
+    if (dataSource == nil) {
+        return kCFStringEncodingInvalidId;
+    }
+    return [dataSource _overrideEncoding];
 }
 
 - (BOOL)hasCustomTextEncoding
 {
-    // FIXME: Implement this.
-    return NO;
+    return [self _mainFrameOverrideEncoding] != kCFStringEncodingInvalidId;
 }
 
 - (CFStringEncoding)customTextEncoding
 {
-    if (![self hasCustomTextEncoding]) {
+    CFStringEncoding result = [self _mainFrameOverrideEncoding];
+    
+    if (result == kCFStringEncodingInvalidId) {
         ERROR("must not ask for customTextEncoding is hasCustomTextEncoding is NO");
-        return kCFStringEncodingInvalidId;
     }
 
-    // FIXME: Implement this.
-    return kCFStringEncodingInvalidId;
+    return result;
 }
 
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list