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

mrobinson at webkit.org mrobinson at webkit.org
Wed Dec 22 18:12:06 UTC 2010


The following commit has been merged in the debian/experimental branch:
commit b0ecf4f85aff775fd54edbd4685df478cd28871d
Author: mrobinson at webkit.org <mrobinson at webkit.org@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Date:   Wed Dec 8 19:17:18 2010 +0000

    2010-12-08  Martin Robinson  <mrobinson at igalia.com>
    
            Reviewed by John Sullivan.
    
            [GTK] Layering violation in ContextMenuGtk.cpp
            https://bugs.webkit.org/show_bug.cgi?id=50676
    
            ContextMenuGtk accesses the page's ContextMenuController, which is a layering
            violation. This was fixed for Mac with change r73469. We make a similar fix here
            by moving the "activated" signal connection to the WebKit layer.
    
            * platform/gtk/ContextMenuGtk.cpp:
            (WebCore::ContextMenu::appendItem): Remove access of ContextMenuController. This
            is a layering violation.
    2010-12-08  Martin Robinson  <mrobinson at igalia.com>
    
            Reviewed by John Sullivan.
    
            [GTK] Layering violation in ContextMenuGtk.cpp
            https://bugs.webkit.org/show_bug.cgi?id=50676
    
            ContextMenuGtk accesses the page's ContextMenuController, which is a layering
            violation. This was fixed for Mac with change r73469. We make a similar fix here
            by moving the "activated" signal connection to the WebKit layer.
    
            * webkit/webkitwebview.cpp:
            (popupMenuItemActivated): Have ContextMenuController handle this signal.
            (webkit_web_view_forward_context_menu_event): For all items in the untouched
            context menu, connect their "activated" signal to the new popupMenuItemActivated
            handler.
    
    git-svn-id: http://svn.webkit.org/repository/webkit/trunk@73534 268f45cc-cd09-0410-ab3c-d52691b4dbfc

diff --git a/WebCore/ChangeLog b/WebCore/ChangeLog
index ca4b77d..1658f0a 100644
--- a/WebCore/ChangeLog
+++ b/WebCore/ChangeLog
@@ -1,3 +1,18 @@
+2010-12-08  Martin Robinson  <mrobinson at igalia.com>
+
+        Reviewed by John Sullivan.
+
+        [GTK] Layering violation in ContextMenuGtk.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=50676
+
+        ContextMenuGtk accesses the page's ContextMenuController, which is a layering
+        violation. This was fixed for Mac with change r73469. We make a similar fix here
+        by moving the "activated" signal connection to the WebKit layer.
+
+        * platform/gtk/ContextMenuGtk.cpp:
+        (WebCore::ContextMenu::appendItem): Remove access of ContextMenuController. This
+        is a layering violation.
+
 2010-12-08  Jessie Berlin  <jberlin at apple.com>
 
         Reviewed by Adam Roben.
diff --git a/WebCore/platform/gtk/ContextMenuGtk.cpp b/WebCore/platform/gtk/ContextMenuGtk.cpp
index 210cfa6..31449bc 100644
--- a/WebCore/platform/gtk/ContextMenuGtk.cpp
+++ b/WebCore/platform/gtk/ContextMenuGtk.cpp
@@ -19,21 +19,10 @@
 #include "config.h"
 #include "ContextMenu.h"
 
