Title: [292367] trunk/Source/WebKit
Revision
292367
Author
ape...@igalia.com
Date
2022-04-04 20:01:41 -0700 (Mon, 04 Apr 2022)

Log Message

[WPE][GTK] Fix code examples in reference documentation
https://bugs.webkit.org/show_bug.cgi?id=238770

Reviewed by Michael Catanzaro.

Replace DocBook SGML tags containing code examples with Markdown fenced code blocks
as consumed by gi-docgen.

* UIProcess/API/glib/WebKitSettings.cpp:
* UIProcess/API/glib/WebKitUserContentManager.cpp:
* UIProcess/API/glib/WebKitWebContext.cpp:
* UIProcess/API/glib/WebKitWebView.cpp:
(webkit_web_view_class_init):
* UIProcess/API/glib/WebKitWebsitePolicies.cpp:
* UIProcess/API/gtk/WebKitWebInspector.cpp:
* UIProcess/API/gtk/WebKitWebViewGtk.cpp:
* WebProcess/InjectedBundle/API/glib/WebKitWebExtension.cpp:

Modified Paths

Diff

Modified: trunk/Source/WebKit/ChangeLog (292366 => 292367)


--- trunk/Source/WebKit/ChangeLog	2022-04-05 02:42:46 UTC (rev 292366)
+++ trunk/Source/WebKit/ChangeLog	2022-04-05 03:01:41 UTC (rev 292367)
@@ -1,3 +1,23 @@
+2022-04-04  Adrian Perez de Castro  <ape...@igalia.com>
+
+        [WPE][GTK] Fix code examples in reference documentation
+        https://bugs.webkit.org/show_bug.cgi?id=238770
+
+        Reviewed by Michael Catanzaro.
+
+        Replace DocBook SGML tags containing code examples with Markdown fenced code blocks
+        as consumed by gi-docgen.
+
+        * UIProcess/API/glib/WebKitSettings.cpp:
+        * UIProcess/API/glib/WebKitUserContentManager.cpp:
+        * UIProcess/API/glib/WebKitWebContext.cpp:
+        * UIProcess/API/glib/WebKitWebView.cpp:
+        (webkit_web_view_class_init):
+        * UIProcess/API/glib/WebKitWebsitePolicies.cpp:
+        * UIProcess/API/gtk/WebKitWebInspector.cpp:
+        * UIProcess/API/gtk/WebKitWebViewGtk.cpp:
+        * WebProcess/InjectedBundle/API/glib/WebKitWebExtension.cpp:
+
 2022-04-04  Simon Fraser  <simon.fra...@apple.com>
 
         Fix the CG_DISPLAY_LIST_BACKED_IMAGE_BUFFER build

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp (292366 => 292367)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp	2022-04-05 02:42:46 UTC (rev 292366)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp	2022-04-05 03:01:41 UTC (rev 292367)
@@ -97,12 +97,11 @@
  * other things on a #WebKitWebView. After creation, a #WebKitSettings object
  * contains default settings.
  *
- * <informalexample><programlisting>
- * /<!-- -->* Disable _javascript_. *<!-- -->/
+ * ```c
+ * // Disable _javascript_
  * WebKitSettings *settings = webkit_web_view_group_get_settings (my_view_group);
  * webkit_settings_set_enable_javascript (settings, FALSE);
- *
- * </programlisting></informalexample>
+ * ```
  */
 
 WEBKIT_DEFINE_TYPE(WebKitSettings, webkit_settings, G_TYPE_OBJECT)

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitUserContentManager.cpp (292366 => 292367)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitUserContentManager.cpp	2022-04-05 02:42:46 UTC (rev 292366)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitUserContentManager.cpp	2022-04-05 03:01:41 UTC (rev 292367)
@@ -268,13 +268,13 @@
  * receive the signals, it is recommended to connect to the signal
  * *before* registering the handler name:
  *
