[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:03:26 UTC 2009


The following commit has been merged in the debian/unstable branch:
commit 68482307e783e3109fd678fb5450eccd1f1e1382
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sun Oct 19 18:08:32 2003 +0000

    WebKit:
    
    	Fixed: <rdar://problem/3229530>: Dragging standalone image to desktop should save it, not re-download it
    
            Reviewed by darin.
    
    	* English.lproj/Localizable.strings:
            * WebKit.pbproj/project.pbxproj:
    	* WebView.subproj/WebDocumentPrivate.h: Added.
            * WebView.subproj/WebImageRepresentation.h:
            * WebView.subproj/WebImageRepresentation.m:
            (-[WebImageRepresentation dealloc]): release new filename and data ivars
            (-[WebImageRepresentation doneLoading]): return YES if data is non-nil
            (-[WebImageRepresentation setDataSource:]): store the filename
            (-[WebImageRepresentation receivedError:withDataSource:]): store the data
            (-[WebImageRepresentation finishedLoadingWithDataSource:]): store the data
            (-[WebImageRepresentation data]): new
            (-[WebImageRepresentation filename]): new
            * WebView.subproj/WebImageView.m:
            (-[WebImageView namesOfPromisedFilesDroppedAtDestination:]): just save the image, don't download it
    	(-[WebImageView image]): new
    
    WebBrowser:
    
    	Fixed:
    	<rdar://problem/3456752>: Filename when saving a standalone image includes "nxn pixels"
    	<rdar://problem/3177870>: Context menu for standalone images should be "Save Image As..." not "Download Image to Disk"
    
            Reviewed by darin.
    
            * BrowserDocument.m:
            (-[BrowserDocument displayName]): If we are saving a standalone image, use the responses suggestedFilename
            * ContextMenuHandler.m:
            (-[BrowserWebView webView:contextMenuItemsForElement:defaultMenuItems:]): If this is a context menu for a standalone image, provide "Save Image As..." and "Copy Image to Clipboard"
            (-[BrowserWebView saveDocumentAs:]): renamed from savePageAs to be more generic
            * English.lproj/StringsNotToBeLocalized.txt:
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5216 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index adc7100..b0deed4 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,25 @@
+2003-10-18  Chris Blumenberg  <cblu at apple.com>
+
+	Fixed: <rdar://problem/3229530>: Dragging standalone image to desktop should save it, not re-download it
+
+        Reviewed by darin.
+
+	* English.lproj/Localizable.strings:
+        * WebKit.pbproj/project.pbxproj:
+	* WebView.subproj/WebDocumentPrivate.h: Added.
+        * WebView.subproj/WebImageRepresentation.h:
+        * WebView.subproj/WebImageRepresentation.m:
+        (-[WebImageRepresentation dealloc]): release new filename and data ivars
+        (-[WebImageRepresentation doneLoading]): return YES if data is non-nil
+        (-[WebImageRepresentation setDataSource:]): store the filename
+        (-[WebImageRepresentation receivedError:withDataSource:]): store the data
+        (-[WebImageRepresentation finishedLoadingWithDataSource:]): store the data
+        (-[WebImageRepresentation data]): new
+        (-[WebImageRepresentation filename]): new
+        * WebView.subproj/WebImageView.m:
+        (-[WebImageView namesOfPromisedFilesDroppedAtDestination:]): just save the image, don't download it
+	(-[WebImageView image]): new
+
 2003-10-17  Chris Blumenberg  <cblu at apple.com>
 
 	Fixed: <rdar://problem/3456176>: Assertion failure when loading atomfilms.com
diff --git a/WebKit/English.lproj/Localizable.strings b/WebKit/English.lproj/Localizable.strings
index 7604a36..2bca7e5 100644
Binary files a/WebKit/English.lproj/Localizable.strings and b/WebKit/English.lproj/Localizable.strings differ
diff --git a/WebKit/WebKit.pbproj/project.pbxproj b/WebKit/WebKit.pbproj/project.pbxproj
index 251b197..0ec0ed4 100644
--- a/WebKit/WebKit.pbproj/project.pbxproj
+++ b/WebKit/WebKit.pbproj/project.pbxproj
@@ -319,6 +319,7 @@
 				BE07CEB1047538F000CA289C,
 				BE6DC39B04C62C4E004D0EF6,
 				ED21B9820528F7AA003299AC,
+				833987820543012D00EE146E,
 			);
 			isa = PBXHeadersBuildPhase;
 			runOnlyForDeploymentPostprocessing = 0;
