diff options
Diffstat (limited to 'WebCore/platform/mac/PasteboardMac.mm')
-rw-r--r-- | WebCore/platform/mac/PasteboardMac.mm | 22 |
1 files changed, 17 insertions, 5 deletions
diff --git a/WebCore/platform/mac/PasteboardMac.mm b/WebCore/platform/mac/PasteboardMac.mm index e21f549..f048791 100644 --- a/WebCore/platform/mac/PasteboardMac.mm +++ b/WebCore/platform/mac/PasteboardMac.mm @@ -135,8 +135,8 @@ static NSAttributedString *stripAttachmentCharacters(NSAttributedString *string) void Pasteboard::writeSelection(NSPasteboard* pasteboard, Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame) { - if (WebArchivePboardType == nil) - Pasteboard::generalPasteboard(); //Initialises pasteboard types + if (!WebArchivePboardType) + Pasteboard::generalPasteboard(); // Initialises pasteboard types ASSERT(selectedRange); NSAttributedString *attributedString = [[[NSAttributedString alloc] _initWithDOMRange:kit(selectedRange)] autorelease]; @@ -203,12 +203,24 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Pasteboard::writeSelection(m_pasteboard.get(), selectedRange, canSmartCopyOrDelete, frame); } +void Pasteboard::writePlainText(const String& text) +{ + if (!WebArchivePboardType) + Pasteboard::generalPasteboard(); // Initialises pasteboard types + + NSArray *types = [NSArray arrayWithObject:NSStringPboardType]; + NSPasteboard *pasteboard = m_pasteboard.get(); + [pasteboard declareTypes:types owner:nil]; + + [pasteboard setString:text forType:NSStringPboardType]; +} + void Pasteboard::writeURL(NSPasteboard* pasteboard, NSArray* types, const KURL& url, const String& titleStr, Frame* frame) { - if (WebArchivePboardType == nil) - Pasteboard::generalPasteboard(); //Initialises pasteboard types + if (!WebArchivePboardType) + Pasteboard::generalPasteboard(); // Initialises pasteboard types - if (types == nil) { + if (!types) { types = writableTypesForURL(); [pasteboard declareTypes:types owner:nil]; } |