[SCM] WebKit Debian packaging branch, webkit-1.1, updated. upstream/1.1.15.1-1414-gc69ee75

pfeldman at chromium.org pfeldman at chromium.org
Thu Oct 29 20:33:02 UTC 2009


The following commit has been merged in the webkit-1.1 branch:
commit 7132907e11f457dfb08d461d9be1027abb8e1922
Author: pfeldman at chromium.org <pfeldman at chromium.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Sep 24 09:38:48 2009 +0000

    2009-09-23  Alexander Pavlov  <apavlov at chromium.org>
    
            Reviewed by Eric Seidel.
    
            Introduce Pasteboard::writePlaintext(const String&) so that copying
            of the inspected elements HTML will be possible in WebInspector.
            https://bugs.webkit.org/show_bug.cgi?id=29634
    
            * platform/Pasteboard.h:
            * platform/android/TemporaryLinkStubs.cpp:
            (Pasteboard::writePlainText):
            * platform/chromium/ChromiumBridge.h:
            * platform/chromium/PasteboardChromium.cpp:
            (WebCore::Pasteboard::writePlainText):
            * platform/gtk/PasteboardGtk.cpp:
            (WebCore::Pasteboard::writePlainText):
            * platform/haiku/PasteboardHaiku.cpp:
            (WebCore::Pasteboard::writePlainText):
            * platform/mac/PasteboardMac.mm:
            (WebCore::Pasteboard::writePlainText):
            * platform/qt/PasteboardQt.cpp:
            (WebCore::Pasteboard::writePlainText):
            * platform/win/PasteboardWin.cpp:
            (WebCore::Pasteboard::writeSelection):
            (WebCore::Pasteboard::writePlainText):
            * platform/wince/PasteboardWince.cpp:
            (WebCore::Pasteboard::writePlainText):
            * platform/wx/PasteboardWx.cpp:
            (WebCore::Pasteboard::writeSelection):
            (WebCore::Pasteboard::writePlainText):
            (WebCore::Pasteboard::writeURL):
    
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@48710 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 5d83c7b..3659115 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,35 @@
+2009-09-23  Alexander Pavlov  <apavlov at chromium.org>
+
+        Reviewed by Eric Seidel.
+
+        Introduce Pasteboard::writePlaintext(const String&) so that copying
+        of the inspected elements HTML will be possible in WebInspector.
+        https://bugs.webkit.org/show_bug.cgi?id=29634
+
+        * platform/Pasteboard.h:
+        * platform/android/TemporaryLinkStubs.cpp:
+        (Pasteboard::writePlainText):
+        * platform/chromium/ChromiumBridge.h:
+        * platform/chromium/PasteboardChromium.cpp:
+        (WebCore::Pasteboard::writePlainText):
+        * platform/gtk/PasteboardGtk.cpp:
+        (WebCore::Pasteboard::writePlainText):
+        * platform/haiku/PasteboardHaiku.cpp:
+        (WebCore::Pasteboard::writePlainText):
+        * platform/mac/PasteboardMac.mm:
+        (WebCore::Pasteboard::writePlainText):
+        * platform/qt/PasteboardQt.cpp:
+        (WebCore::Pasteboard::writePlainText):
+        * platform/win/PasteboardWin.cpp:
+        (WebCore::Pasteboard::writeSelection):
+        (WebCore::Pasteboard::writePlainText):
+        * platform/wince/PasteboardWince.cpp:
+        (WebCore::Pasteboard::writePlainText):
+        * platform/wx/PasteboardWx.cpp:
+        (WebCore::Pasteboard::writeSelection):
+        (WebCore::Pasteboard::writePlainText):
+        (WebCore::Pasteboard::writeURL):
+
 2009-09-24  Oswald Buddenhagen  <oswald.buddenhagen at nokia.com>
 
         Reviewed by Simon Hausmann.
diff --git a/WebCore/platform/Pasteboard.h b/WebCore/platform/Pasteboard.h
index cd6a3b5..188b962 100644
--- a/WebCore/platform/Pasteboard.h
+++ b/WebCore/platform/Pasteboard.h
@@ -86,6 +86,7 @@ public:
     
     static Pasteboard* generalPasteboard();
     void writeSelection(Range*, bool canSmartCopyOrDelete, Frame*);
+    void writePlainText(const String&);
     void writeURL(const KURL&, const String&, Frame* = 0);
     void writeImage(Node*, const KURL&, const String& title);
 #if PLATFORM(MAC)
diff --git a/WebCore/platform/android/TemporaryLinkStubs.cpp b/WebCore/platform/android/TemporaryLinkStubs.cpp
index b68a74c..c0b57a6 100644
--- a/WebCore/platform/android/TemporaryLinkStubs.cpp
+++ b/WebCore/platform/android/TemporaryLinkStubs.cpp
@@ -175,6 +175,11 @@ void Pasteboard::writeSelection(Range*, bool, Frame*)
     notImplemented();
 }
 
