Skip to content
Permalink
Browse files
[Settings] Move remaining simple settings to Settings.in
https://bugs.webkit.org/show_bug.cgi?id=177730

Patch by Sam Weinig <sam@webkit.org> on 2017-10-01
Reviewed by Darin Adler.

- Adds new option type for Settings.in, 'getter', which allows you to specify
  a custom name for the setting's getter. For instance, the setting javaEnabled
  has a custom getter name, 'isJavaEnabled'.
- Adds support for WTF::Seconds as a type of setting. Used by only
  timeWithoutMouseMovementBeforeHidingControls at the moment.
- Moves non-generated settings from Settings.h/cpp that don't require custom
  action when set, to Settings.in

* Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py:
* Scripts/GenerateSettings/GenerateSettingsHeaderFile.py:
* Scripts/GenerateSettings/Settings.py:

    Add support for 'getter' and the Seconds type.

* WebCore.xcodeproj/project.pbxproj:
* platform/text/FontRenderingMode.h: Copied from Source/WebCore/platform/text/TextFlags.h.
* platform/text/TextFlags.h:

    Add FontRenderingMode.h. Moved out of TextFlags.h to be accessible by
    the settings generator.

* page/Settings.cpp:
(WebCore::Settings::Settings):
(WebCore::Settings::setJavaEnabled): Deleted.
(WebCore::Settings::setJavaEnabledForLocalFiles): Deleted.
(WebCore::Settings::setPreferMIMETypeForImages): Deleted.
(WebCore::Settings::setForcePendingWebGLPolicy): Deleted.
(WebCore::Settings::setNeedsAdobeFrameReloadingQuirk): Deleted.
(WebCore::Settings::setFontRenderingMode): Deleted.
(WebCore::Settings::fontRenderingMode const): Deleted.
(WebCore::Settings::setShowTiledScrollingIndicator): Deleted.
(WebCore::Settings::setFontFallbackPrefersPictographs): Deleted.
(WebCore::Settings::setWebFontsAlwaysFallBack): Deleted.
* page/Settings.h:
(WebCore::Settings::isJavaEnabled const): Deleted.
(WebCore::Settings::isJavaEnabledForLocalFiles const): Deleted.
(WebCore::Settings::preferMIMETypeForImages const): Deleted.
(WebCore::Settings::needsAcrobatFrameReloadingQuirk const): Deleted.
(WebCore::Settings::showTiledScrollingIndicator const): Deleted.
(WebCore::Settings::setTouchEventEmulationEnabled): Deleted.
(WebCore::Settings::isTouchEventEmulationEnabled const): Deleted.
(WebCore::Settings::setTimeWithoutMouseMovementBeforeHidingControls): Deleted.
(WebCore::Settings::timeWithoutMouseMovementBeforeHidingControls const): Deleted.
(WebCore::Settings::fontFallbackPrefersPictographs const): Deleted.
(WebCore::Settings::webFontsAlwaysFallBack const): Deleted.
(WebCore::Settings::setMediaKeysStorageDirectory): Deleted.
(WebCore::Settings::mediaKeysStorageDirectory const): Deleted.
(WebCore::Settings::setMediaDeviceIdentifierStorageDirectory): Deleted.
(WebCore::Settings::mediaDeviceIdentifierStorageDirectory const): Deleted.
(WebCore::Settings::applePayEnabled const): Deleted.
(WebCore::Settings::setApplePayEnabled): Deleted.
(WebCore::Settings::applePayCapabilityDisclosureAllowed const): Deleted.
(WebCore::Settings::setApplePayCapabilityDisclosureAllowed): Deleted.
(WebCore::Settings::isForcePendingWebGLPolicy const): Deleted.
* page/Settings.in:

    Moved hand-written settings to be Settings.in based.

Canonical link: https://commits.webkit.org/193981@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@222698 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Sam Weinig authored and webkit-commit-queue committed Oct 2, 2017
1 parent 5de5d13 commit 6cee6673d728097aefd4fa7e231ecc042bf8561c
@@ -1,3 +1,68 @@
2017-10-01 Sam Weinig <sam@webkit.org>

[Settings] Move remaining simple settings to Settings.in
https://bugs.webkit.org/show_bug.cgi?id=177730

Reviewed by Darin Adler.

- Adds new option type for Settings.in, 'getter', which allows you to specify
a custom name for the setting's getter. For instance, the setting javaEnabled
has a custom getter name, 'isJavaEnabled'.
- Adds support for WTF::Seconds as a type of setting. Used by only
timeWithoutMouseMovementBeforeHidingControls at the moment.
- Moves non-generated settings from Settings.h/cpp that don't require custom
action when set, to Settings.in

