[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:07:16 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 3dffb7e604c7e381dcf99ec5116b7f86a407ea4f
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Wed Oct 29 22:36:59 2003 +0000
Fixed: <rdar://problem/3438716>: jpg and gif images copied from Safari and placed in mail are sent as tiff
Reviewed by john.
* Misc.subproj/WebNSPasteboardExtras.h:
* Misc.subproj/WebNSPasteboardExtras.m:
(-[NSPasteboard _web_writeFileContents:withFilename:]): new
* Misc.subproj/WebNSViewExtras.h:
* Misc.subproj/WebNSViewExtras.m:
(-[NSView _web_dragImage:originalData:rect:URL:title:event:]): now takes originalData and calls _web_fileContents:withFilename:
* WebView.subproj/WebDefaultContextMenuDelegate.m:
(-[WebDefaultUIDelegate copyImageToClipboard:]): call _web_writeFileContents:withFilename:
* WebView.subproj/WebHTMLView.m:
(-[WebHTMLView _handleMouseDragged:]): call renamed _web_dragImage and [WebView _cachedResponseForURL:]
(-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]): call [WebView _cachedResponseForURL:]
* WebView.subproj/WebImageView.m:
(-[WebImageView writeImageToPasteboard:]): call _web_writeFileContents:withFilename:
(-[WebImageView mouseDragged:]): call renamed _web_dragImage
* WebView.subproj/WebView.m:
(-[WebView _cachedResponseForURL:]): new
* WebView.subproj/WebViewPrivate.h:
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@5307 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index dee852a..d1d3323 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,27 @@
+2003-10-29 Chris Blumenberg <cblu at apple.com>
+
+ Fixed: <rdar://problem/3438716>: jpg and gif images copied from Safari and placed in mail are sent as tiff
+
+ Reviewed by john.
+
+ * Misc.subproj/WebNSPasteboardExtras.h:
+ * Misc.subproj/WebNSPasteboardExtras.m:
+ (-[NSPasteboard _web_writeFileContents:withFilename:]): new
+ * Misc.subproj/WebNSViewExtras.h:
+ * Misc.subproj/WebNSViewExtras.m:
+ (-[NSView _web_dragImage:originalData:rect:URL:title:event:]): now takes originalData and calls _web_fileContents:withFilename:
+ * WebView.subproj/WebDefaultContextMenuDelegate.m:
+ (-[WebDefaultUIDelegate copyImageToClipboard:]): call _web_writeFileContents:withFilename:
+ * WebView.subproj/WebHTMLView.m:
+ (-[WebHTMLView _handleMouseDragged:]): call renamed _web_dragImage and [WebView _cachedResponseForURL:]
+ (-[WebHTMLView namesOfPromisedFilesDroppedAtDestination:]): call [WebView _cachedResponseForURL:]
+ * WebView.subproj/WebImageView.m:
+ (-[WebImageView writeImageToPasteboard:]): call _web_writeFileContents:withFilename:
+ (-[WebImageView mouseDragged:]): call renamed _web_dragImage
+ * WebView.subproj/WebView.m:
+ (-[WebView _cachedResponseForURL:]): new
+ * WebView.subproj/WebViewPrivate.h:
+
2003-10-28 John Sullivan <sullivan at apple.com>
- fixed <rdar://problem/3466082>: 7B85/111: Crash viewing web page ([WebView setNextKeyView:])
diff --git a/WebKit/Misc.subproj/WebNSPasteboardExtras.h b/WebKit/Misc.subproj/WebNSPasteboardExtras.h
index 180ca00..60028b3 100644
--- a/WebKit/Misc.subproj/WebNSPasteboardExtras.h
+++ b/WebKit/Misc.subproj/WebNSPasteboardExtras.h
@@ -40,4 +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 and specifies a filename.
+// NSFileContentsPboardType must be declared on the pasteboard before calling this method.
+- (void)_web_writeFileContents:(NSData *)data withFilename:(NSString *)filename;
+
@end
diff --git a/WebKit/Misc.subproj/WebNSPasteboardExtras.m b/WebKit/Misc.subproj/WebNSPasteboardExtras.m
index 76e69ad..c15a7ef 100644
--- a/WebKit/Misc.subproj/WebNSPasteboardExtras.m
+++ b/WebKit/Misc.subproj/WebNSPasteboardExtras.m
@@ -133,5 +133,12 @@ NSString *WebURLNamePboardType = nil;
return [findPasteboard changeCount];
}
+- (void)_web_writeFileContents:(NSData *)data withFilename:(NSString *)filename
+{
+ NSFileWrapper *wrapper = [[NSFileWrapper alloc] initRegularFileWithContents:data];
+ [wrapper setPreferredFilename:filename];
+ [self writeFileWrapper:wrapper];
+ [wrapper release];
+}
@end
diff --git a/WebKit/Misc.subproj/WebNSViewExtras.h b/WebKit/Misc.subproj/WebNSViewExtras.h
index 0fcc3cd..24081e6 100644
--- a/WebKit/Misc.subproj/WebNSViewExtras.h
+++ b/WebKit/Misc.subproj/WebNSViewExtras.h
@@ -40,9 +40,10 @@
- (NSDragOperation)_web_dragOperationForDraggingInfo:(id <NSDraggingInfo>)sender;
// Resizes and applies alpha to image, extends pboard and sets drag origins for dragging promised image files.
-- (void)_web_dragPromisedImage:(WebImageRenderer *)image
- rect:(NSRect)rect
- URL:(NSURL *)URL
- title:(NSString *)title
- event:(NSEvent *)event;
+- (void)_web_dragImage:(WebImageRenderer *)image
+ originalData:(NSData *)originalData
+ rect:(NSRect)rect
+ URL:(NSURL *)URL
+ title:(NSString *)title
+ event:(NSEvent *)event;
@end
diff --git a/WebKit/Misc.subproj/WebNSViewExtras.m b/WebKit/Misc.subproj/WebNSViewExtras.m
index a04653a..60e72fb 100644
--- a/WebKit/Misc.subproj/WebNSViewExtras.m
+++ b/WebKit/Misc.subproj/WebNSViewExtras.m
@@ -11,7 +11,7 @@
#import <WebKit/WebNSViewExtras.h>
#import <Foundation/NSString_NSURLExtras.h>
-#import <Foundation/NSURLFileTypeMappings.h>
+#import <Foundation/NSURL_NSURLExtras.h>
#define WebDragStartHysteresisX 5.0
#define WebDragStartHysteresisY 5.0
@@ -177,22 +177,20 @@
}
#endif
-- (void)_web_dragPromisedImage:(WebImageRenderer *)image
- rect:(NSRect)rect
- URL:(NSURL *)URL
- title:(NSString *)title
- event:(NSEvent *)event
+- (void)_web_dragImage:(WebImageRenderer *)image
+ originalData:(NSData *)originalData
+ rect:(NSRect)rect
+ URL:(NSURL *)URL
+ title:(NSString *)title
+ event:(NSEvent *)event
{
NSPoint mouseDownPoint = [self convertPoint:[event locationInWindow] fromView:nil];
NSImage *dragImage;
NSPoint origin;
NSSize offset;
- NSString *MIMEType = [image MIMEType];
- NSString *fileType = nil;
- if (MIMEType && ![MIMEType isEqualToString:@"application/octet-stream"]) {
- fileType = [[NSURLFileTypeMappings sharedMappings] preferredExtensionForMIMEType:MIMEType];
- }
+ NSString *filename = [URL _web_suggestedFilenameWithMIMEType:[image MIMEType]];
+ NSString *fileType = [filename pathExtension];
if (!fileType) {
fileType = @"";
}
@@ -229,7 +227,13 @@
NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
NSMutableArray *types = [NSMutableArray arrayWithObjects:NSFilesPromisePboardType, NSTIFFPboardType, nil];
[types addObjectsFromArray:[NSPasteboard _web_writableDragTypesForURL]];
+ if (originalData) {
+ [types insertObject:NSFileContentsPboardType atIndex:0];
+ }
[pboard _web_writeURL:URL andTitle:title withOwner:self types:types];
+ if (originalData) {
+ [pboard _web_writeFileContents:originalData withFilename:filename];
+ }
[pboard setPropertyList:filesTypes forType:NSFilesPromisePboardType];
[pboard setData:[image TIFFRepresentation] forType:NSTIFFPboardType];
diff --git a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
index 75d8601..10b7770 100644
--- a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
+++ b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
@@ -173,12 +173,20 @@
- (void)copyImageToClipboard:(id)sender
{
- NSDictionary *element = [sender representedObject];
- NSData *tiff = [[element objectForKey:WebElementImageKey] TIFFRepresentation];
-
+ NSDictionary *element = [sender representedObject];
NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
- [pasteboard declareTypes:[NSArray arrayWithObject:NSTIFFPboardType] owner:nil];
- [pasteboard setData:tiff forType:NSTIFFPboardType];
+ NSMutableArray *types = [NSMutableArray arrayWithObject:NSTIFFPboardType];
+ WebView *webView = [[element objectForKey:WebElementFrameKey] webView];
+ NSCachedURLResponse *cachedResponse = [webView _cachedResponseForURL:[element objectForKey:WebElementImageURLKey]];
+ NSData *data = [cachedResponse data];
+ if (data) {
+ [types insertObject:NSFileContentsPboardType atIndex:0];
+ }
+ [pasteboard declareTypes:types owner:nil];
+ if (data) {
+ [pasteboard _web_writeFileContents:data withFilename:[[cachedResponse response] suggestedFilename]];
+ }
+ [pasteboard setData:[[element objectForKey:WebElementImageKey] TIFFRepresentation] forType:NSTIFFPboardType];
}
- (void)openFrameInNewWindow:(id)sender
@@ -188,5 +196,4 @@
[self openNewWindowWithURL:[[webFrame dataSource] _URL] element:element];
}
-
@end
diff --git a/WebKit/WebView.subproj/WebHTMLView.m b/WebKit/WebView.subproj/WebHTMLView.m
index 3b4c09e..9c15397 100644
--- a/WebKit/WebView.subproj/WebHTMLView.m
+++ b/WebKit/WebView.subproj/WebHTMLView.m
@@ -40,7 +40,6 @@
#import <Foundation/NSFileManager_NSURLExtras.h>
#import <Foundation/NSURL_NSURLExtras.h>
-#import <Foundation/NSURLRequestPrivate.h>
// The link drag hysteresis is much larger than the others because there
// needs to be enough space to cancel the link press without starting a link drag,
@@ -639,11 +638,12 @@ static WebHTMLView *lastHitView = nil;
_private->draggingImageURL = [imageURL retain];
WebImageRenderer *image = [element objectForKey:WebElementImageKey];
ASSERT([image isKindOfClass:[WebImageRenderer class]]);
- [self _web_dragPromisedImage:image
- rect:[[element objectForKey:WebElementImageRectKey] rectValue]
- URL:linkURL ? linkURL : imageURL
- title:[element objectForKey:WebElementImageAltStringKey]
- event:_private->mouseDownEvent];
+ [self _web_dragImage:image
+ originalData:[[[self _webView] _cachedResponseForURL:imageURL] data]
+ rect:[[element objectForKey:WebElementImageRectKey] rectValue]
+ URL:linkURL ? linkURL : imageURL
+ title:[element objectForKey:WebElementImageAltStringKey]
+ event:_private->mouseDownEvent];
} else if (linkURL) {
NSPasteboard *pasteboard = [NSPasteboard pasteboardWithName:NSDragPboard];
@@ -1490,14 +1490,10 @@ static WebHTMLView *lastHitView = nil;
ASSERT(_private->draggingImageURL);
WebView *webView = [self _webView];
+ NSCachedURLResponse *cachedResponse = [webView _cachedResponseForURL:_private->draggingImageURL];
+ NSData *data = [cachedResponse data];
NSString *filename;
- NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:_private->draggingImageURL];
- [request setHTTPUserAgent:[webView userAgentForURL:_private->draggingImageURL]];
- NSCachedURLResponse *cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
- [request release];
-
- NSData *data = [cachedResponse data];
if (data) {
// FIXME: Report an error if we fail to create a file.
NSString *path = [[dropDestination path] stringByAppendingPathComponent:[[cachedResponse response] suggestedFilename]];
diff --git a/WebKit/WebView.subproj/WebImageView.m b/WebKit/WebView.subproj/WebImageView.m
index b9e5dbd..0796844 100644
--- a/WebKit/WebView.subproj/WebImageView.m
+++ b/WebKit/WebView.subproj/WebImageView.m
@@ -12,6 +12,7 @@
#import <WebKit/WebImageRenderer.h>
#import <WebKit/WebImageRendererFactory.h>
#import <WebKit/WebImageRepresentation.h>
+#import <WebKit/WebNSPasteboardExtras.h>
#import <WebKit/WebNSViewExtras.h>
#import <WebKit/WebViewPrivate.h>
@@ -185,12 +186,11 @@
}
- (BOOL)writeImageToPasteboard:(NSPasteboard *)pasteboard
-{
- NSData *TIFFData = [self haveCompleteImage] ? [[rep image] TIFFRepresentation] : nil;
-
- if (TIFFData) {
- [pasteboard declareTypes:[NSArray arrayWithObject:NSTIFFPboardType] owner:nil];
- [pasteboard setData:TIFFData forType:NSTIFFPboardType];
+{
+ if ([self haveCompleteImage]) {
+ [pasteboard declareTypes:[NSArray arrayWithObjects:NSFileContentsPboardType, NSTIFFPboardType, nil] owner:nil];
+ [pasteboard _web_writeFileContents:[rep data] withFilename:[rep filename]];
+ [pasteboard setData:[[rep image] TIFFRepresentation] forType:NSTIFFPboardType];
return YES;
}
@@ -238,11 +238,12 @@
// Retain this view during the drag because it may be released before the drag ends.
[self retain];
- [self _web_dragPromisedImage:[rep image]
- rect:[self drawingRect]
- URL:[rep URL]
- title:nil
- event:event];
+ [self _web_dragImage:[rep image]
+ originalData:[rep data]
+ rect:[self drawingRect]
+ URL:[rep URL]
+ title:nil
+ event:event];
}
- (NSArray *)namesOfPromisedFilesDroppedAtDestination:(NSURL *)dropDestination
diff --git a/WebKit/WebView.subproj/WebView.m b/WebKit/WebView.subproj/WebView.m
index b947268..70c6e75 100644
--- a/WebKit/WebView.subproj/WebView.m
+++ b/WebKit/WebView.subproj/WebView.m
@@ -2,19 +2,26 @@
WebView.m
Copyright 2001, 2002 Apple, Inc. All rights reserved.
*/
+
+#import <WebKit/WebViewPrivate.h>
+
+#import <WebKit/WebAssertions.h>
#import <WebKit/WebBackForwardList.h>
#import <WebKit/WebBridge.h>
#import <WebKit/WebControllerSets.h>
#import <WebKit/WebDataSourcePrivate.h>
+#import <WebKit/WebDefaultFrameLoadDelegate.h>
#import <WebKit/WebDefaultPolicyDelegate.h>
+#import <WebKit/WebDefaultResourceLoadDelegate.h>
+#import <WebKit/WebDefaultUIDelegate.h>
#import <WebKit/WebDocument.h>
#import <WebKit/WebDocumentInternal.h>
#import <WebKit/WebDynamicScrollBarsView.h>
+#import <WebKit/WebDownload.h>
#import <WebKit/WebException.h>
-#import <WebKit/WebFrame.h>
+#import <WebKit/WebFormDelegatePrivate.h>
#import <WebKit/WebFramePrivate.h>
#import <WebKit/WebFrameViewPrivate.h>
-#import <WebKit/WebHistoryItem.h>
#import <WebKit/WebHistoryItemPrivate.h>
#import <WebKit/WebHTMLView.h>
#import <WebKit/WebIconDatabase.h>
@@ -31,10 +38,11 @@
#import <WebKit/WebTextView.h>
#import <WebKit/WebTextRepresentation.h>
#import <WebKit/WebTextRenderer.h>
-#import <WebKit/WebViewPrivate.h>
#import <WebKit/WebUIDelegate.h>
-#import <WebKit/WebAssertions.h>
+#import <WebCore/WebCoreEncodings.h>
+#import <WebCore/WebCoreSettings.h>
+
#import <Foundation/NSUserDefaults_NSURLExtras.h>
#import <Foundation/NSURLConnection.h>
@@ -42,14 +50,7 @@
#import <Foundation/NSDictionary_NSURLExtras.h>
#import <Foundation/NSURLDownloadPrivate.h>
#import <Foundation/NSURLFileTypeMappings.h>
-#import <WebCore/WebCoreEncodings.h>
-#import <WebCore/WebCoreSettings.h>
-#import <WebKit/WebDefaultFrameLoadDelegate.h>
-#import <WebKit/WebDefaultPolicyDelegate.h>
-#import <WebKit/WebDefaultResourceLoadDelegate.h>
-#import <WebKit/WebDefaultUIDelegate.h>
-#import <WebKit/WebDownload.h>
-#import <WebKit/WebFormDelegatePrivate.h>
+#import <Foundation/NSURLRequestPrivate.h>
static const struct UserAgentSpoofTableEntry *_web_findSpoofTableEntry(const char *, unsigned);
@@ -70,22 +71,22 @@ NSString *WebElementLinkTargetFrameKey = @"WebElementTargetFrame";
NSString *WebElementLinkLabelKey = @"WebElementLinkLabel";
NSString *WebElementLinkTitleKey = @"WebElementLinkTitle";
-NSString *WebViewProgressStartedNotification = @"WebProgressStartedNotification";
-NSString *WebViewProgressEstimateChangedNotification = @"WebProgressEstimateChangedNotification";
-NSString *WebViewProgressFinishedNotification = @"WebProgressFinishedNotification";
+NSString *WebViewProgressStartedNotification = @"WebProgressStartedNotification";
+NSString *WebViewProgressEstimateChangedNotification = @"WebProgressEstimateChangedNotification";
+NSString *WebViewProgressFinishedNotification = @"WebProgressFinishedNotification";
enum { WebViewVersion = 2 };
static NSMutableSet *schemesWithRepresentationsSet;
-NSString *_WebCanGoBackKey = @"canGoBack";
-NSString *_WebCanGoForwardKey = @"canGoForward";
-NSString *_WebEstimatedProgressKey = @"estimatedProgress";
-NSString *_WebIsLoadingKey = @"isLoading";
-NSString *_WebMainFrameIconKey = @"mainFrameIcon";
-NSString *_WebMainFrameTitleKey = @"mainFrameTitle";
-NSString *_WebMainFrameURLKey = @"mainFrameURL";
+NSString *_WebCanGoBackKey = @"canGoBack";
+NSString *_WebCanGoForwardKey = @"canGoForward";
+NSString *_WebEstimatedProgressKey = @"estimatedProgress";
+NSString *_WebIsLoadingKey = @"isLoading";
+NSString *_WebMainFrameIconKey = @"mainFrameIcon";
+NSString *_WebMainFrameTitleKey = @"mainFrameTitle";
+NSString *_WebMainFrameURLKey = @"mainFrameURL";
@interface WebProgressItem : NSObject
{
@@ -1024,6 +1025,15 @@ NSString *_WebMainFrameURLKey = @"mainFrameURL";
[[self mainFrame] _reloadForPluginChanges];
}
+- (NSCachedURLResponse *)_cachedResponseForURL:(NSURL *)URL
+{
+ NSMutableURLRequest *request = [[NSMutableURLRequest alloc] initWithURL:URL];
+ [request setHTTPUserAgent:[self userAgentForURL:URL]];
+ NSCachedURLResponse *cachedResponse = [[NSURLCache sharedURLCache] cachedResponseForRequest:request];
+ [request release];
+ return cachedResponse;
+}
+
@end
diff --git a/WebKit/WebView.subproj/WebViewPrivate.h b/WebKit/WebView.subproj/WebViewPrivate.h
index d9546db..3a19bd6 100644
--- a/WebKit/WebView.subproj/WebViewPrivate.h
+++ b/WebKit/WebView.subproj/WebViewPrivate.h
@@ -256,6 +256,9 @@ Could be worth adding to the API.
- (void)_reloadForPluginChanges;
+ (void)_setAlwaysUseATSU:(BOOL)f;
+
+- (NSCachedURLResponse *)_cachedResponseForURL:(NSURL *)URL;
+
@end
@interface _WebSafeForwarder : NSObject
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list