[SCM] WebKit Debian packaging branch, webkit-1.2, updated. upstream/1.1.90-6072-g9a69373

eric at webkit.org eric at webkit.org
Wed Apr 7 23:22:07 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 662a00b24187ac85998ae185d4513098269e1380
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Nov 4 10:19:39 2009 +0000

    2009-11-04  Martin Robinson  <martin.james.robinson at gmail.com>
    
            Reviewed by Jan Alonzo.
    
            [GTK] Enable DOM clipboard and drag-and-drop access
            https://bugs.webkit.org/show_bug.cgi?id=30623
    
            Unify redudant methods which will always return the same value.
    
            * platform/gtk/PasteboardGtk.cpp:
            (WebCore::Pasteboard::writeSelection):
            * platform/gtk/PasteboardHelper.h:
    2009-11-04  Martin Robinson  <martin.james.robinson at gmail.com>
    
            Reviewed by Jan Alonzo.
    
            [GTK] Enable DOM clipboard and drag-and-drop access
            https://bugs.webkit.org/show_bug.cgi?id=30623
    
            Move handling of target list to PasteboardHelperGtk.
    
            * WebCoreSupport/PasteboardHelperGtk.cpp:
            (WebKit::PasteboardHelperGtk::PasteboardHelperGtk):
            (WebKit::PasteboardHelperGtk::~PasteboardHelperGtk):
            (WebKit::PasteboardHelperGtk::fullTargetList):
            * WebCoreSupport/PasteboardHelperGtk.h:
            * webkit/webkitprivate.cpp:
            (WebKit::pasteboardHelperInstance):
            (webkit_init):
            * webkit/webkitprivate.h:
            * webkit/webkitwebview.cpp:
            (webkit_web_view_dispose):
            (webkit_web_view_init):
            (webkit_web_view_get_copy_target_list):
            (webkit_web_view_get_paste_target_list):
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@50507 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index 8b7f5b6..e63f141 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,16 @@
+2009-11-04  Martin Robinson  <martin.james.robinson at gmail.com>
+
+        Reviewed by Jan Alonzo.
+
+        [GTK] Enable DOM clipboard and drag-and-drop access
+        https://bugs.webkit.org/show_bug.cgi?id=30623
+
+        Unify redudant methods which will always return the same value.
+
+        * platform/gtk/PasteboardGtk.cpp:
+        (WebCore::Pasteboard::writeSelection):
+        * platform/gtk/PasteboardHelper.h:
+
 2009-11-04  Joanmarie Diggs  <joanmarie.diggs at gmail.com>
 
         Reviewed by Jan Alonzo.
diff --git a/WebCore/platform/gtk/PasteboardGtk.cpp b/WebCore/platform/gtk/PasteboardGtk.cpp
index 0ff26f7..ee95a38 100644
--- a/WebCore/platform/gtk/PasteboardGtk.cpp
+++ b/WebCore/platform/gtk/PasteboardGtk.cpp
@@ -102,7 +102,7 @@ void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete,
     PasteboardSelectionData* data = new PasteboardSelectionData(text, markup);
 
     gint n_targets;
-    GtkTargetEntry* targets = gtk_target_table_new_from_list(m_helper->getCopyTargetList(frame), &n_targets);
+    GtkTargetEntry* targets = gtk_target_table_new_from_list(m_helper->targetList(), &n_targets);
     gtk_clipboard_set_with_data(clipboard, targets, n_targets,
                                 clipboard_get_contents_cb, clipboard_clear_contents_cb, data);
     gtk_target_table_free(targets, n_targets);
diff --git a/WebCore/platform/gtk/PasteboardHelper.h b/WebCore/platform/gtk/PasteboardHelper.h
index 8e67127..e589f24 100644
--- a/WebCore/platform/gtk/PasteboardHelper.h
+++ b/WebCore/platform/gtk/PasteboardHelper.h
@@ -41,8 +41,7 @@ public:
     virtual GtkClipboard* getCurrentTarget(Frame*) const = 0;
     virtual GtkClipboard* getClipboard(Frame*) const = 0;
     virtual GtkClipboard* getPrimary(Frame*) const = 0;
