summaryrefslogtreecommitdiffstats
path: root/WebCore/platform/mac/PasteboardMac.mm
diff options
context:
space:
mode:
Diffstat (limited to 'WebCore/platform/mac/PasteboardMac.mm')
-rw-r--r--WebCore/platform/mac/PasteboardMac.mm23
1 files changed, 15 insertions, 8 deletions
diff --git a/WebCore/platform/mac/PasteboardMac.mm b/WebCore/platform/mac/PasteboardMac.mm
index 87db2f9..4e15ad0 100644
--- a/WebCore/platform/mac/PasteboardMac.mm
+++ b/WebCore/platform/mac/PasteboardMac.mm
@@ -33,14 +33,15 @@
#import "DocumentFragment.h"
#import "Editor.h"
#import "EditorClient.h"
+#import "Frame.h"
#import "HitTestResult.h"
#import "Image.h"
#import "KURL.h"
+#import "LegacyWebArchive.h"
#import "LoaderNSURLExtras.h"
#import "MIMETypeRegistry.h"
#import "RenderImage.h"
#import "WebCoreNSStringExtras.h"
-#import "WebCoreSystemInterface.h"
#import "markup.h"
#import <wtf/RetainPtr.h>
@@ -159,7 +160,9 @@ void Pasteboard::writeSelection(NSPasteboard* pasteboard, Range* selectedRange,
// Put HTML on the pasteboard.
if ([types containsObject:WebArchivePboardType]) {
- [pasteboard setData:frame->editor()->client()->dataForArchivedSelection(frame) forType:WebArchivePboardType];
+ RefPtr<LegacyWebArchive> archive = LegacyWebArchive::createFromSelection(frame);
+ RetainPtr<CFDataRef> data = archive ? archive->rawDataRepresentation() : 0;
+ [pasteboard setData:(NSData *)data.get() forType:WebArchivePboardType];
}
// Put the attributed string on the pasteboard (RTF/RTFD format).
@@ -210,7 +213,7 @@ void Pasteboard::writeURL(NSPasteboard* pasteboard, NSArray* types, const KURL&
ASSERT(!url.isEmpty());
- NSURL *cocoaURL = url.getNSURL();
+ NSURL *cocoaURL = url;
NSString *userVisibleString = frame->editor()->client()->userVisibleString(cocoaURL);
NSString *title = (NSString*)titleStr;
@@ -270,17 +273,21 @@ void Pasteboard::writeImage(Node* node, const KURL& url, const String& title)
ASSERT(node);
Frame* frame = node->document()->frame();
- NSURL *cocoaURL = url.getNSURL();
+ NSURL *cocoaURL = url;
ASSERT(cocoaURL);
- NSArray* types = writableTypesForImage();
- [m_pasteboard.get() declareTypes:types owner:nil];
- writeURL(m_pasteboard.get(), types, cocoaURL, nsStringNilIfEmpty(title), frame);
-
ASSERT(node->renderer() && node->renderer()->isImage());
RenderImage* renderer = static_cast<RenderImage*>(node->renderer());
CachedImage* cachedImage = static_cast<CachedImage*>(renderer->cachedImage());
ASSERT(cachedImage);
+
+ if (cachedImage->errorOccurred())
+ return;
+
+ NSArray* types = writableTypesForImage();
+ [m_pasteboard.get() declareTypes:types owner:nil];
+ writeURL(m_pasteboard.get(), types, cocoaURL, nsStringNilIfEmpty(title), frame);
+
Image* image = cachedImage->image();
ASSERT(image);