Title: [278682] trunk/Source/WebKit
Revision
278682
Author
commit-qu...@webkit.org
Date
2021-06-09 16:44:40 -0700 (Wed, 09 Jun 2021)

Log Message

[GTK] Duplicate WebKitWebView::show-option-menu confuses introspection, should use --warn-error when building gir
https://bugs.webkit.org/show_bug.cgi?id=222985

Patch by Michael Catanzaro <mcatanz...@gnome.org> on 2021-06-09
Reviewed by Adrian Perez de Castro.

WebKitWebView::show-option-menu has different parameters for GTK than it does for WPE. It
seems g-ir-scanner is taking the WPE documentation and merging it with the GTK parameters.
We can fix this by moving the introspection comment into platform-specific files.

Additionally, let's use --warn-error to turn warnings into errors to prevent this from ever
happening again, as we already do when generating introspection for _javascript_Core.

* PlatformGTK.cmake:
* UIProcess/API/glib/WebKitWebView.cpp:
(webkit_web_view_class_init):
* UIProcess/API/glib/WebKitWebViewPrivate.h:
* UIProcess/API/gtk/WebKitWebViewGtk.cpp:
(createShowOptionMenuSignal):
* UIProcess/API/wpe/WebKitWebViewWPE.cpp:
(createShowOptionMenuSignal):

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (278681 => 278682)


--- trunk/Source/WebKit/ChangeLog	2021-06-09 23:41:30 UTC (rev 278681)
+++ trunk/Source/WebKit/ChangeLog	2021-06-09 23:44:40 UTC (rev 278682)
@@ -1,3 +1,26 @@
+2021-06-09  Michael Catanzaro  <mcatanz...@gnome.org>
+
+        [GTK] Duplicate WebKitWebView::show-option-menu confuses introspection, should use --warn-error when building gir
+        https://bugs.webkit.org/show_bug.cgi?id=222985
+
+        Reviewed by Adrian Perez de Castro.
+
+        WebKitWebView::show-option-menu has different parameters for GTK than it does for WPE. It
+        seems g-ir-scanner is taking the WPE documentation and merging it with the GTK parameters.
+        We can fix this by moving the introspection comment into platform-specific files.
+
+        Additionally, let's use --warn-error to turn warnings into errors to prevent this from ever
+        happening again, as we already do when generating introspection for _javascript_Core.
+
+        * PlatformGTK.cmake:
+        * UIProcess/API/glib/WebKitWebView.cpp:
+        (webkit_web_view_class_init):
+        * UIProcess/API/glib/WebKitWebViewPrivate.h:
+        * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
+        (createShowOptionMenuSignal):
+        * UIProcess/API/wpe/WebKitWebViewWPE.cpp:
+        (createShowOptionMenuSignal):
+
 2021-06-09  Peng Liu  <peng.l...@apple.com>
 
         [iOS] UIDelegate::UIClient::fullscreenMayReturnToInline() is not called when a video exits fullscreen

Modified: trunk/Source/WebKit/PlatformGTK.cmake (278681 => 278682)


--- trunk/Source/WebKit/PlatformGTK.cmake	2021-06-09 23:41:30 UTC (rev 278681)
+++ trunk/Source/WebKit/PlatformGTK.cmake	2021-06-09 23:44:40 UTC (rev 278682)
@@ -664,6 +664,7 @@
             ${INTROSPECTION_SCANNER}
             --quiet
             --warn-all
+            --warn-error
             --symbol-prefix=webkit
             --identifier-prefix=WebKit
             --namespace=WebKit2
@@ -710,6 +711,7 @@
             ${INTROSPECTION_SCANNER}
             --quiet
             --warn-all
+            --warn-error
             --symbol-prefix=webkit
             --identifier-prefix=WebKit
             --namespace=WebKit2WebExtension

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp (278681 => 278682)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp	2021-06-09 23:41:30 UTC (rev 278681)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp	2021-06-09 23:44:40 UTC (rev 278682)
@@ -2170,72 +2170,11 @@
         g_cclosure_marshal_generic,
         G_TYPE_BOOLEAN, 1,
         WEBKIT_TYPE_COLOR_CHOOSER_REQUEST);