+void Pasteboard::writePlainText(const String&)
+{
+    notImplemented();
+}
+
 void Pasteboard::writeURL(const KURL&, const String&, Frame*)
 {
     notImplemented();
diff --git a/WebCore/platform/chromium/ChromiumBridge.h b/WebCore/platform/chromium/ChromiumBridge.h
index b34924b..0505d07 100644
--- a/WebCore/platform/chromium/ChromiumBridge.h
+++ b/WebCore/platform/chromium/ChromiumBridge.h
@@ -76,6 +76,7 @@ namespace WebCore {
         // Chromium currently uses a different technique to write to alternate
         // clipboard buffers.
         static void clipboardWriteSelection(const String&, const KURL&, const String&, bool);
+        static void clipboardWritePlainText(const String&);
         static void clipboardWriteURL(const KURL&, const String&);
         static void clipboardWriteImage(const NativeImageSkia*, const KURL&, const String&);
 
diff --git a/WebCore/platform/chromium/PasteboardChromium.cpp b/WebCore/platform/chromium/PasteboardChromium.cpp
index 4fd6cf2..598dcbf 100644
--- a/WebCore/platform/chromium/PasteboardChromium.cpp
+++ b/WebCore/platform/chromium/PasteboardChromium.cpp
@@ -96,6 +96,17 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
     ChromiumBridge::clipboardWriteSelection(html, url, plainText, canSmartCopyOrDelete);
 }
 
+void Pasteboard::writePlainText(const String& text)
+{
+    String plainText = text;
+
+#if PLATFORM(WIN_OS)
+    replaceNewlinesWithWindowsStyleNewlines(plainText);
+#endif
+    // FIXME: uncomment when Chromium CL http://codereview.chromium.org/211052 is closed.
+    //ChromiumBridge::clipboardWritePlainText(plainText);
+}
+
 void Pasteboard::writeURL(const KURL& url, const String& titleStr, Frame* frame)
 {
     ASSERT(!url.isEmpty());
diff --git a/WebCore/platform/gtk/PasteboardGtk.cpp b/WebCore/platform/gtk/PasteboardGtk.cpp
index 6949b0a..f1ebe7c 100644
--- a/WebCore/platform/gtk/PasteboardGtk.cpp
+++ b/WebCore/platform/gtk/PasteboardGtk.cpp
@@ -108,6 +108,12 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
     gtk_target_table_free(targets, n_targets);
 }
 
+void Pasteboard::writePlainText(const String& text)
+{
+    GtkClipboard* clipboard = gtk_clipboard_get_for_display(gdk_display_get_default(), GDK_SELECTION_CLIPBOARD);
+    gtk_clipboard_set_text(clipboard, text.utf8().data(), text.utf8().length());
+}
+
 void Pasteboard::writeURL(const KURL& url, const String&, Frame* frame)
 {
     if (url.isEmpty())
diff --git a/WebCore/platform/haiku/PasteboardHaiku.cpp b/WebCore/platform/haiku/PasteboardHaiku.cpp
index 67a7f5b..8ad72ca 100644
--- a/WebCore/platform/haiku/PasteboardHaiku.cpp
+++ b/WebCore/platform/haiku/PasteboardHaiku.cpp
@@ -68,6 +68,23 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
     clipboard.Unlock();
 }
 
+void Pasteboard::writePlainText(const String& text)
+{
+    BClipboard clipboard("WebKit");
+    if (!clipboard.Lock())
+        return;
+
+    clipboard.Clear();
+    BMessage* data = clipboard.Data();
+    if (!data)
+        return;
+
+    data->AddString("text/plain", BString(text));
+    clipboard.Commit();
+
+    clipboard.Unlock();
+}
+
 bool Pasteboard::canSmartReplace()
 {
     notImplemented();
diff --git a/WebCore/platform/mac/PasteboardMac.mm b/WebCore/platform/mac/PasteboardMac.mm
index e21f549..657a329 100644
--- a/WebCore/platform/mac/PasteboardMac.mm
+++ b/WebCore/platform/mac/PasteboardMac.mm
@@ -203,6 +203,18 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
     Pasteboard::writeSelection(m_pasteboard.get(), selectedRange, canSmartCopyOrDelete, frame);
 }
 
+void Pasteboard::writePlainText(const String& text)
+{
+    if (WebArchivePboardType == nil)
+        Pasteboard::generalPasteboard(); //Initialises pasteboard types
+
+    NSArray *types = [NSArray arrayWithObjects:NSStringPboardType, nil];
+    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)
diff --git a/WebCore/platform/qt/PasteboardQt.cpp b/WebCore/platform/qt/PasteboardQt.cpp
index 969de62..92879dd 100644
--- a/WebCore/platform/qt/PasteboardQt.cpp
+++ b/WebCore/platform/qt/PasteboardQt.cpp
@@ -119,6 +119,19 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP
     return 0;
 }
 
