[SCM] WebKit Debian packaging branch, debian/experimental, updated. upstream/1.3.3-9427-gc2be6fc

philn at webkit.org philn at webkit.org
Wed Dec 22 13:28:22 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit 88a209f98c63969de6849de3d0497921182726aa
Author: philn at webkit.org <philn at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Thu Sep 16 16:06:46 2010 +0000

    2010-09-14  Philippe Normand  <pnormand at igalia.com>
    
            Reviewed by Eric Carlson and Martin Robinson.
    
            [GTK] eventSender.contextClick() should return the contents of the context menu
            https://bugs.webkit.org/show_bug.cgi?id=39102
    
            Make the eventSender use the new private WebKitGtk+ API to
            retrieve the context-menu item titles and store them in an array.
    
            * DumpRenderTree/gtk/EventSender.cpp:
            (contextClickCallback):
    
    WebKit/gtk:
    
            Reviewed by Eric Carlson and Martin Robinson.
    
            [GTK] eventSender.contextClick() should return the contents of the context menu
            https://bugs.webkit.org/show_bug.cgi?id=39102
    
            New private WebView API to retrieve the context-menu widget. This
            is used by DRT only.
    
            * webkit/webkitprivate.h:
            * webkit/webkitwebview.cpp:
            (webkit_web_view_get_context_menu):
    
    LayoutTests:
    
            Reviewed by Eric Carlson and Martin Robinson.
    
            [GTK] eventSender.contextClick() should return the contents of the context menu
            https://bugs.webkit.org/show_bug.cgi?id=39102
    
            New test checking the return value of eventSender.contextClick()
            on a non-editable element. Skipped on qt and win.
    
            * editing/selection/context-menu-on-text-expected.txt: Added.
            * editing/selection/context-menu-on-text.html: Added.
            * platform/qt/Skipped:
            * platform/win/Skipped:
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@67626 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/LayoutTests/ChangeLog b/LayoutTests/ChangeLog
index 668696a..3a4327e 100644
--- a/LayoutTests/ChangeLog
+++ b/LayoutTests/ChangeLog
@@ -1,3 +1,18 @@
+2010-09-14  Philippe Normand  <pnormand at igalia.com>
+
+        Reviewed by Eric Carlson and Martin Robinson.
+
+        [GTK] eventSender.contextClick() should return the contents of the context menu
+        https://bugs.webkit.org/show_bug.cgi?id=39102
+
+        New test checking the return value of eventSender.contextClick()
+        on a non-editable element. Skipped on qt and win.
+
+        * editing/selection/context-menu-on-text-expected.txt: Added.
+        * editing/selection/context-menu-on-text.html: Added.
+        * platform/qt/Skipped:
+        * platform/win/Skipped:
+
 2010-09-16  Alexey Proskuryakov  <ap at apple.com>
 
         Reviewed by Adam Barth.
diff --git a/LayoutTests/editing/selection/context-menu-on-text-expected.txt b/LayoutTests/editing/selection/context-menu-on-text-expected.txt
new file mode 100644
index 0000000..2e3a698
--- /dev/null
+++ b/LayoutTests/editing/selection/context-menu-on-text-expected.txt
@@ -0,0 +1,4 @@
+This test checks that the context menu is shown over a simple non-editable text.
+
+Lorem ipsum
+SUCCESS
diff --git a/LayoutTests/editing/selection/context-menu-on-text.html b/LayoutTests/editing/selection/context-menu-on-text.html
new file mode 100644
index 0000000..6578a0f
--- /dev/null
+++ b/LayoutTests/editing/selection/context-menu-on-text.html
@@ -0,0 +1,29 @@
+<body onload="test()">
+<p>This test checks that the context menu is shown over a simple non-editable text.</p>
+<div id="text">Lorem ipsum</div>
+<div id="result">FAIL</div>
+</body>
+<script>
+function test()
+{
+    if (window.layoutTestController)
+        layoutTestController.dumpAsText();
+
+    var text = document.getElementById("text");
+
+    var x = text.offsetParent.offsetLeft + text.offsetLeft + 4;
+    var y = text.offsetParent.offsetTop + text.offsetTop + text.offsetHeight / 2;
+
+    if (!window.eventSender)
+        return;
+
+    eventSender.mouseMoveTo(x, y);
+
+    var items = eventSender.contextClick();
+
+    if (items.length > 0)
+        document.getElementById('result').innerHTML = 'SUCCESS';
+    else
+        document.getElementById('result').innerHTML = 'FAILURE: No context menu';
+}
+</script>
diff --git a/LayoutTests/platform/qt/Skipped b/LayoutTests/platform/qt/Skipped
index 84bdfbf..f8abee7 100644
--- a/LayoutTests/platform/qt/Skipped
+++ b/LayoutTests/platform/qt/Skipped
@@ -2267,6 +2267,9 @@ editing/selection/wrapped-line-caret-2.html
 # https://bugs.webkit.org/show_bug.cgi?id=41918
 editing/selection/5195166-1.html
 