-
-    /**
-     * WebKitWebView::show-option-menu:
-     * @web_view: the #WebKitWebView on which the signal is emitted
-     * @menu: the #WebKitOptionMenu
-     * @event: the #GdkEvent that triggered the menu, or %NULL
-     * @rectangle: the option element area
-     *
-     * This signal is emitted when a select element in @web_view needs to display a
-     * dropdown menu. This signal can be used to show a custom menu, using @menu to get
-     * the details of all items that should be displayed. The area of the element in the
-     * #WebKitWebView is given as @rectangle parameter, it can be used to position the
-     * menu. If this was triggered by a user interaction, like a mouse click,
-     * @event parameter provides the #GdkEvent.
-     * To handle this signal asynchronously you should keep a ref of the @menu.
-     *
-     * The default signal handler will pop up a #GtkMenu.
-     *
-     * Returns: %TRUE to stop other handlers from being invoked for the event.
-     *   %FALSE to propagate the event further.
-     *
-     * Since: 2.18
-     */
-    signals[SHOW_OPTION_MENU] = g_signal_new(
-        "show-option-menu",
-        G_TYPE_FROM_CLASS(webViewClass),
-        G_SIGNAL_RUN_LAST,
-        G_STRUCT_OFFSET(WebKitWebViewClass, show_option_menu),
-        g_signal_accumulator_true_handled, nullptr,
-        g_cclosure_marshal_generic,
-        G_TYPE_BOOLEAN, 3,
-        WEBKIT_TYPE_OPTION_MENU,
-        GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE,
-        GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE);
 #endif // PLATFORM(GTK)
 
