Permalink
Show file tree
Hide file tree
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
[Settings] Generate the bulk of WebPage::updatePreferences(...)
https://bugs.webkit.org/show_bug.cgi?id=178823 Patch by Sam Weinig <sam@webkit.org> on 2017-10-26 Reviewed by Tim Horton. * CMakeLists.txt: * DerivedSources.make: * WebKit.xcodeproj/project.pbxproj: Add new file generation. * Scripts/GeneratePreferences.rb: Replace 'webkitOnly' boolean option with a new 'webcoreBinding' option. 'webcoreBinding' supports the following values: - none (same as webkit only) - custom (means that you do bind to a webcore concept, but currently it must be done in a custom manner) - DeprecatedGlobalSettings (binds to a DeprecatedGlobalSettings setting) - RuntimeEnabledFeatures (binds to a RuntimeEnabledFeatures setting) If 'webcoreBinding' is not provided, the preference binds to WebCore Setting of either the same name or the override name provided by the new 'webcoreName' option (we should try to remove the need for 'webcoreName' by unifying with WebCore on preference/setting naming). A 'condition' option was also added to indicate that the preference is only available when that macro condition is true. Since we are generating most of WebPage::updatePreferences, we can simplify the macros in WebPreferencesDefinitions.h to only have normal/debug/experimental variants and remove the need for per-type macros, which were only used in WebPage::updatePreferences. * Scripts/PreferencesTemplates/WebPageUpdatePreferences.cpp.erb: Added. Generates bindings from WebPreferences to WebCore::Settings/DeprecatedGlobalSettings/RuntimeEnabledFeatures. Does not generate a binding if the 'webcoreBinding' option is set to either 'none' or 'custom'. * Scripts/PreferencesTemplates/WebPreferencesDefinitions.h.erb: Simplify down to just normal/debug/experimental macros. * Shared/WebPreferences.yaml: Annotate perferences with new optional 'webcoreBinding', 'webcoreName', and 'condition' options. * WebProcess/WebPage/WebPage.cpp: (WebKit::WebPage::updatePreferences): Replace a ton of hand written preference to settings bindings with a call to updatePreferencesGenerated(). * WebProcess/WebPage/WebPage.h: Add declaration of updatePreferencesGenerated, remove platformPreferencesDidChange. * WebProcess/WebPage/gtk/WebPageGtk.cpp: (WebKit::WebPage::platformPreferencesDidChange): Deleted. * WebProcess/WebPage/ios/WebPageIOS.mm: (WebKit::WebPage::platformPreferencesDidChange): Deleted. * WebProcess/WebPage/mac/WebPageMac.mm: (WebKit::WebPage::platformPreferencesDidChange): Deleted. * WebProcess/WebPage/win/WebPageWin.cpp: (WebKit::WebPage::platformPreferencesDidChange): Deleted. * WebProcess/WebPage/wpe/WebPageWPE.cpp: (WebKit::WebPage::platformPreferencesDidChange): Deleted. Remove all the empty platformPreferencesDidChange functions. Canonical link: https://commits.webkit.org/195065@main git-svn-id: https://svn.webkit.org/repository/webkit/trunk@224077 268f45cc-cd09-0410-ab3c-d52691b4dbfc
- Loading branch information
1 parent
db3c6fb
commit e661afe71141a50b131ea174a5f6a40b110c71ea
Showing
15 changed files
with
370 additions
and
448 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@@ -0,0 +1,75 @@ | ||
/* | ||
* THIS FILE WAS AUTOMATICALLY GENERATED, DO NOT EDIT. | ||
* | ||
* Copyright (C) 2017 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. | ||
*/ | ||
|
||
#include "config.h" | ||
#include "WebPage.h" | ||
|
||
#include "WebPreferencesKeys.h" | ||
#include "WebPreferencesStore.h" | ||
#include <WebCore/DeprecatedGlobalSettings.h> | ||
#include <WebCore/Page.h> | ||
#include <WebCore/RuntimeEnabledFeatures.h> | ||
#include <WebCore/Settings.h> | ||
|
||
namespace WebKit { | ||
|
||
void WebPage::updatePreferencesGenerated(const WebPreferencesStore& store) | ||
{ | ||
WebCore::Settings& settings = m_page->settings(); | ||
|
||
<%- for @pref in @preferencesBoundToSetting do -%> | ||
<%- if @pref.condition -%> | ||
#if <%= @pref.condition %> | ||
<%- end -%> | ||
settings.set<%= @pref.webcoreNameUpper %>(store.get<%= @pref.typeUpper %>ValueForKey(WebPreferencesKey::<%= @pref.nameLower %>Key())); | ||
<%- if @pref.condition -%> | ||
#endif | ||
<%- end -%> | ||
<%- end -%> | ||
<%- for @pref in @preferencesBoundToDeprecatedGlobalSettings do -%> | ||
<%- if @pref.condition -%> | ||
#if <%= @pref.condition %> | ||
<%- end -%> | ||
WebCore::DeprecatedGlobalSettings::set<%= @pref.webcoreNameUpper %>(store.get<%= @pref.typeUpper %>ValueForKey(WebPreferencesKey::<%= @pref.nameLower %>Key())); | ||
<%- if @pref.condition -%> | ||
#endif | ||
<%- end -%> | ||
<%- end -%> | ||
<%- for @pref in @preferencesBoundToRuntimeEnabledFeatures do -%> | ||
<%- if @pref.condition -%> | ||
#if <%= @pref.condition %> | ||
<%- end -%> | ||
WebCore::RuntimeEnabledFeatures::sharedFeatures().set<%= @pref.webcoreNameUpper %>(store.get<%= @pref.typeUpper %>ValueForKey(WebPreferencesKey::<%= @pref.nameLower %>Key())); | ||
<%- if @pref.condition -%> | ||
#endif | ||
<%- end -%> | ||
<%- end -%> | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.