+# missing DRT feature, see also https://bugs.webkit.org/show_bug.cgi?id=39102
+editing/selection/context-menu-on-text.html
+
 # ============================================================================= #
 # Failing editing/spelling tests
 # ============================================================================= #
diff --git a/LayoutTests/platform/win/Skipped b/LayoutTests/platform/win/Skipped
index a461667..8460cf4 100644
--- a/LayoutTests/platform/win/Skipped
+++ b/LayoutTests/platform/win/Skipped
@@ -295,6 +295,9 @@ fast/text/international/thai-baht-space.html
 # Sensitive to load timing or PHP behavior (https://bugs.webkit.org/show_bug.cgi?id=44873) 
 http/tests/css/css-image-loading.html
 
+# missing DRT feature, see also https://bugs.webkit.org/show_bug.cgi?id=39102
+editing/selection/context-menu-on-text.html
+
 ################################################################################
 ####################### No bugs filed about the below yet#######################
 ################################################################################
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 40403ae..11da8d6 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,17 @@
+2010-09-14  Philippe Normand  <pnormand at igalia.com>
+
+        Reviewed by Eric Carlson and Martin Robinson.
+
+        [GTK] eventSender.contextClick() should return the contents of the context menu
+        https://bugs.webkit.org/show_bug.cgi?id=39102
+
+        New private WebView API to retrieve the context-menu widget. This
+        is used by DRT only.
+
+        * webkit/webkitprivate.h:
+        * webkit/webkitwebview.cpp:
+        (webkit_web_view_get_context_menu):
+
 2010-09-16  Alejandro G. Castro  <alex at igalia.com>
 
         Reviewed by Xan Lopez.
