[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 08:09:10 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit b27d38036dbe3877ed618088adc8eac742dff7bd
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Tue Nov 4 19:15:10 2003 +0000

    WebCore:
    
    	Fixed:
    	<rdar://problem/3472403>: RTFD of copied text and images should use original image data not tiffs
    
            Reviewed by john.
    
            * kwq/KWQKHTMLPart.h:
            * kwq/KWQKHTMLPart.mm:
            (KWQKHTMLPart::fileWrapperForElement): call [_bridge _fileWrapperForURL:] to get cached data
            * kwq/WebCoreBridge.h: added _fileWrapperForURL: to the bridge protocol
            * kwq/WebCoreBridge.mm:
            (-[WebCoreBridge selectedAttributedString]): call the instance method attributedString
            (-[WebCoreBridge attributedStringFrom:startOffset:to:endOffset:]): call the instance method attributedString
    
    WebKit:
    
    	Fixed:
    	<rdar://problem/3472403>: RTFD of copied text and images should use original image data not tiffs
    	<rdar://problem/3472435>: dragging local image file downloads it instead of copies it
    	<rdar://problem/3472450>: copied and dragged local image files are TIFF, not original image data
    
            Reviewed by john.
    
            * Misc.subproj/WebNSPasteboardExtras.h:
            * Misc.subproj/WebNSPasteboardExtras.m:
            (-[NSPasteboard _web_writeFileWrapperAsRTFDAttachment:]): new
            * Misc.subproj/WebNSViewExtras.h:
            * Misc.subproj/WebNSViewExtras.m:
            (-[NSView _web_dragImage:fileWrapper:rect:URL:title:event:]): take a file wrapper instead of data so [NSPasteboard _web_writeFileWrapperAsRTFDAttachment:] can be called
            * WebCoreSupport.subproj/WebBridge.m:
            (-[WebBridge fileWrapperForURL:]): call fileWrapperForURL on the WebView
            * WebView.subproj/WebDefaultContextMenuDelegate.m:
            (-[WebDefaultUIDelegate copyImageToClipboard:]): call [NSPasteboard _web_writeFileWrapperAsRTFDAttachment:]
            * WebView.subproj/WebHTMLView.m:
            (-[WebHTMLView _handleMouseDragged:]): when calling _web_dragImage, pass a file wrapper from fileWrapperForURL
            (-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]): call fileWrapperForURL
            * WebView.subproj/WebImageRepresentation.h:
            * WebView.subproj/WebImageRepresentation.m:
            (-[WebImageRepresentation fileWrapper]): new
            * WebView.subproj/WebImageView.m:
            (-[WebImageView writeImageToPasteboard:]): call [NSPasteboard _web_writeFileWrapperAsRTFDAttachment:]
            (-[WebImageView mouseDragged:]): pass the file wrapper to _web_dragImage
            * WebView.subproj/WebView.m:
            (-[WebView _fileWrapperForURL:]): new, returns a file wrapper from a local file or from the cache
            * WebView.subproj/WebViewPrivate.h:
    
    WebBrowser:
    
    	Fixed:
    	<rdar://problem/3472437>: "Download Link to Disk..." should be "Save Link As..." if the link is local
    	<rdar://problem/3472439>: "Download Image to Disk..." should be "Save Image As..." if the image is local
    
            Reviewed by john.
    
            * BrowserDocument.h:
            * BrowserDocument.m:
            (-[BrowserDocument setFileWrapperToSave:MIMEType:]): new, when saving data, use a file wrapper so that we can save things other than data sources.
            (-[BrowserDocument setDataSourceToSave:]): now calls setFileWrapperToSave:MIMEType:
            (-[BrowserDocument isSavingPlainText]): checks the _savingMIMEType
            (-[BrowserDocument saveDocumentTo:]): calls setDataSourceToSave if there is no fileWrapperToSave
            (-[BrowserDocument document:didSave:contextInfo:]): calls setFileWrapperToSave:MIMEType:
            (-[BrowserDocument dataRepresentationOfType:]): returns the data of the wrapper
            (-[BrowserDocument displayName]): if saving, return the filename of the wrapper
            (-[BrowserDocument fileType]): use _savingMIMEType
            * ContextMenuHandler.m:
            (-[BrowserWebView webView:contextMenuItemsForElement:defaultMenuItems:]): provide "Save Image As..." and "Save Link As..." for local files
            (-[BrowserWebView saveFileWrapperForURLKey:menuItem:]): new
            (-[BrowserWebView saveImageAs:]): new
            (-[BrowserWebView saveLinkAs:]): new
            * English.lproj/Localizable.strings:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5381 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog-2005-08-23 b/WebCore/ChangeLog-2005-08-23
