[webkit-changes] [WebKit/WebKit] 4663bc: Generate web preferences using feature status taxo...

Elliott Williams noreply at github.com
Tue Jan 3 17:56:33 PST 2023


  Branch: refs/heads/main
  Home:   https://github.com/WebKit/WebKit
  Commit: 4663bc861b1e2ece8476a5c8708b4825cf4b03a9
      https://github.com/WebKit/WebKit/commit/4663bc861b1e2ece8476a5c8708b4825cf4b03a9
  Author: Elliott Williams <emw at apple.com>
  Date:   2023-01-03 (Tue, 03 Jan 2023)

  Changed paths:
    M LayoutTests/css-custom-properties-api/initialValue.html
    M LayoutTests/fast/css-custom-paint/properties.html
    M LayoutTests/fast/css/css-typed-om/style-property-map-set-CSSMathSum-value.html
    M LayoutTests/fast/images/text-recognition/mac/image-overlay-text-disables-app-highlight-menu-items.html
    M LayoutTests/fast/text/text-edge-with-margin-padding-border-simple.html
    M LayoutTests/highlight/highlight-world-leak.html
    M LayoutTests/http/tests/clear-site-data/bfcache.html
    M LayoutTests/http/tests/misc/favicon-loads-with-images-disabled.html
    M LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/mime-types/canPlayType-expected.txt
    M LayoutTests/imported/w3c/web-platform-tests/media-capabilities/decodingInfo.webrtc.html
    M LayoutTests/imported/w3c/web-platform-tests/media-capabilities/encodingInfo.webrtc.html
    M LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-immediately-during-extendable-events.https.html
    M LayoutTests/media/vp9.html
    M LayoutTests/platform/gtk/fast/dom/navigator-detached-no-crash-expected.txt
    M LayoutTests/platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt
    M LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt
    M LayoutTests/webgl/webgl-draft-extensions-flag-default.html
    M LayoutTests/webrtc/video-av1.html
    M LayoutTests/webrtc/vp9-vtb.html
    M Source/WTF/Scripts/GeneratePreferences.rb
    A Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml
    R Source/WTF/Scripts/Preferences/WebPreferences.yaml
    R Source/WTF/Scripts/Preferences/WebPreferencesDebug.yaml
    R Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml
    R Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml
    M Source/WTF/WTF.xcodeproj/project.pbxproj
    M Source/WTF/wtf/CMakeLists.txt
    M Source/WebCore/CMakeLists.txt
    M Source/WebCore/DerivedSources-input.xcfilelist
    M Source/WebCore/DerivedSources.make
    M Source/WebCore/Scripts/GenerateSettings.rb
    M Source/WebCore/Scripts/SettingsTemplates/Settings.cpp.erb
    M Source/WebCore/WebCore.xcodeproj/project.pbxproj
    M Source/WebCore/WebCoreMacros.cmake
    M Source/WebCore/page/Settings.yaml
    M Source/WebKit/CMakeLists.txt
    M Source/WebKit/DerivedSources-input.xcfilelist
    M Source/WebKit/DerivedSources.make
    M Source/WebKit/Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb
    M Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb
    M Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb
    M Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesGetterSetters.cpp.erb
    M Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb
    M Source/WebKit/UIProcess/API/C/WKPreferences.cpp
    M Source/WebKit/UIProcess/Cocoa/WebPreferencesCocoa.mm
    M Source/WebKit/UIProcess/WebPreferences.cpp
    M Source/WebKit/UIProcess/WebPreferences.h
    M Source/WebKitLegacy/PlatformMac.cmake
    M Source/WebKitLegacy/PlatformWin.cmake
    M Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj
    M Source/WebKitLegacy/mac/Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb
    M Source/WebKitLegacy/mac/Scripts/PreferencesTemplates/WebPreferencesInternalFeatures.mm.erb
    M Source/WebKitLegacy/mac/Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb
    M Source/WebKitLegacy/mac/Scripts/generate-preferences.sh
    M Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.h
    M Tools/DumpRenderTree/CMakeLists.txt
    M Tools/DumpRenderTree/DerivedSources-input.xcfilelist
    M Tools/DumpRenderTree/DerivedSources.make
    M Tools/DumpRenderTree/mac/DumpRenderTree.mm
    M Tools/TestWebKitAPI/Tests/WebKit/GetUserMedia.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm
    M Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm
    M Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm
    M Tools/WebKitTestRunner/CMakeLists.txt
    M Tools/WebKitTestRunner/DerivedSources-input.xcfilelist
    M Tools/WebKitTestRunner/DerivedSources.make

  Log Message:
  -----------
  Generate web preferences using feature status taxonomy