+void Pasteboard::writePlainText(const String& text)
+{
+
+#ifndef QT_NO_CLIPBOARD
+    QMimeData* md = new QMimeData;
+    QString qtext = text;
+    qtext.replace(QChar(0xa0), QLatin1Char(' '));
+    md->setText(qtext);
+    QApplication::clipboard()->setMimeData(md, m_selectionMode ?
+            QClipboard::Selection : QClipboard::Clipboard);
+#endif
+}
+
 void Pasteboard::writeURL(const KURL& _url, const String&, Frame*)
 {
     ASSERT(!_url.isEmpty());
diff --git a/WebCore/platform/win/PasteboardWin.cpp b/WebCore/platform/win/PasteboardWin.cpp
index 188630f..d09769a 100644
--- a/WebCore/platform/win/PasteboardWin.cpp
+++ b/WebCore/platform/win/PasteboardWin.cpp
@@ -111,7 +111,7 @@ void Pasteboard::clear()
 void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame)
 {
     clear();
-    
+
     // Put CF_HTML format on the pasteboard 
     if (::OpenClipboard(m_owner)) {
         ExceptionCode ec = 0;
@@ -145,6 +145,21 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
     }
 }
 
+void Pasteboard::writePlainText(const String& text)
+{
+    clear();
+
+    // Put plain string on the pasteboard. CF_UNICODETEXT covers CF_TEXT as well
+    String str = text;
+    replaceNewlinesWithWindowsStyleNewlines(str);
+    if (::OpenClipboard(m_owner)) {
+        HGLOBAL cbData = createGlobalData(str);
+        if (!::SetClipboardData(CF_UNICODETEXT, cbData))
+            ::GlobalFree(cbData);
+        ::CloseClipboard();
+    }
+}
+
 void Pasteboard::writeURL(const KURL& url, const String& titleStr, Frame* frame)
 {
     ASSERT(!url.isEmpty());
diff --git a/WebCore/platform/wince/PasteboardWince.cpp b/WebCore/platform/wince/PasteboardWince.cpp
index cba85b8..16f4968 100644
--- a/WebCore/platform/wince/PasteboardWince.cpp
+++ b/WebCore/platform/wince/PasteboardWince.cpp
@@ -142,6 +142,21 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
     }
 }
 
+void Pasteboard::writePlainText(const String& text)
+{
+    clear();
+
+    // Put plain string on the pasteboard. CF_UNICODETEXT covers CF_TEXT as well
+    String str = text;
+    replaceNewlinesWithWindowsStyleNewlines(str);
+    if (::OpenClipboard(m_owner)) {
+        HGLOBAL cbData = createGlobalData(str);
+        if (!::SetClipboardData(CF_UNICODETEXT, cbData))
+            ::GlobalFree(cbData);
+        ::CloseClipboard();
+    }
+}
+
 void Pasteboard::writeURL(const KURL& url, const String& titleStr, Frame* frame)
 {
     ASSERT(!url.isEmpty());
diff --git a/WebCore/platform/wx/PasteboardWx.cpp b/WebCore/platform/wx/PasteboardWx.cpp
index 67697de..207c63c 100644
--- a/WebCore/platform/wx/PasteboardWx.cpp
+++ b/WebCore/platform/wx/PasteboardWx.cpp
@@ -52,13 +52,20 @@ Pasteboard* Pasteboard::generalPasteboard()
 
 void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame)
 {
-    if (wxTheClipboard->Open())
-    {
+    if (wxTheClipboard->Open()) {
         wxTheClipboard->SetData( new wxTextDataObject(frame->selectedText()) );
         wxTheClipboard->Close();
     }
 }
 
+void Pasteboard::writePlainText(const String& text)
+{
+    if (wxTheClipboard->Open()) {
+        wxTheClipboard->SetData( new wxTextDataObject(text) );
+        wxTheClipboard->Close();
+    }
+}
+
 bool Pasteboard::canSmartReplace()
 {
     notImplemented();
@@ -92,8 +99,7 @@ PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefP
 
 void Pasteboard::writeURL(const KURL& url, const String&, Frame*)
 {
-    if (wxTheClipboard->Open())
-    {
+    if (wxTheClipboard->Open()) {
         wxTheClipboard->SetData( new wxTextDataObject( url.string() ) );
         wxTheClipboard->Close();
     }

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list