@@ -790,6 +791,8 @@
 			fileRef = 35081D9A02B6D4D80ACA2ACA;
 			isa = PBXBuildFile;
 			settings = {
+				ATTRIBUTES = (
+				);
 			};
 		};
 		35081DA502B6D4D80ACA2ACA = {
@@ -1874,6 +1877,23 @@
 //832
 //833
 //834
+		833987810543012D00EE146E = {
+			expectedFileType = sourcecode.c.h;
+			fileEncoding = 4;
+			isa = PBXFileReference;
+			path = WebDocumentPrivate.h;
+			refType = 4;
+			sourceTree = "<group>";
+		};
+		833987820543012D00EE146E = {
+			fileRef = 833987810543012D00EE146E;
+			isa = PBXBuildFile;
+			settings = {
+				ATTRIBUTES = (
+					Private,
+				);
+			};
+		};
 		83402EF6035A588900BE770A = {
 			expectedFileType = sourcecode.c.h;
 			fileEncoding = 4;
@@ -2467,6 +2487,7 @@
 				515E27D00458CA4B00CA2D3A,
 				35081DAE02B6D4F50ACA2ACA,
 				ED21B9810528F7AA003299AC,
+				833987810543012D00EE146E,
 				3944606B020F50ED0ECA1767,
 				3944606C020F50ED0ECA1767,
 				2D81DAB203EB0B2D00A80166,
diff --git a/WebKit/WebView.subproj/WebDocumentPrivate.h b/WebKit/WebView.subproj/WebDocumentPrivate.h
new file mode 100644
index 0000000..12e571b
--- /dev/null
+++ b/WebKit/WebView.subproj/WebDocumentPrivate.h
@@ -0,0 +1,9 @@
+/*	
+    WebDocumentPrivate.h
+    Copyright (C) 2003 Apple Computer, Inc. All rights reserved.    
+*/
+
+
+ at protocol WebDocumentImage
+- (NSImage *)image;
+ at end
\ No newline at end of file
diff --git a/WebKit/WebView.subproj/WebImageRepresentation.h b/WebKit/WebView.subproj/WebImageRepresentation.h
index 4c23afa..3f90445 100644
--- a/WebKit/WebView.subproj/WebImageRepresentation.h
+++ b/WebKit/WebView.subproj/WebImageRepresentation.h
@@ -11,10 +11,13 @@
 @interface WebImageRepresentation : NSObject <WebDocumentRepresentation>
 {
     WebImageRenderer *image;
-    BOOL doneLoading;
+    NSString *filename;
+    NSData *data;
     NSURL *URL;
 }
 - (WebImageRenderer *)image;
+- (NSString *)filename;
 - (BOOL)doneLoading;
+- (NSData *)data;
 - (NSURL *)URL;
 @end
diff --git a/WebKit/WebView.subproj/WebImageRepresentation.m b/WebKit/WebView.subproj/WebImageRepresentation.m
index 28abea0..831172d 100644
--- a/WebKit/WebView.subproj/WebImageRepresentation.m
+++ b/WebKit/WebView.subproj/WebImageRepresentation.m
@@ -18,7 +18,9 @@
 
 - (void)dealloc
 {
+    [filename release];
     [image release];
+    [data release];
     [URL release];
     [super dealloc];
 }
@@ -35,12 +37,13 @@
 
 - (BOOL)doneLoading
 {
-    return doneLoading;
+    return data != nil;
 }
 
 - (void)setDataSource:(WebDataSource *)dataSource
 {
     URL = [[[dataSource request] URL] retain];
+    filename = [[[dataSource response] suggestedFilename] retain];
     image = [[[WebImageRendererFactory sharedFactory] imageRendererWithMIMEType:[[dataSource response] MIMEType]] retain];
 }
 
@@ -52,18 +55,16 @@
 
 - (void)receivedError:(NSError *)error withDataSource:(WebDataSource *)dataSource
 {
-    NSData *allData = [dataSource data];
-    if ([allData length] > 0) {
-        [image incrementalLoadWithBytes:[allData bytes] length:[allData length] complete:YES];
+    data = [[dataSource data] retain];
+    if ([data length] > 0) {
+        [image incrementalLoadWithBytes:[data bytes] length:[data length] complete:YES];
     }
-    doneLoading = YES;
 }
 
 - (void)finishedLoadingWithDataSource:(WebDataSource *)dataSource
 {
-    NSData *allData = [dataSource data];
-    [image incrementalLoadWithBytes:[allData bytes] length:[allData length] complete:YES];
-    doneLoading = YES;
+    data = [[dataSource data] retain];
+    [image incrementalLoadWithBytes:[data bytes] length:[data length] complete:YES];
 }
 
 - (BOOL)canProvideDocumentSource
@@ -78,12 +79,21 @@
 
 - (NSString *)title
 {
-    NSString *lastPathComponent = [[URL path] lastPathComponent];
     NSSize size = [image size];
     if (!NSEqualSizes(size, NSZeroSize)) {
-        return [NSString stringWithFormat:UI_STRING("%@ %dx%d pixels", "window title for a standalone image"), lastPathComponent, (int)size.width, (int)size.height];
+        return [NSString stringWithFormat:UI_STRING("%@ %.0fx%.0f pixels", "window title for a standalone image"), filename, size.width, size.height];
     }
-    return lastPathComponent;
+    return filename;
+}
+
+- (NSData *)data
+{
+    return data;
+}
+
+- (NSString *)filename
+{
+    return filename;
 }
 
 @end
diff --git a/WebKit/WebView.subproj/WebImageView.h b/WebKit/WebView.subproj/WebImageView.h
index 72667b2..2ae5f7c 100644
--- a/WebKit/WebView.subproj/WebImageView.h
+++ b/WebKit/WebView.subproj/WebImageView.h
@@ -6,9 +6,10 @@
 #import <Cocoa/Cocoa.h>
 
 @class WebImageRepresentation;
+ at protocol WebDocumentImage;
 @protocol WebDocumentView;
 
- at interface WebImageView : NSView <WebDocumentView>
+ at interface WebImageView : NSView <WebDocumentView, WebDocumentImage>
 {
     WebImageRepresentation *rep;
     BOOL needsLayout;
diff --git a/WebKit/WebView.subproj/WebImageView.m b/WebKit/WebView.subproj/WebImageView.m
index e89a62c..8078989 100644
--- a/WebKit/WebView.subproj/WebImageView.m
+++ b/WebKit/WebView.subproj/WebImageView.m
@@ -5,6 +5,7 @@
 
 #import <WebKit/WebImageView.h>
 
+#import <WebKit/WebAssertions.h>
 #import <WebKit/WebDataSource.h>
 #import <WebKit/WebDocument.h>
 #import <WebKit/WebFrameViewPrivate.h>
@@ -16,7 +17,7 @@
 
 #import <WebCore/WebCoreImageRenderer.h>
 
-#import <WebKit/WebAssertions.h>
+#import <Foundation/NSFileManager_NSURLExtras.h>
 
 @implementation WebImageView
 
@@ -240,16 +241,11 @@
 
 - (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
 {
-    NSURL *URL = [rep URL];
-    [[self webView] _downloadURL:URL toDirectory:[dropDestination path]];
-
-    // FIXME: The file is supposed to be created at this point so the Finder places the file
-    // where the drag ended. Since we can't create the file until the download starts,
-    // this fails. Even if we did create the file at this point, the Finder doesn't
-    // place the file in the right place anyway (2825055).
-    // FIXME: We may return a different filename than the file that we will create.
-    // Since the file isn't created at this point anwyway, it doesn't matter what we return.
-    return [NSArray arrayWithObject:[[URL path] lastPathComponent]];
+    // FIXME: Report an error if we fail to create a file.
+    NSString *path = [[dropDestination path] stringByAppendingPathComponent:[rep filename]];
+    path = [[NSFileManager defaultManager] _web_pathWithUniqueFilenameForPath:path];
+    [[rep data] writeToFile:path atomically:NO];
+    return [NSArray arrayWithObject:[path lastPathComponent]];
 }
 
 - (void)draggedImage:(NSImage *)anImage endedAt:(NSPoint)aPoint operation:(NSDragOperation)operation
@@ -261,4 +257,9 @@
     [self release];
 }
 
+- (NSImage *)image
+{
+    return [rep image];
+}
+
 @end

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list