Title: [119021] trunk/Source/WebCore
Revision
119021
Author
[email protected]
Date
2012-05-30 19:03:00 -0700 (Wed, 30 May 2012)

Log Message

[wx] Implement HTML clipboard support.
https://bugs.webkit.org/show_bug.cgi?id=87883

Reviewed by Kevin Ollivier.

Modified Paths

Diff

Modified: trunk/Source/WebCore/ChangeLog (119020 => 119021)


--- trunk/Source/WebCore/ChangeLog	2012-05-31 02:01:50 UTC (rev 119020)
+++ trunk/Source/WebCore/ChangeLog	2012-05-31 02:03:00 UTC (rev 119021)
@@ -1,3 +1,16 @@
+2012-05-30  Robin Dunn  <[email protected]>
+
+        [wx] Implement HTML clipboard support.
+        https://bugs.webkit.org/show_bug.cgi?id=87883
+
+        Reviewed by Kevin Ollivier.
+
+        * platform/wx/ClipboardWx.cpp:
+        (WebCore::ClipboardWx::writeRange):
+        * platform/wx/PasteboardWx.cpp:
+        (WebCore::Pasteboard::writeSelection):
+        (WebCore::Pasteboard::documentFragment):
+
 2012-05-30  Garrett Casto  <[email protected]>
 
         TextFieldDecorationElement should respect style attribute

Modified: trunk/Source/WebCore/platform/wx/ClipboardWx.cpp (119020 => 119021)


--- trunk/Source/WebCore/platform/wx/ClipboardWx.cpp	2012-05-31 02:01:50 UTC (rev 119020)
+++ trunk/Source/WebCore/platform/wx/ClipboardWx.cpp	2012-05-31 02:03:00 UTC (rev 119021)
@@ -26,7 +26,9 @@
 #include "config.h"
 #include "ClipboardWx.h"
 
+#include "Editor.h"
 #include "FileList.h"
+#include "Frame.h"
 #include "HashTable.h"
 #include "IntPoint.h"
 #include "NotImplemented.h"
@@ -127,9 +129,9 @@
     Pasteboard::generalPasteboard()->writeURL(url, string, frame);
 }
 
-void ClipboardWx::writeRange(Range*, Frame*) 
+void ClipboardWx::writeRange(Range* range, Frame* frame) 
 {
-    notImplemented();
+    Pasteboard::generalPasteboard()->writeSelection(range, frame->editor()->smartInsertDeleteEnabled() && frame->selection()->granularity() == WordGranularity, frame);
 }
 
 bool ClipboardWx::hasData() 

Modified: trunk/Source/WebCore/platform/wx/PasteboardWx.cpp (119020 => 119021)


--- trunk/Source/WebCore/platform/wx/PasteboardWx.cpp	2012-05-31 02:01:50 UTC (rev 119020)
+++ trunk/Source/WebCore/platform/wx/PasteboardWx.cpp	2012-05-31 02:03:00 UTC (rev 119021)
@@ -53,7 +53,10 @@
 void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame)
 {
     if (wxTheClipboard->Open()) {
-        wxTheClipboard->SetData( new wxTextDataObject(frame->editor()->selectedText()) );
+#if wxCHECK_VERSION(2, 9, 4)
+        wxTheClipboard->SetData(new wxHTMLDataObject(createMarkup(selectedRange, 0, AnnotateForInterchange)));
+#endif
+        wxTheClipboard->SetData(new wxTextDataObject(frame->editor()->selectedText()));
         wxTheClipboard->Close();
     }
 }
@@ -91,11 +94,21 @@
 {
     RefPtr<DocumentFragment> fragment = 0;
     if (wxTheClipboard->Open()) {
-        if (allowPlainText && wxTheClipboard->IsSupported( wxDF_TEXT )) {
-            wxTextDataObject data;
-            wxTheClipboard->GetData( data );
-            chosePlainText = true;
-            fragment = createFragmentFromText(context.get(), data.GetText());
+#if wxCHECK_VERSION(2, 9, 4)
+        if (wxTheClipboard->IsSupported(wxDF_HTML)) {
+            wxHTMLDataObject data;
+            wxTheClipboard->GetData(data);
+            chosePlainText = false;
+            fragment = createFragmentFromMarkup(frame->document(), data.GetHTML(), "", FragmentScriptingNotAllowed);
+        } else
+#endif
+        {
+            if (allowPlainText && wxTheClipboard->IsSupported( wxDF_TEXT )) {
+                wxTextDataObject data;
+                wxTheClipboard->GetData( data );
+                chosePlainText = true;
+                fragment = createFragmentFromText(context.get(), data.GetText());
+            }
         }
         wxTheClipboard->Close();
     }
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to