diff --git a/WebKit/gtk/webkit/webkitprivate.h b/WebKit/gtk/webkit/webkitprivate.h
index 5c6d151..616ee6b 100644
--- a/WebKit/gtk/webkit/webkitprivate.h
+++ b/WebKit/gtk/webkit/webkitprivate.h
@@ -286,6 +286,9 @@ extern "C" {
     void
     webkit_web_view_set_tooltip_text(WebKitWebView*, const char*);
 
+    GtkMenu*
+    webkit_web_view_get_context_menu(WebKitWebView*);
+
     WEBKIT_API void
     webkit_web_view_execute_core_command_by_name(WebKitWebView* webView, const gchar* name, const gchar* value);
 
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index 0938ccf..87df72b 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -4730,3 +4730,17 @@ gboolean webkit_web_view_is_command_enabled(WebKitWebView* webView, const gchar*
 
     return core(webView)->focusController()->focusedOrMainFrame()->editor()->command(name).isEnabled();
 }
+
+GtkMenu* webkit_web_view_get_context_menu(WebKitWebView* webView)
+{
+    g_return_val_if_fail(WEBKIT_IS_WEB_VIEW(webView), 0);
+
+#if ENABLE(CONTEXT_MENUS)
+    ContextMenu* menu = core(webView)->contextMenuController()->contextMenu();
+    if (!menu)
+        return 0;
+    return menu->platformDescription();
+#else
+    return 0;
+#endif
+}
diff --git a/WebKitTools/ChangeLog b/WebKitTools/ChangeLog
index 39d916d..a24382d 100644
--- a/WebKitTools/ChangeLog
+++ b/WebKitTools/ChangeLog
@@ -1,3 +1,16 @@
+2010-09-14  Philippe Normand  <pnormand at igalia.com>
+
+        Reviewed by Eric Carlson and Martin Robinson.
+
+        [GTK] eventSender.contextClick() should return the contents of the context menu
+        https://bugs.webkit.org/show_bug.cgi?id=39102
+
+        Make the eventSender use the new private WebKitGtk+ API to
+        retrieve the context-menu item titles and store them in an array.
+
+        * DumpRenderTree/gtk/EventSender.cpp:
+        (contextClickCallback):
+
 2010-09-16  Eric Uhrhane  <ericu at chromium.org>
 
         Reviewed by Jian Li.
diff --git a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
index fc118bc..0e2e469 100644
--- a/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
+++ b/WebKitTools/DumpRenderTree/gtk/EventSender.cpp
@@ -42,6 +42,7 @@
 #include <webkit/webkitwebview.h>
 #include <wtf/ASCIICType.h>
 #include <wtf/Platform.h>
+#include <wtf/text/CString.h>
 
 #include <gdk/gdk.h>
 #include <gdk/gdkkeysyms.h>
@@ -49,6 +50,7 @@
 
 extern "C" {
     extern void webkit_web_frame_layout(WebKitWebFrame* frame);
+    extern GtkMenu* webkit_web_view_get_context_menu(WebKitWebView*);
 }
 
 static bool dragMode;
@@ -148,15 +150,37 @@ bool prepareMouseButtonEvent(GdkEvent* event, int eventSenderButtonNumber, guint
 static JSValueRef contextClickCallback(JSContextRef context, JSObjectRef function, JSObjectRef thisObject, size_t argumentCount, const JSValueRef arguments[], JSValueRef* exception)
 {
     GdkEvent* pressEvent = gdk_event_new(GDK_BUTTON_PRESS);
+
     if (!prepareMouseButtonEvent(pressEvent, 2, 0))
-        return JSValueMakeUndefined(context);
+        return JSObjectMakeArray(context, 0, 0, 0);
 
     GdkEvent* releaseEvent = gdk_event_copy(pressEvent);
     sendOrQueueEvent(pressEvent);
+
+    JSValueRef valueRef = JSObjectMakeArray(context, 0, 0, 0);
+    WebKitWebView* view = webkit_web_frame_get_web_view(mainFrame);
+    GtkMenu* gtkMenu = webkit_web_view_get_context_menu(view);
+    if (gtkMenu) {
+        GList* items = gtk_container_get_children(GTK_CONTAINER(gtkMenu));
+        JSValueRef arrayValues[g_list_length(items)];
+        int index = 0;
+        for (GList* item = g_list_first(items); item; item = g_list_next(item)) {
+            CString label;
+            if (GTK_IS_SEPARATOR_MENU_ITEM(item->data))
+                label = "<separator>";
+            else
+                label = gtk_menu_item_get_label(GTK_MENU_ITEM(item->data));
+
+            arrayValues[index] = JSValueMakeString(context, JSStringCreateWithUTF8CString(label.data()));
+            index++;
+        }
+        if (index)
+            valueRef = JSObjectMakeArray(context, index - 1, arrayValues, 0);
+    }
+
     releaseEvent->type = GDK_BUTTON_RELEASE;
     sendOrQueueEvent(releaseEvent);
-
-    return JSValueMakeUndefined(context);
+    return valueRef;
 }
 
 static void updateClickCount(int button)

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list