-    virtual GtkTargetList* getCopyTargetList(Frame*) const = 0;
-    virtual GtkTargetList* getPasteTargetList(Frame*) const = 0;
+    virtual GtkTargetList* targetList() const = 0;
     virtual gint getWebViewTargetInfoHtml() const = 0;
 };
 
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index e1c550a..14dcfc5 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,27 @@
+2009-11-04  Martin Robinson  <martin.james.robinson at gmail.com>
+
+        Reviewed by Jan Alonzo.
+
+        [GTK] Enable DOM clipboard and drag-and-drop access
+        https://bugs.webkit.org/show_bug.cgi?id=30623
+
+        Move handling of target list to PasteboardHelperGtk.
+
+        * WebCoreSupport/PasteboardHelperGtk.cpp:
+        (WebKit::PasteboardHelperGtk::PasteboardHelperGtk):
+        (WebKit::PasteboardHelperGtk::~PasteboardHelperGtk):
+        (WebKit::PasteboardHelperGtk::fullTargetList):
+        * WebCoreSupport/PasteboardHelperGtk.h:
+        * webkit/webkitprivate.cpp:
+        (WebKit::pasteboardHelperInstance):
+        (webkit_init):
+        * webkit/webkitprivate.h:
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_dispose):
+        (webkit_web_view_init):
+        (webkit_web_view_get_copy_target_list):
+        (webkit_web_view_get_paste_target_list):
+
 2009-10-30  Evan Stade  <estade at chromium.org>
 
         Reviewed by David Levin.
diff --git a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp
index f2ea316..c71ef1b 100644
--- a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.cpp
@@ -31,6 +31,20 @@ using namespace WebCore;
 
 namespace WebKit {
 
+static GdkAtom gdkMarkupAtom = gdk_atom_intern("text/html", FALSE);
+
+PasteboardHelperGtk::PasteboardHelperGtk()
+    : m_targetList(gtk_target_list_new(0, 0))
+{
+    gtk_target_list_add_text_targets(m_targetList, WEBKIT_WEB_VIEW_TARGET_INFO_TEXT);
+    gtk_target_list_add(m_targetList, gdkMarkupAtom, 0, WEBKIT_WEB_VIEW_TARGET_INFO_HTML);
+}
+
+PasteboardHelperGtk::~PasteboardHelperGtk()
+{
+    gtk_target_list_unref(m_targetList);
+}
+
 GtkClipboard* PasteboardHelperGtk::getCurrentTarget(Frame* frame) const
 {
     WebKitWebView* webView = webkit_web_frame_get_web_view(kit(frame));
@@ -55,16 +69,9 @@ GtkClipboard* PasteboardHelperGtk::getPrimary(Frame* frame) const
                                     GDK_SELECTION_PRIMARY);
 }
 
-GtkTargetList* PasteboardHelperGtk::getCopyTargetList(Frame* frame) const
-{
-    WebKitWebView* webView = webkit_web_frame_get_web_view(kit(frame));
-    return webkit_web_view_get_copy_target_list(webView);
-}
-
-GtkTargetList* PasteboardHelperGtk::getPasteTargetList(Frame* frame) const
+GtkTargetList* PasteboardHelperGtk::targetList() const
 {
-    WebKitWebView* webView = webkit_web_frame_get_web_view(kit(frame));
-    return webkit_web_view_get_paste_target_list(webView);
+    return m_targetList;
 }
 
 gint PasteboardHelperGtk::getWebViewTargetInfoHtml() const
diff --git a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h
index 849b417..12ba207 100644
--- a/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h
+++ b/WebKit/gtk/WebCoreSupport/PasteboardHelperGtk.h
@@ -39,13 +39,16 @@ namespace WebKit {
 
 class PasteboardHelperGtk : public PasteboardHelper {
 public:
-    PasteboardHelperGtk() { }
+    PasteboardHelperGtk();
+    ~PasteboardHelperGtk();
     virtual GtkClipboard* getCurrentTarget(Frame*) const;
     virtual GtkClipboard* getClipboard(Frame*) const;
     virtual GtkClipboard* getPrimary(Frame*) const;
-    virtual GtkTargetList* getCopyTargetList(Frame*) const;
-    virtual GtkTargetList* getPasteTargetList(Frame*) const;
+    virtual GtkTargetList* targetList() const;
     virtual gint getWebViewTargetInfoHtml() const;
+
+private:
+    GtkTargetList* m_targetList;
 };
 
 }
diff --git a/WebKit/gtk/webkit/webkitprivate.cpp b/WebKit/gtk/webkit/webkitprivate.cpp
index 4425dcd..f3d263a 100644
--- a/WebKit/gtk/webkit/webkitprivate.cpp
+++ b/WebKit/gtk/webkit/webkitprivate.cpp
@@ -153,6 +153,12 @@ WebKitHitTestResult* kit(const WebCore::HitTestResult& result)
                                            NULL));
 }
 