-#include "ContextMenuController.h"
-
 #include <gtk/gtk.h>
 
 namespace WebCore {
 
-// TODO: ref-counting correctness checking.
-// See http://bugs.webkit.org/show_bug.cgi?id=16115
-
-static void menuItemActivated(GtkMenuItem* item, ContextMenuController* controller)
-{
-    ContextMenuItem contextItem(item);
-    controller->contextMenuItemSelected(&contextItem);
-}
-
 ContextMenu::ContextMenu(const HitTestResult& result)
     : m_hitTestResult(result)
 {
@@ -53,13 +42,8 @@ void ContextMenu::appendItem(ContextMenuItem& item)
     ASSERT(m_platformDescription);
     checkOrEnableIfNeeded(item);
 
-    ContextMenuItemType type = item.type();
     GtkMenuItem* platformItem = ContextMenuItem::createNativeMenuItem(item.releasePlatformDescription());
     ASSERT(platformItem);
-
-    if (type == ActionType || type == CheckableActionType)
-        g_signal_connect(platformItem, "activate", G_CALLBACK(menuItemActivated), controller());
-
     gtk_menu_shell_append(GTK_MENU_SHELL(m_platformDescription), GTK_WIDGET(platformItem));
     gtk_widget_show(GTK_WIDGET(platformItem));
 }
diff --git a/WebKit/gtk/ChangeLog b/WebKit/gtk/ChangeLog
index 205d1a5..e50c5ed 100644
--- a/WebKit/gtk/ChangeLog
+++ b/WebKit/gtk/ChangeLog
@@ -1,3 +1,20 @@
+2010-12-08  Martin Robinson  <mrobinson at igalia.com>
+
+        Reviewed by John Sullivan.
+
+        [GTK] Layering violation in ContextMenuGtk.cpp
+        https://bugs.webkit.org/show_bug.cgi?id=50676
+
+        ContextMenuGtk accesses the page's ContextMenuController, which is a layering
+        violation. This was fixed for Mac with change r73469. We make a similar fix here
+        by moving the "activated" signal connection to the WebKit layer.
+
+        * webkit/webkitwebview.cpp:
+        (popupMenuItemActivated): Have ContextMenuController handle this signal.
+        (webkit_web_view_forward_context_menu_event): For all items in the untouched
+        context menu, connect their "activated" signal to the new popupMenuItemActivated
+        handler.
+
 2010-12-08  Antonio Gomes  <agomes at rim.com>
 
         Reviewed by Martin Robinson.
diff --git a/WebKit/gtk/webkit/webkitwebview.cpp b/WebKit/gtk/webkit/webkitwebview.cpp
index 93a3188..9cfd133 100644
--- a/WebKit/gtk/webkit/webkitwebview.cpp
+++ b/WebKit/gtk/webkit/webkitwebview.cpp
@@ -265,6 +265,12 @@ static Node* getFocusedNode(Frame* frame)
     return 0;
 }
 
+static void contextMenuItemActivated(GtkMenuItem* item, ContextMenuController* controller)
+{
+    ContextMenuItem contextItem(item);
+    controller->contextMenuItemSelected(&contextItem);
+}
+
 static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webView, const PlatformMouseEvent& event)
 {
     Page* page = core(webView);
@@ -305,7 +311,8 @@ static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webVie
     // If coreMenu is NULL, this means WebCore decided to not create
     // the default context menu; this may happen when the page is
     // handling the right-click for reasons other than the context menu.
-    ContextMenu* coreMenu = page->contextMenuController()->contextMenu();
+    ContextMenuController* controller = page->contextMenuController();
+    ContextMenu* coreMenu = controller->contextMenu();
     if (!coreMenu)
         return mousePressEventResult;
 
@@ -323,12 +330,23 @@ static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webVie
     if (!menu)
         return FALSE;
 
+    // We connect the "activate" signal here rather than in ContextMenuGtk to avoid
+    // a layering violation. ContextMenuGtk should not know about the ContextMenuController.
+    // FIXME: This should handle submenu items.
+    GOwnPtr<GList> items(gtk_container_get_children(GTK_CONTAINER(menu)));
+    GList* currentListItem = items.get();
+    while (currentListItem) {
+        GtkMenuItem* item = GTK_MENU_ITEM(currentListItem->data);
+        if (!GTK_IS_SEPARATOR_MENU_ITEM(item) && !gtk_menu_item_get_submenu(item))
+            g_signal_connect(item, "activate", G_CALLBACK(contextMenuItemActivated), controller);
+        currentListItem = currentListItem->next;
+    }
+
     g_signal_emit(webView, webkit_web_view_signals[POPULATE_POPUP], 0, menu);
 
-    GList* items = gtk_container_get_children(GTK_CONTAINER(menu));
-    bool empty = !g_list_nth(items, 0);
-    g_list_free(items);
-    if (empty)
+    // If the context menu is now empty, don't show it.
+    items.set(gtk_container_get_children(GTK_CONTAINER(menu)));
+    if (!items)
         return FALSE;
 
     WebKitWebViewPrivate* priv = WEBKIT_WEB_VIEW_GET_PRIVATE(webView);
@@ -336,9 +354,7 @@ static gboolean webkit_web_view_forward_context_menu_event(WebKitWebView* webVie
     priv->lastPopupXPosition = event.globalX();
     priv->lastPopupYPosition = event.globalY();
 
-    gtk_menu_popup(menu, NULL, NULL,
-                   &PopupMenuPositionFunc,
-                   webView, event.button() + 1, gtk_get_current_event_time());
+    gtk_menu_popup(menu, 0, 0, &PopupMenuPositionFunc, webView, event.button() + 1, gtk_get_current_event_time());
     return TRUE;
 }
 

-- 
WebKit Debian packaging



More information about the Pkg-webkit-commits mailing list