Diff
Modified: trunk/Source/WebCore/ChangeLog (223652 => 223653)
--- trunk/Source/WebCore/ChangeLog 2017-10-19 03:29:51 UTC (rev 223652)
+++ trunk/Source/WebCore/ChangeLog 2017-10-19 04:08:39 UTC (rev 223653)
@@ -1,3 +1,41 @@
+2017-10-18 Sam Weinig <[email protected]>
+
+ [Settings] Convert more settings to be generated
+ https://bugs.webkit.org/show_bug.cgi?id=177766
+
+ Reviewed by Dean Jackson.
+
+ - Replaces setNeedsStyleRecalcInAllFrames option in Settings.in
+ with a more generic, onChange, which allows you to specify a function
+ in SettingsBase that will be called when the setting changes.
+ setNeedsStyleRecalcInAllFrames is then reimplemented in terms of
+ onChange.
+ - Moves most (all but two) of the remaining non-static settings from
+ SettingsBase to Settings.in
+
+ * Scripts/GenerateSettings/GenerateSettingsImplementationFile.py:
+ (printSetterBody):
+ * Scripts/GenerateSettings/Settings.py:
+ (Setting.__init__):
+ (Setting.__str__):
+ (Setting.typeIsValueType):
+ (Setting.setterFunctionName):
+ (Setting.setterChangeFunctionName):
+ (Setting.hasComplexSetter):
+ (parseInput):
+
+ Add support for the onChange option.
+
+ * page/Settings.in:
+
+ Migrate most of the remaining non-static settings to Settings.in.
+ Adopt onChange option.
+
+ * page/SettingsBase.cpp:
+ * page/SettingsBase.h:
+
+ Add helper functions for use by the onChange option.
+
2017-10-18 Chris Dumez <[email protected]>
Implement ServiceWorkerRegistration.scope / updateViaCache
Modified: trunk/Source/WebCore/Scripts/GenerateSettings/GenerateSettingsImplementationFile.py (223652 => 223653)
--- trunk/Source/WebCore/Scripts/GenerateSettings/GenerateSettingsImplementationFile.py 2017-10-19 03:29:51 UTC (rev 223652)
+++ trunk/Source/WebCore/Scripts/GenerateSettings/GenerateSettingsImplementationFile.py 2017-10-19 04:08:39 UTC (rev 223653)
@@ -151,6 +151,7 @@
return
setterFunctionName = setting.setterFunctionName()
+ changeFunctionName = setting.setterChangeFunctionName()
if setting.typeIsValueType():
outputFile.write("void Settings::" + setterFunctionName + "(" + setting.type + " " + setting.name + ")\n")
@@ -161,7 +162,7 @@
outputFile.write(" if (m_" + setting.name + " == " + setting.name + ")\n")
outputFile.write(" return;\n")
outputFile.write(" m_" + setting.name + " = " + setting.name + ";\n")
- outputFile.write(" m_page->setNeedsRecalcStyleInAllFrames();\n")
+ outputFile.write(" " + changeFunctionName + "();\n")
outputFile.write("}\n\n")
Modified: trunk/Source/WebCore/Scripts/GenerateSettings/Settings.py (223652 => 223653)
--- trunk/Source/WebCore/Scripts/GenerateSettings/Settings.py 2017-10-19 03:29:51 UTC (rev 223652)
+++ trunk/Source/WebCore/Scripts/GenerateSettings/Settings.py 2017-10-19 04:08:39 UTC (rev 223653)
@@ -64,7 +64,7 @@
self.type = 'bool'
self.initial = None
self.conditional = None
- self.setNeedsStyleRecalcInAllFrames = None
+ self._onChange_ = None
self.getter = None
def __str__(self):
@@ -73,20 +73,21 @@
result += ' INIT:' + self.initial
if (self.conditional):
result += ' COND:' + self.conditional
- if (self.setNeedsStyleRecalcInAllFrames):
- result += ' RECALC:' + self.setNeedsStyleRecalcInAllFrames
+ if (self.onChange):
+ result += ' CHANGE:' + self.onChange
if (self.getter):
result += ' GETTER:' + self.getter
return result
- def hasComplexSetter(self):
- return self.setNeedsStyleRecalcInAllFrames
-
def typeIsValueType(self):
- return self.type != 'String'
+ if self.type == 'String':
+ return False
+ if self.type == 'URL':
+ return False
+ return True
def setterFunctionName(self):
- for prefix in ['css', 'xss', 'ftp', 'dom']:
+ for prefix in ['css', 'xss', 'ftp', 'dom', 'dns']:
if self.name.startswith(prefix):
return 'set' + uppercaseFirstN(self.name, len(prefix))
return 'set' + uppercaseFirstN(self.name, 1)
@@ -94,6 +95,12 @@
def getterFunctionName(self):
return self.getter or self.name
+ def setterChangeFunctionName(self):
+ return self.onChange
+
+ def hasComplexSetter(self):
+ return self.onChange != None
+
def idlType(self):
# FIXME: Add support for more types including enumerate types.
if self.type == 'int':
@@ -144,8 +151,8 @@
setting.initial = value
if (name == 'conditional'):
setting.conditional = value
- if (name == 'setNeedsStyleRecalcInAllFrames'):
- setting.setNeedsStyleRecalcInAllFrames = value
+ if (name == 'onChange'):
+ setting._onChange_ = value
if (name == 'getter'):
setting.getter = value
Modified: trunk/Source/WebCore/page/Settings.in (223652 => 223653)
--- trunk/Source/WebCore/page/Settings.in 2017-10-19 03:29:51 UTC (rev 223652)
+++ trunk/Source/WebCore/page/Settings.in 2017-10-19 04:08:39 UTC (rev 223653)
@@ -35,10 +35,10 @@
# since the memory used won't be released until the Page is destroyed.
sessionStorageQuota type=unsigned, initial=StorageMap::noQuota
-minimumFontSize type=int, initial=0, setNeedsStyleRecalcInAllFrames=1
-minimumLogicalFontSize type=int, initial=0, setNeedsStyleRecalcInAllFrames=1
-defaultFontSize type=int, initial=16, setNeedsStyleRecalcInAllFrames=1
-defaultFixedFontSize type=int, initial=0, setNeedsStyleRecalcInAllFrames=1
+minimumFontSize type=int, initial=0, _onChange_=setNeedsRecalcStyleInAllFrames
+minimumLogicalFontSize type=int, initial=0, _onChange_=setNeedsRecalcStyleInAllFrames
+defaultFontSize type=int, initial=16, _onChange_=setNeedsRecalcStyleInAllFrames
+defaultFixedFontSize type=int, initial=0, _onChange_=setNeedsRecalcStyleInAllFrames
editingBehaviorType type=EditingBehaviorType, initial=editingBehaviorTypeForPlatform()
maximumHTMLParserDOMTreeDepth type=unsigned, initial=defaultMaximumHTMLParserDOMTreeDepth
@@ -59,14 +59,16 @@
usesDashboardBackwardCompatibilityMode initial=false, conditional=DASHBOARD_SUPPORT
clipboardAccessPolicy type=ClipboardAccessPolicy, initial=ClipboardAccessPolicy::RequiresUserGesture
-textAreasAreResizable initial=false, setNeedsStyleRecalcInAllFrames=1
-authorAndUserStylesEnabled initial=true, setNeedsStyleRecalcInAllFrames=1
-acceleratedCompositingEnabled initial=true, setNeedsStyleRecalcInAllFrames=1
-acceleratedCompositedAnimationsEnabled initial=true, setNeedsStyleRecalcInAllFrames=1
-showDebugBorders initial=false, setNeedsStyleRecalcInAllFrames=1
-showRepaintCounter initial=false, setNeedsStyleRecalcInAllFrames=1
+textAreasAreResizable initial=false, _onChange_=setNeedsRecalcStyleInAllFrames
+authorAndUserStylesEnabled initial=true, _onChange_=setNeedsRecalcStyleInAllFrames
+userStyleSheetLocation type=URL, _onChange_=userStyleSheetLocationChanged
+acceleratedCompositingEnabled initial=true, _onChange_=setNeedsRecalcStyleInAllFrames
+acceleratedCompositedAnimationsEnabled initial=true, _onChange_=setNeedsRecalcStyleInAllFrames
+showDebugBorders initial=false, _onChange_=setNeedsRecalcStyleInAllFrames
+showRepaintCounter initial=false, _onChange_=setNeedsRecalcStyleInAllFrames
visibleDebugOverlayRegions type=DebugOverlayRegions, initial=0
showTiledScrollingIndicator initial=false
+resourceUsageOverlayVisible initial=false, _onChange_=resourceUsageOverlayVisibleChanged, condition=RESOURCE_USAGE
# 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,
@@ -199,13 +201,13 @@
useLegacyBackgroundSizeShorthandBehavior initial=false
fixedBackgroundsPaintRelativeToDocument initial=defaultFixedBackgroundsPaintRelativeToDocument
-textAutosizingEnabled initial=defaultTextAutosizingEnabled(), setNeedsStyleRecalcInAllFrames=1, conditional=TEXT_AUTOSIZING
-textAutosizingWindowSizeOverride type=IntSize, setNeedsStyleRecalcInAllFrames=1, conditional=TEXT_AUTOSIZING
+textAutosizingEnabled initial=defaultTextAutosizingEnabled(), _onChange_=setNeedsRecalcStyleInAllFrames, conditional=TEXT_AUTOSIZING
+textAutosizingWindowSizeOverride type=IntSize, _onChange_=setNeedsRecalcStyleInAllFrames, conditional=TEXT_AUTOSIZING
minimumZoomFontSize type=float, initial=defaultMinimumZoomFontSize(), conditional=TEXT_AUTOSIZING
-subpixelAntialiasedLayerTextEnabled initial=false, setNeedsStyleRecalcInAllFrames=1
-simpleLineLayoutEnabled initial=true, setNeedsStyleRecalcInAllFrames=1
-simpleLineLayoutDebugBordersEnabled initial=false, setNeedsStyleRecalcInAllFrames=1
+subpixelAntialiasedLayerTextEnabled initial=false, _onChange_=setNeedsRecalcStyleInAllFrames
+simpleLineLayoutEnabled initial=true, _onChange_=setNeedsRecalcStyleInAllFrames
+simpleLineLayoutDebugBordersEnabled initial=false, _onChange_=setNeedsRecalcStyleInAllFrames
subpixelCSSOMElementMetricsEnabled initial=false
@@ -271,7 +273,7 @@
mediaPreloadingEnabled initial=false
# Runtime-enabled features
-visualViewportEnabled initial=false, setNeedsStyleRecalcInAllFrames=1
+visualViewportEnabled initial=false, _onChange_=setNeedsRecalcStyleInAllFrames
inputEventsEnabled initial=true
@@ -308,7 +310,7 @@
timeWithoutMouseMovementBeforeHidingControls type=Seconds, initial=3_s
-fontFallbackPrefersPictographs initial=false, setNeedsStyleRecalcInAllFrames=1
+fontFallbackPrefersPictographs initial=false, _onChange_=setNeedsRecalcStyleInAllFrames
fontLoadTimingOverride type=FontLoadTimingOverride, initial=FontLoadTimingOverride::None
shouldIgnoreFontLoadCompletions initial=false
@@ -320,6 +322,31 @@
javaEnabled initial=false, getter=isJavaEnabled
javaEnabledForLocalFiles initial=true, getter=isJavaEnabledForLocalFiles
+# Unlike the imagesEnabled setting, this only suppresses the network load of
+# the image URL. A cached image will still be rendered if requested.
+loadsImagesAutomatically initial=false, _onChange_=imagesEnabledChanged
+imagesEnabled initial=true, getter=areImagesEnabled, _onChange_=imagesEnabledChanged
+scriptEnabled initial=false, getter=isScriptEnabled, _onChange_=scriptEnabledChanged
+pluginsEnabled initial=false, getter=arePluginsEnabled, _onChange_=pluginsEnabledChanged
+
+usesPageCache initial=false, _onChange_=usesPageCacheChanged
+
+dnsPrefetchingEnabled initial=false, _onChange_=dnsPrefetchingEnabledChanged
+
+backgroundShouldExtendBeyondPage initial=false, _onChange_=backgroundShouldExtendBeyondPageChanged
+
+scrollingPerformanceLoggingEnabled initial=false, _onChange_=scrollingPerformanceLoggingEnabledChanged
+
+hiddenPageDOMTimerThrottlingEnabled initial=false, _onChange_=hiddenPageDOMTimerThrottlingStateChanged
+hiddenPageDOMTimerThrottlingAutoIncreases initial=false, _onChange_=hiddenPageDOMTimerThrottlingStateChanged
+hiddenPageCSSAnimationSuspensionEnabled initial=false, _onChange_=hiddenPageCSSAnimationSuspensionEnabledChanged
+
+storageBlockingPolicy type=SecurityOrigin::StorageBlockingPolicy, initial=SecurityOrigin::AllowAllStorage, _onChange_=storageBlockingPolicyChanged
+
+# Only set by Layout Tests.
+mediaTypeOverride type=String, initial="screen", _onChange_=mediaTypeOverrideChanged
+
+
fontRenderingMode type=FontRenderingMode, initial=FontRenderingMode::Normal
preferMIMETypeForImages initial=false
Modified: trunk/Source/WebCore/page/SettingsBase.cpp (223652 => 223653)
--- trunk/Source/WebCore/page/SettingsBase.cpp 2017-10-19 03:29:51 UTC (rev 223652)
+++ trunk/Source/WebCore/page/SettingsBase.cpp 2017-10-19 04:08:39 UTC (rev 223653)
@@ -63,19 +63,6 @@
namespace WebCore {
-static void setImageLoadingSettings(Page* page)
-{
- if (!page)
- return;
-
- for (Frame* frame = &page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
- if (!frame->document())
- continue;
- frame->document()->cachedResourceLoader().setImagesEnabled(page->settings().areImagesEnabled());
- frame->document()->cachedResourceLoader().setAutoLoadImages(page->settings().loadsImagesAutomatically());
- }
-}
-
static void invalidateAfterGenericFamilyChange(Page* page)
{
invalidateFontCascadeCache();
@@ -146,17 +133,7 @@
, m_fontGenericFamilies(std::make_unique<FontGenericFamilies>())
, m_layoutInterval(layoutScheduleThreshold)
, m_minimumDOMTimerInterval(DOMTimer::defaultMinimumInterval())
- , m_loadsImagesAutomatically(false)
- , m_areImagesEnabled(true)
- , m_arePluginsEnabled(false)
- , m_isScriptEnabled(false)
- , m_usesPageCache(false)
- , m_backgroundShouldExtendBeyondPage(false)
- , m_dnsPrefetchingEnabled(false)
- , m_scrollingPerformanceLoggingEnabled(false)
, m_setImageLoadingSettingsTimer(*this, &SettingsBase::imageLoadingSettingsTimerFired)
- , m_hiddenPageDOMTimerThrottlingEnabled(false)
- , m_hiddenPageCSSAnimationSuspensionEnabled(false)
{
// A Frame may not have been created yet, so we initialize the AtomicString
// hash before trying to use it.
@@ -272,85 +249,6 @@
}
#endif
-void SettingsBase::setMediaTypeOverride(const String& mediaTypeOverride)
-{
- if (m_mediaTypeOverride == mediaTypeOverride)
- return;
-
- m_mediaTypeOverride = mediaTypeOverride;
-
- if (!m_page)
- return;
-
- FrameView* view = m_page->mainFrame().view();
- ASSERT(view);
-
- view->setMediaType(mediaTypeOverride);
- m_page->setNeedsRecalcStyleInAllFrames();
-}
-
-void SettingsBase::setLoadsImagesAutomatically(bool loadsImagesAutomatically)
-{
- m_loadsImagesAutomatically = loadsImagesAutomatically;
-
- // Changing this setting to true might immediately start new loads for images that had previously had loading disabled.
- // If this happens while a WebView is being dealloc'ed, and we don't know the WebView is being dealloc'ed, these new loads
- // can cause crashes downstream when the WebView memory has actually been free'd.
- // One example where this can happen is in Mac apps that subclass WebView then do work in their overridden dealloc methods.
- // Starting these loads synchronously is not important. By putting it on a 0-delay, properly closing the Page cancels them
- // before they have a chance to really start.
- // See http://webkit.org/b/60572 for more discussion.
- m_setImageLoadingSettingsTimer.startOneShot(0_s);
-}
-
-void SettingsBase::imageLoadingSettingsTimerFired()
-{
- setImageLoadingSettings(m_page);
-}
-
-void SettingsBase::setScriptEnabled(bool isScriptEnabled)
-{
- if (m_isScriptEnabled == isScriptEnabled)
- return;
-
- m_isScriptEnabled = isScriptEnabled;
-
- if (!m_page)
- return;
-
-#if PLATFORM(IOS)
- m_page->setNeedsRecalcStyleInAllFrames();
-#endif
-}
-
-void SettingsBase::setImagesEnabled(bool areImagesEnabled)
-{
- m_areImagesEnabled = areImagesEnabled;
-
- // See comment in setLoadsImagesAutomatically.
- m_setImageLoadingSettingsTimer.startOneShot(0_s);
-}
-
-void SettingsBase::setPluginsEnabled(bool arePluginsEnabled)
-{
- if (m_arePluginsEnabled == arePluginsEnabled)
- return;
-
- m_arePluginsEnabled = arePluginsEnabled;
- Page::refreshPlugins(false);
-}
-
-void SettingsBase::setUserStyleSheetLocation(const URL& userStyleSheetLocation)
-{
- if (m_userStyleSheetLocation == userStyleSheetLocation)
- return;
-
- m_userStyleSheetLocation = userStyleSheetLocation;
-
- if (m_page)
- m_page->userStyleSheetLocationChanged();
-}
-
void SettingsBase::setMinimumDOMTimerInterval(Seconds interval)
{
auto oldTimerInterval = std::exchange(m_minimumDOMTimerInterval, interval);
@@ -371,42 +269,6 @@
m_layoutInterval = std::max(layoutInterval, layoutScheduleThreshold);
}
-void SettingsBase::setUsesPageCache(bool usesPageCache)
-{
- if (m_usesPageCache == usesPageCache)
- return;
-
- m_usesPageCache = usesPageCache;
-
- if (!m_page)
- return;
-
- if (!m_usesPageCache)
- PageCache::singleton().pruneToSizeNow(0, PruningReason::None);
-}
-
-void SettingsBase::setDNSPrefetchingEnabled(bool dnsPrefetchingEnabled)
-{
- if (m_dnsPrefetchingEnabled == dnsPrefetchingEnabled)
- return;
-
- m_dnsPrefetchingEnabled = dnsPrefetchingEnabled;
- if (m_page)
- m_page->dnsPrefetchingStateChanged();
-}
-
-#if ENABLE(RESOURCE_USAGE)
-void SettingsBase::setResourceUsageOverlayVisible(bool visible)
-{
- if (m_resourceUsageOverlayVisible == visible)
- return;
-
- m_resourceUsageOverlayVisible = visible;
- if (m_page)
- m_page->setResourceUsageOverlayVisible(visible);
-}
-#endif
-
#if PLATFORM(WIN)
void SettingsBase::setShouldUseHighResolutionTimers(bool shouldUseHighResolutionTimers)
{
@@ -414,27 +276,6 @@
}
#endif
-void SettingsBase::setStorageBlockingPolicy(SecurityOrigin::StorageBlockingPolicy enabled)
-{
- if (m_storageBlockingPolicy == enabled)
- return;
-
- m_storageBlockingPolicy = enabled;
- if (m_page)
- m_page->storageBlockingStateChanged();
-}
-
-void SettingsBase::setBackgroundShouldExtendBeyondPage(bool shouldExtend)
-{
- if (m_backgroundShouldExtendBeyondPage == shouldExtend)
- return;
-
- m_backgroundShouldExtendBeyondPage = shouldExtend;
-
- if (m_page)
- m_page->mainFrame().view()->updateExtendBackgroundIfNecessary();
-}
-
#if USE(AVFOUNDATION)
void SettingsBase::setAVFoundationEnabled(bool enabled)
{
@@ -499,14 +340,6 @@
}
#endif
-void SettingsBase::setScrollingPerformanceLoggingEnabled(bool enabled)
-{
- m_scrollingPerformanceLoggingEnabled = enabled;
-
- if (m_page && m_page->mainFrame().view())
- m_page->mainFrame().view()->setScrollingPerformanceLoggingEnabled(enabled);
-}
-
// It's very important that this setting doesn't change in the middle of a document's lifetime.
// The Mac port uses this flag when registering and deregistering platform-dependent scrollbar
// objects. Therefore, if this changes at an unexpected time, deregistration may not happen
@@ -553,33 +386,6 @@
return gShouldRespectPriorityInCSSAttributeSetters;
}
-void SettingsBase::setHiddenPageDOMTimerThrottlingEnabled(bool flag)
-{
- if (m_hiddenPageDOMTimerThrottlingEnabled == flag)
- return;
- m_hiddenPageDOMTimerThrottlingEnabled = flag;
- if (m_page)
- m_page->hiddenPageDOMTimerThrottlingStateChanged();
-}
-
-void SettingsBase::setHiddenPageDOMTimerThrottlingAutoIncreases(bool flag)
-{
- if (m_hiddenPageDOMTimerThrottlingAutoIncreases == flag)
- return;
- m_hiddenPageDOMTimerThrottlingAutoIncreases = flag;
- if (m_page)
- m_page->hiddenPageDOMTimerThrottlingStateChanged();
-}
-
-void SettingsBase::setHiddenPageCSSAnimationSuspensionEnabled(bool flag)
-{
- if (m_hiddenPageCSSAnimationSuspensionEnabled == flag)
- return;
- m_hiddenPageCSSAnimationSuspensionEnabled = flag;
- if (m_page)
- m_page->hiddenPageCSSAnimationSuspensionStateChanged();
-}
-
void SettingsBase::setLowPowerVideoAudioBufferSizeEnabled(bool flag)
{
gLowPowerVideoAudioBufferSizeEnabled = flag;
@@ -668,4 +474,122 @@
m_mediaContentTypesRequiringHardwareSupport = contentTypes;
}
+
+
+// MARK - onChange handlers
+
+void SettingsBase::setNeedsRecalcStyleInAllFrames()
+{
+ if (m_page)
+ m_page->setNeedsRecalcStyleInAllFrames();
+}
+
+void SettingsBase::mediaTypeOverrideChanged()
+{
+ if (!m_page)
+ return;
+
+ FrameView* view = m_page->mainFrame().view();
+ if (view)
+ view->setMediaType(m_page->settings().mediaTypeOverride());
+
+ m_page->setNeedsRecalcStyleInAllFrames();
+}
+
+void SettingsBase::imagesEnabledChanged()
+{
+ // Changing this setting to true might immediately start new loads for images that had previously had loading disabled.
+ // If this happens while a WebView is being dealloc'ed, and we don't know the WebView is being dealloc'ed, these new loads
+ // can cause crashes downstream when the WebView memory has actually been free'd.
+ // One example where this can happen is in Mac apps that subclass WebView then do work in their overridden dealloc methods.
+ // Starting these loads synchronously is not important. By putting it on a 0-delay, properly closing the Page cancels them
+ // before they have a chance to really start.
+ // See http://webkit.org/b/60572 for more discussion.
+ m_setImageLoadingSettingsTimer.startOneShot(0_s);
+}
+
+void SettingsBase::imageLoadingSettingsTimerFired()
+{
+ if (!m_page)
+ return;
+
+ for (Frame* frame = &m_page->mainFrame(); frame; frame = frame->tree().traverseNext()) {
+ if (!frame->document())
+ continue;
+ frame->document()->cachedResourceLoader().setImagesEnabled(m_page->settings().areImagesEnabled());
+ frame->document()->cachedResourceLoader().setAutoLoadImages(m_page->settings().loadsImagesAutomatically());
+ }
+}
+
+void SettingsBase::scriptEnabledChanged()
+{
+#if PLATFORM(IOS)
+ // FIXME: Why do we only do this on iOS?
+ if (m_page)
+ m_page->setNeedsRecalcStyleInAllFrames();
+#endif
+}
+
+void SettingsBase::pluginsEnabledChanged()
+{
+ Page::refreshPlugins(false);
+}
+
+void SettingsBase::userStyleSheetLocationChanged()
+{
+ if (m_page)
+ m_page->userStyleSheetLocationChanged();
+}
+
+void SettingsBase::usesPageCacheChanged()
+{
+ if (!m_page)
+ return;
+
+ if (!m_page->settings().usesPageCache())
+ PageCache::singleton().pruneToSizeNow(0, PruningReason::None);
+}
+
+void SettingsBase::dnsPrefetchingEnabledChanged()
+{
+ if (m_page)
+ m_page->dnsPrefetchingStateChanged();
+}
+
+void SettingsBase::resourceUsageOverlayVisibleChanged()
+{
+ if (m_page)
+ m_page->setResourceUsageOverlayVisible(m_page->settings().resourceUsageOverlayVisible());
+}
+
+void SettingsBase::storageBlockingPolicyChanged()
+{
+ if (m_page)
+ m_page->storageBlockingStateChanged();
+}
+
+void SettingsBase::backgroundShouldExtendBeyondPageChanged()
+{
+ if (m_page)
+ m_page->mainFrame().view()->updateExtendBackgroundIfNecessary();
+}
+
+void SettingsBase::scrollingPerformanceLoggingEnabledChanged()
+{
+ if (m_page && m_page->mainFrame().view())
+ m_page->mainFrame().view()->setScrollingPerformanceLoggingEnabled(m_page->settings().scrollingPerformanceLoggingEnabled());
+}
+
+void SettingsBase::hiddenPageDOMTimerThrottlingStateChanged()
+{
+ if (m_page)
+ m_page->hiddenPageDOMTimerThrottlingStateChanged();
+}
+
+void SettingsBase::hiddenPageCSSAnimationSuspensionEnabledChanged()
+{
+ if (m_page)
+ m_page->hiddenPageCSSAnimationSuspensionStateChanged();
+}
+
} // namespace WebCore
Modified: trunk/Source/WebCore/page/SettingsBase.h (223652 => 223653)
--- trunk/Source/WebCore/page/SettingsBase.h 2017-10-19 03:29:51 UTC (rev 223652)
+++ trunk/Source/WebCore/page/SettingsBase.h 2017-10-19 04:08:39 UTC (rev 223653)
@@ -131,37 +131,6 @@
WEBCORE_EXPORT void setPictographFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
WEBCORE_EXPORT const AtomicString& pictographFontFamily(UScriptCode = USCRIPT_COMMON) const;
- WEBCORE_EXPORT static bool defaultTextAutosizingEnabled();
- WEBCORE_EXPORT static float defaultMinimumZoomFontSize();
-
- // Only set by Layout Tests.
- WEBCORE_EXPORT void setMediaTypeOverride(const String&);
- const String& mediaTypeOverride() const { return m_mediaTypeOverride; }
-
- // Unlike areImagesEnabled, this only suppresses the network load of
- // the image URL. A cached image will still be rendered if requested.
- WEBCORE_EXPORT void setLoadsImagesAutomatically(bool);
- bool loadsImagesAutomatically() const { return m_loadsImagesAutomatically; }
-
- // Clients that execute script should call ScriptController::canExecuteScripts()
- // instead of this function. ScriptController::canExecuteScripts() checks the
- // HTML sandbox, plug-in sandboxing, and other important details.
- bool isScriptEnabled() const { return m_isScriptEnabled; }
- WEBCORE_EXPORT void setScriptEnabled(bool);
-
-
- WEBCORE_EXPORT void setImagesEnabled(bool);
- bool areImagesEnabled() const { return m_areImagesEnabled; }
-
- WEBCORE_EXPORT void setPluginsEnabled(bool);
- bool arePluginsEnabled() const { return m_arePluginsEnabled; }
-
- WEBCORE_EXPORT void setDNSPrefetchingEnabled(bool);
- bool dnsPrefetchingEnabled() const { return m_dnsPrefetchingEnabled; }
-
- WEBCORE_EXPORT void setUserStyleSheetLocation(const URL&);
- const URL& userStyleSheetLocation() const { return m_userStyleSheetLocation; }
-
WEBCORE_EXPORT void setMinimumDOMTimerInterval(Seconds); // Initialized to DOMTimer::defaultMinimumInterval().
Seconds minimumDOMTimerInterval() const { return m_minimumDOMTimerInterval; }
@@ -168,18 +137,9 @@
WEBCORE_EXPORT void setLayoutInterval(Seconds);
Seconds layoutInterval() const { return m_layoutInterval; }
- bool hiddenPageDOMTimerThrottlingEnabled() const { return m_hiddenPageDOMTimerThrottlingEnabled; }
- WEBCORE_EXPORT void setHiddenPageDOMTimerThrottlingEnabled(bool);
- bool hiddenPageDOMTimerThrottlingAutoIncreases() const { return m_hiddenPageDOMTimerThrottlingAutoIncreases; }
- WEBCORE_EXPORT void setHiddenPageDOMTimerThrottlingAutoIncreases(bool);
- WEBCORE_EXPORT void setUsesPageCache(bool);
- bool usesPageCache() const { return m_usesPageCache; }
-
-#if ENABLE(RESOURCE_USAGE)
- bool resourceUsageOverlayVisible() const { return m_resourceUsageOverlayVisible; }
- WEBCORE_EXPORT void setResourceUsageOverlayVisible(bool);
-#endif
+ WEBCORE_EXPORT static bool defaultTextAutosizingEnabled();
+ WEBCORE_EXPORT static float defaultMinimumZoomFontSize();
#if PLATFORM(WIN)
static void setShouldUseHighResolutionTimers(bool);
@@ -195,9 +155,6 @@
static bool globalConstRedeclarationShouldThrow();
- WEBCORE_EXPORT void setBackgroundShouldExtendBeyondPage(bool);
- bool backgroundShouldExtendBeyondPage() const { return m_backgroundShouldExtendBeyondPage; }
-
#if USE(AVFOUNDATION)
WEBCORE_EXPORT static void setAVFoundationEnabled(bool flag);
static bool isAVFoundationEnabled() { return gAVFoundationEnabled; }
@@ -229,18 +186,9 @@
WEBCORE_EXPORT static void setUsesMockScrollAnimator(bool);
static bool usesMockScrollAnimator();
- WEBCORE_EXPORT void setStorageBlockingPolicy(SecurityOrigin::StorageBlockingPolicy);
- SecurityOrigin::StorageBlockingPolicy storageBlockingPolicy() const { return m_storageBlockingPolicy; }
-
- WEBCORE_EXPORT void setScrollingPerformanceLoggingEnabled(bool);
- bool scrollingPerformanceLoggingEnabled() { return m_scrollingPerformanceLoggingEnabled; }
-
WEBCORE_EXPORT static void setShouldRespectPriorityInCSSAttributeSetters(bool);
static bool shouldRespectPriorityInCSSAttributeSetters();
- bool hiddenPageCSSAnimationSuspensionEnabled() const { return m_hiddenPageCSSAnimationSuspensionEnabled; }
- WEBCORE_EXPORT void setHiddenPageCSSAnimationSuspensionEnabled(bool);
-
static bool lowPowerVideoAudioBufferSizeEnabled() { return gLowPowerVideoAudioBufferSizeEnabled; }
WEBCORE_EXPORT static void setLowPowerVideoAudioBufferSizeEnabled(bool);
@@ -296,37 +244,34 @@
void initializeDefaultFontFamilies();
+ void imageLoadingSettingsTimerFired();
+
+ // Helpers used by generated Settings.cpp.
+ void setNeedsRecalcStyleInAllFrames();
+ void mediaTypeOverrideChanged();
+ void imagesEnabledChanged();
+ void scriptEnabledChanged();
+ void pluginsEnabledChanged();
+ void userStyleSheetLocationChanged();
+ void usesPageCacheChanged();
+ void dnsPrefetchingEnabledChanged();
+ void resourceUsageOverlayVisibleChanged();
+ void storageBlockingPolicyChanged();
+ void backgroundShouldExtendBeyondPageChanged();
+ void scrollingPerformanceLoggingEnabledChanged();
+ void hiddenPageDOMTimerThrottlingStateChanged();
+ void hiddenPageCSSAnimationSuspensionEnabledChanged();
+
Page* m_page;
- String m_mediaTypeOverride { "screen" };
- URL m_userStyleSheetLocation;
const std::unique_ptr<FontGenericFamilies> m_fontGenericFamilies;
- SecurityOrigin::StorageBlockingPolicy m_storageBlockingPolicy { SecurityOrigin::AllowAllStorage };
Seconds m_layoutInterval;
Seconds m_minimumDOMTimerInterval;
- bool m_loadsImagesAutomatically : 1;
- bool m_areImagesEnabled : 1;
- bool m_arePluginsEnabled : 1;
- bool m_isScriptEnabled : 1;
- bool m_usesPageCache : 1;
- bool m_showTiledScrollingIndicator : 1;
- bool m_backgroundShouldExtendBeyondPage : 1;
- bool m_dnsPrefetchingEnabled : 1;
- bool m_scrollingPerformanceLoggingEnabled : 1;
-
Timer m_setImageLoadingSettingsTimer;
- void imageLoadingSettingsTimerFired();
- bool m_hiddenPageDOMTimerThrottlingEnabled : 1;
- bool m_hiddenPageCSSAnimationSuspensionEnabled : 1;
+ Vector<ContentType> m_mediaContentTypesRequiringHardwareSupport;
-#if ENABLE(RESOURCE_USAGE)
- bool m_resourceUsageOverlayVisible { false };
-#endif
-
- bool m_hiddenPageDOMTimerThrottlingAutoIncreases { false };
-
#if USE(AVFOUNDATION)
WEBCORE_EXPORT static bool gAVFoundationEnabled;
WEBCORE_EXPORT static bool gAVFoundationNSURLSessionEnabled;
@@ -364,8 +309,6 @@
static bool gLowPowerVideoAudioBufferSizeEnabled;
static bool gResourceLoadStatisticsEnabledEnabled;
static bool gAllowsAnySSLCertificate;
-
- Vector<ContentType> m_mediaContentTypesRequiringHardwareSupport;
};
inline bool SettingsBase::isPostLoadCPUUsageMeasurementEnabled()