* Scripts/GenerateSettings/GenerateInternalSettingsImplementationFile.py:
* Scripts/GenerateSettings/GenerateSettingsHeaderFile.py:
* Scripts/GenerateSettings/Settings.py:

Add support for 'getter' and the Seconds type.

* WebCore.xcodeproj/project.pbxproj:
* platform/text/FontRenderingMode.h: Copied from Source/WebCore/platform/text/TextFlags.h.
* platform/text/TextFlags.h:

Add FontRenderingMode.h. Moved out of TextFlags.h to be accessible by
the settings generator.

* page/Settings.cpp:
(WebCore::Settings::Settings):
(WebCore::Settings::setJavaEnabled): Deleted.
(WebCore::Settings::setJavaEnabledForLocalFiles): Deleted.
(WebCore::Settings::setPreferMIMETypeForImages): Deleted.
(WebCore::Settings::setForcePendingWebGLPolicy): Deleted.
(WebCore::Settings::setNeedsAdobeFrameReloadingQuirk): Deleted.
(WebCore::Settings::setFontRenderingMode): Deleted.
(WebCore::Settings::fontRenderingMode const): Deleted.
(WebCore::Settings::setShowTiledScrollingIndicator): Deleted.
(WebCore::Settings::setFontFallbackPrefersPictographs): Deleted.
(WebCore::Settings::setWebFontsAlwaysFallBack): Deleted.
* page/Settings.h:
(WebCore::Settings::isJavaEnabled const): Deleted.
(WebCore::Settings::isJavaEnabledForLocalFiles const): Deleted.
(WebCore::Settings::preferMIMETypeForImages const): Deleted.
(WebCore::Settings::needsAcrobatFrameReloadingQuirk const): Deleted.
(WebCore::Settings::showTiledScrollingIndicator const): Deleted.
(WebCore::Settings::setTouchEventEmulationEnabled): Deleted.
(WebCore::Settings::isTouchEventEmulationEnabled const): Deleted.
(WebCore::Settings::setTimeWithoutMouseMovementBeforeHidingControls): Deleted.
(WebCore::Settings::timeWithoutMouseMovementBeforeHidingControls const): Deleted.
(WebCore::Settings::fontFallbackPrefersPictographs const): Deleted.
(WebCore::Settings::webFontsAlwaysFallBack const): Deleted.
(WebCore::Settings::setMediaKeysStorageDirectory): Deleted.
(WebCore::Settings::mediaKeysStorageDirectory const): Deleted.
(WebCore::Settings::setMediaDeviceIdentifierStorageDirectory): Deleted.
(WebCore::Settings::mediaDeviceIdentifierStorageDirectory const): Deleted.
(WebCore::Settings::applePayEnabled const): Deleted.
(WebCore::Settings::setApplePayEnabled): Deleted.
(WebCore::Settings::applePayCapabilityDisclosureAllowed const): Deleted.
(WebCore::Settings::setApplePayCapabilityDisclosureAllowed): Deleted.
(WebCore::Settings::isForcePendingWebGLPolicy const): Deleted.
* page/Settings.in:

Moved hand-written settings to be Settings.in based.

2017-10-01 Zalan Bujtas <zalan@apple.com>

RenderView does not need to be a SelectionSubtreeRoot
@@ -25,7 +25,7 @@

import os.path

from Settings import license, makeSetterFunctionName, makeConditionalString, mapToIDLType, makeConditionalString
from Settings import license, makeSetterFunctionName, makeGetterFunctionName, makeConditionalString, mapToIDLType


def generateInternalSettingsImplementationFile(outputDirectory, settings):
@@ -53,7 +53,7 @@ def generateInternalSettingsImplementationFile(outputDirectory, settings):
if setting.conditional:
outputFile.write("#if " + makeConditionalString(setting.conditional) + "\n")

outputFile.write(" , m_" + setting.name + "(page->settings()." + setting.name + "())\n")
outputFile.write(" , m_" + setting.name + "(page->settings()." + makeGetterFunctionName(setting) + "())\n")

if setting.conditional:
outputFile.write("#endif\n")
@@ -25,7 +25,7 @@

import os.path

from Settings import license, makeConditionalString, makeSetterFunctionName, includeForSetting, typeIsAggregate
from Settings import license, makeConditionalString, makeSetterFunctionName, makeGetterFunctionName, includeForSetting, typeIsValueType


