Commit fc2d14b4 authored by aliceli1's avatar aliceli1

WebCore:

        Reviewed by Harrison.

        Fix for <rdar://problem/4894155> REGRESSION: Extra line break is pasted with content into message body after choosing File - Paste

        Migration of some editing code from WebHTMView to WebCore::Editor
        resulted in not calling pasteboardTypesForSelection, which Mail was
        overriding for the special purpose of adding a type to the
        pasteboard after WebKit did.  This patch adds 2 separate code paths
        for Tiger and Leopard.  On Tiger we give in and call the WebView's
        pasteboardTypesForSelection.  On Leopard we call a delegate after
        the pasteboard types are set. 

        * bridge/EditorClient.h:
        * editing/Editor.h:
        * platform/Pasteboard.h:
        * platform/graphics/svg/SVGImageEmptyClients.h:
        (WebCore::SVGEmptyEditorClient::didSetSelectionTypesForPasteboard):
        (WebCore::SVGEmptyEditorClient::pasteboardTypesForSelection):
        * platform/mac/PasteboardMac.mm:
        (WebCore::Pasteboard::Pasteboard):
        (WebCore::Pasteboard::clear):
        (WebCore::Pasteboard::writeSelection):
        (WebCore::Pasteboard::writeURL):
        (WebCore::Pasteboard::plainText):
        (WebCore::Pasteboard::documentFragment):

WebKit:

        Reviewed by Harrison.

        Fix for <rdar://problem/4894155> REGRESSION: Extra line break is pasted with content into message body after choosing File - Paste

        Migration of some editing code from WebHTMView to WebCore::Editor
        resulted in not calling pasteboardTypesForSelection, which Mail was
        overriding for the special purpose of adding a type to the
        pasteboard after WebKit did.  This patch adds 2 separate code paths
        for Tiger and Leopard.  On Tiger we give in and call the WebView's
        pasteboardTypesForSelection.  On Leopard we call a delegate after
        the pasteboard types are set. 

        * DefaultDelegates/WebDefaultEditingDelegate.m:
        (-[WebDefaultEditingDelegate webView:didSetSelectionTypesForPasteboard:]):
        * WebCoreSupport/WebEditorClient.h:
        * WebCoreSupport/WebEditorClient.mm:
        (WebEditorClient::didSetSelectionTypesForPasteboard):
        (WebEditorClient::pasteboardTypesForSelection):
        * WebView/WebEditingDelegate.h:

WebKitQt:

        Added these stubs to keep the Qt build from failing.

        * WebCoreSupport/EditorClientQt.cpp:
        (WebCore::EditorClientQt::didSetSelectionTypesForPasteboard):
        * WebCoreSupport/EditorClientQt.h:



