[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:25:06 UTC 2009
The following commit has been merged in the debian/unstable branch:
commit 0a487ee0907123f4fbe36967771e173f37094a52
Author: cblu <cblu at 268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date: Mon Feb 2 19:14:39 2004 +0000
Fixed: <rdar://problem/3546426>: when copying images via context menus, only some data is added to the pasteboard
Reviewed by john.
* Misc.subproj/WebNSPasteboardExtras.h:
* Misc.subproj/WebNSPasteboardExtras.m:
(-[NSPasteboard _web_writeImage:URL:title:fileWrapper:HTMLString:]): new, writes and image, URL and other optional arguments to the pasteboard
* Misc.subproj/WebNSViewExtras.m:
(-[NSView _web_dragImage:fileWrapper:rect:URL:title:HTMLString:event:]): factored code out to _web_writeImage, call _web_writeImage
* WebView.subproj/WebDefaultContextMenuDelegate.m:
(-[WebDefaultUIDelegate copyImageToClipboard:]): call _web_writeImage
* WebView.subproj/WebImageView.m:
(-[WebImageView writeImageToPasteboard:]): call _web_writeImage
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@6024 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/WebKit/ChangeLog b/WebKit/ChangeLog
index 71b2355..6ed9765 100644
--- a/WebKit/ChangeLog
+++ b/WebKit/ChangeLog
@@ -1,3 +1,19 @@
+2004-02-02 Chris Blumenberg <cblu at apple.com>
+
+ Fixed: <rdar://problem/3546426>: when copying images via context menus, only some data is added to the pasteboard
+
+ Reviewed by john.
+
+ * Misc.subproj/WebNSPasteboardExtras.h:
+ * Misc.subproj/WebNSPasteboardExtras.m:
+ (-[NSPasteboard _web_writeImage:URL:title:fileWrapper:HTMLString:]): new, writes and image, URL and other optional arguments to the pasteboard
+ * Misc.subproj/WebNSViewExtras.m:
+ (-[NSView _web_dragImage:fileWrapper:rect:URL:title:HTMLString:event:]): factored code out to _web_writeImage, call _web_writeImage
+ * WebView.subproj/WebDefaultContextMenuDelegate.m:
+ (-[WebDefaultUIDelegate copyImageToClipboard:]): call _web_writeImage
+ * WebView.subproj/WebImageView.m:
+ (-[WebImageView writeImageToPasteboard:]): call _web_writeImage
+
2004-02-02 Darin Adler <darin at apple.com>
- fixed build failure on Merlot
diff --git a/WebKit/Misc.subproj/WebNSPasteboardExtras.h b/WebKit/Misc.subproj/WebNSPasteboardExtras.h
index 28f495f..91d9d38 100644
--- a/WebKit/Misc.subproj/WebNSPasteboardExtras.h
+++ b/WebKit/Misc.subproj/WebNSPasteboardExtras.h
@@ -8,6 +8,8 @@
#import <Foundation/Foundation.h>
+ at class WebImageRenderer;
+
extern NSString *WebURLPboardType;
extern NSString *WebURLNamePboardType;
@@ -44,4 +46,11 @@ extern NSString *WebURLNamePboardType;
// NSRTFDPboardType must be declared on the pasteboard before calling this method.
- (void)_web_writeFileWrapperAsRTFDAttachment:(NSFileWrapper *)wrapper;
+// Writes an image, URL and other optional types to the pasteboard.
+- (void)_web_writeImage:(WebImageRenderer *)image
+ URL:(NSURL *)URL
+ title:(NSString *)title
+ fileWrapper:(NSFileWrapper *)wrapper
+ HTMLString:(NSString *)HTMLString;
+
@end
diff --git a/WebKit/Misc.subproj/WebNSPasteboardExtras.m b/WebKit/Misc.subproj/WebNSPasteboardExtras.m
index 241e19f..2a4cc7b 100644
--- a/WebKit/Misc.subproj/WebNSPasteboardExtras.m
+++ b/WebKit/Misc.subproj/WebNSPasteboardExtras.m
@@ -7,12 +7,15 @@
//
#import <WebKit/WebNSPasteboardExtras.h>
+
+#import <WebKit/WebAssertions.h>
+#import <WebKit/WebImageRenderer.h>
#import <WebKit/WebNSURLExtras.h>
#import <WebKit/WebURLsWithTitles.h>
#import <WebKit/WebViewPrivate.h>
-#import <WebKit/WebAssertions.h>
#import <Foundation/NSString_NSURLExtras.h>
+#import <Foundation/NSURL_NSURLExtras.h>
#import <HIServices/CoreTranslationFlavorTypeNames.h>
@@ -144,4 +147,47 @@ NSString *WebURLNamePboardType = nil;
[self setData:RTFDData forType:NSRTFDPboardType];
}
+- (void)_web_writeImage:(WebImageRenderer *)image
+ URL:(NSURL *)URL
+ title:(NSString *)title
+ fileWrapper:(NSFileWrapper *)fileWrapper
+ HTMLString:(NSString *)HTMLString
+{
+ ASSERT(image);
+ ASSERT(URL);
+
+ BOOL isDrag = (self == [NSPasteboard pasteboardWithName:NSDragPboard]);
+ NSMutableArray *types = [NSMutableArray arrayWithObject:NSTIFFPboardType];
+
+ [types addObjectsFromArray:[NSPasteboard _web_writableDragTypesForURL]];
+
+ if (fileWrapper) {
+ [types addObject:NSRTFDPboardType];
+ }
+ if (HTMLString) {
+ [types addObject:NSHTMLPboardType];
+ }
+ if (isDrag) {
+ [types addObject:NSFilesPromisePboardType];
+ }
+
+ [self setData:[image TIFFRepresentation] forType:NSTIFFPboardType];
+ [self _web_writeURL:URL andTitle:title withOwner:self types:types];
+
+ if (fileWrapper) {
+ [self _web_writeFileWrapperAsRTFDAttachment:fileWrapper];
+ }
+ if (HTMLString) {
+ [self setString:HTMLString forType:NSHTMLPboardType];
+ }
+ if (isDrag) {
+ NSString *filename = [URL _web_suggestedFilenameWithMIMEType:[image MIMEType]];
+ NSString *fileType = [filename pathExtension];
+ if (!fileType) {
+ fileType = @"";
+ }
+ [self setPropertyList:[NSArray arrayWithObject:fileType] forType:NSFilesPromisePboardType];
+ }
+}
+
@end
diff --git a/WebKit/Misc.subproj/WebNSViewExtras.m b/WebKit/Misc.subproj/WebNSViewExtras.m
index bed9429..4dfb875 100644
--- a/WebKit/Misc.subproj/WebNSViewExtras.m
+++ b/WebKit/Misc.subproj/WebNSViewExtras.m
@@ -3,12 +3,13 @@
Copyright (c) 2002, Apple, Inc. All rights reserved.
*/
+#import <WebKit/WebNSViewExtras.h>
+
#import <WebKit/WebFrameView.h>
#import <WebKit/WebImageRenderer.h>
#import <WebKit/WebNSImageExtras.h>
#import <WebKit/WebNSPasteboardExtras.h>
#import <WebKit/WebNSURLExtras.h>
-#import <WebKit/WebNSViewExtras.h>
#import <Foundation/NSString_NSURLExtras.h>
#import <Foundation/NSURL_NSURLExtras.h>
@@ -226,23 +227,8 @@
NSArray *filesTypes = [NSArray arrayWithObject:fileType];
NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
- NSMutableArray *types = [NSMutableArray arrayWithObjects:NSFilesPromisePboardType, NSTIFFPboardType, nil];
- [types addObjectsFromArray:[NSPasteboard _web_writableDragTypesForURL]];
- if (fileWrapper) {
- [types insertObject:NSRTFDPboardType atIndex:0];
- }
- if (HTMLString) {
- [types addObject:NSHTMLPboardType];
- }
- [pboard _web_writeURL:URL andTitle:title withOwner:self types:types];
- if (fileWrapper) {
- [pboard _web_writeFileWrapperAsRTFDAttachment:fileWrapper];
- }
- if (HTMLString) {
- [pboard setString:HTMLString forType:NSHTMLPboardType];
- }
- [pboard setPropertyList:filesTypes forType:NSFilesPromisePboardType];
- [pboard setData:[image TIFFRepresentation] forType:NSTIFFPboardType];
+
+ [pboard _web_writeImage:image URL:URL title:title fileWrapper:fileWrapper HTMLString:HTMLString];
id source = [[NSFilePromiseDragSource alloc] initWithSource:(id)self];
[source setTypes:filesTypes onPasteboard:pboard];
diff --git a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
index 2eba169..974b427 100644
--- a/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
+++ b/WebKit/WebView.subproj/WebDefaultContextMenuDelegate.m
@@ -204,19 +204,16 @@
- (void)copyImageToClipboard:(id)sender
{
- NSDictionary *element = [sender representedObject];
- NSPasteboard *pasteboard = [NSPasteboard generalPasteboard];
- NSMutableArray *types = [NSMutableArray arrayWithObject:NSTIFFPboardType];
+ NSDictionary *element = [sender representedObject];
+ NSURL *linkURL = [element objectForKey:WebElementLinkURLKey];
+ NSURL *imageURL = [element objectForKey:WebElementImageURLKey];
WebView *webView = [[element objectForKey:WebElementFrameKey] webView];
- NSFileWrapper *wrapper = [webView _fileWrapperForURL:[element objectForKey:WebElementImageURLKey]];
- if (wrapper) {
- [types insertObject:NSRTFDPboardType atIndex:0];
- }
- [pasteboard declareTypes:types owner:nil];
- if (wrapper) {
- [pasteboard _web_writeFileWrapperAsRTFDAttachment:wrapper];
- }
- [pasteboard setData:[[element objectForKey:WebElementImageKey] TIFFRepresentation] forType:NSTIFFPboardType];
+
+ [[NSPasteboard generalPasteboard] _web_writeImage:[element objectForKey:WebElementImageKey]
+ URL:linkURL ? linkURL : imageURL
+ title:[element objectForKey:WebElementImageAltStringKey]
+ fileWrapper:[webView _fileWrapperForURL:imageURL]
+ HTMLString:[element objectForKey:WebElementHTMLStringKey]];
}
- (void)openFrameInNewWindow:(id)sender
diff --git a/WebKit/WebView.subproj/WebImageView.m b/WebKit/WebView.subproj/WebImageView.m
index 11e3d2c..126a487 100644
--- a/WebKit/WebView.subproj/WebImageView.m
+++ b/WebKit/WebView.subproj/WebImageView.m
@@ -177,9 +177,7 @@
- (BOOL)writeImageToPasteboard:(NSPasteboard *)pasteboard
{
if ([self haveCompleteImage]) {
- [pasteboard declareTypes:[NSArray arrayWithObjects:NSRTFDPboardType, NSTIFFPboardType, nil] owner:nil];
- [pasteboard _web_writeFileWrapperAsRTFDAttachment:[rep fileWrapper]];
- [pasteboard setData:[[rep image] TIFFRepresentation] forType:NSTIFFPboardType];
+ [pasteboard _web_writeImage:[rep image] URL:[rep URL] title:nil fileWrapper:[rep fileWrapper] HTMLString:nil];
return YES;
}
--
WebKit Debian packaging
More information about the Pkg-webkit-commits
mailing list