index 3f13178..7e00e2e 100644
--- a/WebCore/ChangeLog-2005-08-23
+++ b/WebCore/ChangeLog-2005-08-23
@@ -1,3 +1,18 @@
+2003-11-04  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed:
+	<rdar://problem/3472403>: RTFD of copied text and images should use original image data not tiffs
+
+        Reviewed by john.
+
+        * kwq/KWQKHTMLPart.h:
+        * kwq/KWQKHTMLPart.mm:
+        (KWQKHTMLPart::fileWrapperForElement): call [_bridge _fileWrapperForURL:] to get cached data
+        * kwq/WebCoreBridge.h: added _fileWrapperForURL: to the bridge protocol
+        * kwq/WebCoreBridge.mm:
+        (-[WebCoreBridge selectedAttributedString]): call the instance method attributedString 
+        (-[WebCoreBridge attributedStringFrom:startOffset:to:endOffset:]): call the instance method attributedString 
+
 2003-11-04  Maciej Stachowiak  <mjs at apple.com>
 
         Reviewed by Chris.
diff --git a/WebCore/kwq/KWQKHTMLPart.h b/WebCore/kwq/KWQKHTMLPart.h
index 29aa226..67ca973 100644
--- a/WebCore/kwq/KWQKHTMLPart.h
+++ b/WebCore/kwq/KWQKHTMLPart.h
@@ -52,6 +52,7 @@ namespace KJS {
 #ifdef __OBJC__
 @class NSAttributedString;
 @class NSEvent;
+ at class NSFileWrapper;
 @class NSResponder;
 @class NSView;
 @class WebCoreBridge;
@@ -64,6 +65,7 @@ namespace KJS {
 #else
 class NSAttributedString;
 class NSEvent;
+class NSFileWrapper;
 class NSResponder;
 class NSView;
 class WebCoreBridge;
@@ -179,7 +181,8 @@ public:
 
     QRect selectionRect() const;
 
-    static NSAttributedString *attributedString(DOM::NodeImpl *startNode, int startOffset, DOM::NodeImpl *endNode, int endOffset);
+    NSFileWrapper *fileWrapperForElement(DOM::ElementImpl *);
+    NSAttributedString *attributedString(DOM::NodeImpl *startNode, int startOffset, DOM::NodeImpl *endNode, int endOffset);
 
     void addMetaData(const QString &key, const QString &value);
 
diff --git a/WebCore/kwq/KWQKHTMLPart.mm b/WebCore/kwq/KWQKHTMLPart.mm
index e94bb17..b3d9c91 100644
--- a/WebCore/kwq/KWQKHTMLPart.mm
+++ b/WebCore/kwq/KWQKHTMLPart.mm
@@ -2116,22 +2116,29 @@ struct ListItemInfo {
     unsigned end;
 };
 
-static NSFileWrapper *fileWrapperForElement(ElementImpl *e)
+NSFileWrapper *KWQKHTMLPart::fileWrapperForElement(ElementImpl *e)
 {
-    RenderImage *renderer = static_cast<RenderImage *>(e->renderer());
-    NSImage *image = renderer->pixmap().image();
+    NSFileWrapper *wrapper = nil;
 
     KWQ_BLOCK_EXCEPTIONS;
-    NSData *tiffData = [image TIFFRepresentationUsingCompression:NSTIFFCompressionLZW factor:0.0];
-
-    NSFileWrapper *wrapper = [[NSFileWrapper alloc] initRegularFileWithContents:tiffData];
-    [wrapper setPreferredFilename:@"image.tiff"];
-    [wrapper autorelease];
-
-    return wrapper;
+    
+    DOMString attr = e->getAttribute(ATTR_SRC);
+    if (!attr.isEmpty()) {
+        NSURL *URL = completeURL(attr.string()).getNSURL();
+        wrapper = [_bridge fileWrapperForURL:URL];
+    }    
+    if (!wrapper) {
+        RenderImage *renderer = static_cast<RenderImage *>(e->renderer());
+        NSImage *image = renderer->pixmap().image();
+        NSData *tiffData = [image TIFFRepresentationUsingCompression:NSTIFFCompressionLZW factor:0.0];
+        wrapper = [[NSFileWrapper alloc] initRegularFileWithContents:tiffData];
+        [wrapper setPreferredFilename:@"image.tiff"];
+        [wrapper autorelease];
+    }
+    
     KWQ_UNBLOCK_EXCEPTIONS;
 
-    return nil;
+    return wrapper;
 }
 
 static ElementImpl *listParent(ElementImpl *item)
diff --git a/WebCore/kwq/WebCoreBridge.h b/WebCore/kwq/WebCoreBridge.h
index ab342ca..311a913 100644
--- a/WebCore/kwq/WebCoreBridge.h
+++ b/WebCore/kwq/WebCoreBridge.h
@@ -357,6 +357,8 @@ typedef enum {
 
 - (void)didSetName:(NSString *)name;
 
+- (NSFileWrapper *)fileWrapperForURL:(NSURL *)URL;
+
 @end
 
 // This interface definition allows those who hold a WebCoreBridge * to call all the methods
diff --git a/WebCore/kwq/WebCoreBridge.mm b/WebCore/kwq/WebCoreBridge.mm
index b577732..9266d65 100644
--- a/WebCore/kwq/WebCoreBridge.mm
+++ b/WebCore/kwq/WebCoreBridge.mm
@@ -862,14 +862,14 @@ static HTMLFormElementImpl *formElementFromDOMElement(id <WebDOMElement>element)
 
 - (NSAttributedString *)selectedAttributedString
 {
-    return KWQKHTMLPart::attributedString(_part->selectionStart(), _part->selectionStartOffset(), _part->selectionEnd(), _part->selectionEndOffset());
+    return _part->attributedString(_part->selectionStart(), _part->selectionStartOffset(), _part->selectionEnd(), _part->selectionEndOffset());
 }
 
 - (NSAttributedString *)attributedStringFrom:(id<WebDOMNode>)start startOffset:(int)startOffset to:(id<WebDOMNode>)end endOffset:(int)endOffset
 {
     WebCoreDOMNode *startNode = start;
     WebCoreDOMNode *endNode = end;
-    return KWQKHTMLPart::attributedString([startNode impl], startOffset, [endNode impl], endOffset);
+    return _part->attributedString([startNode impl], startOffset, [endNode impl], endOffset);
 }
 
 - (id<WebDOMNode>)selectionStart
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index ebe460f..b19514d 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,35 @@
+2003-11-04  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed:
+	<rdar://problem/3472403>: RTFD of copied text and images should use original image data not tiffs
+	<rdar://problem/3472435>: dragging local image file downloads it instead of copies it
+	<rdar://problem/3472450>: copied and dragged local image files are TIFF, not original image data
+	
+        Reviewed by john.
+
+        * Misc.subproj/WebNSPasteboardExtras.h:
+        * Misc.subproj/WebNSPasteboardExtras.m:
+        (-[NSPasteboard _web_writeFileWrapperAsRTFDAttachment:]): new
+        * Misc.subproj/WebNSViewExtras.h:
+        * Misc.subproj/WebNSViewExtras.m:
+        (-[NSView _web_dragImage:fileWrapper:rect:URL:title:event:]): take a file wrapper instead of data so [NSPasteboard _web_writeFileWrapperAsRTFDAttachment:] can be called
+        * WebCoreSupport.subproj/WebBridge.m:
+        (-[WebBridge fileWrapperForURL:]): call fileWrapperForURL on the WebView
+        * WebView.subproj/WebDefaultContextMenuDelegate.m:
+        (-[WebDefaultUIDelegate copyImageToClipboard:]): call [NSPasteboard _web_writeFileWrapperAsRTFDAttachment:]
+        * WebView.subproj/WebHTMLView.m:
+        (-[WebHTMLView _handleMouseDragged:]): when calling _web_dragImage, pass a file wrapper from fileWrapperForURL
+        (-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]): call fileWrapperForURL
+        * WebView.subproj/WebImageRepresentation.h:
+        * WebView.subproj/WebImageRepresentation.m:
+        (-[WebImageRepresentation fileWrapper]): new
+        * WebView.subproj/WebImageView.m:
+        (-[WebImageView writeImageToPasteboard:]): call [NSPasteboard _web_writeFileWrapperAsRTFDAttachment:]
+        (-[WebImageView mouseDragged:]): pass the file wrapper to _web_dragImage
+        * WebView.subproj/WebView.m:
+        (-[WebView _fileWrapperForURL:]): new, returns a file wrapper from a local file or from the cache
+        * WebView.subproj/WebViewPrivate.h:
+
 2003-11-04  John Sullivan  <sullivan at apple.com>
 
         - fixed <rdar://problem/3472813>: REGRESSION (100-111): Some tabs start 
diff --git a/WebKit/English.lproj/StringsNotToBeLocalized.txt b/WebKit/English.lproj/StringsNotToBeLocalized.txt
index 1d20ed1..f3efaab 100644
--- a/WebKit/English.lproj/StringsNotToBeLocalized.txt
+++ b/WebKit/English.lproj/StringsNotToBeLocalized.txt
@@ -23,6 +23,7 @@
 "/tmp/WebKitPlugInStreamXXXXXX"
 "/tmp/XXXXXX.tiff"
 "0x0"
+"1"
 "1.0.0"
 "1.00"
 "1000"
@@ -174,6 +175,7 @@
 "WebKitJavaScriptEnabled"
 "WebKitLogLevel"
 "WebKitMinimumFontSize"
+"WebKitMinimumLogicalFontSize"
 "WebKitObjectCacheSizePreferenceKey"
 "WebKitPageCacheSizePreferenceKey"
 "WebKitPluginsEnabled"
diff --git a/WebKit/Misc.subproj/WebNSPasteboardExtras.h b/WebKit/Misc.subproj/WebNSPasteboardExtras.h
index 696f359..28f495f 100644
--- a/WebKit/Misc.subproj/WebNSPasteboardExtras.h
+++ b/WebKit/Misc.subproj/WebNSPasteboardExtras.h
@@ -40,8 +40,8 @@ extern NSString *WebURLNamePboardType;
 // Sets the text on the NSFindPboard. Returns the new changeCount for the NSFindPboard.
 + (int)_web_setFindPasteboardString:(NSString *)string withOwner:(id)owner;
 
-// Writes file contents data to the pasteboard as an RTFD attachment.
+// Writes a file wrapper to the pasteboard as an RTFD attachment.
 // NSRTFDPboardType must be declared on the pasteboard before calling this method.
-- (void)_web_writeFileDataAsRTFDAttachment:(NSData *)data withFilename:(NSString *)filename;
+- (void)_web_writeFileWrapperAsRTFDAttachment:(NSFileWrapper *)wrapper;
 
 @end
diff --git a/WebKit/Misc.subproj/WebNSPasteboardExtras.m b/WebKit/Misc.subproj/WebNSPasteboardExtras.m
index 57e57a1..e7deb64 100644
--- a/WebKit/Misc.subproj/WebNSPasteboardExtras.m
+++ b/WebKit/Misc.subproj/WebNSPasteboardExtras.m
@@ -133,14 +133,10 @@ NSString *WebURLNamePboardType = nil;
     return [findPasteboard changeCount];
 }
 
-- (void)_web_writeFileDataAsRTFDAttachment:(NSData *)data withFilename:(NSString *)filename
+- (void)_web_writeFileWrapperAsRTFDAttachment:(NSFileWrapper *)wrapper
 {
-    NSFileWrapper *wrapper = [[NSFileWrapper alloc] initRegularFileWithContents:data];
-    [wrapper setPreferredFilename:filename];
-    
     NSTextAttachment *attachment = [[NSTextAttachment alloc] initWithFileWrapper:wrapper];
-    [wrapper release];
-
+    
     NSAttributedString *string = [NSAttributedString attributedStringWithAttachment:attachment];
     [attachment release];
     
diff --git a/WebKit/Misc.subproj/WebNSViewExtras.h b/WebKit/Misc.subproj/WebNSViewExtras.h
index 24081e6..d402679 100644
--- a/WebKit/Misc.subproj/WebNSViewExtras.h
+++ b/WebKit/Misc.subproj/WebNSViewExtras.h
@@ -41,7 +41,7 @@
 
 // Resizes and applies alpha to image, extends pboard and sets drag origins for dragging promised image files.
 - (void)_web_dragImage:(WebImageRenderer *)image
-          originalData:(NSData *)originalData
+           fileWrapper:(NSFileWrapper *)fileWrapper
                   rect:(NSRect)rect
                    URL:(NSURL *)URL
                  title:(NSString *)title
diff --git a/WebKit/Misc.subproj/WebNSViewExtras.m b/WebKit/Misc.subproj/WebNSViewExtras.m
index 8a70b4c..279c00c 100644
--- a/WebKit/Misc.subproj/WebNSViewExtras.m
+++ b/WebKit/Misc.subproj/WebNSViewExtras.m
@@ -178,7 +178,7 @@
 #endif
 
 - (void)_web_dragImage:(WebImageRenderer *)image
-          originalData:(NSData *)originalData
+           fileWrapper:(NSFileWrapper *)fileWrapper
                   rect:(NSRect)rect
                    URL:(NSURL *)URL
                  title:(NSString *)title
@@ -227,12 +227,12 @@
     NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
     NSMutableArray *types = [NSMutableArray arrayWithObjects:NSFilesPromisePboardType, NSTIFFPboardType, nil];
     [types addObjectsFromArray:[NSPasteboard _web_writableDragTypesForURL]];
-    if (originalData) {
+    if (fileWrapper) {
         [types insertObject:NSRTFDPboardType atIndex:0];
     }
     [pboard _web_writeURL:URL andTitle:title withOwner:self types:types];
-    if (originalData) {
-        [pboard _web_writeFileDataAsRTFDAttachment:originalData withFilename:filename];
+    if (fileWrapper) {
+        [pboard _web_writeFileWrapperAsRTFDAttachment:fileWrapper];
     }
     [pboard setPropertyList:filesTypes forType:NSFilesPromisePboardType];
     [pboard setData:[image TIFFRepresentation] forType:NSTIFFPboardType];
diff --git a/WebKit/WebCoreSupport.subproj/WebBridge.m b/WebKit/WebCoreSupport.subproj/WebBridge.m
index 842524d..cb7d7a1 100644
--- a/WebKit/WebCoreSupport.subproj/WebBridge.m
+++ b/WebKit/WebCoreSupport.subproj/WebBridge.m
@@ -1019,4 +1019,9 @@ static id <WebFormDelegate> formDelegate(WebBridge *self)
     [_frame _setName:name];
 }
 
+- (NSFileWrapper *)fileWrapperForURL:(NSURL *)URL
+{
+    return [[_frame webView] _fileWrapperForURL:URL];
+}
+
 @end
diff --git a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
index 615711f..a3e2f35 100644
--- a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
+++ b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
@@ -177,14 +177,13 @@
     NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
     NSMutableArray *types = [NSMutableArray arrayWithObject:NSTIFFPboardType];
     WebView *webView = [[element objectForKey:WebElementFrameKey] webView];
-    NSCachedURLResponse *cachedResponse = [webView _cachedResponseForURL:[element objectForKey:WebElementImageURLKey]];
-    NSData *data = [cachedResponse data];
-    if (data) {
+    NSFileWrapper *wrapper = [webView _fileWrapperForURL:[element objectForKey:WebElementImageURLKey]];
+    if (wrapper) {
         [types insertObject:NSRTFDPboardType atIndex:0];
     }
     [pasteboard declareTypes:types owner:nil];
-    if (data) {
-        [pasteboard _web_writeFileDataAsRTFDAttachment:data withFilename:[[cachedResponse response] suggestedFilename]];
+    if (wrapper) {
+        [pasteboard _web_writeFileWrapperAsRTFDAttachment:wrapper];
     }
     [pasteboard setData:[[element objectForKey:WebElementImageKey] TIFFRepresentation] forType:NSTIFFPboardType];
 }
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 6c4801b..d1e5221 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -639,7 +639,7 @@ static WebHTMLView *lastHitView = nil;
         WebImageRenderer *image = [element objectForKey:WebElementImageKey];
         ASSERT([image isKindOfClass:[WebImageRenderer class]]);
         [self _web_dragImage:image
-                originalData:[[[self _webView] _cachedResponseForURL:imageURL] data]
+                 fileWrapper:[[self _webView] _fileWrapperForURL:imageURL]
                         rect:[[element objectForKey:WebElementImageRectKey] rectValue]
                          URL:linkURL ? linkURL : imageURL
                        title:[element objectForKey:WebElementImageAltStringKey]
@@ -1503,16 +1503,15 @@ static WebHTMLView *lastHitView = nil;
     ASSERT(_private->draggingImageURL);
     
     WebView *webView = [self _webView];
-    NSCachedURLResponse *cachedResponse = [webView _cachedResponseForURL:_private->draggingImageURL];
-    NSData *data = [cachedResponse data];
+    NSFileWrapper *wrapper = [webView _fileWrapperForURL:_private->draggingImageURL];
     NSString *filename;
     
-    if (data) {
+    if (wrapper) {
         // FIXME: Report an error if we fail to create a file.
-        NSString *path = [[dropDestination path] stringByAppendingPathComponent:[[cachedResponse response] suggestedFilename]];
+        NSString *path = [[dropDestination path] stringByAppendingPathComponent:[wrapper preferredFilename]];
         path = [[NSFileManager defaultManager] _web_pathWithUniqueFilenameForPath:path];
-        if (![data writeToFile:path atomically:NO]) {
-            ERROR("Failed to create image file via [NSData writeToFile:atomically:]");
+        if (![wrapper writeToFile:path atomically:NO updateFilenames:YES]) {
+            ERROR("Failed to create image file via -[NSFileWrapper writeToFile:atomically:updateFilenames:]");
         }
         filename = [path lastPathComponent];
     } else {
diff --git a/WebKit/WebView.subproj/WebImageRepresentation.h b/WebKit/WebView.subproj/WebImageRepresentation.h
index 3f90445..561500b 100644
--- a/WebKit/WebView.subproj/WebImageRepresentation.h
+++ b/WebKit/WebView.subproj/WebImageRepresentation.h
@@ -17,6 +17,7 @@
 }
 - (WebImageRenderer *)image;
 - (NSString *)filename;
+- (NSFileWrapper *)fileWrapper;
 - (BOOL)doneLoading;
 - (NSData *)data;
 - (NSURL *)URL;
diff --git a/WebKit/WebView.subproj/WebImageRepresentation.m b/WebKit/WebView.subproj/WebImageRepresentation.m
index 831172d..60cd65f 100644
--- a/WebKit/WebView.subproj/WebImageRepresentation.m
+++ b/WebKit/WebView.subproj/WebImageRepresentation.m
@@ -96,4 +96,11 @@
     return filename;
 }
 
+- (NSFileWrapper *)fileWrapper
+{
+    NSFileWrapper *wrapper = [[NSFileWrapper alloc] initRegularFileWithContents:data];
+    [wrapper setPreferredFilename:filename];
+    return [wrapper autorelease]; 
+}
+
 @end
diff --git a/WebKit/WebView.subproj/WebImageView.m b/WebKit/WebView.subproj/WebImageView.m
index 8e23152..7d18f62 100644
--- a/WebKit/WebView.subproj/WebImageView.m
+++ b/WebKit/WebView.subproj/WebImageView.m
@@ -189,7 +189,7 @@
 {    
     if ([self haveCompleteImage]) {
         [pasteboard declareTypes:[NSArray arrayWithObjects:NSRTFDPboardType, NSTIFFPboardType, nil] owner:nil];
-        [pasteboard _web_writeFileDataAsRTFDAttachment:[rep data] withFilename:[rep filename]];
+        [pasteboard _web_writeFileWrapperAsRTFDAttachment:[rep fileWrapper]];
         [pasteboard setData:[[rep image] TIFFRepresentation] forType:NSTIFFPboardType];
         return YES;
     }
@@ -239,7 +239,7 @@
     [self retain];
 
     [self _web_dragImage:[rep image]
-            originalData:[rep data]
+             fileWrapper:[rep fileWrapper]
                     rect:[self drawingRect]
                      URL:[rep URL]
                    title:nil
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index 31fce88..dc95629 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -1059,6 +1059,21 @@ NSString *_WebMainFrameURLKey =         @"mainFrameURL";
     return cachedResponse;
 }
 
+- (NSFileWrapper *)_fileWrapperForURL:(NSURL *)URL
+{
+    if ([URL isFileURL]) {
+        return [[[NSFileWrapper alloc] initWithPath:[URL path]] autorelease];
+    } else {
+        NSCachedURLResponse *cachedResponse = [self _cachedResponseForURL:URL];
+        if (cachedResponse) {
+            NSFileWrapper *wrapper = [[[NSFileWrapper alloc] initRegularFileWithContents:[cachedResponse data]] autorelease];
+            [wrapper setPreferredFilename:[[cachedResponse response] suggestedFilename]];
+            return wrapper;
+        }
+    }
+    return nil;
+}
+
 @end
 
 
diff --git a/WebKit/WebView.subproj/WebViewPrivate.h b/WebKit/WebView.subproj/WebViewPrivate.h
index abe31cb..6432932 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.h
+++ b/WebKit/WebView.subproj/WebViewPrivate.h
@@ -260,6 +260,7 @@ Could be worth adding to the API.
 + (void)_setAlwaysUseATSU:(BOOL)f;
 
 - (NSCachedURLResponse *)_cachedResponseForURL:(NSURL *)URL;
+- (NSFileWrapper *)_fileWrapperForURL:(NSURL *)URL;
 
 @end
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list