Title: [185825] trunk/Source/WebKit2
Revision
185825
Author
carlo...@webkit.org
Date
2015-06-22 05:42:33 -0700 (Mon, 22 Jun 2015)

Log Message

REGRESSION(r182303): [GTK] Context menu API is broken since r182303
https://bugs.webkit.org/show_bug.cgi?id=146202

Reviewed by Žan Doberšek.

The problem is that ContextMenuclient API changed in r182303, but
we didn't notice it either, and the default handler for
getContextMenuFromProposedMenu was executed. An override keyword
would have caught this.

* UIProcess/API/gtk/WebKitContextMenuClient.cpp: Build a Vector of
WebContextMenuItemData as expected by our API, and add add
override keyword to ensure this doesn't happen again.

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (185824 => 185825)


--- trunk/Source/WebKit2/ChangeLog	2015-06-22 12:06:46 UTC (rev 185824)
+++ trunk/Source/WebKit2/ChangeLog	2015-06-22 12:42:33 UTC (rev 185825)
@@ -1,3 +1,19 @@
+2015-06-22  Carlos Garcia Campos  <cgar...@igalia.com>
+
+        REGRESSION(r182303): [GTK] Context menu API is broken since r182303
+        https://bugs.webkit.org/show_bug.cgi?id=146202
+
+        Reviewed by Žan Doberšek.
+
+        The problem is that ContextMenuclient API changed in r182303, but
+        we didn't notice it either, and the default handler for
+        getContextMenuFromProposedMenu was executed. An override keyword
+        would have caught this.
+
+        * UIProcess/API/gtk/WebKitContextMenuClient.cpp: Build a Vector of
+        WebContextMenuItemData as expected by our API, and add add
+        override keyword to ensure this doesn't happen again.
+
 2015-06-22  Zan Dobersek  <zdober...@igalia.com>
 
         [WK2] ConnectionUnix should use FastMalloc to allocate on-heap resources

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuClient.cpp (185824 => 185825)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuClient.cpp	2015-06-22 12:06:46 UTC (rev 185824)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitContextMenuClient.cpp	2015-06-22 12:42:33 UTC (rev 185825)
@@ -21,6 +21,7 @@
 #include "WebKitContextMenuClient.h"
 
 #include "APIContextMenuClient.h"
+#include "WebContextMenuItem.h"
 #include "WebKitWebViewBasePrivate.h"
 #include "WebKitWebViewPrivate.h"
 
@@ -34,7 +35,7 @@
     }
 
 private:
-    bool getContextMenuFromProposedMenu(WebPageProxy&, const Vector<WebContextMenuItemData>& proposedMenu, Vector<WebContextMenuItemData>&, const WebHitTestResult::Data& hitTestResultData, API::Object* userData)
+    bool getContextMenuFromProposedMenu(WebPageProxy&, const Vector<RefPtr<WebContextMenuItem>>& proposedMenu, Vector<RefPtr<WebContextMenuItem>>&, const WebHitTestResult::Data& hitTestResultData, API::Object* userData) override
     {
         GRefPtr<GVariant> variant;
         if (userData) {
@@ -42,7 +43,12 @@
             CString userDataString = static_cast<API::String*>(userData)->string().utf8();
             variant = adoptGRef(g_variant_parse(nullptr, userDataString.data(), userDataString.data() + userDataString.length(), nullptr, nullptr));
         }
-        webkitWebViewPopulateContextMenu(m_webView, proposedMenu, hitTestResultData, variant.get());
+
+        Vector<WebContextMenuItemData> menuItems;
+        menuItems.reserveInitialCapacity(proposedMenu.size());
+        for (auto& item : proposedMenu)
+            menuItems.uncheckedAppend(*item->data());
+        webkitWebViewPopulateContextMenu(m_webView, menuItems, hitTestResultData, variant.get());
         return true;
     }
 
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to