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

eric at webkit.org eric at webkit.org
Thu Apr 8 00:43:34 UTC 2010


The following commit has been merged in the webkit-1.2 branch:
commit 8a3b786521fd2f2c2ec2df8690292ce8360a8724
Author: eric at webkit.org <eric at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Sat Dec 19 18:37:56 2009 +0000

    2009-12-19  Alejandro G. Castro  <alex at igalia.com>
    
            Reviewed by Xan Lopez.
    
            Tests for https://bugs.webkit.org/show_bug.cgi?id=28153
            can't middle-button paste within a single window
    
            * LayoutTests/platform/gtk/editing/pasteboard/middle-button-paste-expected.txt: Added
            * LayoutTests/platform/gtk/editing/pasteboard/middle-button-paste.html: Adeed
    2009-12-19  Alejandro G. Castro  <alex at igalia.com>
    
            Reviewed by Xan Lopez.
    
            Fixed the problem when pasting in the same window with the
            middle-button, now we store a reference to the range instead of
            requesting it every time, and we do not release it until the
            clipboard is requested.
            https://bugs.webkit.org/show_bug.cgi?id=28153
    
            * WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp:
            * WebKit/gtk/WebCoreSupport/EditorClientGtk.h:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@52389 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 916a821..e94497a 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,13 @@
+2009-12-19  Alejandro G. Castro  <alex at igalia.com>
+
+        Reviewed by Xan Lopez.
+
+        Tests for https://bugs.webkit.org/show_bug.cgi?id=28153
+        can't middle-button paste within a single window
+
+        * LayoutTests/platform/gtk/editing/pasteboard/middle-button-paste-expected.txt: Added
+        * LayoutTests/platform/gtk/editing/pasteboard/middle-button-paste.html: Adeed
+
 2009-12-19  MORITA Hajime  <morrita at gmail.com>
 
         Reviewed by Darin Adler.
diff --git a/LayoutTests/platform/gtk/editing/pasteboard/middle-button-paste-expected.txt b/LayoutTests/platform/gtk/editing/pasteboard/middle-button-paste-expected.txt
new file mode 100644
index 0000000..657dde8
--- /dev/null
+++ b/LayoutTests/platform/gtk/editing/pasteboard/middle-button-paste-expected.txt
@@ -0,0 +1,3 @@
+Select me, selecSelect mt me, select me
+
+The original text was "Select me, select me, select me", after selecting and pasting the result should be "Select me, selecSelect mt me, select me"
diff --git a/LayoutTests/platform/gtk/editing/pasteboard/middle-button-paste.html b/LayoutTests/platform/gtk/editing/pasteboard/middle-button-paste.html
new file mode 100644
index 0000000..62e3b5c
--- /dev/null
+++ b/LayoutTests/platform/gtk/editing/pasteboard/middle-button-paste.html
@@ -0,0 +1,41 @@
+<html>
+<head>
+
+<script type="text/javascript">
+if (window.layoutTestController)
+    layoutTestController.dumpAsText();
+</script>
+
+<style>
+body { margin: 0; padding: 0 }
+</style>
+
+<script type="text/javascript">
+
+function runTest()
+{
+    var target = document.getElementById("text");
+
+    var x = target.offsetParent.offsetLeft + target.offsetLeft;
+    var y = target.offsetParent.offsetTop + target.offsetTop +
+        target.offsetHeight / 2;
+
+    eventSender.mouseDown();
+    eventSender.mouseMoveTo(x, y);
+    eventSender.mouseMoveTo(x + 50, y);
+    eventSender.mouseUp();
+    eventSender.mouseMoveTo(x + 100, y);
+    eventSender.mouseDown(1);
+    eventSender.mouseUp(1);
+}
+
+</script>
+</head>
+<body onload="runTest()">
+<div id="text" contenteditable>Select me, select me, select me</div>
+
+<br/>
+<p>The original text was "Select me, select me, select me", after selecting and pasting the result should be "Select me, selecSelect mt me, select me"</p>
+</body>
+</html>
+
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 1261683..bf04832 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,16 @@
+2009-12-19  Alejandro G. Castro  <alex at igalia.com>
+
+        Reviewed by Xan Lopez.
+
+        Fixed the problem when pasting in the same window with the
+        middle-button, now we store a reference to the range instead of
+        requesting it every time, and we do not release it until the
+        clipboard is requested.
+        https://bugs.webkit.org/show_bug.cgi?id=28153
+
+        * WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp:
+        * WebKit/gtk/WebCoreSupport/EditorClientGtk.h:
+
 2009-12-19  Gustavo Noronha Silva  <gustavo.noronha at collabora.co.uk>
 
         Reviewed by Xan Lopez.
diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
index 6ec6baf..b8566a2 100644
--- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
+++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.cpp
@@ -185,29 +185,28 @@ void EditorClient::respondToChangedContents()
     notImplemented();
 }
 
-static void clipboard_get_contents_cb(GtkClipboard* clipboard, GtkSelectionData* selection_data, guint info, gpointer data)
+void clipboard_get_contents_cb(GtkClipboard* clipboard, GtkSelectionData* selection_data, guint info, gpointer data)
 {
-    WebKitWebView* webView = reinterpret_cast<WebKitWebView*>(data);
-    Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
-    PassRefPtr<Range> selectedRange = frame->selection()->toNormalizedRange();
+    EditorClient* client = static_cast<EditorClient*>(data);
+
+    if (!client->m_range)
+        return;
 
     if (static_cast<gint>(info) == WEBKIT_WEB_VIEW_TARGET_INFO_HTML) {
-        String markup = createMarkup(selectedRange.get(), 0, AnnotateForInterchange);
+        String markup = createMarkup(client->m_range.get(), 0, AnnotateForInterchange);
         gtk_selection_data_set(selection_data, selection_data->target, 8,
                                reinterpret_cast<const guchar*>(markup.utf8().data()), markup.utf8().length());
     } else {
-        String text = selectedRange->text();
+        String text = client->m_range->text();
         gtk_selection_data_set_text(selection_data, text.utf8().data(), text.utf8().length());
     }
 }
 
-static void clipboard_clear_contents_cb(GtkClipboard* clipboard, gpointer data)
+void clipboard_clear_contents_cb(GtkClipboard* clipboard, gpointer data)
 {
-    WebKitWebView* webView = reinterpret_cast<WebKitWebView*>(data);
-    Frame* frame = core(webView)->focusController()->focusedOrMainFrame();
+    EditorClient* client = static_cast<EditorClient*>(data);
 
-    // Collapse the selection without clearing it
-    frame->selection()->setBase(frame->selection()->extent(), frame->selection()->affinity());
+    client->m_range = 0;
 }
 
 void EditorClient::respondToChangedSelection()
@@ -226,11 +225,11 @@ void EditorClient::respondToChangedSelection()
         GtkTargetList* targetList = webkit_web_view_get_copy_target_list(m_webView);
         gint targetCount;
         GtkTargetEntry* targets = gtk_target_table_new_from_list(targetList, &targetCount);
-        gtk_clipboard_set_with_owner(clipboard, targets, targetCount,
-                                     clipboard_get_contents_cb, clipboard_clear_contents_cb, G_OBJECT(m_webView));
+        gtk_clipboard_set_with_data(clipboard, targets, targetCount,
+                                    clipboard_get_contents_cb, clipboard_clear_contents_cb, this);
+        m_range = targetFrame->selection()->toNormalizedRange();
         gtk_target_table_free(targets, targetCount);
-    } else if (gtk_clipboard_get_owner(clipboard) == G_OBJECT(m_webView))
-        gtk_clipboard_clear(clipboard);
+    }
 
     if (!targetFrame->editor()->hasComposition())
         return;
@@ -551,6 +550,7 @@ void EditorClient::handleInputMethodKeydown(KeyboardEvent* event)
 EditorClient::EditorClient(WebKitWebView* webView)
     : m_isInRedo(false)
     , m_webView(webView)
+    , m_range(0)
 {
     WebKitWebViewPrivate* priv = m_webView->priv;
     g_signal_connect(priv->imContext, "commit", G_CALLBACK(imContextCommitted), this);
diff --git a/WebKit/gtk/WebCoreSupport/EditorClientGtk.h b/WebKit/gtk/WebCoreSupport/EditorClientGtk.h
index 9292651..33efa4d 100644
--- a/WebKit/gtk/WebCoreSupport/EditorClientGtk.h
+++ b/WebKit/gtk/WebCoreSupport/EditorClientGtk.h
@@ -34,6 +34,7 @@
 
 #include <wtf/Deque.h>
 #include <wtf/Forward.h>
+#include <gtk/gtk.h>
 
 typedef struct _WebKitWebView WebKitWebView;
 
@@ -120,6 +121,10 @@ namespace WebKit {
 
     private:
         WebKitWebView* m_webView;
+        RefPtr<WebCore::Range> m_range;
+
+        friend void clipboard_get_contents_cb(GtkClipboard* clipboard, GtkSelectionData* selection_data, guint info, gpointer data);
+        friend void clipboard_clear_contents_cb(GtkClipboard* clipboard, gpointer data);
     };
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list