[webkit-changes] [WebKit/WebKit] 760e6a: [GLib] Add introspectable API to configure experim...
Adrian Perez
noreply at github.com
Mon Apr 24 13:32:00 PDT 2023
Branch: refs/heads/main
Home: https://github.com/WebKit/WebKit
Commit: 760e6a2591cf8cb0e8bc40af0caaccce3bc64f28
https://github.com/WebKit/WebKit/commit/760e6a2591cf8cb0e8bc40af0caaccce3bc64f28
Author: Adrian Perez de Castro <aperez at igalia.com>
Date: 2023-04-24 (Mon, 24 Apr 2023)
Changed paths:
M Source/WebKit/PlatformGTK.cmake
M Source/WebKit/PlatformWPE.cmake
M Source/WebKit/SourcesGTK.txt
M Source/WebKit/SourcesWPE.txt
A Source/WebKit/UIProcess/API/glib/WebKitFeature.cpp
A Source/WebKit/UIProcess/API/glib/WebKitFeature.h.in
A Source/WebKit/UIProcess/API/glib/WebKitFeaturePrivate.h
M Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp
M Source/WebKit/UIProcess/API/glib/WebKitSettings.h.in
M Source/WebKit/UIProcess/API/glib/webkit.h.in
M Tools/MiniBrowser/gtk/BrowserSettingsDialog.c
M Tools/MiniBrowser/gtk/main.c
M Tools/MiniBrowser/wpe/main.cpp
M Tools/Scripts/webkitpy/style/checker.py
M Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitSettings.cpp
Log Message:
-----------
[GLib] Add introspectable API to configure experimental features at runtime
https://bugs.webkit.org/show_bug.cgi?id=255518
Reviewed by Carlos Garcia Campos.
Adds a WebKitFeature boxed type that wraps API::Feature, and new
functions in WebKitSettings to change their values and retrieve the
lists of available features. The structure loosely follows what the
Cocoa port does, with a few notable differences:
- Some feature identifiers have an "Enabled" suffix, and others do
not, as declared in UnifiedWebPreferences.yaml. The identifiers
exposed though the API remove the suffix for consistency.
- Whether a feature is hidden is not exposed. There is currently only
one hidden feature (fullscreen API) so it seems moot to make the
distinction. Might be added in the future if needed.
- The feature category is a string, to avoid committing a set of fixed
enum values to the public API. This way it will not be needed to
map values if there are changes in the future, and also transmits the
idea that the category for a given feature is informative, and may
change across versions.
- There is a helper WebKitFeatureList boxed type that groups features,
to avoid using GPtrArray (which is bad for GObject Introspection
bindings) or GList (poor match given the sizes of each set are fixed
and well known).
The GTK MiniBrowser gets two new pages in its settings dialog, one for
experimental features and the other for development features. This
needed a switcher added, so at the same time the dialog gets changed to
use a header bar where to place a stack switcher. The existing page
with the settings gets tweaked to allow type-to-search, as it was done
also for the two new pages.
Both the GTK and WPE MiniBrowser get a new -F/--features= command line
option which can be used to toggle a set of features given their
identifiers.
* Source/WebKit/PlatformGTK.cmake: Add WebKitFeature.h.in to the list of
generated API headers.
* Source/WebKit/PlatformWPE.cmake: Ditto.
* Source/WebKit/SourcesGTK.txt: Add WebKitFeature.cpp to the list of
sources.
* Source/WebKit/SourcesWPE.txt: Ditto.
* Source/WebKit/UIProcess/API/glib/WebKitFeature.cpp: Added.
(toFeatureStatus):
(toFeatureCategory):
(_WebKitFeature::_WebKitFeature):
(_WebKitFeature::toIdentifier):
(webkitFeatureCreate):
(webkitFeatureGetFeature):
(webkit_feature_ref):
(webkit_feature_unref):
(webkit_feature_get_identifier):
(webkit_feature_get_name):
(webkit_feature_get_details):
(webkit_feature_get_status):
(webkit_feature_get_category):
(webkit_feature_get_default_value):
(_WebKitFeatureList::_WebKitFeatureList):
(_WebKitFeatureList::~_WebKitFeatureList):
(webkitFeatureListCreate):
(webkit_feature_list_ref):
(webkit_feature_list_unref):
(webkit_feature_list_get_length):
(webkit_feature_list_get):
* Source/WebKit/UIProcess/API/glib/WebKitFeature.h.in: Added.
* Source/WebKit/UIProcess/API/glib/WebKitFeaturePrivate.h: Added.
* Source/WebKit/UIProcess/API/glib/WebKitSettings.cpp:
(webkit_settings_set_feature_enabled):
(webkit_settings_get_feature_enabled):
(webkit_settings_get_all_features):
(webkit_settings_get_experimental_features):
(webkit_settings_get_development_features):
* Source/WebKit/UIProcess/API/glib/WebKitSettings.h.in:
* Source/WebKit/UIProcess/API/glib/webkit.h.in:
* Tools/MiniBrowser/gtk/BrowserSettingsDialog.c:
(featureTreeViewRowActivated):
(cellRendererToggled):
(featureTreeViewRenderEnabledData):
(featureTreeViewRenderStatusData):
(featureTreeViewRenderCategoryData):
(featureTreeViewSearchMatchSubstring):
(createFeatureTreeView):
(settingsTreeViewSearchMatchSubstring):
(browser_settings_dialog_init):
(browserSettingsDialogConstructed):
(browser_settings_dialog_new):
* Tools/MiniBrowser/gtk/main.c:
(findFeature):
(parseFeaturesOptionCallback):
(addSettingsGroupToContext):
* Tools/MiniBrowser/wpe/main.cpp:
(findFeature):
(activate):
(main):
* Tools/Scripts/webkitpy/style/checker.py:
* Tools/TestWebKitAPI/Tests/WebKitGLib/TestWebKitSettings.cpp:
(testWebKitFeatures):
(beforeAll):
Canonical link: https://commits.webkit.org/263331@main
More information about the webkit-changes
mailing list