def generateSettingsHeaderFile(outputDirectory, settings):
@@ -112,21 +112,22 @@ def printIncludes(outputFile, sortedUnconditionalSettingsNames, sortedConditiona

def printGetterAndSetter(outputFile, setting):
setterFunctionName = makeSetterFunctionName(setting)
getterFunctionName = makeGetterFunctionName(setting)

# Export is only needed if the definition is not in the header.
webcoreExport = "WEBCORE_EXPORT " if setting.setNeedsStyleRecalcInAllFrames else ""

if not typeIsAggregate(setting):
outputFile.write(" " + setting.type + " " + setting.name + "() const { return m_" + setting.name + "; } \n")
if not typeIsValueType(setting):
outputFile.write(" " + setting.type + " " + getterFunctionName + "() const { return m_" + setting.name + "; } \n")
outputFile.write(" " + webcoreExport + "void " + setterFunctionName + "(" + setting.type + " " + setting.name + ")")
else:
outputFile.write(" const " + setting.type + "& " + setting.name + "() const { return m_" + setting.name + "; } \n")
outputFile.write(" const " + setting.type + "& " + getterFunctionName + "() const { return m_" + setting.name + "; } \n")
outputFile.write(" " + webcoreExport + "void " + setterFunctionName + "(const " + setting.type + "& " + setting.name + ")")

if setting.setNeedsStyleRecalcInAllFrames:
outputFile.write("; \n")
outputFile.write(";\n\n")
else:
outputFile.write(" { m_" + setting.name + " = " + setting.name + "; } \n")
outputFile.write(" { m_" + setting.name + " = " + setting.name + "; }\n\n")


def printGettersAndSetters(outputFile, sortedUnconditionalSettingsNames, sortedConditionals, settingsByConditional, settings):
@@ -25,7 +25,7 @@

import os.path

from Settings import license, makeConditionalString, makeSetterFunctionName, typeIsAggregate
from Settings import license, makeConditionalString, makeSetterFunctionName, typeIsValueType


def generateSettingsImplementationFile(outputDirectory, settings):
@@ -155,7 +155,7 @@ def printSetterBody(outputFile, setting):

setterFunctionName = makeSetterFunctionName(setting)

if not typeIsAggregate(setting):
if not typeIsValueType(setting):
outputFile.write("void SettingsGenerated::" + setterFunctionName + "(" + setting.type + " " + setting.name + ")\n")
else:
outputFile.write("void SettingsGenerated::" + setterFunctionName + "(const " + setting.type + "& " + setting.name + ")\n")
@@ -66,6 +66,7 @@ def __init__(self, name):
self.conditional = None
self.setNeedsStyleRecalcInAllFrames = None
self.include = None
self.getter = None

def __str__(self):
result = self.name + " TYPE:" + self.type
@@ -77,6 +78,8 @@ def __str__(self):
result += " RECALC:" + self.setNeedsStyleRecalcInAllFrames
if (self.include):
result += " INCLUDE:" + self.include
if (self.getter):
result += " GETTER:" + self.getter
return result


@@ -91,6 +94,12 @@ def makeSetterFunctionName(setting):
return "set" + uppercaseFirstN(setting.name, 1)


def makeGetterFunctionName(setting):
if setting.getter:
return setting.getter
return setting.name


def makePreferredConditional(conditional):
return conditional.split('|')[0]

@@ -131,15 +140,10 @@ def typeIsPrimitive(setting):
return False


def typeIsAggregate(setting):
# Special case supported aggregates (e.g. classes/structs)
def typeIsValueType(setting):
if setting.type == 'String':
return True
if setting.type == 'IntSize':
return True

# Everything else is an enum
# FIXME: Should we make it a requirement to annotate enums or classes/structs in someway?
return False


@@ -152,10 +156,12 @@ def includeForSetting(setting):
if typeIsPrimitive(setting):
return None

# Special case String, as it doesn't follow the pattern of being in a file with the
# Special case String and Seconds, as they doesn't follow the pattern of being in a file with the
# same name as the class.
if setting.type == 'String':
return "<wtf/text/WTFString.h>"
if setting.type == 'Seconds':
return "<wtf/Seconds.h>"

# Default to using the type name for the include.
return "\"" + setting.type + ".h\""
@@ -182,6 +188,8 @@ def parseInput(input):
setting.setNeedsStyleRecalcInAllFrames = value
if (name == 'include'):
setting.include = value
if (name == 'getter'):
setting.getter = value

# FIXME: ASSERT something about setting.initial

0 comments on commit 6cee667

Please sign in to comment.