[SCM] WebKit Debian packaging branch, debian/unstable, updated. debian/1.1.15-1-40151-g37bb677

cblu cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc
Sat Sep 26 06:55:36 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit b4b5c9c5b43b46e6e13fed5cb8c63b4d7927c22c
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Mon Oct 28 21:59:40 2002 +0000

    WebCore:
    
    	Fixed: 3056726 - View Source window always displays the source in current system encoding
    	Fixed: 3019352 - Text encoding is not handled when viewing plain text
    
            * kwq/WebCoreBridge.h:
            * kwq/WebCoreBridge.mm:
            (+[WebCoreBridge stringWithData:textEncoding:]): added, creates a string with data using the WebCore's decoding logic.
            (+[WebCoreBridge stringWithData:textEncodingName:]): added, calls stringWithData:textEncoding: after getting the encoding for a text encoding name
    
    WebKit:
    
    	Fixed: 3056726 - View Source window always displays the source in current system encoding
    	Fixed: 3019352 - Text encoding is not handled when viewing plain text
    
            * WebView.subproj/WebDataSource.h:
            * WebView.subproj/WebDataSource.m:
            (-[WebDataSource stringWithData:]): added, creates a string using the specified encoding.
            * WebView.subproj/WebHTMLRepresentation.m:
            (-[WebHTMLRepresentation documentSource]): uses the bridge specified encoding when creating the string
            * WebView.subproj/WebTextView.h:
            * WebView.subproj/WebTextView.m:
            (-[WebTextView dataSourceUpdated:]): use stringWithData:
            (-[WebTextView supportsTextEncoding]): Yup
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@2494 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2002-12-03 b/WebCore/ChangeLog-2002-12-03
index e944015..4cdb7a1 100644
--- a/WebCore/ChangeLog-2002-12-03
+++ b/WebCore/ChangeLog-2002-12-03
@@ -1,3 +1,13 @@
+2002-10-28  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed: 3056726 - View Source window always displays the source in current system encoding
+	Fixed: 3019352 - Text encoding is not handled when viewing plain text
+
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (+[WebCoreBridge stringWithData:textEncoding:]): added, creates a string with data using the WebCore's decoding logic.
+        (+[WebCoreBridge stringWithData:textEncodingName:]): added, calls stringWithData:textEncoding: after getting the encoding for a text encoding name
+
 2002-10-28  Don Melton  <gramps at apple.com>
 
         * khtml/html/htmlparser.cpp:
diff --git a/WebCore/ChangeLog-2003-10-25 b/WebCore/ChangeLog-2003-10-25
index e944015..4cdb7a1 100644
--- a/WebCore/ChangeLog-2003-10-25
+++ b/WebCore/ChangeLog-2003-10-25
@@ -1,3 +1,13 @@
+2002-10-28  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed: 3056726 - View Source window always displays the source in current system encoding
+	Fixed: 3019352 - Text encoding is not handled when viewing plain text
+
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (+[WebCoreBridge stringWithData:textEncoding:]): added, creates a string with data using the WebCore's decoding logic.
+        (+[WebCoreBridge stringWithData:textEncodingName:]): added, calls stringWithData:textEncoding: after getting the encoding for a text encoding name
+
 2002-10-28  Don Melton  <gramps at apple.com>
 
         * khtml/html/htmlparser.cpp:
diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index e944015..4cdb7a1 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,13 @@
+2002-10-28  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed: 3056726 - View Source window always displays the source in current system encoding
+	Fixed: 3019352 - Text encoding is not handled when viewing plain text
+
+        * kwq/WebCoreBridge.h:
+        * kwq/WebCoreBridge.mm:
+        (+[WebCoreBridge stringWithData:textEncoding:]): added, creates a string with data using the WebCore's decoding logic.
+        (+[WebCoreBridge stringWithData:textEncodingName:]): added, calls stringWithData:textEncoding: after getting the encoding for a text encoding name
+
 2002-10-28  Don Melton  <gramps at apple.com>
 
         * khtml/html/htmlparser.cpp:
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index a06a40f..95e41eb 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -163,6 +163,9 @@ enum FrameBorderStyle {
 
 - (int)frameBorderStyle;
 
++ (NSString *)stringWithData:(NSData *)data textEncoding:(CFStringEncoding)textEncoding;
++ (NSString *)stringWithData:(NSData *)data textEncodingName:(NSString *)textEncodingName;
+
 @end
 
 // The WebCoreBridge protocol contains methods for use by the WebCore side of the bridge.
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index 6f255a9..4c5637b 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -799,4 +799,16 @@ static NSAttributedString *attributedString(DOM::NodeImpl *_startNode, int start
     return NoFrameBorder;
 }
 
++ (NSString *)stringWithData:(NSData *)data textEncoding:(CFStringEncoding)textEncoding
+{
+    QString string = QString::fromStringWithEncoding((const char*)[data bytes], [data length], textEncoding);
+    return string.getNSString();
+}
+
++ (NSString *)stringWithData:(NSData *)data textEncodingName:(NSString *)textEncodingName
+{
+    CFStringEncoding textEncoding = KWQCFStringEncodingFromIANACharsetName((CFStringRef)textEncodingName);
+    return [WebCoreBridge stringWithData:data textEncoding:textEncoding];
+}
+
 @end
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 1f5df25..2b4deae 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,18 @@
+2002-10-28  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed: 3056726 - View Source window always displays the source in current system encoding
+	Fixed: 3019352 - Text encoding is not handled when viewing plain text
+
+        * WebView.subproj/WebDataSource.h:
+        * WebView.subproj/WebDataSource.m:
+        (-[WebDataSource stringWithData:]): added, creates a string using the specified encoding.
+        * WebView.subproj/WebHTMLRepresentation.m:
+        (-[WebHTMLRepresentation documentSource]): uses the bridge specified encoding when creating the string
+        * WebView.subproj/WebTextView.h:
+        * WebView.subproj/WebTextView.m:
+        (-[WebTextView dataSourceUpdated:]): use stringWithData: 
+        (-[WebTextView supportsTextEncoding]): Yup
+
 2002-10-28  Richard Williamson   <rjw at apple.com>
 
         Fixed crasher.
diff --git a/WebKit/ChangeLog-2002-12-03 b/WebKit/ChangeLog-2002-12-03
index 1f5df25..2b4deae 100644
--- a/WebKit/ChangeLog-2002-12-03
+++ b/WebKit/ChangeLog-2002-12-03
@@ -1,3 +1,18 @@
+2002-10-28  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed: 3056726 - View Source window always displays the source in current system encoding
+	Fixed: 3019352 - Text encoding is not handled when viewing plain text
+
+        * WebView.subproj/WebDataSource.h:
+        * WebView.subproj/WebDataSource.m:
+        (-[WebDataSource stringWithData:]): added, creates a string using the specified encoding.
+        * WebView.subproj/WebHTMLRepresentation.m:
+        (-[WebHTMLRepresentation documentSource]): uses the bridge specified encoding when creating the string
+        * WebView.subproj/WebTextView.h:
+        * WebView.subproj/WebTextView.m:
+        (-[WebTextView dataSourceUpdated:]): use stringWithData: 
+        (-[WebTextView supportsTextEncoding]): Yup
+
 2002-10-28  Richard Williamson   <rjw at apple.com>
 
         Fixed crasher.
diff --git a/WebKit/WebView.subproj/WebDataSource.h b/WebKit/WebView.subproj/WebDataSource.h
index 2ce2450..d13c33f 100644
--- a/WebKit/WebView.subproj/WebDataSource.h
+++ b/WebKit/WebView.subproj/WebDataSource.h
@@ -159,6 +159,15 @@
 - (WebError *)mainDocumentError;
 
 /*!
+    @method stringWithData:
+    @result A string decoded using the determined encoding.
+    @discussion The overidden encoding is used if one is present. If no overidden encoding is specified,
+    the server specified encoding is used. If no server specified encoding is specified,
+    kCFStringEncodingISOLatin1 is used.
+*/
+- (NSString *)stringWithData:(NSData *)data;
+
+/*!
     @method registerRepresentationClass:forMIMEType:
     @discussion A class that implements WebDocumentRepresentation may be registered 
     with this method.
diff --git a/WebKit/WebView.subproj/WebDataSource.m b/WebKit/WebView.subproj/WebDataSource.m
index 4308ca8..a512295 100644
--- a/WebKit/WebView.subproj/WebDataSource.m
+++ b/WebKit/WebView.subproj/WebDataSource.m
@@ -195,6 +195,21 @@
     return _private->mainDocumentError;
 }
 
+- (NSString *)stringWithData:(NSData *)data
+{
+    NSString *textEncodingName = [self _overrideEncoding];
+
+    if(!textEncodingName){
+        textEncodingName = [[self response] textEncodingName];
+    }
+
+    if(textEncodingName){
+        return [WebBridge stringWithData:data textEncodingName:textEncodingName];
+    }else{
+        return [WebBridge stringWithData:data textEncoding:kCFStringEncodingISOLatin1];
+    }
+}
+
 + (void)registerRepresentationClass:(Class)repClass forMIMEType:(NSString *)MIMEType
 {
     // FIXME: OK to allow developers to override built-in reps?
diff --git a/WebKit/WebView.subproj/WebHTMLRepresentation.m b/WebKit/WebView.subproj/WebHTMLRepresentation.m
index 5a5c44c..fb5c4a8 100644
--- a/WebKit/WebView.subproj/WebHTMLRepresentation.m
+++ b/WebKit/WebView.subproj/WebHTMLRepresentation.m
@@ -70,9 +70,7 @@
 
 - (NSString *)documentSource
 {
-    
-    // FIMXE: Converting to string with ASCII encoding is not appropriate, although it works for some pages.
-    return [[[NSString alloc] initWithData:[[_private->bridge dataSource] data] encoding:NSASCIIStringEncoding] autorelease];
+    return [WebBridge stringWithData:[[_private->bridge dataSource] data] textEncoding:[_private->bridge textEncoding]];
 }
 
 
diff --git a/WebKit/WebView.subproj/WebTextView.h b/WebKit/WebView.subproj/WebTextView.h
index c3af838..f0a33cf 100644
--- a/WebKit/WebView.subproj/WebTextView.h
+++ b/WebKit/WebView.subproj/WebTextView.h
@@ -8,8 +8,9 @@
 
 @protocol WebDocumentView;
 @protocol WebDocumentDragSettings;
+ at protocol WebDocumentTextEncoding;
 
- at interface WebTextView : WebSearchableTextView <WebDocumentView, WebDocumentDragSettings>
+ at interface WebTextView : WebSearchableTextView <WebDocumentView, WebDocumentDragSettings, WebDocumentTextEncoding>
 {
     BOOL canDragFrom;
     BOOL canDragTo;
diff --git a/WebKit/WebView.subproj/WebTextView.m b/WebKit/WebView.subproj/WebTextView.m
index 56c62c5..3acec26 100644
--- a/WebKit/WebView.subproj/WebTextView.m
+++ b/WebKit/WebView.subproj/WebTextView.m
@@ -59,11 +59,8 @@
     } else {
         [self setRichText:NO];
         [self setFixedWidthFont];
-        // FIXME: This needs to use the correct encoding, but the list of names of encodings
-        // is currently inside WebCore where we can't share it.
-        string = [[NSString alloc] initWithData:[dataSource data] encoding:NSASCIIStringEncoding];
+        string = [dataSource stringWithData:[dataSource data]];
         [self setString:string];
-        [string release];
     }
 }
 
@@ -125,5 +122,9 @@
                                types:[NSArray arrayWithObject:NSStringPboardType]];
 }
 
+- (BOOL)supportsTextEncoding
+{
+    return YES;
+}
 
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list