https://bugs.webkit.org/show_bug.cgi?id=247926
rdar://92112770

Reviewed by Brent Fulgham.

Merge WebPreferences*.yaml into UnifiedWebPreferences.yaml. Insteading
of using different preference files to distinguish between experimental
features, internal features, and debug preferences, each preference has
a `status` field that determines where it ends up. The status field was
introduced as WebKit::API::FeatureStatus in
https://commits.webkit.org/257166@main, and current statuses were
generated by surveying Safari/WebKit contributors at Apple.

Feature status determines whether a preference is ephemeral, or backed
by persistent storage. It currently determines which of the preexisting
experimental / internal debug API declarations a preference appears in.

Future work will expose a new interface for clients to see *all* exposed
features, grouping them by status, and will replace the preexisting
ExperimentalFeatures/InternalDebugFeatures listings with views onto the
main list.

* Source/WTF/Scripts/GeneratePreferences.rb:
  - Remove the base/debug/experimental/internal distinctions, and just
    parse an arbitrary list of preference files.
  - Parse feature statuses, and add methods for preference templates to
    query them.
  - Add support for automatically static_casting enum preferences to
    their unrefined type. It's still not possible for a UI-visible
    feature to be anything other than a boolean toggle, which limits the
    features that can be marked as "internal", "developer", "testable",
    "preview", and "stable".
  - Small quality of life changes, such as the ability to output _all_
    the parse errors in a single run of the generator script.

* Source/WTF/Scripts/Preferences/WebPreferences.yaml: Removed.
* Source/WTF/Scripts/Preferences/WebPreferencesDebug.yaml: Removed.
* Source/WTF/Scripts/Preferences/WebPreferencesExperimental.yaml: Removed.
* Source/WTF/Scripts/Preferences/WebPreferencesInternal.yaml: Removed.
* Source/WTF/Scripts/Preferences/UnifiedWebPreferences.yaml: Added. Make
  some fixes and status changes to the initial version of this file
  generated from the survey. The main categories of fixes are:
  - Any preference which can be exposed in UI (including "internal"
    features) needs a human-readable name.
  - Any preference exposed beyond WebCore needs defaults values for
    WebKit and WebKitLegacy.
  - Preferences with "custom" bindings that were merely static_casts now
    use the automatic static_cast support provided by the generator
    script.
  - Non-boolean preferences can't be exposed as an "experimental" or
    "internal debug" feature yet. For now, these are reclassified as
    "embedder" preferences.
  As a test fixup: Service workers are not implemented for WebKitLegacy,
  and ServiceWorkersEnabled's new status of "developer" was causing the
  setting to be errantly turned on in DumpRenderTree. There's no reason
  for this flag to be exposed at all in WKL, so hide it.

* Source/WTF/WTF.xcodeproj/project.pbxproj: Update file references.
* Source/WTF/wtf/CMakeLists.txt: Update file references.

* Source/WebCore/CMakeLists.txt: Update GenerateSettings.rb invocation.
  Inline the settings macro since this is the only place we use it.
* Source/WebCore/DerivedSources-input.xcfilelist: Update file
  references.
* Source/WebCore/DerivedSources.make: Update file references and
  GenerateSettings.rb invocation.
* Source/WebCore/Scripts/GenerateSettings.rb: Update to consume the
  unified preferences file. The WebCore-only Settings.yaml still hosts
  non-feature settings. These don't need a status assigned to them;
  WebCore::Settings doesn't use the feature status field and these are
  never exposed in API (if they were, we'd probably consider them all
  "embedder settings").
* Source/WebCore/WebCoreMacros.cmake: Remove settings macro, no longer
  used.
* Source/WebCore/WebCore.xcodeproj/project.pbxproj: Update file
  references.

* Source/WebKit/CMakeLists.txt: Update GenerateSettings.rb invocation.
* Source/WebKit/DerivedSources-input.xcfilelist: Update file references.
* Source/WebKit/DerivedSources.make: Update file references and
  GenerateSettings.rb invocation.

* Source/WebKit/Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb:
  Automatic static_casting.
* Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
  Replace "Internal Debug" and "Experimental" classifications with
  status-based categories.
* Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.cpp.erb:
  Use statuses to determine what constitutes an "experimental feature".
* Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesGetterSetters.cpp.erb:
  Enumerate the entire list of exposed preferences. Instead of calling
  special updateBoolValueForFeatureKey functions for experimental or
  internal-debug features, pass an "ephemeral?" flag into the main
  updateValueForKey which determines whether the update should be
  persisted into user defaults.
* Source/WebKit/Scripts/PreferencesTemplates/WebPreferencesInternalDebugFeatures.cpp.erb:
  Use statuses to determine what constitutes an "internal debug" feature.

