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

Patch by Sam Weinig <sam@webkit.org> on 2017-10-18
Reviewed by Daniel Bates.

* Scripts/GenerateSettings/Settings.py:
(Setting.__init__):
(Setting.__str__):
(Setting.getterFunctionName):
(parseInput):

    Add support for parsing the 'getter' option.

* page/Settings.in:

    Migrate simple settings from SettingsBase to here.

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

    Remove simple settings.

Canonical link: https://commits.webkit.org/194676@main
git-svn-id: https://svn.webkit.org/repository/webkit/trunk@223624 268f45cc-cd09-0410-ab3c-d52691b4dbfc
  • Loading branch information
Sam Weinig authored and webkit-commit-queue committed Oct 18, 2017
1 parent b53290f commit 52d477e39f25759c54709dc3457abfe534653209
Showing with 116 additions and 178 deletions.
  1. +54 −0 Source/WebCore/ChangeLog
  2. +36 −33 Source/WebCore/Scripts/GenerateSettings/Settings.py
  3. +26 −2 Source/WebCore/page/Settings.in
  4. +0 −70 Source/WebCore/page/SettingsBase.cpp
  5. +0 −73 Source/WebCore/page/SettingsBase.h
@@ -1,3 +1,57 @@
2017-10-18 Sam Weinig <sam@webkit.org>

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

Reviewed by Daniel Bates.

* Scripts/GenerateSettings/Settings.py:
(Setting.__init__):
(Setting.__str__):
(Setting.getterFunctionName):
(parseInput):

Add support for parsing the 'getter' option.

* page/Settings.in:

Migrate simple settings from SettingsBase to here.

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

Remove simple settings.

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

[FrameView::layout cleanup] Move root/body marking dirty logic to a separate function
@@ -61,39 +61,38 @@ def license():
class Setting:
def __init__(self, name):
self.name = name
self.type = "bool"
self.type = 'bool'
self.initial = None
self.conditional = None
self.setNeedsStyleRecalcInAllFrames = None
self.getter = None

def __str__(self):
result = self.name + " TYPE:" + self.type
result = self.name + ' TYPE:' + self.type
if (self.initial):
result += " INIT:" + self.initial
result += ' INIT:' + self.initial
if (self.conditional):
result += " COND:" + self.conditional
result += ' COND:' + self.conditional
if (self.setNeedsStyleRecalcInAllFrames):
result += " RECALC:" + self.setNeedsStyleRecalcInAllFrames
result += ' RECALC:' + self.setNeedsStyleRecalcInAllFrames
if (self.getter):
result += ' GETTER:' + self.getter
return result

def hasComplexSetter(self):
if self.setNeedsStyleRecalcInAllFrames:
return True
return False
return self.setNeedsStyleRecalcInAllFrames

def typeIsValueType(self):
if self.type == 'String':
return False
return True
return self.type != 'String'

def setterFunctionName(self):
for prefix in ["css", "xss", "ftp", "dom"]:
for prefix in ['css', 'xss', 'ftp', 'dom']:
if self.name.startswith(prefix):
return "set" + uppercaseFirstN(self.name, len(prefix))
return "set" + uppercaseFirstN(self.name, 1)
return 'set' + uppercaseFirstN(self.name, len(prefix))
return 'set' + uppercaseFirstN(self.name, 1)

def getterFunctionName(self):
return self.name
return self.getter or self.name

def idlType(self):
# FIXME: Add support for more types including enumerate types.
@@ -122,32 +121,36 @@ def makePreferredConditional(conditional):

def makeConditionalString(conditional):
conditionals = conditional.split('|')
return "ENABLE(" + ") || ENABLE(".join(conditionals) + ")"
return 'ENABLE(' + ') || ENABLE('.join(conditionals) + ')'


def parseInput(input):
settings = {}
for line in open(input, "r"):
if not line.startswith("#") and not line.isspace():

(name, optionsString) = line.rstrip().split(' ', 1)
with open(input, 'r') as file:
for line in file:
if not line.startswith('#') and not line.isspace():

(name, optionsString) = line.rstrip().split(' ', 1)

options = re.split(r' *, *', optionsString)
options = re.split(r' *, *', optionsString)