-#if PLATFORM(WPE)
-    /**
-     * WebKitWebView::show-option-menu:
-     * @web_view: the #WebKitWebView on which the signal is emitted
-     * @menu: the #WebKitOptionMenu
-     * @rectangle: the option element area
-     *
-     * This signal is emitted when a select element in @web_view needs to display a
-     * dropdown menu. This signal can be used to show a custom menu, using @menu to get
-     * the details of all items that should be displayed. The area of the element in the
-     * #WebKitWebView is given as @rectangle parameter, it can be used to position the
-     * menu.
-     * To handle this signal asynchronously you should keep a ref of the @menu.
-     *
-     * Returns: %TRUE to stop other handlers from being invoked for the event.
-     *   %FALSE to propagate the event further.
-     *
-     * Since: 2.28
-     */
-    signals[SHOW_OPTION_MENU] = g_signal_new(
-        "show-option-menu",
-        G_TYPE_FROM_CLASS(webViewClass),
-        G_SIGNAL_RUN_LAST,
-        G_STRUCT_OFFSET(WebKitWebViewClass, show_option_menu),
-        g_signal_accumulator_true_handled, nullptr,
-        g_cclosure_marshal_generic,
-        G_TYPE_BOOLEAN, 2,
-        WEBKIT_TYPE_OPTION_MENU,
-        WEBKIT_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE);
-#endif
+    // This signal is different for WPE and GTK, so it's declared in
+    // WebKitWebView[Gtk,WPE].cpp to ensure we don't break the introspection.
+    signals[SHOW_OPTION_MENU] = createShowOptionMenuSignal(webViewClass);
 
     /**
      * WebKitWebView::user-message-received:

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h (278681 => 278682)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h	2021-06-09 23:41:30 UTC (rev 278681)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h	2021-06-09 23:44:40 UTC (rev 278682)
@@ -121,3 +121,5 @@
 void webkitWebViewCancelComposition(WebKitWebView*, const String&);
 void webkitWebViewDeleteSurrounding(WebKitWebView*, int offset, unsigned characterCount);
 void webkitWebViewSetIsWebProcessResponsive(WebKitWebView*, bool);
+
+guint createShowOptionMenuSignal(WebKitWebViewClass*);

Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp (278681 => 278682)


--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp	2021-06-09 23:41:30 UTC (rev 278681)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp	2021-06-09 23:44:40 UTC (rev 278682)
@@ -465,3 +465,40 @@
     auto& page = *webkitWebViewBaseGetPage(reinterpret_cast<WebKitWebViewBase*>(webView));
     *rgba = page.backgroundColor().value_or(WebCore::Color::white);
 }
+
+guint createShowOptionMenuSignal(WebKitWebViewClass* webViewClass)
+{
+    /**
+     * WebKitWebView::show-option-menu:
+     * @web_view: the #WebKitWebView on which the signal is emitted
+     * @menu: the #WebKitOptionMenu
+     * @event: the #GdkEvent that triggered the menu, or %NULL
+     * @rectangle: the option element area
+     *
+     * This signal is emitted when a select element in @web_view needs to display a
+     * dropdown menu. This signal can be used to show a custom menu, using @menu to get
+     * the details of all items that should be displayed. The area of the element in the
+     * #WebKitWebView is given as @rectangle parameter, it can be used to position the
+     * menu. If this was triggered by a user interaction, like a mouse click,
+     * @event parameter provides the #GdkEvent.
+     * To handle this signal asynchronously you should keep a ref of the @menu.
+     *
+     * The default signal handler will pop up a #GtkMenu.
+     *
+     * Returns: %TRUE to stop other handlers from being invoked for the event.
+     *   %FALSE to propagate the event further.
+     *
+     * Since: 2.18
+     */
+    return g_signal_new(
+        "show-option-menu",
+        G_TYPE_FROM_CLASS(webViewClass),
+        G_SIGNAL_RUN_LAST,
+        G_STRUCT_OFFSET(WebKitWebViewClass, show_option_menu),
+        g_signal_accumulator_true_handled, nullptr,
+        g_cclosure_marshal_generic,
+        G_TYPE_BOOLEAN, 3,
+        WEBKIT_TYPE_OPTION_MENU,
+        GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE,
+        GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE);
+}

Modified: trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp (278681 => 278682)


--- trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp	2021-06-09 23:41:30 UTC (rev 278681)
+++ trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp	2021-06-09 23:44:40 UTC (rev 278682)
@@ -227,3 +227,35 @@
     auto& webCoreColor = page.backgroundColor();
     webkitColorFillFromWebCoreColor(webCoreColor.value_or(WebCore::Color::white), color);
 }
+
+guint createShowOptionMenuSignal(WebKitWebViewClass* webViewClass)
+{
+    /**
+     * WebKitWebView::show-option-menu:
+     * @web_view: the #WebKitWebView on which the signal is emitted
+     * @menu: the #WebKitOptionMenu
+     * @rectangle: the option element area
+     *
+     * This signal is emitted when a select element in @web_view needs to display a
+     * dropdown menu. This signal can be used to show a custom menu, using @menu to get
+     * the details of all items that should be displayed. The area of the element in the
+     * #WebKitWebView is given as @rectangle parameter, it can be used to position the
+     * menu.
+     * To handle this signal asynchronously you should keep a ref of the @menu.
+     *
+     * Returns: %TRUE to stop other handlers from being invoked for the event.
+     *   %FALSE to propagate the event further.
+     *
+     * Since: 2.28
+     */
+    return g_signal_new(
+        "show-option-menu",
+        G_TYPE_FROM_CLASS(webViewClass),
+        G_SIGNAL_RUN_LAST,
+        G_STRUCT_OFFSET(WebKitWebViewClass, show_option_menu),
+        g_signal_accumulator_true_handled, nullptr,
+        g_cclosure_marshal_generic,
+        G_TYPE_BOOLEAN, 2,
+        WEBKIT_TYPE_OPTION_MENU,
+        WEBKIT_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE);
+}
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to