* Source/WebKit/UIProcess/API/C/WKPreferences.cpp: Pass an "ephemeral"
  flag to set*ValueforKey. To match existing behavior, layout testing
  overrides are set as non-ephemeral. They don't actually cause user
  defaults writes, because the WebPreferences instance used by layout
  tests is non-persistent (doesn't have an identifier).
(WKPreferencesSetBoolValueForKeyForTesting):
(WKPreferencesSetDoubleValueForKeyForTesting):
(WKPreferencesSetUInt32ValueForKeyForTesting):
(WKPreferencesSetStringValueForKeyForTesting):

* Source/WebKit/UIProcess/Cocoa/WebPreferencesCocoa.mm:
(WebKit::WebPreferences::platformInitializeStore): Adopt new
  macro names.
(WebKit::setDebugUInt32ValueIfInUserDefaults): Deleted because no
  persisted preferences use uint32_t values.

* Source/WebKit/UIProcess/WebPreferences.cpp: Instead of calling
  special updateBoolValueForFeatureKey functions for experimental or
  internal-debug features, update the main
  set/updateValueForKey methods to take an "ephemeral?" flag which
  determines whether the update should be persisted into user defaults.
(WebKit::WebPreferences::setBoolValueForKey):
(WebKit::WebPreferences::setDoubleValueForKey):
(WebKit::WebPreferences::setUInt32ValueForKey):
(WebKit::WebPreferences::setStringValueForKey):
(WebKit::WebPreferences::updateStringValueForKey):
(WebKit::WebPreferences::updateBoolValueForKey):
(WebKit::WebPreferences::updateUInt32ValueForKey):
(WebKit::WebPreferences::updateDoubleValueForKey):
(WebKit::WebPreferences::updateFloatValueForKey):
(WebKit::WebPreferences::updateBoolValueForInternalDebugFeatureKey): Deleted.
(WebKit::WebPreferences::updateBoolValueForExperimentalFeatureKey): Deleted.
* Source/WebKit/UIProcess/WebPreferences.h: Ditto above changes.

* Source/WebKitLegacy/WebKitLegacy.xcodeproj/project.pbxproj: Update
  file references.
* Source/WebKitLegacy/PlatformMac.cmake: Update GeneratePreferences.rb
  invocation.
* Source/WebKitLegacy/PlatformWin.cmake: Ditto.
* Source/WebKitLegacy/mac/Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb:
  Use statuses.
* Source/WebKitLegacy/mac/Scripts/PreferencesTemplates/WebPreferencesInternalFeatures.mm.erb:
  Use statuses.
* Source/WebKitLegacy/mac/Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb:
  Support automatic static_casting.
* Source/WebKitLegacy/mac/Scripts/generate-preferences.sh: Update
  GeneratePreferences.rb invocation.
* Source/WebKitLegacy/mac/WebView/WebPreferencesDefaultValues.h: Add
  include statement needed for static_casting.

In TestWebKitAPI, many API tests set features by searching
+[WKPreferences _experimentalFeatures] and +[WKPreferences
_internalDebugFeatures] for a matching key. This is frustratingly
brittle, and because many features are being removed from the
"experimental" UI, these search sites must be updated.

* Tools/TestWebKitAPI/Tests/WebKit/GetUserMedia.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/ProcessSwapOnNavigation.mm:
* Tools/TestWebKitAPI/Tests/WebKitCocoa/SiteIsolation.mm:
(TestWebKitAPI::TEST):
* Tools/TestWebKitAPI/Tests/WebKitCocoa/WebPushDaemon.mm:
* Tools/TestWebKitAPI/Tests/ios/DragAndDropTestsIOS.mm:
(TestWebKitAPI::TEST):

* Tools/DumpRenderTree/DerivedSources-input.xcfilelist: Update file
  references.
* Tools/DumpRenderTree/DerivedSources.make: Update
  GeneratePreferences.rb invocation.
* Tools/WebKitTestRunner/DerivedSources-input.xcfilelist: Ditto.
* Tools/WebKitTestRunner/DerivedSources.make: Ditto.

Update some layout test baselines, and modify some tests to enable a
feature flag that they depend on which was previously in Experimental
Features (and therefore on by default). Going forward, features in the
"testable" status or one of the developer-facing statuses ("developer",
"preview", "stable") are enabled during layout testing.

* LayoutTests/css-custom-properties-api/initialValue.html:
* LayoutTests/fast/css-custom-paint/properties.html:
* LayoutTests/fast/css/css-typed-om/style-property-map-set-CSSMathSum-value.html:
* LayoutTests/fast/images/text-recognition/mac/image-overlay-text-disables-app-highlight-menu-items.html:
* LayoutTests/fast/text/text-edge-with-margin-padding-border-simple.html:
* LayoutTests/highlight/highlight-world-leak.html:
* LayoutTests/http/tests/clear-site-data/bfcache.html:
* LayoutTests/http/tests/misc/favicon-loads-with-images-disabled.html:
* LayoutTests/imported/w3c/web-platform-tests/html/semantics/embedded-content/media-elements/mime-types/canPlayType-expected.txt:
* LayoutTests/imported/w3c/web-platform-tests/media-capabilities/decodingInfo.webrtc.html:
* LayoutTests/imported/w3c/web-platform-tests/media-capabilities/encodingInfo.webrtc.html:
* LayoutTests/imported/w3c/web-platform-tests/service-workers/service-worker/unregister-immediately-during-extendable-events.https.html:
* LayoutTests/media/vp9.html:
* LayoutTests/platform/gtk/fast/dom/navigator-detached-no-crash-expected.txt:
* LayoutTests/platform/mac-wk1/fast/dom/navigator-detached-no-crash-expected.txt:
* LayoutTests/platform/mac-wk2/fast/dom/navigator-detached-no-crash-expected.txt:
* LayoutTests/webgl/webgl-draft-extensions-flag-default.html:
* LayoutTests/webrtc/video-av1.html:
* LayoutTests/webrtc/vp9-vtb.html:

Canonical link: https://commits.webkit.org/258413@main




More information about the webkit-changes mailing list