[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
#
|
|
|
|
# Copyright (c) 2017, 2020 Apple Inc. All rights reserved.
|
|
|
|
#
|
|
|
|
# Redistribution and use in source and binary forms, with or without
|
|
|
|
# modification, are permitted provided that the following conditions
|
|
|
|
# are met:
|
|
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer.
|
|
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
|
|
# documentation and/or other materials provided with the distribution.
|
|
|
|
#
|
|
|
|
# THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
|
|
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
|
|
|
|
# THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
# PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
|
|
|
|
# BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
|
|
|
|
# THE POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
|
|
|
|
require "fileutils"
|
|
|
|
require 'erb'
|
|
|
|
require 'optparse'
|
|
|
|
require 'yaml'
|
|
|
|
|
|
|
|
options = {
|
[Preferences] It should be possible to have different default values for WebKitLegacy and WebKit in preference yaml files
https://bugs.webkit.org/show_bug.cgi?id=216987
Reviewed by Darin Adler.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Update script phase to explicitly specify the frontend (WebKitLegacy) and the templates to generate.
Source/WebKitLegacy/mac:
Add new syntax for default values that allows specializing based on both frontend (WebKit or
WebKitLegacy) and then futher based on platform macros. For example, the preference for
CSSTypedOMEnabled now looks like:
CSSTypedOMEnabled:
type: bool
humanReadableName: "CSS Typed OM"
humanReadableDescription: "Enable the CSS Typed OM"
webcoreBinding: RuntimeEnabledFeatures
condition: ENABLE(CSS_TYPED_OM)
defaultValue:
WebKitLegacy:
default: false
WebKit:
"ENABLE(EXPERIMENTAL_FEATURES) && (PLATFORM(GTK) || PLATFORM(WPE))": true
default: false
Which means that in WebKitLegacy, the default value is false, and in WebKit, the default
value will be:
#if ENABLE(EXPERIMENTAL_FEATURES) && (PLATFORM(GTK) || PLATFORM(WPE))
true
#else
false
#endif
As many platform macro based conditions can be provided as wanted, and they are evaluated
in the order specified in the file.
The syntax currently always requires explicitly specifying WebKitLegacy and WebKit and default
for each, even if they are all the same, but could be extended in the future to allow compaction
if that becomes desirable. There is also not yet support for conditionally enabling a feature
based on os-feature-flags or linked-on-or-after checks, so those still require specifying the
default value as a function, but that seems like a nice future improvement.
As this is still staging for doing this for both WebKitLegacy and WebKit, this change only effects
WebKitLegacy for now, and subsequent changes will move this to a shared location.
* Scripts/GeneratePreferences.rb:
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb:
* WebView/WebPreferencesExperimental.yaml:
Canonical link: https://commits.webkit.org/229795@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267623 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-26 16:34:32 +00:00
|
|
|
:frontend => nil,
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
:basePreferences => nil,
|
|
|
|
:debugPreferences => nil,
|
|
|
|
:experimentalPreferences => nil,
|
|
|
|
:internalPreferences => nil,
|
[Preferences] It should be possible to have different default values for WebKitLegacy and WebKit in preference yaml files
https://bugs.webkit.org/show_bug.cgi?id=216987
Reviewed by Darin Adler.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Update script phase to explicitly specify the frontend (WebKitLegacy) and the templates to generate.
Source/WebKitLegacy/mac:
Add new syntax for default values that allows specializing based on both frontend (WebKit or
WebKitLegacy) and then futher based on platform macros. For example, the preference for
CSSTypedOMEnabled now looks like:
CSSTypedOMEnabled:
type: bool
humanReadableName: "CSS Typed OM"
humanReadableDescription: "Enable the CSS Typed OM"
webcoreBinding: RuntimeEnabledFeatures
condition: ENABLE(CSS_TYPED_OM)
defaultValue:
WebKitLegacy:
default: false
WebKit:
"ENABLE(EXPERIMENTAL_FEATURES) && (PLATFORM(GTK) || PLATFORM(WPE))": true
default: false
Which means that in WebKitLegacy, the default value is false, and in WebKit, the default
value will be:
#if ENABLE(EXPERIMENTAL_FEATURES) && (PLATFORM(GTK) || PLATFORM(WPE))
true
#else
false
#endif
As many platform macro based conditions can be provided as wanted, and they are evaluated
in the order specified in the file.
The syntax currently always requires explicitly specifying WebKitLegacy and WebKit and default
for each, even if they are all the same, but could be extended in the future to allow compaction
if that becomes desirable. There is also not yet support for conditionally enabling a feature
based on os-feature-flags or linked-on-or-after checks, so those still require specifying the
default value as a function, but that seems like a nice future improvement.
As this is still staging for doing this for both WebKitLegacy and WebKit, this change only effects
WebKitLegacy for now, and subsequent changes will move this to a shared location.
* Scripts/GeneratePreferences.rb:
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb:
* WebView/WebPreferencesExperimental.yaml:
Canonical link: https://commits.webkit.org/229795@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267623 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-26 16:34:32 +00:00
|
|
|
:outputDirectory => nil,
|
|
|
|
:templates => []
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
}
|
|
|
|
optparse = OptionParser.new do |opts|
|
2020-10-20 09:27:37 +00:00
|
|
|
opts.banner = "Usage: #{File.basename($0)} --frontend <frontend> --base <base> --debug <debug> --experimental <experimental> --internal <internal> --template file"
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
|
[Preferences] It should be possible to have different default values for WebKitLegacy and WebKit in preference yaml files
https://bugs.webkit.org/show_bug.cgi?id=216987
Reviewed by Darin Adler.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Update script phase to explicitly specify the frontend (WebKitLegacy) and the templates to generate.
Source/WebKitLegacy/mac:
Add new syntax for default values that allows specializing based on both frontend (WebKit or
WebKitLegacy) and then futher based on platform macros. For example, the preference for
CSSTypedOMEnabled now looks like:
CSSTypedOMEnabled:
type: bool
humanReadableName: "CSS Typed OM"
humanReadableDescription: "Enable the CSS Typed OM"
webcoreBinding: RuntimeEnabledFeatures
condition: ENABLE(CSS_TYPED_OM)
defaultValue:
WebKitLegacy:
default: false
WebKit:
"ENABLE(EXPERIMENTAL_FEATURES) && (PLATFORM(GTK) || PLATFORM(WPE))": true
default: false
Which means that in WebKitLegacy, the default value is false, and in WebKit, the default
value will be:
#if ENABLE(EXPERIMENTAL_FEATURES) && (PLATFORM(GTK) || PLATFORM(WPE))
true
#else
false
#endif
As many platform macro based conditions can be provided as wanted, and they are evaluated
in the order specified in the file.
The syntax currently always requires explicitly specifying WebKitLegacy and WebKit and default
for each, even if they are all the same, but could be extended in the future to allow compaction
if that becomes desirable. There is also not yet support for conditionally enabling a feature
based on os-feature-flags or linked-on-or-after checks, so those still require specifying the
default value as a function, but that seems like a nice future improvement.
As this is still staging for doing this for both WebKitLegacy and WebKit, this change only effects
WebKitLegacy for now, and subsequent changes will move this to a shared location.
* Scripts/GeneratePreferences.rb:
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb:
* WebView/WebPreferencesExperimental.yaml:
Canonical link: https://commits.webkit.org/229795@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267623 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-26 16:34:32 +00:00
|
|
|
opts.separator ""
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
|
[Preferences] It should be possible to have different default values for WebKitLegacy and WebKit in preference yaml files
https://bugs.webkit.org/show_bug.cgi?id=216987
Reviewed by Darin Adler.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Update script phase to explicitly specify the frontend (WebKitLegacy) and the templates to generate.
Source/WebKitLegacy/mac:
Add new syntax for default values that allows specializing based on both frontend (WebKit or
WebKitLegacy) and then futher based on platform macros. For example, the preference for
CSSTypedOMEnabled now looks like:
CSSTypedOMEnabled:
type: bool
humanReadableName: "CSS Typed OM"
humanReadableDescription: "Enable the CSS Typed OM"
webcoreBinding: RuntimeEnabledFeatures
condition: ENABLE(CSS_TYPED_OM)
defaultValue:
WebKitLegacy:
default: false
WebKit:
"ENABLE(EXPERIMENTAL_FEATURES) && (PLATFORM(GTK) || PLATFORM(WPE))": true
default: false
Which means that in WebKitLegacy, the default value is false, and in WebKit, the default
value will be:
#if ENABLE(EXPERIMENTAL_FEATURES) && (PLATFORM(GTK) || PLATFORM(WPE))
true
#else
false
#endif
As many platform macro based conditions can be provided as wanted, and they are evaluated
in the order specified in the file.
The syntax currently always requires explicitly specifying WebKitLegacy and WebKit and default
for each, even if they are all the same, but could be extended in the future to allow compaction
if that becomes desirable. There is also not yet support for conditionally enabling a feature
based on os-feature-flags or linked-on-or-after checks, so those still require specifying the
default value as a function, but that seems like a nice future improvement.
As this is still staging for doing this for both WebKitLegacy and WebKit, this change only effects
WebKitLegacy for now, and subsequent changes will move this to a shared location.
* Scripts/GeneratePreferences.rb:
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb:
* WebView/WebPreferencesExperimental.yaml:
Canonical link: https://commits.webkit.org/229795@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267623 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-26 16:34:32 +00:00
|
|
|
opts.on("--frontend input", "frontend to generate preferences for (WebKit, WebKitLegacy)") { |frontend| options[:frontend] = frontend }
|
|
|
|
opts.on("--base input", "file to generate preferences from") { |basePreferences| options[:basePreferences] = basePreferences }
|
|
|
|
opts.on("--debug input", "file to generate debug preferences from") { |debugPreferences| options[:debugPreferences] = debugPreferences }
|
|
|
|
opts.on("--experimental input", "file to generate experimental preferences from") { |experimentalPreferences| options[:experimentalPreferences] = experimentalPreferences }
|
|
|
|
opts.on("--internal input", "file to generate internal preferences from") { |internalPreferences| options[:internalPreferences] = internalPreferences }
|
2020-09-28 20:26:13 +00:00
|
|
|
opts.on("--template input", "template to use for generation (may be specified multiple times)") { |template| options[:templates] << template }
|
|
|
|
opts.on("--outputDir output", "directory to generate file in") { |outputDir| options[:outputDirectory] = outputDir }
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
optparse.parse!
|
|
|
|
|
2020-09-30 01:29:42 +00:00
|
|
|
if !options[:frontend] || !options[:basePreferences] || !options[:debugPreferences] || !options[:experimentalPreferences] || !options[:internalPreferences]
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
puts optparse
|
|
|
|
exit -1
|
|
|
|
end
|
|
|
|
|
|
|
|
if !options[:outputDirectory]
|
|
|
|
options[:outputDirectory] = Dir.getwd
|
|
|
|
end
|
|
|
|
|
|
|
|
FileUtils.mkdir_p(options[:outputDirectory])
|
|
|
|
|
2020-09-27 00:21:02 +00:00
|
|
|
def load(path)
|
|
|
|
parsed = begin
|
|
|
|
YAML.load_file(path)
|
|
|
|
rescue ArgumentError => e
|
|
|
|
puts "ERROR: Could not parse input file: #{e.message}"
|
|
|
|
exit(-1)
|
|
|
|
end
|
|
|
|
if parsed
|
|
|
|
previousName = nil
|
|
|
|
parsed.keys.each do |name|
|
|
|
|
if previousName != nil and previousName > name
|
|
|
|
puts "ERROR: Input file #{path} is not sorted. First out of order name found is '#{name}'."
|
|
|
|
exit(-1)
|
|
|
|
end
|
|
|
|
previousName = name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
parsed
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
end
|
|
|
|
|
2020-09-27 00:21:02 +00:00
|
|
|
parsedBasePreferences = load(options[:basePreferences])
|
|
|
|
parsedDebugPreferences = load(options[:debugPreferences])
|
|
|
|
parsedExperimentalPreferences = load(options[:experimentalPreferences])
|
|
|
|
parsedInternalPreferences = load(options[:internalPreferences])
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
|
|
|
|
|
|
|
|
class Preference
|
|
|
|
attr_accessor :name
|
[Preferences] Generate base preferences for WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=217042
Reviewed by Tim Horton.
Imports (and sorts) WebPreferences.yaml from WebKit, and starts generation for
for WebKitLegacy. To support this, a few tweaks to generation were required:
- A new 'exposed' key was added to the configuration files which allows restricting
which frontends a preference is exposed to. By default, preferences are exposed to
all frontends. This is intended to be used for preferences that don't have a binding
to WebCore (e.g. process model related preferences for Webkit). We will require a
seperate concept for features that WebCore knows about, but are not supported by
a frontend, but that will be added in future revisions.
'exposed' is used in a few places that have 'custom' bindings to WebCore where
WebKitLegacy and WebKit don't use the same type or meaning for a preference, such
as WebKitLegacy's FrameFlattening enum vs. WebKit's FrameFlatteningEnabled bool,
or WebKitLegacy's WebSQLEnabled vs. WebKit's WebSQLDisabled. Eventually, it would
be nice to make these match, but it is not required.
- A new 'webKitLegacyPreferenceKey' key was added to the configuration files allowing
for existing keys that don't match the default pattern of "WebKit" + keyName. This is
to avoid changing the value of the preference key strings in WebPreferenceKeysPrivate.h,
as I am not confident that changing them is kosher. I also went back and reverted the
few I had already changed, just to be on the safe side.
- Support was added in WebViewPreferencesChangedGenerated.mm.erb for non bool values.
- Preferences that are conditionally compiled out (using the conditional key) no longer
generate a default when they are compiled out, which required a little macro magic
in WebPreferencesDefinitions.h.erb in the form of the new INITIALIZE_DEFAULT_PREFERENCES_FOR_
macros.
* Scripts/GeneratePreferences.rb:
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb:
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
* WebView/WebPreferences.yaml:
* WebView/WebPreferencesDebug.yaml:
* WebView/WebPreferencesDefaultValues.h:
* WebView/WebPreferencesDefaultValues.mm:
(WebKit::defaultAllowsInlineMediaPlayback):
(WebKit::defaultAllowsInlineMediaPlaybackAfterFullscreen):
(WebKit::defaultAllowsPictureInPictureMediaPlayback):
(WebKit::defaultJavaScriptCanOpenWindowsAutomatically):
(WebKit::defaultInlineMediaPlaybackRequiresPlaysInlineAttribute):
(WebKit::defaultPassiveTouchListenersAsDefaultOnDocument):
(WebKit::defaultRequiresUserGestureToLoadVideo):
(WebKit::defaultWebSQLEnabled):
(WebKit::defaultAttachmentElementEnabled):
(WebKit::defaultShouldRestrictBaseURLSchemes):
* WebView/WebPreferencesExperimental.yaml:
* WebView/WebPreferencesInternal.h:
* WebView/WebPreferencesInternal.yaml:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _preferencesChanged:]):
(shouldAllowPictureInPictureMediaPlayback): Deleted.
(shouldAllowWindowOpenWithoutUserGesture): Deleted.
(shouldRequireUserGestureToLoadVideo): Deleted.
(shouldRestrictBaseURLSchemes): Deleted.
* WebView/WebViewData.h:
Canonical link: https://commits.webkit.org/229829@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267689 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-28 01:42:22 +00:00
|
|
|
attr_accessor :opts
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
attr_accessor :type
|
|
|
|
attr_accessor :humanReadableName
|
|
|
|
attr_accessor :humanReadableDescription
|
|
|
|
attr_accessor :webcoreBinding
|
|
|
|
attr_accessor :condition
|
|
|
|
attr_accessor :hidden
|
[Preferences] Generate base preferences for WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=217042
Reviewed by Tim Horton.
Imports (and sorts) WebPreferences.yaml from WebKit, and starts generation for
for WebKitLegacy. To support this, a few tweaks to generation were required:
- A new 'exposed' key was added to the configuration files which allows restricting
which frontends a preference is exposed to. By default, preferences are exposed to
all frontends. This is intended to be used for preferences that don't have a binding
to WebCore (e.g. process model related preferences for Webkit). We will require a
seperate concept for features that WebCore knows about, but are not supported by
a frontend, but that will be added in future revisions.
'exposed' is used in a few places that have 'custom' bindings to WebCore where
WebKitLegacy and WebKit don't use the same type or meaning for a preference, such
as WebKitLegacy's FrameFlattening enum vs. WebKit's FrameFlatteningEnabled bool,
or WebKitLegacy's WebSQLEnabled vs. WebKit's WebSQLDisabled. Eventually, it would
be nice to make these match, but it is not required.
- A new 'webKitLegacyPreferenceKey' key was added to the configuration files allowing
for existing keys that don't match the default pattern of "WebKit" + keyName. This is
to avoid changing the value of the preference key strings in WebPreferenceKeysPrivate.h,
as I am not confident that changing them is kosher. I also went back and reverted the
few I had already changed, just to be on the safe side.
- Support was added in WebViewPreferencesChangedGenerated.mm.erb for non bool values.
- Preferences that are conditionally compiled out (using the conditional key) no longer
generate a default when they are compiled out, which required a little macro magic
in WebPreferencesDefinitions.h.erb in the form of the new INITIALIZE_DEFAULT_PREFERENCES_FOR_
macros.
* Scripts/GeneratePreferences.rb:
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb:
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
* WebView/WebPreferences.yaml:
* WebView/WebPreferencesDebug.yaml:
* WebView/WebPreferencesDefaultValues.h:
* WebView/WebPreferencesDefaultValues.mm:
(WebKit::defaultAllowsInlineMediaPlayback):
(WebKit::defaultAllowsInlineMediaPlaybackAfterFullscreen):
(WebKit::defaultAllowsPictureInPictureMediaPlayback):
(WebKit::defaultJavaScriptCanOpenWindowsAutomatically):
(WebKit::defaultInlineMediaPlaybackRequiresPlaysInlineAttribute):
(WebKit::defaultPassiveTouchListenersAsDefaultOnDocument):
(WebKit::defaultRequiresUserGestureToLoadVideo):
(WebKit::defaultWebSQLEnabled):
(WebKit::defaultAttachmentElementEnabled):
(WebKit::defaultShouldRestrictBaseURLSchemes):
* WebView/WebPreferencesExperimental.yaml:
* WebView/WebPreferencesInternal.h:
* WebView/WebPreferencesInternal.yaml:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _preferencesChanged:]):
(shouldAllowPictureInPictureMediaPlayback): Deleted.
(shouldAllowWindowOpenWithoutUserGesture): Deleted.
(shouldRequireUserGestureToLoadVideo): Deleted.
(shouldRestrictBaseURLSchemes): Deleted.
* WebView/WebViewData.h:
Canonical link: https://commits.webkit.org/229829@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267689 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-28 01:42:22 +00:00
|
|
|
attr_accessor :defaultValues
|
2020-10-20 09:27:37 +00:00
|
|
|
attr_accessor :exposed
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
|
[Preferences] It should be possible to have different default values for WebKitLegacy and WebKit in preference yaml files
https://bugs.webkit.org/show_bug.cgi?id=216987
Reviewed by Darin Adler.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Update script phase to explicitly specify the frontend (WebKitLegacy) and the templates to generate.
Source/WebKitLegacy/mac:
Add new syntax for default values that allows specializing based on both frontend (WebKit or
WebKitLegacy) and then futher based on platform macros. For example, the preference for
CSSTypedOMEnabled now looks like:
CSSTypedOMEnabled:
type: bool
humanReadableName: "CSS Typed OM"
humanReadableDescription: "Enable the CSS Typed OM"
webcoreBinding: RuntimeEnabledFeatures
condition: ENABLE(CSS_TYPED_OM)
defaultValue:
WebKitLegacy:
default: false
WebKit:
"ENABLE(EXPERIMENTAL_FEATURES) && (PLATFORM(GTK) || PLATFORM(WPE))": true
default: false
Which means that in WebKitLegacy, the default value is false, and in WebKit, the default
value will be:
#if ENABLE(EXPERIMENTAL_FEATURES) && (PLATFORM(GTK) || PLATFORM(WPE))
true
#else
false
#endif
As many platform macro based conditions can be provided as wanted, and they are evaluated
in the order specified in the file.
The syntax currently always requires explicitly specifying WebKitLegacy and WebKit and default
for each, even if they are all the same, but could be extended in the future to allow compaction
if that becomes desirable. There is also not yet support for conditionally enabling a feature
based on os-feature-flags or linked-on-or-after checks, so those still require specifying the
default value as a function, but that seems like a nice future improvement.
As this is still staging for doing this for both WebKitLegacy and WebKit, this change only effects
WebKitLegacy for now, and subsequent changes will move this to a shared location.
* Scripts/GeneratePreferences.rb:
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb:
* WebView/WebPreferencesExperimental.yaml:
Canonical link: https://commits.webkit.org/229795@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267623 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-26 16:34:32 +00:00
|
|
|
def initialize(name, opts, frontend)
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
@name = name
|
[Preferences] Generate base preferences for WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=217042
Reviewed by Tim Horton.
Imports (and sorts) WebPreferences.yaml from WebKit, and starts generation for
for WebKitLegacy. To support this, a few tweaks to generation were required:
- A new 'exposed' key was added to the configuration files which allows restricting
which frontends a preference is exposed to. By default, preferences are exposed to
all frontends. This is intended to be used for preferences that don't have a binding
to WebCore (e.g. process model related preferences for Webkit). We will require a
seperate concept for features that WebCore knows about, but are not supported by
a frontend, but that will be added in future revisions.
'exposed' is used in a few places that have 'custom' bindings to WebCore where
WebKitLegacy and WebKit don't use the same type or meaning for a preference, such
as WebKitLegacy's FrameFlattening enum vs. WebKit's FrameFlatteningEnabled bool,
or WebKitLegacy's WebSQLEnabled vs. WebKit's WebSQLDisabled. Eventually, it would
be nice to make these match, but it is not required.
- A new 'webKitLegacyPreferenceKey' key was added to the configuration files allowing
for existing keys that don't match the default pattern of "WebKit" + keyName. This is
to avoid changing the value of the preference key strings in WebPreferenceKeysPrivate.h,
as I am not confident that changing them is kosher. I also went back and reverted the
few I had already changed, just to be on the safe side.
- Support was added in WebViewPreferencesChangedGenerated.mm.erb for non bool values.
- Preferences that are conditionally compiled out (using the conditional key) no longer
generate a default when they are compiled out, which required a little macro magic
in WebPreferencesDefinitions.h.erb in the form of the new INITIALIZE_DEFAULT_PREFERENCES_FOR_
macros.
* Scripts/GeneratePreferences.rb:
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb:
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
* WebView/WebPreferences.yaml:
* WebView/WebPreferencesDebug.yaml:
* WebView/WebPreferencesDefaultValues.h:
* WebView/WebPreferencesDefaultValues.mm:
(WebKit::defaultAllowsInlineMediaPlayback):
(WebKit::defaultAllowsInlineMediaPlaybackAfterFullscreen):
(WebKit::defaultAllowsPictureInPictureMediaPlayback):
(WebKit::defaultJavaScriptCanOpenWindowsAutomatically):
(WebKit::defaultInlineMediaPlaybackRequiresPlaysInlineAttribute):
(WebKit::defaultPassiveTouchListenersAsDefaultOnDocument):
(WebKit::defaultRequiresUserGestureToLoadVideo):
(WebKit::defaultWebSQLEnabled):
(WebKit::defaultAttachmentElementEnabled):
(WebKit::defaultShouldRestrictBaseURLSchemes):
* WebView/WebPreferencesExperimental.yaml:
* WebView/WebPreferencesInternal.h:
* WebView/WebPreferencesInternal.yaml:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _preferencesChanged:]):
(shouldAllowPictureInPictureMediaPlayback): Deleted.
(shouldAllowWindowOpenWithoutUserGesture): Deleted.
(shouldRequireUserGestureToLoadVideo): Deleted.
(shouldRestrictBaseURLSchemes): Deleted.
* WebView/WebViewData.h:
Canonical link: https://commits.webkit.org/229829@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267689 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-28 01:42:22 +00:00
|
|
|
@opts = opts
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
@type = opts["type"]
|
|
|
|
@humanReadableName = '"' + (opts["humanReadableName"] || "") + '"'
|
|
|
|
@humanReadableDescription = '"' + (opts["humanReadableDescription"] || "") + '"'
|
|
|
|
@getter = opts["getter"]
|
|
|
|
@webcoreBinding = opts["webcoreBinding"]
|
|
|
|
@webcoreName = opts["webcoreName"]
|
|
|
|
@condition = opts["condition"]
|
|
|
|
@hidden = opts["hidden"] || false
|
[Preferences] Generate base preferences for WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=217042
Reviewed by Tim Horton.
Imports (and sorts) WebPreferences.yaml from WebKit, and starts generation for
for WebKitLegacy. To support this, a few tweaks to generation were required:
- A new 'exposed' key was added to the configuration files which allows restricting
which frontends a preference is exposed to. By default, preferences are exposed to
all frontends. This is intended to be used for preferences that don't have a binding
to WebCore (e.g. process model related preferences for Webkit). We will require a
seperate concept for features that WebCore knows about, but are not supported by
a frontend, but that will be added in future revisions.
'exposed' is used in a few places that have 'custom' bindings to WebCore where
WebKitLegacy and WebKit don't use the same type or meaning for a preference, such
as WebKitLegacy's FrameFlattening enum vs. WebKit's FrameFlatteningEnabled bool,
or WebKitLegacy's WebSQLEnabled vs. WebKit's WebSQLDisabled. Eventually, it would
be nice to make these match, but it is not required.
- A new 'webKitLegacyPreferenceKey' key was added to the configuration files allowing
for existing keys that don't match the default pattern of "WebKit" + keyName. This is
to avoid changing the value of the preference key strings in WebPreferenceKeysPrivate.h,
as I am not confident that changing them is kosher. I also went back and reverted the
few I had already changed, just to be on the safe side.
- Support was added in WebViewPreferencesChangedGenerated.mm.erb for non bool values.
- Preferences that are conditionally compiled out (using the conditional key) no longer
generate a default when they are compiled out, which required a little macro magic
in WebPreferencesDefinitions.h.erb in the form of the new INITIALIZE_DEFAULT_PREFERENCES_FOR_
macros.
* Scripts/GeneratePreferences.rb:
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb:
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
* WebView/WebPreferences.yaml:
* WebView/WebPreferencesDebug.yaml:
* WebView/WebPreferencesDefaultValues.h:
* WebView/WebPreferencesDefaultValues.mm:
(WebKit::defaultAllowsInlineMediaPlayback):
(WebKit::defaultAllowsInlineMediaPlaybackAfterFullscreen):
(WebKit::defaultAllowsPictureInPictureMediaPlayback):
(WebKit::defaultJavaScriptCanOpenWindowsAutomatically):
(WebKit::defaultInlineMediaPlaybackRequiresPlaysInlineAttribute):
(WebKit::defaultPassiveTouchListenersAsDefaultOnDocument):
(WebKit::defaultRequiresUserGestureToLoadVideo):
(WebKit::defaultWebSQLEnabled):
(WebKit::defaultAttachmentElementEnabled):
(WebKit::defaultShouldRestrictBaseURLSchemes):
* WebView/WebPreferencesExperimental.yaml:
* WebView/WebPreferencesInternal.h:
* WebView/WebPreferencesInternal.yaml:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _preferencesChanged:]):
(shouldAllowPictureInPictureMediaPlayback): Deleted.
(shouldAllowWindowOpenWithoutUserGesture): Deleted.
(shouldRequireUserGestureToLoadVideo): Deleted.
(shouldRestrictBaseURLSchemes): Deleted.
* WebView/WebViewData.h:
Canonical link: https://commits.webkit.org/229829@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267689 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-28 01:42:22 +00:00
|
|
|
@defaultValues = opts["defaultValue"][frontend]
|
2020-10-20 09:27:37 +00:00
|
|
|
@exposed = !opts["exposed"] || opts["exposed"].include?(frontend)
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
end
|
|
|
|
|
|
|
|
def nameLower
|
|
|
|
if @getter
|
|
|
|
@getter
|
|
|
|
elsif @name.start_with?("VP")
|
|
|
|
@name[0..1].downcase + @name[2..@name.length]
|
Make it possible to send an arbitrary IPC message from JavaScript
https://bugs.webkit.org/show_bug.cgi?id=217423
<rdar://problem/69969351>
Reviewed by Geoffrey Garen.
Source/JavaScriptCore:
Added a helper function to get uint64_t out of BigInt.
* runtime/JSBigInt.cpp:
(JSC::JSBigInt::toUint64Heap): Added.
* runtime/JSBigInt.h:
(JSC::JSBigInt::toUint64): Added.
Source/WebKit:
This patch introduces the JavaScript API (window.IPC) to send IPC out of WebContent process.
The feature is compiled in under ASAN and Debug builds and can be enabled at runtime.
window.IPC has two methods: sendMessage and sendSyncMessage which sends an async and sync IPC respectively.
It takes the destination process name (UI, GPU, or Networking), the destination ID (e.g. WebPageProxy ID),
message ID, timeout for sendSyncMessage, and optionally IPC message arguments. The message arguments can be
passed in as a TypedArray or ArrayBuffer, or a JavaScript array that recursively describes encoded objects.
Each object can be either a TypedArray or ArrayBuffer, which will be treated as encoded message, an array
which will be encoded as a Vector with each item within the array encoded recursively, or a dictionary which
describes a specific type.
When a specific type is described via a dictionary, "value" is encoed based on "type" as follows:
- When "type" is "String", "value" is encoded as a WTF::String, treating null or undefined as a null string.
- When "type" is "bool", "int8_t", "int16_t", "int32_t", "int64_t", "uint8_t", "uint16_t", "uint32_t",
or "uint64_t", "value" (which can be BigInt or a number) is encoded as the respective C++ type.
- When "type" is "RGBA", "value" is used as PackedColor::RGBA to construct WebCore::Color to be encoded.
- When "type" is "IntRect" or "FloatRect", "x", "y", "width", and "height" are treated as respective values
of IntRect or FloatRect C++ objects, and the constructed *Rect is encoded.
- When "type" is "FrameInfoData", the context object's WebFrame's FrameInfoData is encoded.
The list of IPC messages are exposed on window.IPC.messages, and VisitedLinkStore ID, WebPageProxy ID,
and frame identifiers are also exposed as static variables on window.IPC.
* Sources.txt:
* WebKit.xcodeproj/project.pbxproj:
* WebProcess/WebCoreSupport/WebFrameLoaderClient.cpp:
(WebKit::WebFrameLoaderClient::dispatchDidClearWindowObjectInWorld): Inject the API if enabled.
* WebProcess/WebPage/IPCTestingAPI.cpp: Added.
(WebKit::IPCTestingAPI::JSIPC::create): Added.
(WebKit::IPCTestingAPI::JSIPC::webFrame): Added.
(WebKit::IPCTestingAPI::JSIPC::JSIPC): Added.
(WebKit::IPCTestingAPI::JSIPC::wrapperClass): Added.
(WebKit::IPCTestingAPI::JSIPC::unwrap): Added.
(WebKit::IPCTestingAPI::JSIPC::toWrapped): Added.
(WebKit::IPCTestingAPI::JSIPC::initialize): Added.
(WebKit::IPCTestingAPI::JSIPC::finalize): Added.
(WebKit::IPCTestingAPI::JSIPC::staticFunctions): Added.
(WebKit::IPCTestingAPI::JSIPC::staticValues): Added.
(WebKit::IPCTestingAPI::convertToUint64): Added.
(WebKit::IPCTestingAPI::processTargetFromArgument): Added.
(WebKit::IPCTestingAPI::destinationIDFromArgument): Added.
(WebKit::IPCTestingAPI::messageIDFromArgument): Added.
(WebKit::IPCTestingAPI::encodeTypedArray): Added.
(WebKit::IPCTestingAPI::createTypeError): Added.
(WebKit::IPCTestingAPI::encodeRectType): Added.
(WebKit::IPCTestingAPI::encodeIntegralType): Added.
(WebKit::IPCTestingAPI::VectorEncodeHelper::encode const): Added.
(WebKit::IPCTestingAPI::encodeArgument): Added.
(WebKit::IPCTestingAPI::JSIPC::sendMessage): Added.
(WebKit::IPCTestingAPI::JSIPC::sendSyncMessage): Added.
(WebKit::IPCTestingAPI::JSIPC::visitedLinkStoreID): Added.
(WebKit::IPCTestingAPI::JSIPC::webPageProxyID): Added.
(WebKit::IPCTestingAPI::JSIPC::frameIdentifier): Added.
(WebKit::IPCTestingAPI::JSIPC::retrieveID): Added.
(WebKit::IPCTestingAPI::JSIPC::messages): Added.
(WebKit::IPCTestingAPI::inject):
* WebProcess/WebPage/IPCTestingAPI.h: Added.
* WebProcess/WebPage/WebFrame.h:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::m_limitsNavigationsToAppBoundDomains):
(WebKit::WebPage::updatePreferences):
* WebProcess/WebPage/WebPage.h:
(WebKit::WebPage::ipcTestingAPIEnabled const):
(WebKit::WebPage::webPageProxyID const):
(WebKit::WebPage::visitedLinkTableID const):
Source/WTF:
Added a compile time flag (ENABLE_IPC_TESTING_API) and a runtime flag (IPCTestingAPIEnabled)
for the JavaScript API to test IPC.
* Scripts/GeneratePreferences.rb:
(Preference::nameLower): Keep IPC uppercase.
* Scripts/Preferences/WebPreferencesInternal.yaml: Added IPCTestingAPIEnabled.
* wtf/PlatformEnable.h: Added ENABLE_IPC_TESTING_API.
Tools:
* TestWebKitAPI/TestWebKitAPI.xcodeproj/project.pbxproj:
* TestWebKitAPI/Tests/WebKitCocoa/IPCTestingAPI.mm: Added.
(-[IPCTestingAPIDelegate webView:runJavaScriptAlertPanelWithMessage:initiatedByFrame:completionHandler:]):
(TEST):
Canonical link: https://commits.webkit.org/230272@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268239 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-09 00:48:35 +00:00
|
|
|
elsif @name.start_with?("CSS", "DOM", "DNS", "FTP", "ICE", "IPC", "PDF", "XSS")
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
@name[0..2].downcase + @name[3..@name.length]
|
|
|
|
elsif @name.start_with?("HTTP")
|
|
|
|
@name[0..3].downcase + @name[4..@name.length]
|
|
|
|
else
|
|
|
|
@name[0].downcase + @name[1..@name.length]
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def webcoreNameUpper
|
|
|
|
if @webcoreName
|
|
|
|
@webcoreName[0].upcase + @webcoreName[1..@webcoreName.length]
|
|
|
|
else
|
|
|
|
@name
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def typeUpper
|
|
|
|
if @type == "uint32_t"
|
|
|
|
"UInt32"
|
|
|
|
else
|
|
|
|
@type.capitalize
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
[Preferences] Generate base preferences for WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=217042
Reviewed by Tim Horton.
Imports (and sorts) WebPreferences.yaml from WebKit, and starts generation for
for WebKitLegacy. To support this, a few tweaks to generation were required:
- A new 'exposed' key was added to the configuration files which allows restricting
which frontends a preference is exposed to. By default, preferences are exposed to
all frontends. This is intended to be used for preferences that don't have a binding
to WebCore (e.g. process model related preferences for Webkit). We will require a
seperate concept for features that WebCore knows about, but are not supported by
a frontend, but that will be added in future revisions.
'exposed' is used in a few places that have 'custom' bindings to WebCore where
WebKitLegacy and WebKit don't use the same type or meaning for a preference, such
as WebKitLegacy's FrameFlattening enum vs. WebKit's FrameFlatteningEnabled bool,
or WebKitLegacy's WebSQLEnabled vs. WebKit's WebSQLDisabled. Eventually, it would
be nice to make these match, but it is not required.
- A new 'webKitLegacyPreferenceKey' key was added to the configuration files allowing
for existing keys that don't match the default pattern of "WebKit" + keyName. This is
to avoid changing the value of the preference key strings in WebPreferenceKeysPrivate.h,
as I am not confident that changing them is kosher. I also went back and reverted the
few I had already changed, just to be on the safe side.
- Support was added in WebViewPreferencesChangedGenerated.mm.erb for non bool values.
- Preferences that are conditionally compiled out (using the conditional key) no longer
generate a default when they are compiled out, which required a little macro magic
in WebPreferencesDefinitions.h.erb in the form of the new INITIALIZE_DEFAULT_PREFERENCES_FOR_
macros.
* Scripts/GeneratePreferences.rb:
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb:
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
* WebView/WebPreferences.yaml:
* WebView/WebPreferencesDebug.yaml:
* WebView/WebPreferencesDefaultValues.h:
* WebView/WebPreferencesDefaultValues.mm:
(WebKit::defaultAllowsInlineMediaPlayback):
(WebKit::defaultAllowsInlineMediaPlaybackAfterFullscreen):
(WebKit::defaultAllowsPictureInPictureMediaPlayback):
(WebKit::defaultJavaScriptCanOpenWindowsAutomatically):
(WebKit::defaultInlineMediaPlaybackRequiresPlaysInlineAttribute):
(WebKit::defaultPassiveTouchListenersAsDefaultOnDocument):
(WebKit::defaultRequiresUserGestureToLoadVideo):
(WebKit::defaultWebSQLEnabled):
(WebKit::defaultAttachmentElementEnabled):
(WebKit::defaultShouldRestrictBaseURLSchemes):
* WebView/WebPreferencesExperimental.yaml:
* WebView/WebPreferencesInternal.h:
* WebView/WebPreferencesInternal.yaml:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _preferencesChanged:]):
(shouldAllowPictureInPictureMediaPlayback): Deleted.
(shouldAllowWindowOpenWithoutUserGesture): Deleted.
(shouldRequireUserGestureToLoadVideo): Deleted.
(shouldRestrictBaseURLSchemes): Deleted.
* WebView/WebViewData.h:
Canonical link: https://commits.webkit.org/229829@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267689 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-28 01:42:22 +00:00
|
|
|
# WebKitLegacy specific helpers.
|
|
|
|
|
|
|
|
def preferenceKey
|
|
|
|
if @opts["webKitLegacyPreferenceKey"]
|
|
|
|
@opts["webKitLegacyPreferenceKey"]
|
|
|
|
else
|
|
|
|
"WebKit#{@name}"
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
def preferenceAccessor
|
|
|
|
case @type
|
|
|
|
when "bool"
|
|
|
|
"_boolValueForKey"
|
|
|
|
when "uint32_t"
|
|
|
|
"_integerValueForKey"
|
|
|
|
when "double"
|
|
|
|
"_floatValueForKey"
|
|
|
|
when "String"
|
|
|
|
"_stringValueForKey"
|
|
|
|
else
|
|
|
|
raise "Unknown type: #{@type}"
|
|
|
|
end
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
class Preferences
|
|
|
|
attr_accessor :preferences
|
|
|
|
|
2020-09-28 20:26:13 +00:00
|
|
|
def initialize(parsedBasePreferences, parsedDebugPreferences, parsedExperimentalPreferences, parsedInternalPreferences, frontend)
|
[Preferences] It should be possible to have different default values for WebKitLegacy and WebKit in preference yaml files
https://bugs.webkit.org/show_bug.cgi?id=216987
Reviewed by Darin Adler.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Update script phase to explicitly specify the frontend (WebKitLegacy) and the templates to generate.
Source/WebKitLegacy/mac:
Add new syntax for default values that allows specializing based on both frontend (WebKit or
WebKitLegacy) and then futher based on platform macros. For example, the preference for
CSSTypedOMEnabled now looks like:
CSSTypedOMEnabled:
type: bool
humanReadableName: "CSS Typed OM"
humanReadableDescription: "Enable the CSS Typed OM"
webcoreBinding: RuntimeEnabledFeatures
condition: ENABLE(CSS_TYPED_OM)
defaultValue:
WebKitLegacy:
default: false
WebKit:
"ENABLE(EXPERIMENTAL_FEATURES) && (PLATFORM(GTK) || PLATFORM(WPE))": true
default: false
Which means that in WebKitLegacy, the default value is false, and in WebKit, the default
value will be:
#if ENABLE(EXPERIMENTAL_FEATURES) && (PLATFORM(GTK) || PLATFORM(WPE))
true
#else
false
#endif
As many platform macro based conditions can be provided as wanted, and they are evaluated
in the order specified in the file.
The syntax currently always requires explicitly specifying WebKitLegacy and WebKit and default
for each, even if they are all the same, but could be extended in the future to allow compaction
if that becomes desirable. There is also not yet support for conditionally enabling a feature
based on os-feature-flags or linked-on-or-after checks, so those still require specifying the
default value as a function, but that seems like a nice future improvement.
As this is still staging for doing this for both WebKitLegacy and WebKit, this change only effects
WebKitLegacy for now, and subsequent changes will move this to a shared location.
* Scripts/GeneratePreferences.rb:
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb:
* WebView/WebPreferencesExperimental.yaml:
Canonical link: https://commits.webkit.org/229795@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267623 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-26 16:34:32 +00:00
|
|
|
@frontend = frontend
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
|
|
|
|
@preferences = []
|
[Preferences] Generate base preferences for WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=217042
Reviewed by Tim Horton.
Imports (and sorts) WebPreferences.yaml from WebKit, and starts generation for
for WebKitLegacy. To support this, a few tweaks to generation were required:
- A new 'exposed' key was added to the configuration files which allows restricting
which frontends a preference is exposed to. By default, preferences are exposed to
all frontends. This is intended to be used for preferences that don't have a binding
to WebCore (e.g. process model related preferences for Webkit). We will require a
seperate concept for features that WebCore knows about, but are not supported by
a frontend, but that will be added in future revisions.
'exposed' is used in a few places that have 'custom' bindings to WebCore where
WebKitLegacy and WebKit don't use the same type or meaning for a preference, such
as WebKitLegacy's FrameFlattening enum vs. WebKit's FrameFlatteningEnabled bool,
or WebKitLegacy's WebSQLEnabled vs. WebKit's WebSQLDisabled. Eventually, it would
be nice to make these match, but it is not required.
- A new 'webKitLegacyPreferenceKey' key was added to the configuration files allowing
for existing keys that don't match the default pattern of "WebKit" + keyName. This is
to avoid changing the value of the preference key strings in WebPreferenceKeysPrivate.h,
as I am not confident that changing them is kosher. I also went back and reverted the
few I had already changed, just to be on the safe side.
- Support was added in WebViewPreferencesChangedGenerated.mm.erb for non bool values.
- Preferences that are conditionally compiled out (using the conditional key) no longer
generate a default when they are compiled out, which required a little macro magic
in WebPreferencesDefinitions.h.erb in the form of the new INITIALIZE_DEFAULT_PREFERENCES_FOR_
macros.
* Scripts/GeneratePreferences.rb:
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb:
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
* WebView/WebPreferences.yaml:
* WebView/WebPreferencesDebug.yaml:
* WebView/WebPreferencesDefaultValues.h:
* WebView/WebPreferencesDefaultValues.mm:
(WebKit::defaultAllowsInlineMediaPlayback):
(WebKit::defaultAllowsInlineMediaPlaybackAfterFullscreen):
(WebKit::defaultAllowsPictureInPictureMediaPlayback):
(WebKit::defaultJavaScriptCanOpenWindowsAutomatically):
(WebKit::defaultInlineMediaPlaybackRequiresPlaysInlineAttribute):
(WebKit::defaultPassiveTouchListenersAsDefaultOnDocument):
(WebKit::defaultRequiresUserGestureToLoadVideo):
(WebKit::defaultWebSQLEnabled):
(WebKit::defaultAttachmentElementEnabled):
(WebKit::defaultShouldRestrictBaseURLSchemes):
* WebView/WebPreferencesExperimental.yaml:
* WebView/WebPreferencesInternal.h:
* WebView/WebPreferencesInternal.yaml:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _preferencesChanged:]):
(shouldAllowPictureInPictureMediaPlayback): Deleted.
(shouldAllowWindowOpenWithoutUserGesture): Deleted.
(shouldRequireUserGestureToLoadVideo): Deleted.
(shouldRestrictBaseURLSchemes): Deleted.
* WebView/WebViewData.h:
Canonical link: https://commits.webkit.org/229829@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267689 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-28 01:42:22 +00:00
|
|
|
@preferencesNotDebug = initializeParsedPreferences(parsedBasePreferences)
|
|
|
|
@preferencesDebug = initializeParsedPreferences(parsedDebugPreferences)
|
|
|
|
@experimentalFeatures = initializeParsedPreferences(parsedExperimentalPreferences)
|
|
|
|
@internalFeatures = initializeParsedPreferences(parsedInternalPreferences)
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
|
|
|
|
@preferences.sort! { |x, y| x.name <=> y.name }
|
|
|
|
@preferencesNotDebug.sort! { |x, y| x.name <=> y.name }
|
|
|
|
@preferencesDebug.sort! { |x, y| x.name <=> y.name }
|
|
|
|
@experimentalFeatures.sort! { |x, y| x.name <=> y.name }.sort! { |x, y| x.humanReadableName <=> y.humanReadableName }
|
2020-09-27 00:21:02 +00:00
|
|
|
@internalFeatures.sort! { |x, y| x.name <=> y.name }.sort! { |x, y| x.humanReadableName <=> y.humanReadableName }
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
|
2020-10-20 09:27:37 +00:00
|
|
|
@exposedPreferences = @preferences.select { |p| p.exposed }
|
|
|
|
@exposedPreferencesNotDebug = @preferencesNotDebug.select { |p| p.exposed }
|
|
|
|
@exposedPreferencesDebug = @preferencesDebug.select { |p| p.exposed }
|
|
|
|
@exposedExperimentalFeatures = @experimentalFeatures.select { |p| p.exposed }
|
|
|
|
@exposedInternalFeatures = @internalFeatures.select { |p| p.exposed }
|
|
|
|
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
@preferencesBoundToSetting = @preferences.select { |p| !p.webcoreBinding }
|
|
|
|
@preferencesBoundToDeprecatedGlobalSettings = @preferences.select { |p| p.webcoreBinding == "DeprecatedGlobalSettings" }
|
|
|
|
@preferencesBoundToRuntimeEnabledFeatures = @preferences.select { |p| p.webcoreBinding == "RuntimeEnabledFeatures" }
|
|
|
|
|
|
|
|
@warning = "THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT."
|
|
|
|
end
|
|
|
|
|
[Preferences] Generate base preferences for WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=217042
Reviewed by Tim Horton.
Imports (and sorts) WebPreferences.yaml from WebKit, and starts generation for
for WebKitLegacy. To support this, a few tweaks to generation were required:
- A new 'exposed' key was added to the configuration files which allows restricting
which frontends a preference is exposed to. By default, preferences are exposed to
all frontends. This is intended to be used for preferences that don't have a binding
to WebCore (e.g. process model related preferences for Webkit). We will require a
seperate concept for features that WebCore knows about, but are not supported by
a frontend, but that will be added in future revisions.
'exposed' is used in a few places that have 'custom' bindings to WebCore where
WebKitLegacy and WebKit don't use the same type or meaning for a preference, such
as WebKitLegacy's FrameFlattening enum vs. WebKit's FrameFlatteningEnabled bool,
or WebKitLegacy's WebSQLEnabled vs. WebKit's WebSQLDisabled. Eventually, it would
be nice to make these match, but it is not required.
- A new 'webKitLegacyPreferenceKey' key was added to the configuration files allowing
for existing keys that don't match the default pattern of "WebKit" + keyName. This is
to avoid changing the value of the preference key strings in WebPreferenceKeysPrivate.h,
as I am not confident that changing them is kosher. I also went back and reverted the
few I had already changed, just to be on the safe side.
- Support was added in WebViewPreferencesChangedGenerated.mm.erb for non bool values.
- Preferences that are conditionally compiled out (using the conditional key) no longer
generate a default when they are compiled out, which required a little macro magic
in WebPreferencesDefinitions.h.erb in the form of the new INITIALIZE_DEFAULT_PREFERENCES_FOR_
macros.
* Scripts/GeneratePreferences.rb:
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb:
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
* WebView/WebPreferences.yaml:
* WebView/WebPreferencesDebug.yaml:
* WebView/WebPreferencesDefaultValues.h:
* WebView/WebPreferencesDefaultValues.mm:
(WebKit::defaultAllowsInlineMediaPlayback):
(WebKit::defaultAllowsInlineMediaPlaybackAfterFullscreen):
(WebKit::defaultAllowsPictureInPictureMediaPlayback):
(WebKit::defaultJavaScriptCanOpenWindowsAutomatically):
(WebKit::defaultInlineMediaPlaybackRequiresPlaysInlineAttribute):
(WebKit::defaultPassiveTouchListenersAsDefaultOnDocument):
(WebKit::defaultRequiresUserGestureToLoadVideo):
(WebKit::defaultWebSQLEnabled):
(WebKit::defaultAttachmentElementEnabled):
(WebKit::defaultShouldRestrictBaseURLSchemes):
* WebView/WebPreferencesExperimental.yaml:
* WebView/WebPreferencesInternal.h:
* WebView/WebPreferencesInternal.yaml:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _preferencesChanged:]):
(shouldAllowPictureInPictureMediaPlayback): Deleted.
(shouldAllowWindowOpenWithoutUserGesture): Deleted.
(shouldRequireUserGestureToLoadVideo): Deleted.
(shouldRestrictBaseURLSchemes): Deleted.
* WebView/WebViewData.h:
Canonical link: https://commits.webkit.org/229829@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267689 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-28 01:42:22 +00:00
|
|
|
def initializeParsedPreferences(parsedPreferences)
|
|
|
|
result = []
|
|
|
|
if parsedPreferences
|
|
|
|
parsedPreferences.each do |name, options|
|
Use WebPreference definitions from shared configuration files in WebCore (Part 1)
https://bugs.webkit.org/show_bug.cgi?id=217551
Reviewed by Darin Adler.
Source/WebCore:
This begins using the WebPreferences*.yaml files for the generation of
WebCore's Settings and InternalSettings classes. In this first part, we
only are moving settings that already exist in the WebPreferences*.yaml
files. A subsequent change will migrate the remaining additional settings
over.
* Configurations/WebCore.xcconfig:
Add variable (already used by WebKit) to access the WTF build scripts
directory for access to the WebPreferences*.yaml files in DerivedSources.make
* DerivedSources-input.xcfilelist:
Update with new input files, the WebPreferences*.yaml files.
* WebCoreMacros.cmake:
* DerivedSources.make:
Update GenerateSettings.rb call with new parameters.
* Scripts/GenerateSettings.rb:
Adds support for generating Settings based on preferences in the
WebPreferences*.yaml files while maintaining support for the additional
settings from Settings.yaml. Adds support for a new key, 'webcoreImplementation'
to continue supporting custom implementations in SettingsBase.
* Scripts/SettingsTemplates/InternalSettingsGenerated.cpp.erb:
* Scripts/SettingsTemplates/InternalSettingsGenerated.h.erb:
* Scripts/SettingsTemplates/InternalSettingsGenerated.idl.erb:
* Scripts/SettingsTemplates/Settings.cpp.erb:
* Scripts/SettingsTemplates/Settings.h.erb:
Update to account for new names (@allSettingsSet) and differentiation
between custom and non-custom implementations.
* editing/EditorCommand.cpp:
* page/Frame.cpp:
Update for new name. DOMPasteAllowed -> domPasteAllowed, which matches convention.
* page/Settings.yaml:
Moved settings that were bound by WebPreferences to WebPreferences. Sorted remaining
ones left.
* page/SettingsDefaultValues.h:
Remove defaults that were the same on all platforms. These are now hardcoded in
WebPreferences.
* style/StyleFontSizeFunctions.cpp:
(WebCore::Style::fontSizeForKeyword):
Add explicit type, now that minimumLogicalFontSize is a double, not an int in WebCore
(it was already a double at the WebKit/WebKitLegacy level).
Source/WebKit:
* WebProcess/WebPage/WebPage.cpp:
(WebKit::WebPage::sendViewportAttributesChanged):
Add explicit type to support layoutFallbackWidth now being an unsigned int
in Settings (it was already an unsigned int at the WebKit level).
Source/WTF:
This begins using the WebPreferences*.yaml files for the generation of
WebCore's Settings and InternalSettings classes. In this first part, we
only are moving settings that already exist in the WebPreferences*.yaml
files. A subsequent change will migrate the remaining additional settings
over.
To do this we must add default values for 'WebCore', which are unfortunately
still needed for things like the empty client based SVGImage and sanitizing
web content functionality. We only need default WebCore values for preferences
that are bound to WebCore::Settings. It would be good to eliminate the need
for these eventually, but that is not a goal of this change.
This also adds some new keys from WebCore's Settings.yaml:
- 'webcoreOnChange: *' called by WebCore::Settings when the setting changes.
- 'inspectorOverride: true' used to allow the inspector to override the setting.
- 'webcoreImplementation: custom' used to indicate that WebCore::SettingsBase
implements the setting.
- 'webcoreGetter: *' used to provide an alternate name for the getter in WebCore::Settings.
- 'webcoreExcludeFromInternalSettings: true' used to exclude from WebCore's InternalSettings
bindings.
* Scripts/GeneratePreferences.rb:
Adds check that if the preference is bound to WebCore, it includes defaults for all
three front generators, 'WebKit', WebKitLegacy', and 'WebCore'.
* Scripts/Preferences/WebPreferences.yaml:
* Scripts/Preferences/WebPreferencesDebug.yaml:
* Scripts/Preferences/WebPreferencesExperimental.yaml:
* Scripts/Preferences/WebPreferencesInternal.yaml:
Migrates defaults and additional keys from Settings.yaml.
Canonical link: https://commits.webkit.org/230336@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@268313 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-10-10 19:49:55 +00:00
|
|
|
if !options["webcoreBinding"] && options["defaultValue"].size != 3
|
|
|
|
raise "ERROR: Preferences bound to WebCore::Settings must have default values for all frontends: #{name}"
|
|
|
|
end
|
2020-10-20 09:27:37 +00:00
|
|
|
if options["defaultValue"].include?(@frontend)
|
[Preferences] Generate base preferences for WebKitLegacy
https://bugs.webkit.org/show_bug.cgi?id=217042
Reviewed by Tim Horton.
Imports (and sorts) WebPreferences.yaml from WebKit, and starts generation for
for WebKitLegacy. To support this, a few tweaks to generation were required:
- A new 'exposed' key was added to the configuration files which allows restricting
which frontends a preference is exposed to. By default, preferences are exposed to
all frontends. This is intended to be used for preferences that don't have a binding
to WebCore (e.g. process model related preferences for Webkit). We will require a
seperate concept for features that WebCore knows about, but are not supported by
a frontend, but that will be added in future revisions.
'exposed' is used in a few places that have 'custom' bindings to WebCore where
WebKitLegacy and WebKit don't use the same type or meaning for a preference, such
as WebKitLegacy's FrameFlattening enum vs. WebKit's FrameFlatteningEnabled bool,
or WebKitLegacy's WebSQLEnabled vs. WebKit's WebSQLDisabled. Eventually, it would
be nice to make these match, but it is not required.
- A new 'webKitLegacyPreferenceKey' key was added to the configuration files allowing
for existing keys that don't match the default pattern of "WebKit" + keyName. This is
to avoid changing the value of the preference key strings in WebPreferenceKeysPrivate.h,
as I am not confident that changing them is kosher. I also went back and reverted the
few I had already changed, just to be on the safe side.
- Support was added in WebViewPreferencesChangedGenerated.mm.erb for non bool values.
- Preferences that are conditionally compiled out (using the conditional key) no longer
generate a default when they are compiled out, which required a little macro magic
in WebPreferencesDefinitions.h.erb in the form of the new INITIALIZE_DEFAULT_PREFERENCES_FOR_
macros.
* Scripts/GeneratePreferences.rb:
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb:
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
(+[WebPreferences initialize]):
* WebView/WebPreferences.yaml:
* WebView/WebPreferencesDebug.yaml:
* WebView/WebPreferencesDefaultValues.h:
* WebView/WebPreferencesDefaultValues.mm:
(WebKit::defaultAllowsInlineMediaPlayback):
(WebKit::defaultAllowsInlineMediaPlaybackAfterFullscreen):
(WebKit::defaultAllowsPictureInPictureMediaPlayback):
(WebKit::defaultJavaScriptCanOpenWindowsAutomatically):
(WebKit::defaultInlineMediaPlaybackRequiresPlaysInlineAttribute):
(WebKit::defaultPassiveTouchListenersAsDefaultOnDocument):
(WebKit::defaultRequiresUserGestureToLoadVideo):
(WebKit::defaultWebSQLEnabled):
(WebKit::defaultAttachmentElementEnabled):
(WebKit::defaultShouldRestrictBaseURLSchemes):
* WebView/WebPreferencesExperimental.yaml:
* WebView/WebPreferencesInternal.h:
* WebView/WebPreferencesInternal.yaml:
* WebView/WebView.mm:
(-[WebView _commonInitializationWithFrameName:groupName:]):
(-[WebView _preferencesChanged:]):
(shouldAllowPictureInPictureMediaPlayback): Deleted.
(shouldAllowWindowOpenWithoutUserGesture): Deleted.
(shouldRequireUserGestureToLoadVideo): Deleted.
(shouldRestrictBaseURLSchemes): Deleted.
* WebView/WebViewData.h:
Canonical link: https://commits.webkit.org/229829@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267689 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-28 01:42:22 +00:00
|
|
|
preference = Preference.new(name, options, @frontend)
|
|
|
|
@preferences << preference
|
|
|
|
result << preference
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
result
|
|
|
|
end
|
|
|
|
|
2020-09-30 01:29:42 +00:00
|
|
|
def renderTemplate(templateFile, outputDirectory)
|
2020-10-08 00:23:53 +00:00
|
|
|
resultFile = File.join(outputDirectory, File.basename(templateFile, ".erb"))
|
|
|
|
tempResultFile = resultFile + ".tmp"
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
|
|
|
|
output = ERB.new(File.read(templateFile), 0, "-").result(binding)
|
2020-10-08 00:23:53 +00:00
|
|
|
File.open(tempResultFile, "w+") do |f|
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
f.write(output)
|
|
|
|
end
|
2020-10-08 00:23:53 +00:00
|
|
|
if (!File.exist?(resultFile) || IO::read(resultFile) != IO::read(tempResultFile))
|
|
|
|
FileUtils.move(tempResultFile, resultFile)
|
|
|
|
else
|
|
|
|
FileUtils.remove_file(tempResultFile)
|
|
|
|
FileUtils.uptodate?(resultFile, [templateFile]) or FileUtils.touch(resultFile)
|
|
|
|
end
|
[Preferences] Start generating experimental feature preferences for legacy WebKit
https://bugs.webkit.org/show_bug.cgi?id=216909
Reviewed by Tim Horton.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Add new files.
Source/WebKitLegacy/mac:
As a stepping stone to unified preferences definitions and generation, this adds
generation of "experimental feature" preferences for WebKitLegacy. The generator
is almost identical to the one in WebKit, but the templates are changed. The end
goal will be to share the preferences definition (yaml) files. In this pass, I
have copied WebPreferencesExperimental.yaml from WebKit, but change the default
values to match the existing WebKitLegacy default values (and temporarily removed
WebSQLDisabled, as WebKitLegacy has a WebSQLEnabled, and its not clear how to map
to the inverse yet). I have also imported empty versions of WebPreferences.yaml,
WebPreferencesDebug.yaml, and WebPreferencesInternal.yaml, to keep the generator
happy, these will be filled in subsequent changes or, if we decide on a good home
for them, perhaps in WTF, we can just switch to using the shared ones.
Much of the change is moving around existing getter/setters in WebPreferences
to go in their own category, with the intention to remove them when we we have
determined no more callers remain.
* Scripts: Added.
* Scripts/GeneratePreferences.rb: Added.
* Scripts/PreferencesTemplates: Added.
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Added.
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb: Added.
* Scripts/PreferencesTemplates/WebViewPreferencesChangedGenerated.mm.erb: Added.
* WebView/WebFeature.h: Added.
* WebView/WebFeature.m: Added.
(-[WebFeature initWithKey:preferenceKey:name:details:defaultValue:hidden:]):
(-[WebFeature description]):
* WebView/WebFeatureInternal.h: Added.
* WebView/WebPreferenceKeysPrivate.h:
* WebView/WebPreferences.mm:
* WebView/WebPreferences.yaml: Added.
* WebView/WebPreferencesDebug.yaml: Added.
* WebView/WebPreferencesDefaultValues.h: Added.
* WebView/WebPreferencesDefaultValues.mm: Added.
* WebView/WebPreferencesExperimental.yaml: Added.
* WebView/WebPreferencesInternal.h: Added.
* WebView/WebPreferencesInternal.yaml: Added.
* WebView/WebPreferencesPrivate.h:
* WebView/WebView.mm:
(-[WebView _preferencesChanged:]):
* WebView/WebViewInternal.h:
Canonical link: https://commits.webkit.org/229754@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267575 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-25 17:04:46 +00:00
|
|
|
end
|
|
|
|
end
|
|
|
|
|
2020-09-28 20:26:13 +00:00
|
|
|
preferences = Preferences.new(parsedBasePreferences, parsedDebugPreferences, parsedExperimentalPreferences, parsedInternalPreferences, options[:frontend])
|
[Preferences] It should be possible to have different default values for WebKitLegacy and WebKit in preference yaml files
https://bugs.webkit.org/show_bug.cgi?id=216987
Reviewed by Darin Adler.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Update script phase to explicitly specify the frontend (WebKitLegacy) and the templates to generate.
Source/WebKitLegacy/mac:
Add new syntax for default values that allows specializing based on both frontend (WebKit or
WebKitLegacy) and then futher based on platform macros. For example, the preference for
CSSTypedOMEnabled now looks like:
CSSTypedOMEnabled:
type: bool
humanReadableName: "CSS Typed OM"
humanReadableDescription: "Enable the CSS Typed OM"
webcoreBinding: RuntimeEnabledFeatures
condition: ENABLE(CSS_TYPED_OM)
defaultValue:
WebKitLegacy:
default: false
WebKit:
"ENABLE(EXPERIMENTAL_FEATURES) && (PLATFORM(GTK) || PLATFORM(WPE))": true
default: false
Which means that in WebKitLegacy, the default value is false, and in WebKit, the default
value will be:
#if ENABLE(EXPERIMENTAL_FEATURES) && (PLATFORM(GTK) || PLATFORM(WPE))
true
#else
false
#endif
As many platform macro based conditions can be provided as wanted, and they are evaluated
in the order specified in the file.
The syntax currently always requires explicitly specifying WebKitLegacy and WebKit and default
for each, even if they are all the same, but could be extended in the future to allow compaction
if that becomes desirable. There is also not yet support for conditionally enabling a feature
based on os-feature-flags or linked-on-or-after checks, so those still require specifying the
default value as a function, but that seems like a nice future improvement.
As this is still staging for doing this for both WebKitLegacy and WebKit, this change only effects
WebKitLegacy for now, and subsequent changes will move this to a shared location.
* Scripts/GeneratePreferences.rb:
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb:
* WebView/WebPreferencesExperimental.yaml:
Canonical link: https://commits.webkit.org/229795@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267623 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-26 16:34:32 +00:00
|
|
|
|
|
|
|
options[:templates].each do |template|
|
2020-09-30 01:29:42 +00:00
|
|
|
preferences.renderTemplate(template, options[:outputDirectory])
|
[Preferences] It should be possible to have different default values for WebKitLegacy and WebKit in preference yaml files
https://bugs.webkit.org/show_bug.cgi?id=216987
Reviewed by Darin Adler.
Source/WebKitLegacy:
* WebKitLegacy.xcodeproj/project.pbxproj:
Update script phase to explicitly specify the frontend (WebKitLegacy) and the templates to generate.
Source/WebKitLegacy/mac:
Add new syntax for default values that allows specializing based on both frontend (WebKit or
WebKitLegacy) and then futher based on platform macros. For example, the preference for
CSSTypedOMEnabled now looks like:
CSSTypedOMEnabled:
type: bool
humanReadableName: "CSS Typed OM"
humanReadableDescription: "Enable the CSS Typed OM"
webcoreBinding: RuntimeEnabledFeatures
condition: ENABLE(CSS_TYPED_OM)
defaultValue:
WebKitLegacy:
default: false
WebKit:
"ENABLE(EXPERIMENTAL_FEATURES) && (PLATFORM(GTK) || PLATFORM(WPE))": true
default: false
Which means that in WebKitLegacy, the default value is false, and in WebKit, the default
value will be:
#if ENABLE(EXPERIMENTAL_FEATURES) && (PLATFORM(GTK) || PLATFORM(WPE))
true
#else
false
#endif
As many platform macro based conditions can be provided as wanted, and they are evaluated
in the order specified in the file.
The syntax currently always requires explicitly specifying WebKitLegacy and WebKit and default
for each, even if they are all the same, but could be extended in the future to allow compaction
if that becomes desirable. There is also not yet support for conditionally enabling a feature
based on os-feature-flags or linked-on-or-after checks, so those still require specifying the
default value as a function, but that seems like a nice future improvement.
As this is still staging for doing this for both WebKitLegacy and WebKit, this change only effects
WebKitLegacy for now, and subsequent changes will move this to a shared location.
* Scripts/GeneratePreferences.rb:
* Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb:
* Scripts/PreferencesTemplates/WebPreferencesExperimentalFeatures.mm.erb:
* WebView/WebPreferencesExperimental.yaml:
Canonical link: https://commits.webkit.org/229795@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@267623 268f45cc-cd09-0410-ab3c-d52691b4dbfc
2020-09-26 16:34:32 +00:00
|
|
|
end
|