⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 278682 in webkit


Ignore:
Timestamp:
Jun 9, 2021, 4:44:40 PM (5 years ago)
Author:
commit-queue@webkit.org
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 <Michael Catanzaro> 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 JavaScriptCore.

  • 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):

Location:
trunk/Source/WebKit
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit/ChangeLog

    r278663 r278682  
     12021-06-09  Michael Catanzaro  <mcatanzaro@gnome.org>
     2
     3        [GTK] Duplicate WebKitWebView::show-option-menu confuses introspection, should use --warn-error when building gir
     4        https://bugs.webkit.org/show_bug.cgi?id=222985
     5
     6        Reviewed by Adrian Perez de Castro.
     7
     8        WebKitWebView::show-option-menu has different parameters for GTK than it does for WPE. It
     9        seems g-ir-scanner is taking the WPE documentation and merging it with the GTK parameters.
     10        We can fix this by moving the introspection comment into platform-specific files.
     11
     12        Additionally, let's use --warn-error to turn warnings into errors to prevent this from ever
     13        happening again, as we already do when generating introspection for JavaScriptCore.
     14
     15        * PlatformGTK.cmake:
     16        * UIProcess/API/glib/WebKitWebView.cpp:
     17        (webkit_web_view_class_init):
     18        * UIProcess/API/glib/WebKitWebViewPrivate.h:
     19        * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
     20        (createShowOptionMenuSignal):
     21        * UIProcess/API/wpe/WebKitWebViewWPE.cpp:
     22        (createShowOptionMenuSignal):
     23
    1242021-06-09  Peng Liu  <peng.liu6@apple.com>
    225
  • trunk/Source/WebKit/PlatformGTK.cmake

    r278658 r278682  
    665665            --quiet
    666666            --warn-all
     667            --warn-error
    667668            --symbol-prefix=webkit
    668669            --identifier-prefix=WebKit
     
    711712            --quiet
    712713            --warn-all
     714            --warn-error
    713715            --symbol-prefix=webkit
    714716            --identifier-prefix=WebKit
  • trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp

    r278456 r278682  
    21712171        G_TYPE_BOOLEAN, 1,
    21722172        WEBKIT_TYPE_COLOR_CHOOSER_REQUEST);
    2173 
    2174     /**
    2175      * WebKitWebView::show-option-menu:
    2176      * @web_view: the #WebKitWebView on which the signal is emitted
    2177      * @menu: the #WebKitOptionMenu
    2178      * @event: the #GdkEvent that triggered the menu, or %NULL
    2179      * @rectangle: the option element area
    2180      *
    2181      * This signal is emitted when a select element in @web_view needs to display a
    2182      * dropdown menu. This signal can be used to show a custom menu, using @menu to get
    2183      * the details of all items that should be displayed. The area of the element in the
    2184      * #WebKitWebView is given as @rectangle parameter, it can be used to position the
    2185      * menu. If this was triggered by a user interaction, like a mouse click,
    2186      * @event parameter provides the #GdkEvent.
    2187      * To handle this signal asynchronously you should keep a ref of the @menu.
    2188      *
    2189      * The default signal handler will pop up a #GtkMenu.
    2190      *
    2191      * Returns: %TRUE to stop other handlers from being invoked for the event.
    2192      *   %FALSE to propagate the event further.
    2193      *
    2194      * Since: 2.18
    2195      */
    2196     signals[SHOW_OPTION_MENU] = g_signal_new(
    2197         "show-option-menu",
    2198         G_TYPE_FROM_CLASS(webViewClass),
    2199         G_SIGNAL_RUN_LAST,
    2200         G_STRUCT_OFFSET(WebKitWebViewClass, show_option_menu),
    2201         g_signal_accumulator_true_handled, nullptr,
    2202         g_cclosure_marshal_generic,
    2203         G_TYPE_BOOLEAN, 3,
    2204         WEBKIT_TYPE_OPTION_MENU,
    2205         GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE,
    2206         GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE);
    22072173#endif // PLATFORM(GTK)
    22082174
    2209 #if PLATFORM(WPE)
    2210     /**
    2211      * WebKitWebView::show-option-menu:
    2212      * @web_view: the #WebKitWebView on which the signal is emitted
    2213      * @menu: the #WebKitOptionMenu
    2214      * @rectangle: the option element area
    2215      *
    2216      * This signal is emitted when a select element in @web_view needs to display a
    2217      * dropdown menu. This signal can be used to show a custom menu, using @menu to get
    2218      * the details of all items that should be displayed. The area of the element in the
    2219      * #WebKitWebView is given as @rectangle parameter, it can be used to position the
    2220      * menu.
    2221      * To handle this signal asynchronously you should keep a ref of the @menu.
    2222      *
    2223      * Returns: %TRUE to stop other handlers from being invoked for the event.
    2224      *   %FALSE to propagate the event further.
    2225      *
    2226      * Since: 2.28
    2227      */
    2228     signals[SHOW_OPTION_MENU] = g_signal_new(
    2229         "show-option-menu",
    2230         G_TYPE_FROM_CLASS(webViewClass),
    2231         G_SIGNAL_RUN_LAST,
    2232         G_STRUCT_OFFSET(WebKitWebViewClass, show_option_menu),
    2233         g_signal_accumulator_true_handled, nullptr,
    2234         g_cclosure_marshal_generic,
    2235         G_TYPE_BOOLEAN, 2,
    2236         WEBKIT_TYPE_OPTION_MENU,
    2237         WEBKIT_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE);
    2238 #endif
     2175    // This signal is different for WPE and GTK, so it's declared in
     2176    // WebKitWebView[Gtk,WPE].cpp to ensure we don't break the introspection.
     2177    signals[SHOW_OPTION_MENU] = createShowOptionMenuSignal(webViewClass);
    22392178
    22402179    /**
  • trunk/Source/WebKit/UIProcess/API/glib/WebKitWebViewPrivate.h

    r278253 r278682  
    122122void webkitWebViewDeleteSurrounding(WebKitWebView*, int offset, unsigned characterCount);
    123123void webkitWebViewSetIsWebProcessResponsive(WebKitWebView*, bool);
     124
     125guint createShowOptionMenuSignal(WebKitWebViewClass*);
  • trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp

    r278185 r278682  
    466466    *rgba = page.backgroundColor().value_or(WebCore::Color::white);
    467467}
     468
     469guint createShowOptionMenuSignal(WebKitWebViewClass* webViewClass)
     470{
     471    /**
     472     * WebKitWebView::show-option-menu:
     473     * @web_view: the #WebKitWebView on which the signal is emitted
     474     * @menu: the #WebKitOptionMenu
     475     * @event: the #GdkEvent that triggered the menu, or %NULL
     476     * @rectangle: the option element area
     477     *
     478     * This signal is emitted when a select element in @web_view needs to display a
     479     * dropdown menu. This signal can be used to show a custom menu, using @menu to get
     480     * the details of all items that should be displayed. The area of the element in the
     481     * #WebKitWebView is given as @rectangle parameter, it can be used to position the
     482     * menu. If this was triggered by a user interaction, like a mouse click,
     483     * @event parameter provides the #GdkEvent.
     484     * To handle this signal asynchronously you should keep a ref of the @menu.
     485     *
     486     * The default signal handler will pop up a #GtkMenu.
     487     *
     488     * Returns: %TRUE to stop other handlers from being invoked for the event.
     489     *   %FALSE to propagate the event further.
     490     *
     491     * Since: 2.18
     492     */
     493    return g_signal_new(
     494        "show-option-menu",
     495        G_TYPE_FROM_CLASS(webViewClass),
     496        G_SIGNAL_RUN_LAST,
     497        G_STRUCT_OFFSET(WebKitWebViewClass, show_option_menu),
     498        g_signal_accumulator_true_handled, nullptr,
     499        g_cclosure_marshal_generic,
     500        G_TYPE_BOOLEAN, 3,
     501        WEBKIT_TYPE_OPTION_MENU,
     502        GDK_TYPE_EVENT | G_SIGNAL_TYPE_STATIC_SCOPE,
     503        GDK_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE);
     504}
  • trunk/Source/WebKit/UIProcess/API/wpe/WebKitWebViewWPE.cpp

    r278185 r278682  
    228228    webkitColorFillFromWebCoreColor(webCoreColor.value_or(WebCore::Color::white), color);
    229229}
     230
     231guint createShowOptionMenuSignal(WebKitWebViewClass* webViewClass)
     232{
     233    /**
     234     * WebKitWebView::show-option-menu:
     235     * @web_view: the #WebKitWebView on which the signal is emitted
     236     * @menu: the #WebKitOptionMenu
     237     * @rectangle: the option element area
     238     *
     239     * This signal is emitted when a select element in @web_view needs to display a
     240     * dropdown menu. This signal can be used to show a custom menu, using @menu to get
     241     * the details of all items that should be displayed. The area of the element in the
     242     * #WebKitWebView is given as @rectangle parameter, it can be used to position the
     243     * menu.
     244     * To handle this signal asynchronously you should keep a ref of the @menu.
     245     *
     246     * Returns: %TRUE to stop other handlers from being invoked for the event.
     247     *   %FALSE to propagate the event further.
     248     *
     249     * Since: 2.28
     250     */
     251    return g_signal_new(
     252        "show-option-menu",
     253        G_TYPE_FROM_CLASS(webViewClass),
     254        G_SIGNAL_RUN_LAST,
     255        G_STRUCT_OFFSET(WebKitWebViewClass, show_option_menu),
     256        g_signal_accumulator_true_handled, nullptr,
     257        g_cclosure_marshal_generic,
     258        G_TYPE_BOOLEAN, 2,
     259        WEBKIT_TYPE_OPTION_MENU,
     260        WEBKIT_TYPE_RECTANGLE | G_SIGNAL_TYPE_STATIC_SCOPE);
     261}
Note: See TracChangeset for help on using the changeset viewer.