setting = Setting(name)
for option in options:
(name, value) = re.split(r' *= *', option)
if (name == 'type'):
setting.type = value
if (name == 'initial'):
setting.initial = value
if (name == 'conditional'):
setting.conditional = value
if (name == 'setNeedsStyleRecalcInAllFrames'):
setting.setNeedsStyleRecalcInAllFrames = value
setting = Setting(name)
for option in options:
(name, value) = re.split(r' *= *', option)
if (name == 'type'):
setting.type = value
if (name == 'initial'):
setting.initial = value
if (name == 'conditional'):
setting.conditional = value
if (name == 'setNeedsStyleRecalcInAllFrames'):
setting.setNeedsStyleRecalcInAllFrames = value
if (name == 'getter'):
setting.getter = value

# FIXME: ASSERT something about setting.initial
# FIXME: ASSERT something about setting.initial

settings[setting.name] = setting
settings[setting.name] = setting

return settings
@@ -66,6 +66,7 @@ acceleratedCompositedAnimationsEnabled initial=true, setNeedsStyleRecalcInAllFra
showDebugBorders initial=false, setNeedsStyleRecalcInAllFrames=1
showRepaintCounter initial=false, setNeedsStyleRecalcInAllFrames=1
visibleDebugOverlayRegions type=DebugOverlayRegions, initial=0
showTiledScrollingIndicator initial=false

# This is a quirk we are pro-actively applying to old applications. It changes keyboard event dispatching,
# making keyIdentifier available on keypress events, making charCode available on keydown/keyup events,
@@ -303,10 +304,33 @@ viewportFitEnabled initial=false

allowMediaContentTypesRequiringHardwareSupportAsFallback initial=false

paymentRequestEnabled initial=false, conditional=PAYMENT_REQUEST
storageAccessAPIEnabled initial=false

timeWithoutMouseMovementBeforeHidingControls type=Seconds, initial=3_s

fontFallbackPrefersPictographs initial=false, setNeedsStyleRecalcInAllFrames=1

fontLoadTimingOverride type=FontLoadTimingOverride, initial=FontLoadTimingOverride::None
shouldIgnoreFontLoadCompletions initial=false

storageAccessAPIEnabled initial=false
paymentRequestEnabled initial=false, conditional=PAYMENT_REQUEST
applePayEnabled initial=false, conditional=APPLE_PAY
applePayCapabilityDisclosureAllowed initial=true, conditional=APPLE_PAY

javaEnabled initial=false, getter=isJavaEnabled
javaEnabledForLocalFiles initial=true, getter=isJavaEnabledForLocalFiles

fontRenderingMode type=FontRenderingMode, initial=FontRenderingMode::Normal

preferMIMETypeForImages initial=false

forcePendingWebGLPolicy initial=false, getter=isForcePendingWebGLPolicy

mediaKeysStorageDirectory type=String, conditional=LEGACY_ENCRYPTED_MEDIA
mediaDeviceIdentifierStorageDirectory type=String, conditional=MEDIA_STREAM

# FIXME: This quirk is needed because of Radar 4674537 and 5211271. We need to phase it out once Adobe
# can fix the bug from their end.
needsAdobeFrameReloadingQuirk initial=false, getter=needsAcrobatFrameReloadingQuirk

touchEventEmulationEnabled initial=false, getter=isTouchEventEmulationEnabled, conditional=TOUCH_EVENTS
@@ -146,28 +146,17 @@ SettingsBase::SettingsBase(Page* page)
, m_fontGenericFamilies(std::make_unique<FontGenericFamilies>())
, m_layoutInterval(layoutScheduleThreshold)
, m_minimumDOMTimerInterval(DOMTimer::defaultMinimumInterval())
, m_isJavaEnabled(false)
, m_isJavaEnabledForLocalFiles(true)
, m_loadsImagesAutomatically(false)
, m_areImagesEnabled(true)
, m_preferMIMETypeForImages(false)
, m_arePluginsEnabled(false)
, m_isScriptEnabled(false)
, m_needsAdobeFrameReloadingQuirk(false)
, m_usesPageCache(false)
, m_fontRenderingMode(0)
, m_showTiledScrollingIndicator(false)
, m_backgroundShouldExtendBeyondPage(false)
, m_dnsPrefetchingEnabled(false)
#if ENABLE(TOUCH_EVENTS)
, m_touchEventEmulationEnabled(false)
#endif
, m_scrollingPerformanceLoggingEnabled(false)
, m_setImageLoadingSettingsTimer(*this, &SettingsBase::imageLoadingSettingsTimerFired)
, m_hiddenPageDOMTimerThrottlingEnabled(false)
, m_hiddenPageCSSAnimationSuspensionEnabled(false)
, m_fontFallbackPrefersPictographs(false)
, m_forcePendingWebGLPolicy(false)
{
// A Frame may not have been created yet, so we initialize the AtomicString
// hash before trying to use it.
@@ -334,16 +323,6 @@ void SettingsBase::setScriptEnabled(bool isScriptEnabled)
#endif
}