+PasteboardHelperGtk* pasteboardHelperInstance()
+{
+    static PasteboardHelperGtk* helper = new PasteboardHelperGtk();
+    return helper;
+}
+
 } /** end namespace WebKit */
 
 namespace WTF {
@@ -237,7 +243,7 @@ void webkit_init()
 
     PageGroup::setShouldTrackVisitedLinks(true);
 
-    Pasteboard::generalPasteboard()->setHelper(new WebKit::PasteboardHelperGtk());
+    Pasteboard::generalPasteboard()->setHelper(WebKit::pasteboardHelperInstance());
 
     SoupSession* session = webkit_get_default_session();
 
diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h
index 088175f..3b7e161 100644
--- a/WebKit/gtk/webkit/webkitprivate.h
+++ b/WebKit/gtk/webkit/webkitprivate.h
@@ -70,6 +70,7 @@ class DownloadClient;
 namespace WebKit {
 
     class DocumentLoader;
+    class PasteboardHelperGtk;
 
     WebKitWebView* getViewFromFrame(WebKitWebFrame*);
 
@@ -97,6 +98,8 @@ namespace WebKit {
     WebCore::SecurityOrigin* core(WebKitSecurityOrigin*);
 
     WebKitHitTestResult* kit(const WebCore::HitTestResult&);
+
+    WebKit::PasteboardHelperGtk* pasteboardHelperInstance();
 }
 
 typedef struct {
@@ -129,9 +132,6 @@ extern "C" {
         bool editable;
         GtkIMContext* imContext;
 
-        GtkTargetList* copy_target_list;
-        GtkTargetList* paste_target_list;
-
         gboolean transparent;
 
         GtkAdjustment* horizontalAdjustment;
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index 9f668f4..b43d880 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -63,7 +63,9 @@
 #include "FrameLoader.h"
 #include "FrameView.h"
 #include "MouseEventWithHitTestResults.h"
+#include "Pasteboard.h"
 #include "PasteboardHelper.h"
+#include "PasteboardHelperGtk.h"
 #include "PlatformKeyboardEvent.h"
 #include "PlatformWheelEvent.h"
 #include "ProgressTracker.h"
@@ -1001,12 +1003,6 @@ static void webkit_web_view_dispose(GObject* object)
 
         g_object_unref(priv->imContext);
         priv->imContext = NULL;
-
-        gtk_target_list_unref(priv->copy_target_list);
-        priv->copy_target_list = NULL;
-
-        gtk_target_list_unref(priv->paste_target_list);
-        priv->paste_target_list = NULL;
     }
 
     if (priv->mainResource) {
@@ -2572,17 +2568,6 @@ static void webkit_web_view_init(WebKitWebView* webView)
 
     priv->zoomFullContent = FALSE;
 
-    GdkAtom textHtml = gdk_atom_intern_static_string("text/html");
-    /* Targets for copy */
-    priv->copy_target_list = gtk_target_list_new(NULL, 0);
-    gtk_target_list_add(priv->copy_target_list, textHtml, 0, WEBKIT_WEB_VIEW_TARGET_INFO_HTML);
-    gtk_target_list_add_text_targets(priv->copy_target_list, WEBKIT_WEB_VIEW_TARGET_INFO_TEXT);
-
-    /* Targets for pasting */
-    priv->paste_target_list = gtk_target_list_new(NULL, 0);
-    gtk_target_list_add(priv->paste_target_list, textHtml, 0, WEBKIT_WEB_VIEW_TARGET_INFO_HTML);
-    gtk_target_list_add_text_targets(priv->paste_target_list, WEBKIT_WEB_VIEW_TARGET_INFO_TEXT);
-
     priv->webSettings = webkit_web_settings_new();
     webkit_web_view_update_settings(webView);
     g_signal_connect(priv->webSettings, "notify", G_CALLBACK(webkit_web_view_settings_notify), webView);
@@ -3386,10 +3371,7 @@ void webkit_web_view_set_editable(WebKitWebView* webView, gboolean flag)
  **/
 GtkTargetList* webkit_web_view_get_copy_target_list(WebKitWebView* webView)
 {
-    g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL);
-
-    WebKitWebViewPrivate* priv = webView->priv;
-    return priv->copy_target_list;
+    return pasteboardHelperInstance()->targetList();
 }
 
 /**
@@ -3406,10 +3388,7 @@ GtkTargetList* webkit_web_view_get_copy_target_list(WebKitWebView* webView)
  **/
 GtkTargetList* webkit_web_view_get_paste_target_list(WebKitWebView* webView)
 {
-    g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), NULL);
-
-    WebKitWebViewPrivate* priv = webView->priv;
-    return priv->paste_target_list;
+    return pasteboardHelperInstance()->targetList();
 }
 
 /**

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list