- * <informalexample><programlisting>
+ * ```c
  * WebKitWebView *view = webkit_web_view_new ();
  * WebKitUserContentManager *manager = webkit_web_view_get_user_content_manager ();
  * g_signal_connect (manager, "script-message-received::foobar",
  *                   G_CALLBACK (handle_script_message), NULL);
  * webkit_user_content_manager_register_script_message_handler (manager, "foobar");
- * </programlisting></informalexample>
+ * ```
  *
  * Registering a script message handler will fail if the requested
  * name has been already registered before.

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp (292366 => 292367)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp	2022-04-05 02:42:46 UTC (rev 292366)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebContext.cpp	2022-04-05 03:01:41 UTC (rev 292367)
@@ -1215,7 +1215,7 @@
  * when the data of the request is available or
  * webkit_uri_scheme_request_finish_error() in case of error.
  *
- * <informalexample><programlisting>
+ * ```c
  * static void
  * about_uri_scheme_request_cb (WebKitURISchemeRequest *request,
  *                              gpointer                user_data)
@@ -1222,23 +1222,18 @@
  * {
  *     GInputStream *stream;
  *     gsize         stream_length;
- *     const gchar  *path;
+ *     const gchar  *path = webkit_uri_scheme_request_get_path (request);
  *
- *     path = webkit_uri_scheme_request_get_path (request);
  *     if (!g_strcmp0 (path, "memory")) {
- *         /<!-- -->* Create a GInputStream with the contents of memory about page, and set its length to stream_length *<!-- -->/
+ *         // Create a GInputStream with the contents of memory about page, and set its length to stream_length
  *     } else if (!g_strcmp0 (path, "applications")) {
- *         /<!-- -->* Create a GInputStream with the contents of applications about page, and set its length to stream_length *<!-- -->/
+ *         // Create a GInputStream with the contents of applications about page, and set its length to stream_length
  *     } else if (!g_strcmp0 (path, "example")) {
- *         gchar *contents;
- *
- *         contents = g_strdup_printf ("&lt;html&gt;&lt;body&gt;&lt;p&gt;Example about page&lt;/p&gt;&lt;/body&gt;&lt;/html&gt;");
+ *         gchar *contents = g_strdup_printf ("<html><body><p>Example about page</p></body></html>");
  *         stream_length = strlen (contents);
  *         stream = g_memory_input_stream_new_from_data (contents, stream_length, g_free);
  *     } else {
- *         GError *error;
- *
- *         error = g_error_new (ABOUT_HANDLER_ERROR, ABOUT_HANDLER_ERROR_INVALID, "Invalid about:%s page.", path);
+ *         GError *error = g_error_new (ABOUT_HANDLER_ERROR, ABOUT_HANDLER_ERROR_INVALID, "Invalid about:%s page.", path);
  *         webkit_uri_scheme_request_finish_error (request, error);
  *         g_error_free (error);
  *         return;
@@ -1246,7 +1241,7 @@
  *     webkit_uri_scheme_request_finish (request, stream, stream_length, "text/html");
  *     g_object_unref (stream);
  * }
- * </programlisting></informalexample>
+ * ```
  */
 void webkit_web_context_register_uri_scheme(WebKitWebContext* context, const char* scheme, WebKitURISchemeRequestCallback callback, gpointer userData, GDestroyNotify destroyNotify)
 {

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


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp	2022-04-05 02:42:46 UTC (rev 292366)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebView.cpp	2022-04-05 03:01:41 UTC (rev 292367)
@@ -1473,7 +1473,7 @@
      * You can handle this signal and use a switch to track any ongoing
      * load operation.
      *
-     * <informalexample><programlisting>
+     * ```c
      * static void web_view_load_changed (WebKitWebView  *web_view,
      *                                    WebKitLoadEvent load_event,
      *                                    gpointer        user_data)
@@ -1480,27 +1480,27 @@
      * {
      *     switch (load_event) {
      *     case WEBKIT_LOAD_STARTED:
-     *         /<!-- -->* New load, we have now a provisional URI *<!-- -->/
+     *         // New load, we have now a provisional URI
      *         provisional_uri = webkit_web_view_get_uri (web_view);
-     *         /<!-- -->* Here we could start a spinner or update the
-     *          <!-- -->* location bar with the provisional URI *<!-- -->/
+     *         // Here we could start a spinner or update the
+     *         // location bar with the provisional URI
      *         break;
      *     case WEBKIT_LOAD_REDIRECTED:
      *         redirected_uri = webkit_web_view_get_uri (web_view);
      *         break;
      *     case WEBKIT_LOAD_COMMITTED:
-     *         /<!-- -->* The load is being performed. Current URI is
-     *          <!-- -->* the final one and it won't change unless a new
-     *          <!-- -->* load is requested or a navigation within the
-     *          <!-- -->* same page is performed *<!-- -->/
+     *         // The load is being performed. Current URI is
+     *         // the final one and it won't change unless a new
+     *         // load is requested or a navigation within the
+     *         // same page is performed
      *         uri = webkit_web_view_get_uri (web_view);
      *         break;
      *     case WEBKIT_LOAD_FINISHED:
-     *         /<!-- -->* Load finished, we can now stop the spinner *<!-- -->/
+     *         // Load finished, we can now stop the spinner
      *         break;
      *     }
      * }
-     * </programlisting></informalexample>
+     * ```
      */
     signals[LOAD_CHANGED] =
         g_signal_new("load-changed",
@@ -1734,7 +1734,7 @@
      * @decision argument is a generic type, but should be casted to a more
      * specific type when making the decision. For example:
      *
-     * <informalexample><programlisting>
+     * ```c
      * static gboolean
      * decide_policy_cb (WebKitWebView *web_view,
      *                   WebKitPolicyDecision *decision,
@@ -1743,25 +1743,25 @@
      *     switch (type) {
      *     case WEBKIT_POLICY_DECISION_TYPE_NAVIGATION_ACTION: {
      *         WebKitNavigationPolicyDecision *navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION (decision);
-     *         /<!-- -->* Make a policy decision here. *<!-- -->/
+     *         // Make a policy decision here
      *         break;
      *     }
      *     case WEBKIT_POLICY_DECISION_TYPE_NEW_WINDOW_ACTION: {
      *         WebKitNavigationPolicyDecision *navigation_decision = WEBKIT_NAVIGATION_POLICY_DECISION (decision);
-     *         /<!-- -->* Make a policy decision here. *<!-- -->/
+     *         // Make a policy decision here
      *         break;
      *     }
      *     case WEBKIT_POLICY_DECISION_TYPE_RESPONSE:
      *         WebKitResponsePolicyDecision *response = WEBKIT_RESPONSE_POLICY_DECISION (decision);
-     *         /<!-- -->* Make a policy decision here. *<!-- -->/
+     *         // Make a policy decision here
      *         break;
      *     default:
-     *         /<!-- -->* Making no decision results in webkit_policy_decision_use(). *<!-- -->/
+     *         // Making no decision results in webkit_policy_decision_use()
      *         return FALSE;
      *     }
      *     return TRUE;
      * }
-     * </programlisting></informalexample>
+     * ```
      *
      * It is possible to make policy decision asynchronously, by simply calling g_object_ref()
      * on the @decision argument and returning %TRUE to block the default signal handler.
@@ -1798,7 +1798,7 @@
      * A possible way to use this signal could be through a dialog
      * allowing the user decide what to do with the request:
      *
-     * <informalexample><programlisting>
+     * ```c
      * static gboolean permission_request_cb (WebKitWebView *web_view,
      *                                        WebKitPermissionRequest *request,
      *                                        GtkWindow *parent_window)
@@ -1823,7 +1823,7 @@
      *
      *     return TRUE;
      * }
-     * </programlisting></informalexample>
+     * ```
      *
      * It is possible to handle permission requests asynchronously, by
      * simply calling g_object_ref() on the @request argument and
@@ -3905,7 +3905,7 @@
  * This is an example of using webkit_web_view_run_javascript() with a script returning
  * a string:
  *
- * <informalexample><programlisting>
+ * ```c
  * static void
  * web_view_javascript_finished (GObject      *object,
  *                               GAsyncResult *result,
@@ -3924,11 +3924,8 @@
  *
  *     value = webkit_javascript_result_get_js_value (js_result);
  *     if (jsc_value_is_string (value)) {
- *         JSCException *exception;
- *         gchar        *str_value;
- *
- *         str_value = jsc_value_to_string (value);
- *         exception = jsc_context_get_exception (jsc_value_get_context (value));
+ *         gchar        *str_value = jsc_value_to_string (value);
+ *         JSCException *exception = jsc_context_get_exception (jsc_value_get_context (value));
  *         if (exception)
  *             g_warning ("Error running _javascript_: %s", jsc_exception_get_message (exception));
  *         else
@@ -3944,13 +3941,11 @@
  * web_view_get_link_url (WebKitWebView *web_view,
  *                        const gchar   *link_id)
  * {
- *     gchar *script;
- *
- *     script = g_strdup_printf ("window.document.getElementById('%s').href;", link_id);
+ *     gchar *script = g_strdup_printf ("window.document.getElementById('%s').href;", link_id);
  *     webkit_web_view_run_javascript (web_view, script, NULL, web_view_javascript_finished, NULL);
  *     g_free (script);
  * }
- * </programlisting></informalexample>
+ * ```
  *
  * Returns: (transfer full): a #WebKitJavascriptResult with the result of the last executed statement in @script
  *    or %NULL in case of error

Modified: trunk/Source/WebKit/UIProcess/API/glib/WebKitWebsitePolicies.cpp (292366 => 292367)


--- trunk/Source/WebKit/UIProcess/API/glib/WebKitWebsitePolicies.cpp	2022-04-05 02:42:46 UTC (rev 292366)
+++ trunk/Source/WebKit/UIProcess/API/glib/WebKitWebsitePolicies.cpp	2022-04-05 03:01:41 UTC (rev 292367)
@@ -177,11 +177,13 @@
  *
  * Returns: (transfer full): the newly created #WebKitWebsitePolicies
  *
- * <informalexample><programlisting>
+ * ```c
  * WebKitWebsitePolicies *default_website_policies = webkit_website_policies_new_with_policies(
  *     "autoplay", WEBKIT_AUTOPLAY_DENY,
  *     NULL);
- * ...
+ *
+ * // ...
+ *
  * WebKitWebView *view = WEBKIT_WEB_VIEW(g_object_new(WEBKIT_TYPE_WEB_VIEW,
  *     "web-context", ctx,
  *     "settings", settings,
@@ -188,9 +190,10 @@
  *     "user-content-manager", content_manager,
  *     "website-policies", default_website_policies,
  *     NULL));
- * ...
- * </programlisting></informalexample>
  *
+ * // ...
+ * ```
+ *
  * Since: 2.30
  */
 WebKitWebsitePolicies* webkit_website_policies_new_with_policies(const gchar* firstPolicyName, ...)

Modified: trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebInspector.cpp (292366 => 292367)


--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebInspector.cpp	2022-04-05 02:42:46 UTC (rev 292366)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebInspector.cpp	2022-04-05 03:01:41 UTC (rev 292367)
@@ -44,18 +44,18 @@
  * #WebKitWebView has set the #WebKitSettings:enable-developer-extras
  * to true, otherwise no inspector is available.
  *
- * <informalexample><programlisting>
- * /<!-- -->* Enable the developer extras *<!-- -->/
+ * ```c
+ * // Enable the developer extras
  * WebKitSettings *settings = webkit_web_view_get_settings (WEBKIT_WEB_VIEW(my_webview));
  * g_object_set (G_OBJECT(settings), "enable-developer-extras", TRUE, NULL);
  *
- * /<!-- -->* Load some data or reload to be able to inspect the page*<!-- -->/
+ * // Load some data or reload to be able to inspect the page
  * webkit_web_view_load_uri (WEBKIT_WEB_VIEW(my_webview), "http://www.gnome.org");
  *
- * /<!-- -->* Show the inspector *<!-- -->/
+ * // Show the inspector
  * WebKitWebInspector *inspector = webkit_web_view_get_inspector (WEBKIT_WEB_VIEW(my_webview));
  * webkit_web_inspector_show (WEBKIT_WEB_INSPECTOR(inspector));
- * </programlisting></informalexample>
+ * ```
  */
 
 enum {

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


--- trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp	2022-04-05 02:42:46 UTC (rev 292366)
+++ trunk/Source/WebKit/UIProcess/API/gtk/WebKitWebViewGtk.cpp	2022-04-05 03:01:41 UTC (rev 292367)
@@ -432,7 +432,7 @@
  * Note that the parent window must have a RGBA visual and
  * #GtkWidget:app-paintable property set to %TRUE for backgrounds colors to work.
  *
- * <informalexample><programlisting>
+ * ```c
  * static void browser_window_set_background_color (BrowserWindow *window,
  *                                                  const GdkRGBA *rgba)
  * {
@@ -449,7 +449,7 @@
  *     web_view = browser_window_get_web_view (window);
  *     webkit_web_view_set_background_color (web_view, rgba);
  * }
- * </programlisting></informalexample>
+ * ```
  *
  * Since: 2.8
  */

Modified: trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebExtension.cpp (292366 => 292367)


--- trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebExtension.cpp	2022-04-05 02:42:46 UTC (rev 292366)
+++ trunk/Source/WebKit/WebProcess/InjectedBundle/API/glib/WebKitWebExtension.cpp	2022-04-05 03:01:41 UTC (rev 292367)
@@ -51,7 +51,7 @@
  * This function has to be public and it has to use the #G_MODULE_EXPORT macro. It is called when the
  * web process is initialized.
  *
- * <informalexample><programlisting>
+ * ```c
  * static void
  * web_page_created_callback (WebKitWebExtension *extension,
  *                            WebKitWebPage      *web_page,
@@ -69,7 +69,7 @@
  *                       G_CALLBACK (web_page_created_callback),
  *                       NULL);
  * }
- * </programlisting></informalexample>
+ * ```
  *
  * The previous piece of code shows a trivial example of an extension that notifies when
  * a #WebKitWebPage is created.
@@ -82,14 +82,14 @@
  * function, you have to call webkit_web_context_set_web_extensions_initialization_user_data() with
  * the desired data as parameter. You can see an example of this in the following piece of code:
  *
- * <informalexample><programlisting>
- * #define WEB_EXTENSIONS_DIRECTORY /<!-- -->* ... *<!-- -->/
+ * ```c
+ * #define WEB_EXTENSIONS_DIRECTORY // ...
  *
  * static void
  * initialize_web_extensions (WebKitWebContext *context,
  *                            gpointer          user_data)
  * {
- *   /<!-- -->* Web Extensions get a different ID for each Web Process *<!-- -->/
+ *   // Web Extensions get a different ID for each Web Process
  *   static guint32 unique_id = 0;
  *
  *   webkit_web_context_set_web_extensions_directory (
@@ -107,9 +107,9 @@
  *
  *   GtkWidget *view = webkit_web_view_new ();
  *
- *   /<!-- -->* ... *<!-- -->/
+ *   // ...
  * }
- * </programlisting></informalexample>
+ * ```
  */
 
 enum {
_______________________________________________
webkit-changes mailing list
webkit-changes@lists.webkit.org
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to