void SettingsBase::setJavaEnabled(bool isJavaEnabled)
{
m_isJavaEnabled = isJavaEnabled;
}

void SettingsBase::setJavaEnabledForLocalFiles(bool isJavaEnabledForLocalFiles)
{
m_isJavaEnabledForLocalFiles = isJavaEnabledForLocalFiles;
}

void SettingsBase::setImagesEnabled(bool areImagesEnabled)
{
m_areImagesEnabled = areImagesEnabled;
@@ -352,16 +331,6 @@ void SettingsBase::setImagesEnabled(bool areImagesEnabled)
m_setImageLoadingSettingsTimer.startOneShot(0_s);
}

void SettingsBase::setPreferMIMETypeForImages(bool preferMIMETypeForImages)
{
m_preferMIMETypeForImages = preferMIMETypeForImages;
}

void SettingsBase::setForcePendingWebGLPolicy(bool forced)
{
m_forcePendingWebGLPolicy = forced;
}

void SettingsBase::setPluginsEnabled(bool arePluginsEnabled)
{
if (m_arePluginsEnabled == arePluginsEnabled)
@@ -382,13 +351,6 @@ void SettingsBase::setUserStyleSheetLocation(const URL& userStyleSheetLocation)
m_page->userStyleSheetLocationChanged();
}

// FIXME: This quirk is needed because of Radar 4674537 and 5211271. We need to phase it out once Adobe
// can fix the bug from their end.
void SettingsBase::setNeedsAdobeFrameReloadingQuirk(bool shouldNotReloadIFramesForUnchangedSRC)
{
m_needsAdobeFrameReloadingQuirk = shouldNotReloadIFramesForUnchangedSRC;
}

void SettingsBase::setMinimumDOMTimerInterval(Seconds interval)
{
auto oldTimerInterval = std::exchange(m_minimumDOMTimerInterval, interval);
@@ -423,20 +385,6 @@ void SettingsBase::setUsesPageCache(bool usesPageCache)
PageCache::singleton().pruneToSizeNow(0, PruningReason::None);
}

void SettingsBase::setFontRenderingMode(FontRenderingMode mode)
{
if (fontRenderingMode() == mode)
return;
m_fontRenderingMode = static_cast<int>(mode);
if (m_page)
m_page->setNeedsRecalcStyleInAllFrames();
}

FontRenderingMode SettingsBase::fontRenderingMode() const
{
return static_cast<FontRenderingMode>(m_fontRenderingMode);
}

void SettingsBase::setDNSPrefetchingEnabled(bool dnsPrefetchingEnabled)
{
if (m_dnsPrefetchingEnabled == dnsPrefetchingEnabled)
@@ -447,14 +395,6 @@ void SettingsBase::setDNSPrefetchingEnabled(bool dnsPrefetchingEnabled)
m_page->dnsPrefetchingStateChanged();
}

void SettingsBase::setShowTiledScrollingIndicator(bool enabled)
{
if (m_showTiledScrollingIndicator == enabled)
return;

m_showTiledScrollingIndicator = enabled;
}

#if ENABLE(RESOURCE_USAGE)
void SettingsBase::setResourceUsageOverlayVisible(bool visible)
{
@@ -640,16 +580,6 @@ void SettingsBase::setHiddenPageCSSAnimationSuspensionEnabled(bool flag)
m_page->hiddenPageCSSAnimationSuspensionStateChanged();
}

void SettingsBase::setFontFallbackPrefersPictographs(bool preferPictographs)
{
if (m_fontFallbackPrefersPictographs == preferPictographs)
return;

m_fontFallbackPrefersPictographs = preferPictographs;
if (m_page)
m_page->setNeedsRecalcStyleInAllFrames();
}

void SettingsBase::setLowPowerVideoAudioBufferSizeEnabled(bool flag)
{
gLowPowerVideoAudioBufferSizeEnabled = flag;

0 comments on commit 52d477e

Please sign in to comment.