git-svn-id: svn://svn.chromium.org/blink/trunk@18931 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 60f8fb75
2007-01-17 Alice Liu <alice.liu@apple.com>
Reviewed by Harrison.
Fix for <rdar://problem/4894155> REGRESSION: Extra line break is pasted with content into message body after choosing File - Paste
Migration of some editing code from WebHTMView to WebCore::Editor
resulted in not calling pasteboardTypesForSelection, which Mail was
overriding for the special purpose of adding a type to the
pasteboard after WebKit did. This patch adds 2 separate code paths
for Tiger and Leopard. On Tiger we give in and call the WebView's
pasteboardTypesForSelection. On Leopard we call a delegate after
the pasteboard types are set.
* bridge/EditorClient.h:
* editing/Editor.h:
* platform/Pasteboard.h:
* platform/graphics/svg/SVGImageEmptyClients.h:
(WebCore::SVGEmptyEditorClient::didSetSelectionTypesForPasteboard):
(WebCore::SVGEmptyEditorClient::pasteboardTypesForSelection):
* platform/mac/PasteboardMac.mm:
(WebCore::Pasteboard::Pasteboard):
(WebCore::Pasteboard::clear):
(WebCore::Pasteboard::writeSelection):
(WebCore::Pasteboard::writeURL):
(WebCore::Pasteboard::plainText):
(WebCore::Pasteboard::documentFragment):
2007-01-17 John Sullivan <sullivan@apple.com> 2007-01-17 John Sullivan <sullivan@apple.com>
Reviewed by Darin Reviewed by Darin
......
...@@ -29,6 +29,7 @@ ...@@ -29,6 +29,7 @@
#include "EditorInsertAction.h" #include "EditorInsertAction.h"
#include <wtf/Forward.h> #include <wtf/Forward.h>
#if PLATFORM(MAC) #if PLATFORM(MAC)
class NSArray;
class NSData; class NSData;
class NSString; class NSString;
class NSURL; class NSURL;
...@@ -75,6 +76,7 @@ public: ...@@ -75,6 +76,7 @@ public:
virtual void respondToChangedContents() = 0; virtual void respondToChangedContents() = 0;
virtual void didEndEditing() = 0; virtual void didEndEditing() = 0;
virtual void didWriteSelectionToPasteboard() = 0; virtual void didWriteSelectionToPasteboard() = 0;
virtual void didSetSelectionTypesForPasteboard() = 0;
// virtual void webViewDidChangeTypingStyle:(NSNotification *)notification = 0; // virtual void webViewDidChangeTypingStyle:(NSNotification *)notification = 0;
// virtual void webViewDidChangeSelection:(NSNotification *)notification = 0; // virtual void webViewDidChangeSelection:(NSNotification *)notification = 0;
// virtual NSUndoManager* undoManagerForWebView:(WebView *)webView = 0; // virtual NSUndoManager* undoManagerForWebView:(WebView *)webView = 0;
...@@ -94,6 +96,9 @@ public: ...@@ -94,6 +96,9 @@ public:
virtual NSData* dataForArchivedSelection(Frame*) = 0; virtual NSData* dataForArchivedSelection(Frame*) = 0;
virtual NSString* userVisibleString(NSURL*) = 0; virtual NSString* userVisibleString(NSURL*) = 0;
#ifdef BUILDING_ON_TIGER
virtual NSArray* pasteboardTypesForSelection(Frame*) = 0;
#endif
#endif #endif
}; };
......
...@@ -187,7 +187,6 @@ private: ...@@ -187,7 +187,6 @@ private:
PassRefPtr<Clipboard> newGeneralClipboard(ClipboardAccessPolicy policy); PassRefPtr<Clipboard> newGeneralClipboard(ClipboardAccessPolicy policy);
PassRefPtr<Range> selectedRange(); PassRefPtr<Range> selectedRange();
void pasteAsPlainTextWithPasteboard(Pasteboard*); void pasteAsPlainTextWithPasteboard(Pasteboard*);
Vector<String> pasteboardTypesForSelection();
void pasteWithPasteboard(Pasteboard*, bool allowPlainText); void pasteWithPasteboard(Pasteboard*, bool allowPlainText);
void replaceSelectionWithFragment(PassRefPtr<DocumentFragment> fragment, bool selectReplacement, bool smartReplace, bool matchStyle); void replaceSelectionWithFragment(PassRefPtr<DocumentFragment> fragment, bool selectReplacement, bool smartReplace, bool matchStyle);
void replaceSelectionWithText(String text, bool selectReplacement, bool smartReplace); void replaceSelectionWithText(String text, bool selectReplacement, bool smartReplace);
......
...@@ -78,6 +78,7 @@ private: ...@@ -78,6 +78,7 @@ private:
#if PLATFORM(MAC) #if PLATFORM(MAC)
Pasteboard(NSPasteboard *); Pasteboard(NSPasteboard *);
NSPasteboard *m_pasteboard; NSPasteboard *m_pasteboard;
NSArray *m_types;
#endif #endif
#if PLATFORM(WIN) #if PLATFORM(WIN)
......
...@@ -298,6 +298,7 @@ public: ...@@ -298,6 +298,7 @@ public:
virtual void respondToChangedContents() { } virtual void respondToChangedContents() { }
virtual void didEndEditing() { } virtual void didEndEditing() { }
virtual void didWriteSelectionToPasteboard() { } virtual void didWriteSelectionToPasteboard() { }
virtual void didSetSelectionTypesForPasteboard() { }
// virtual void webViewDidChangeTypingStyle:(NSNotification *)notification { } // virtual void webViewDidChangeTypingStyle:(NSNotification *)notification { }
// virtual void webViewDidChangeSelection:(NSNotification *)notification { } // virtual void webViewDidChangeSelection:(NSNotification *)notification { }
// virtual NSUndoManager* undoManagerForWebView:(WebView *)webView { return 0; } // virtual NSUndoManager* undoManagerForWebView:(WebView *)webView { return 0; }
...@@ -317,6 +318,9 @@ public: ...@@ -317,6 +318,9 @@ public:
virtual NSData* dataForArchivedSelection(Frame*) { return 0; } virtual NSData* dataForArchivedSelection(Frame*) { return 0; }
virtual NSString* userVisibleString(NSURL*) { return 0; } virtual NSString* userVisibleString(NSURL*) { return 0; }
#ifdef BUILDING_ON_TIGER
virtual NSArray* pasteboardTypesForSelection(Frame*) { return 0; }
#endif
#endif #endif
......
...@@ -48,6 +48,7 @@ NSString *WebURLNamePboardType; ...@@ -48,6 +48,7 @@ NSString *WebURLNamePboardType;
NSString *WebURLPboardType; NSString *WebURLPboardType;
NSString *WebURLsWithTitlesPboardType; NSString *WebURLsWithTitlesPboardType;
#ifndef BUILDING_ON_TIGER
static NSArray* selectionPasteboardTypes(bool canSmartCopyOrDelete, bool selectionContainsAttachments) static NSArray* selectionPasteboardTypes(bool canSmartCopyOrDelete, bool selectionContainsAttachments)
{ {
if (selectionContainsAttachments) { if (selectionContainsAttachments) {
...@@ -62,6 +63,7 @@ static NSArray* selectionPasteboardTypes(bool canSmartCopyOrDelete, bool selecti ...@@ -62,6 +63,7 @@ static NSArray* selectionPasteboardTypes(bool canSmartCopyOrDelete, bool selecti
return [NSArray arrayWithObjects:WebArchivePboardType, NSRTFPboardType, NSStringPboardType, nil]; return [NSArray arrayWithObjects:WebArchivePboardType, NSRTFPboardType, NSStringPboardType, nil];
} }
} }
#endif
static NSArray* writableTypesForURL() static NSArray* writableTypesForURL()
{ {
...@@ -86,6 +88,7 @@ Pasteboard* Pasteboard::generalPasteboard() ...@@ -86,6 +88,7 @@ Pasteboard* Pasteboard::generalPasteboard()
Pasteboard::Pasteboard(NSPasteboard* pboard) Pasteboard::Pasteboard(NSPasteboard* pboard)
: m_pasteboard(pboard) : m_pasteboard(pboard)
, m_types([NSArray array])
{ {
WebArchivePboardType = @"Apple Web Archive pasteboard type"; WebArchivePboardType = @"Apple Web Archive pasteboard type";
WebSmartPastePboardType = @"NeXT smart paste pasteboard type"; WebSmartPastePboardType = @"NeXT smart paste pasteboard type";
...@@ -96,7 +99,8 @@ Pasteboard::Pasteboard(NSPasteboard* pboard) ...@@ -96,7 +99,8 @@ Pasteboard::Pasteboard(NSPasteboard* pboard)
void Pasteboard::clear() void Pasteboard::clear()
{ {
[m_pasteboard declareTypes:[NSArray array] owner:nil]; m_types = [NSArray array];
[m_pasteboard declareTypes:m_types owner:nil];
} }
static NSAttributedString *stripAttachmentCharacters(NSAttributedString *string) static NSAttributedString *stripAttachmentCharacters(NSAttributedString *string)
...@@ -115,21 +119,37 @@ static NSAttributedString *stripAttachmentCharacters(NSAttributedString *string) ...@@ -115,21 +119,37 @@ static NSAttributedString *stripAttachmentCharacters(NSAttributedString *string)
void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame) void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame)
{ {
NSAttributedString *attributedString = [[[NSAttributedString alloc] _initWithDOMRange:[DOMRange _rangeWith:selectedRange]] autorelease]; NSAttributedString *attributedString = [[[NSAttributedString alloc] _initWithDOMRange:[DOMRange _rangeWith:selectedRange]] autorelease];
NSArray* types = selectionPasteboardTypes(canSmartCopyOrDelete, [attributedString containsAttachments]); #ifdef BUILDING_ON_TIGER
// 4930197: Mail overrides [WebHTMLView pasteboardTypesForSelection] in order to add another type to the pasteboard
[m_pasteboard declareTypes:types owner:nil]; // after WebKit does. On Tiger we must call this function so that Mail code will be executed, meaning that
// we can't call WebCore::Pasteboard's method for setting types.
m_types = frame->editor()->client()->pasteboardTypesForSelection(frame);
// Don't write RTFD to the pasteboard when the copied attributed string has no attachments.
NSMutableArray *mutableTypes = nil;
if (![attributedString containsAttachments]) {
mutableTypes = [m_types mutableCopy];
[mutableTypes removeObject:NSRTFDPboardType];
m_types = mutableTypes;
}
[m_pasteboard declareTypes:m_types owner:nil];
#else
m_types = selectionPasteboardTypes(canSmartCopyOrDelete, [attributedString containsAttachments]);
[m_pasteboard declareTypes:m_types owner:nil];
frame->editor()->client()->didSetSelectionTypesForPasteboard();
#endif
// Put HTML on the pasteboard. // Put HTML on the pasteboard.
if ([types containsObject:WebArchivePboardType]) { if ([m_types containsObject:WebArchivePboardType]) {
[m_pasteboard setData:frame->editor()->client()->dataForArchivedSelection(frame) forType:WebArchivePboardType]; [m_pasteboard setData:frame->editor()->client()->dataForArchivedSelection(frame) forType:WebArchivePboardType];
} }
// Put the attributed string on the pasteboard (RTF/RTFD format). // Put the attributed string on the pasteboard (RTF/RTFD format).
if ([types containsObject:NSRTFDPboardType]) { if ([m_types containsObject:NSRTFDPboardType]) {
NSData *RTFDData = [attributedString RTFDFromRange:NSMakeRange(0, [attributedString length]) documentAttributes:nil]; NSData *RTFDData = [attributedString RTFDFromRange:NSMakeRange(0, [attributedString length]) documentAttributes:nil];
[m_pasteboard setData:RTFDData forType:NSRTFDPboardType]; [m_pasteboard setData:RTFDData forType:NSRTFDPboardType];
} }
if ([types containsObject:NSRTFPboardType]) { if ([m_types containsObject:NSRTFPboardType]) {
if ([attributedString containsAttachments]) if ([attributedString containsAttachments])
attributedString = stripAttachmentCharacters(attributedString); attributedString = stripAttachmentCharacters(attributedString);
NSData *RTFData = [attributedString RTFFromRange:NSMakeRange(0, [attributedString length]) documentAttributes:nil]; NSData *RTFData = [attributedString RTFFromRange:NSMakeRange(0, [attributedString length]) documentAttributes:nil];
...@@ -137,7 +157,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, ...@@ -137,7 +157,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
} }
// Put plain string on the pasteboard. // Put plain string on the pasteboard.
if ([types containsObject:NSStringPboardType]) { if ([m_types containsObject:NSStringPboardType]) {
// Map &nbsp; to a plain old space because this is better for source code, other browsers do it, // Map &nbsp; to a plain old space because this is better for source code, other browsers do it,
// and because HTML forces you to do this any time you want two spaces in a row. // and because HTML forces you to do this any time you want two spaces in a row.
String text = frame->selectedText(); String text = frame->selectedText();
...@@ -150,7 +170,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, ...@@ -150,7 +170,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
[s release]; [s release];
} }
if ([types containsObject:WebSmartPastePboardType]) { if ([m_types containsObject:WebSmartPastePboardType]) {
[m_pasteboard setData:nil forType:WebSmartPastePboardType]; [m_pasteboard setData:nil forType:WebSmartPastePboardType];
} }
} }
...@@ -169,7 +189,8 @@ void Pasteboard::writeURL(const KURL& url, const String& titleStr, Frame* frame) ...@@ -169,7 +189,8 @@ void Pasteboard::writeURL(const KURL& url, const String& titleStr, Frame* frame)
title = userVisibleString; title = userVisibleString;
} }
[m_pasteboard declareTypes:writableTypesForURL() owner:nil]; m_types = writableTypesForURL();
[m_pasteboard declareTypes:m_types owner:nil];
[m_pasteboard setPropertyList:[NSArray arrayWithObjects:[NSArray arrayWithObject:userVisibleString], [m_pasteboard setPropertyList:[NSArray arrayWithObjects:[NSArray arrayWithObject:userVisibleString],
[NSArray arrayWithObject:(NSString*)titleStr.stripWhiteSpace()], [NSArray arrayWithObject:(NSString*)titleStr.stripWhiteSpace()],
...@@ -189,17 +210,17 @@ bool Pasteboard::canSmartReplace() ...@@ -189,17 +210,17 @@ bool Pasteboard::canSmartReplace()
String Pasteboard::plainText(Frame* frame) String Pasteboard::plainText(Frame* frame)
{ {
NSArray *types = [m_pasteboard types]; m_types = [m_pasteboard types];
if ([types containsObject:NSStringPboardType]) if ([m_types containsObject:NSStringPboardType])
return [m_pasteboard stringForType:NSStringPboardType]; return [m_pasteboard stringForType:NSStringPboardType];
NSAttributedString *attributedString = nil; NSAttributedString *attributedString = nil;
NSString *string; NSString *string;
if ([types containsObject:NSRTFDPboardType]) if ([m_types containsObject:NSRTFDPboardType])
attributedString = [[NSAttributedString alloc] initWithRTFD:[m_pasteboard dataForType:NSRTFDPboardType] documentAttributes:NULL]; attributedString = [[NSAttributedString alloc] initWithRTFD:[m_pasteboard dataForType:NSRTFDPboardType] documentAttributes:NULL];
if (attributedString == nil && [types containsObject:NSRTFPboardType]) if (attributedString == nil && [m_types containsObject:NSRTFPboardType])
attributedString = [[NSAttributedString alloc] initWithRTF:[m_pasteboard dataForType:NSRTFPboardType] documentAttributes:NULL]; attributedString = [[NSAttributedString alloc] initWithRTF:[m_pasteboard dataForType:NSRTFPboardType] documentAttributes:NULL];
if (attributedString != nil) { if (attributedString != nil) {
string = [[attributedString string] copy]; string = [[attributedString string] copy];
...@@ -207,7 +228,7 @@ String Pasteboard::plainText(Frame* frame) ...@@ -207,7 +228,7 @@ String Pasteboard::plainText(Frame* frame)
return [string autorelease]; return [string autorelease];
} }
if ([types containsObject:NSFilenamesPboardType]) { if ([m_types containsObject:NSFilenamesPboardType]) {
string = [[m_pasteboard propertyListForType:NSFilenamesPboardType] componentsJoinedByString:@"\n"]; string = [[m_pasteboard propertyListForType:NSFilenamesPboardType] componentsJoinedByString:@"\n"];
if (string != nil) if (string != nil)
return string; return string;
...@@ -231,10 +252,10 @@ String Pasteboard::plainText(Frame* frame) ...@@ -231,10 +252,10 @@ String Pasteboard::plainText(Frame* frame)
PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText) PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, bool allowPlainText, bool& chosePlainText)
{ {
NSArray *types = [m_pasteboard types]; m_types = [m_pasteboard types];
chosePlainText = false; chosePlainText = false;
if ([types containsObject:NSHTMLPboardType]) { if ([m_types containsObject:NSHTMLPboardType]) {
NSString *HTMLString = [m_pasteboard stringForType:NSHTMLPboardType]; NSString *HTMLString = [m_pasteboard stringForType:NSHTMLPboardType];
// This is a hack to make Microsoft's HTML pasteboard data work. See 3778785. // This is a hack to make Microsoft's HTML pasteboard data work. See 3778785.
if ([HTMLString hasPrefix:@"Version:"]) { if ([HTMLString hasPrefix:@"Version:"]) {
...@@ -250,7 +271,7 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP ...@@ -250,7 +271,7 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP
} }
} }
if (allowPlainText && [types containsObject:NSStringPboardType]) { if (allowPlainText && [m_types containsObject:NSStringPboardType]) {
chosePlainText = true; chosePlainText = true;
RefPtr<DocumentFragment> fragment = createFragmentFromText(context.get(), [m_pasteboard stringForType:NSStringPboardType]); RefPtr<DocumentFragment> fragment = createFragmentFromText(context.get(), [m_pasteboard stringForType:NSStringPboardType]);
if (fragment) if (fragment)
......
2007-01-17 Alice Liu <alice.liu@apple.com>
Reviewed by Harrison.
Fix for <rdar://problem/4894155> REGRESSION: Extra line break is pasted with content into message body after choosing File - Paste
Migration of some editing code from WebHTMView to WebCore::Editor
resulted in not calling pasteboardTypesForSelection, which Mail was
overriding for the special purpose of adding a type to the
pasteboard after WebKit did. This patch adds 2 separate code paths
for Tiger and Leopard. On Tiger we give in and call the WebView's
pasteboardTypesForSelection. On Leopard we call a delegate after
the pasteboard types are set.
* DefaultDelegates/WebDefaultEditingDelegate.m:
(-[WebDefaultEditingDelegate webView:didSetSelectionTypesForPasteboard:]):
* WebCoreSupport/WebEditorClient.h:
* WebCoreSupport/WebEditorClient.mm:
(WebEditorClient::didSetSelectionTypesForPasteboard):
(WebEditorClient::pasteboardTypesForSelection):
* WebView/WebEditingDelegate.h:
2007-01-17 John Sullivan <sullivan@apple.com> 2007-01-17 John Sullivan <sullivan@apple.com>
Reviewed by Darin Reviewed by Darin
......
...@@ -101,6 +101,10 @@ static WebDefaultEditingDelegate *sharedDelegate = nil; ...@@ -101,6 +101,10 @@ static WebDefaultEditingDelegate *sharedDelegate = nil;
{ {
} }
- (void)webView:(WebView *)webView didSetSelectionTypesForPasteboard:(NSPasteboard *)pasteboard
{
}
- (void)webViewDidBeginEditing:(NSNotification *)notification - (void)webViewDidBeginEditing:(NSNotification *)notification
{ {
} }
......
...@@ -62,9 +62,13 @@ public: ...@@ -62,9 +62,13 @@ public:
virtual void didBeginEditing(); virtual void didBeginEditing();
virtual void didEndEditing(); virtual void didEndEditing();
virtual void didWriteSelectionToPasteboard(); virtual void didWriteSelectionToPasteboard();
virtual void didSetSelectionTypesForPasteboard();
virtual NSData* dataForArchivedSelection(WebCore::Frame*); virtual NSData* dataForArchivedSelection(WebCore::Frame*);
virtual NSString* userVisibleString(NSURL*); virtual NSString* userVisibleString(NSURL*);
#ifdef BUILDING_ON_TIGER
virtual NSArray* pasteboardTypesForSelection(WebCore::Frame*);
#endif
virtual void respondToChangedContents(); virtual void respondToChangedContents();
......
...@@ -247,6 +247,11 @@ void WebEditorClient::didWriteSelectionToPasteboard() ...@@ -247,6 +247,11 @@ void WebEditorClient::didWriteSelectionToPasteboard()
[[m_webView _editingDelegateForwarder] webView:m_webView didWriteSelectionToPasteboard:[NSPasteboard generalPasteboard]]; [[m_webView _editingDelegateForwarder] webView:m_webView didWriteSelectionToPasteboard:[NSPasteboard generalPasteboard]];
} }
void WebEditorClient::didSetSelectionTypesForPasteboard()
{
[[m_webView _editingDelegateForwarder] webView:m_webView didSetSelectionTypesForPasteboard:[NSPasteboard generalPasteboard]];
}
NSData* WebEditorClient::dataForArchivedSelection(Frame* frame) NSData* WebEditorClient::dataForArchivedSelection(Frame* frame)
{ {
WebArchive *archive = [WebArchiver archiveSelectionInFrame:kit(frame)]; WebArchive *archive = [WebArchiver archiveSelectionInFrame:kit(frame)];
...@@ -258,6 +263,14 @@ NSString* WebEditorClient::userVisibleString(NSURL *URL) ...@@ -258,6 +263,14 @@ NSString* WebEditorClient::userVisibleString(NSURL *URL)
return [URL _web_userVisibleString]; return [URL _web_userVisibleString];
} }
#ifdef BUILDING_ON_TIGER
NSArray* WebEditorClient::pasteboardTypesForSelection(Frame* selectedFrame)
{
WebFrame* frame = kit(selectedFrame);
return [[[frame frameView] documentView] pasteboardTypesForSelection];
}
#endif
bool WebEditorClient::shouldInsertNode(Node *node, Range* replacingRange, EditorInsertAction givenAction) bool WebEditorClient::shouldInsertNode(Node *node, Range* replacingRange, EditorInsertAction givenAction)
{ {
return [[m_webView _editingDelegateForwarder] webView:m_webView shouldInsertNode:kit(node) replacingDOMRange:kit(replacingRange) givenAction:(WebViewInsertAction)givenAction]; return [[m_webView _editingDelegateForwarder] webView:m_webView shouldInsertNode:kit(node) replacingDOMRange:kit(replacingRange) givenAction:(WebViewInsertAction)givenAction];
......
...@@ -49,6 +49,7 @@ typedef enum { ...@@ -49,6 +49,7 @@ typedef enum {
- (BOOL)webView:(WebView *)webView shouldChangeTypingStyle:(DOMCSSStyleDeclaration *)currentStyle toStyle:(DOMCSSStyleDeclaration *)proposedStyle; - (BOOL)webView:(WebView *)webView shouldChangeTypingStyle:(DOMCSSStyleDeclaration *)currentStyle toStyle:(DOMCSSStyleDeclaration *)proposedStyle;
- (BOOL)webView:(WebView *)webView doCommandBySelector:(SEL)selector; - (BOOL)webView:(WebView *)webView doCommandBySelector:(SEL)selector;
- (void)webView:(WebView *)webView didWriteSelectionToPasteboard:(NSPasteboard *)pasteboard; - (void)webView:(WebView *)webView didWriteSelectionToPasteboard:(NSPasteboard *)pasteboard;
- (void)webView:(WebView *)webView didSetSelectionTypesForPasteboard:(NSPasteboard *)pasteboard;
- (void)webViewDidBeginEditing:(NSNotification *)notification; - (void)webViewDidBeginEditing:(NSNotification *)notification;
- (void)webViewDidChange:(NSNotification *)notification; - (void)webViewDidChange:(NSNotification *)notification;
- (void)webViewDidEndEditing:(NSNotification *)notification; - (void)webViewDidEndEditing:(NSNotification *)notification;
......
2007-01-17 Alice Liu <alice.liu@apple.com>
Added these stubs to keep the Qt build from failing.
* WebCoreSupport/EditorClientQt.cpp:
(WebCore::EditorClientQt::didSetSelectionTypesForPasteboard):
* WebCoreSupport/EditorClientQt.h:
2007-01-17 Lars Knoll <lars@trolltech.com> 2007-01-17 Lars Knoll <lars@trolltech.com>
Reviewed by Zack Reviewed by Zack
......
...@@ -112,6 +112,11 @@ void EditorClientQt::didWriteSelectionToPasteboard() ...@@ -112,6 +112,11 @@ void EditorClientQt::didWriteSelectionToPasteboard()
notImplemented(); notImplemented();
} }
void EditorClientQt::didSetSelectionTypesForPasteboard()
{
notImplemented();
}
bool EditorClientQt::selectWordBeforeMenuEvent() bool EditorClientQt::selectWordBeforeMenuEvent()
{ {
notImplemented(); notImplemented();
......
...@@ -60,6 +60,7 @@ public: ...@@ -60,6 +60,7 @@ public:
virtual void respondToChangedContents(); virtual void respondToChangedContents();
virtual void didEndEditing(); virtual void didEndEditing();
virtual void didWriteSelectionToPasteboard(); virtual void didWriteSelectionToPasteboard();
virtual void didSetSelectionTypesForPasteboard();
virtual bool selectWordBeforeMenuEvent(); virtual bool selectWordBeforeMenuEvent();
virtual bool isEditable(); virtual bool isEditable();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment