Document should always have a Settings.
authorakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Feb 2017 17:47:33 +0000 (17:47 +0000)
committerakling@apple.com <akling@apple.com@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Thu, 9 Feb 2017 17:47:33 +0000 (17:47 +0000)
<https://webkit.org/b/120172>

Reviewed by Antti Koivisto.

Since a Document can't move between Frames, and it's either frameless
or partnered with a Frame provided at construction time, we know that
it will never need to switch between different Settings objects either.

Give Document a Ref<Settings> that contains either the Frame's Settings
or a default-constructed Settings object if frameless.
Document::settings() is promoted to a reference getter.

The bulk of this patch is removing now-unnecessary null checks.

* Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
(WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory):
* Modules/plugins/PluginReplacement.h:
(WebCore::ReplacementPlugin::isEnabledBySettings):
* Modules/plugins/QuickTimePluginReplacement.h:
* Modules/plugins/QuickTimePluginReplacement.mm:
(WebCore::QuickTimePluginReplacement::isEnabledBySettings):
* Modules/plugins/YouTubePluginReplacement.cpp:
(WebCore::YouTubePluginReplacement::isEnabledBySettings):
* Modules/plugins/YouTubePluginReplacement.h:
* Modules/webaudio/AudioContext.cpp:
(WebCore::AudioContext::constructCommon):
* bindings/js/CachedScriptFetcher.cpp:
(WebCore::CachedScriptFetcher::requestScriptWithCache):
* css/CSSFontFace.cpp:
(WebCore::CSSFontFace::appendSources):
(WebCore::CSSFontFace::webFontsShouldAlwaysFallBack):
* css/CSSFontSelector.cpp:
(WebCore::CSSFontSelector::fallbackFontCount):
(WebCore::CSSFontSelector::fallbackFontAt):
* css/StyleBuilderConverter.h:
(WebCore::StyleBuilderConverter::convertResize):
* css/StyleBuilderCustom.h:
(WebCore::StyleBuilderCustom::applyValueFontFamily):
* css/StyleResolver.cpp:
(WebCore::StyleResolver::StyleResolver):
(WebCore::StyleResolver::defaultStyleForElement):
(WebCore::StyleResolver::adjustRenderStyle):
(WebCore::StyleResolver::checkForGenericFamilyChange):
(WebCore::StyleResolver::initializeFontStyle):
* css/StyleResolver.h:
(WebCore::StyleResolver::settings):
(WebCore::StyleResolver::documentSettings): Deleted.
* css/parser/CSSParser.cpp:
(WebCore::CSSParserContext::CSSParserContext):
* dom/Document.cpp:
(WebCore::Document::Document):
(WebCore::Document::setReadyState):
(WebCore::Document::setVisualUpdatesAllowed):
(WebCore::Document::defaultCharsetForLegacyBindings):
(WebCore::Document::recalcStyle):
(WebCore::Document::implicitClose):
(WebCore::Document::minimumLayoutDelay):
(WebCore::Document::setDomain):
(WebCore::Document::audioPlaybackRequiresUserGesture):
(WebCore::Document::videoPlaybackRequiresUserGesture):
(WebCore::Document::storageBlockingStateDidChange):
(WebCore::Document::isTelephoneNumberParsingEnabled):
(WebCore::Document::initSecurityContext):
(WebCore::Document::initDNSPrefetch):
(WebCore::Document::getCachedLocale):
(WebCore::Document::shouldEnforceContentDispositionAttachmentSandbox):
(WebCore::Document::settings): Deleted.
* dom/Document.h:
(WebCore::Document::settings):
* dom/Element.cpp:
(WebCore::subpixelMetricsEnabled):
* dom/ExtensionStyleSheets.cpp:
(WebCore::ExtensionStyleSheets::pageUserSheet):
* dom/ScriptExecutionContext.cpp:
(WebCore::ScriptExecutionContext::dispatchErrorEvent):
* dom/ScriptableDocumentParser.cpp:
(WebCore::ScriptableDocumentParser::ScriptableDocumentParser):
* dom/ScriptedAnimationController.cpp:
(WebCore::ScriptedAnimationController::requestAnimationFrameEnabled):
* dom/make_names.pl:
(printConstructorInterior):
* editing/Editor.cpp:
* editing/markup.cpp:
(WebCore::createMarkupInternal):
* html/FTPDirectoryDocument.cpp:
(WebCore::createTemplateDocumentData):
* html/HTMLAnchorElement.cpp:
(WebCore::HTMLAnchorElement::setActive):
(WebCore::HTMLAnchorElement::sendPings):
(WebCore::HTMLAnchorElement::treatLinkAsLiveForEventType):
* html/HTMLAppletElement.cpp:
(WebCore::HTMLAppletElement::canEmbedJava):
* html/HTMLCanvasElement.cpp:
(WebCore::HTMLCanvasElement::getContext2d):
(WebCore::shouldEnableWebGL):
(WebCore::HTMLCanvasElement::shouldAccelerate):
* html/HTMLFormElement.cpp:
(WebCore::HTMLFormElement::submitImplicitly):
* html/HTMLFrameElementBase.cpp:
(WebCore::HTMLFrameElementBase::setLocation):
* html/HTMLImageElement.cpp:
(WebCore::HTMLImageElement::updateImageControls):
* html/HTMLImageLoader.cpp:
(WebCore::HTMLImageLoader::sourceURI):
* html/HTMLInputElement.cpp:
(WebCore::HTMLInputElement::setupDateTimeChooserParameters):
* html/HTMLLinkElement.cpp:
(WebCore::HTMLLinkElement::process):
* html/HTMLMediaElement.cpp:
(WebCore::HTMLMediaElement::HTMLMediaElement):
(WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory):
(WebCore::HTMLMediaElement::mediaPlayerAcceleratedCompositingEnabled):
(WebCore::HTMLMediaElement::enterFullscreen):
(WebCore::HTMLMediaElement::exitFullscreen):
(WebCore::HTMLMediaElement::mediaPlayerNeedsSiteSpecificHacks):
(WebCore::HTMLMediaElement::mediaPlayerNetworkInterfaceName):
(WebCore::HTMLMediaElement::setMediaControlsDependOnPageScaleFactor):
(WebCore::HTMLMediaElement::doesHaveAttribute):
* html/HTMLVideoElement.cpp:
(WebCore::HTMLVideoElement::HTMLVideoElement):
* html/MediaElementSession.cpp:
(WebCore::MediaElementSession::wirelessVideoPlaybackDisabled):
(WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):
(WebCore::MediaElementSession::allowsAutomaticMediaDataLoading):
(WebCore::MediaElementSession::allowsPictureInPicture):
(WebCore::MediaElementSession::maximumMediaSourceBufferSize):
* html/parser/HTMLParserOptions.cpp:
(WebCore::HTMLParserOptions::HTMLParserOptions):
* html/shadow/MediaControlElements.cpp:
(WebCore::MediaControlFullscreenButtonElement::defaultEventHandler):
* loader/LinkLoader.cpp:
(WebCore::LinkLoader::loadLink):
* page/csp/ContentSecurityPolicy.cpp:
(WebCore::ContentSecurityPolicy::allowContentSecurityPolicySourceStarToMatchAnyProtocol):
* rendering/SimpleLineLayout.cpp:
(WebCore::SimpleLineLayout::toggleSimpleLineLayout):
* style/StyleFontSizeFunctions.cpp:
(WebCore::Style::computedFontSizeFromSpecifiedSize):
(WebCore::Style::fontSizeForKeyword):
(WebCore::Style::legacyFontSizeForPixelSize):
* style/StyleScope.cpp:
(WebCore::Style::Scope::collectActiveStyleSheets):
* xml/XMLHttpRequest.cpp:
(WebCore::XMLHttpRequest::usesDashboardBackwardCompatibilityMode):

git-svn-id: https://svn.webkit.org/repository/webkit/trunk@211964 268f45cc-cd09-0410-ab3c-d52691b4dbfc

47 files changed:
Source/WebCore/ChangeLog
Source/WebCore/Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp
Source/WebCore/Modules/plugins/PluginReplacement.h
Source/WebCore/Modules/plugins/QuickTimePluginReplacement.h
Source/WebCore/Modules/plugins/QuickTimePluginReplacement.mm
Source/WebCore/Modules/plugins/YouTubePluginReplacement.cpp
Source/WebCore/Modules/plugins/YouTubePluginReplacement.h
Source/WebCore/Modules/webaudio/AudioContext.cpp
Source/WebCore/bindings/js/CachedScriptFetcher.cpp
Source/WebCore/css/CSSFontFace.cpp
Source/WebCore/css/CSSFontSelector.cpp
Source/WebCore/css/StyleBuilderConverter.h
Source/WebCore/css/StyleBuilderCustom.h
Source/WebCore/css/StyleResolver.cpp
Source/WebCore/css/StyleResolver.h
Source/WebCore/css/parser/CSSParser.cpp
Source/WebCore/dom/Document.cpp
Source/WebCore/dom/Document.h
Source/WebCore/dom/Element.cpp
Source/WebCore/dom/ExtensionStyleSheets.cpp
Source/WebCore/dom/ScriptExecutionContext.cpp
Source/WebCore/dom/ScriptableDocumentParser.cpp
Source/WebCore/dom/ScriptedAnimationController.cpp
Source/WebCore/dom/make_names.pl
Source/WebCore/editing/Editor.cpp
Source/WebCore/editing/markup.cpp
Source/WebCore/html/FTPDirectoryDocument.cpp
Source/WebCore/html/HTMLAnchorElement.cpp
Source/WebCore/html/HTMLAppletElement.cpp
Source/WebCore/html/HTMLCanvasElement.cpp
Source/WebCore/html/HTMLFormElement.cpp
Source/WebCore/html/HTMLFrameElementBase.cpp
Source/WebCore/html/HTMLImageElement.cpp
Source/WebCore/html/HTMLImageLoader.cpp
Source/WebCore/html/HTMLInputElement.cpp
Source/WebCore/html/HTMLLinkElement.cpp
Source/WebCore/html/HTMLMediaElement.cpp
Source/WebCore/html/HTMLVideoElement.cpp
Source/WebCore/html/MediaElementSession.cpp
Source/WebCore/html/parser/HTMLParserOptions.cpp
Source/WebCore/html/shadow/MediaControlElements.cpp
Source/WebCore/loader/LinkLoader.cpp
Source/WebCore/page/csp/ContentSecurityPolicy.cpp
Source/WebCore/rendering/SimpleLineLayout.cpp
Source/WebCore/style/StyleFontSizeFunctions.cpp
Source/WebCore/style/StyleScope.cpp
Source/WebCore/xml/XMLHttpRequest.cpp

index 5e3186c..f0ced7e 100644 (file)
@@ -1,3 +1,151 @@
+2017-02-09  Andreas Kling  <akling@apple.com>
+
+        Document should always have a Settings.
+        <https://webkit.org/b/120172>
+
+        Reviewed by Antti Koivisto.
+
+        Since a Document can't move between Frames, and it's either frameless
+        or partnered with a Frame provided at construction time, we know that
+        it will never need to switch between different Settings objects either.
+
+        Give Document a Ref<Settings> that contains either the Frame's Settings
+        or a default-constructed Settings object if frameless.
+        Document::settings() is promoted to a reference getter.
+
+        The bulk of this patch is removing now-unnecessary null checks.
+
+        * Modules/encryptedmedia/legacy/WebKitMediaKeySession.cpp:
+        (WebCore::WebKitMediaKeySession::mediaKeysStorageDirectory):
+        * Modules/plugins/PluginReplacement.h:
+        (WebCore::ReplacementPlugin::isEnabledBySettings):
+        * Modules/plugins/QuickTimePluginReplacement.h:
+        * Modules/plugins/QuickTimePluginReplacement.mm:
+        (WebCore::QuickTimePluginReplacement::isEnabledBySettings):
+        * Modules/plugins/YouTubePluginReplacement.cpp:
+        (WebCore::YouTubePluginReplacement::isEnabledBySettings):
+        * Modules/plugins/YouTubePluginReplacement.h:
+        * Modules/webaudio/AudioContext.cpp:
+        (WebCore::AudioContext::constructCommon):
+        * bindings/js/CachedScriptFetcher.cpp:
+        (WebCore::CachedScriptFetcher::requestScriptWithCache):
+        * css/CSSFontFace.cpp:
+        (WebCore::CSSFontFace::appendSources):
+        (WebCore::CSSFontFace::webFontsShouldAlwaysFallBack):
+        * css/CSSFontSelector.cpp:
+        (WebCore::CSSFontSelector::fallbackFontCount):
+        (WebCore::CSSFontSelector::fallbackFontAt):
+        * css/StyleBuilderConverter.h:
+        (WebCore::StyleBuilderConverter::convertResize):
+        * css/StyleBuilderCustom.h:
+        (WebCore::StyleBuilderCustom::applyValueFontFamily):
+        * css/StyleResolver.cpp:
+        (WebCore::StyleResolver::StyleResolver):
+        (WebCore::StyleResolver::defaultStyleForElement):
+        (WebCore::StyleResolver::adjustRenderStyle):
+        (WebCore::StyleResolver::checkForGenericFamilyChange):
+        (WebCore::StyleResolver::initializeFontStyle):
+        * css/StyleResolver.h:
+        (WebCore::StyleResolver::settings):
+        (WebCore::StyleResolver::documentSettings): Deleted.
+        * css/parser/CSSParser.cpp:
+        (WebCore::CSSParserContext::CSSParserContext):
+        * dom/Document.cpp:
+        (WebCore::Document::Document):
+        (WebCore::Document::setReadyState):
+        (WebCore::Document::setVisualUpdatesAllowed):
+        (WebCore::Document::defaultCharsetForLegacyBindings):
+        (WebCore::Document::recalcStyle):
+        (WebCore::Document::implicitClose):
+        (WebCore::Document::minimumLayoutDelay):
+        (WebCore::Document::setDomain):
+        (WebCore::Document::audioPlaybackRequiresUserGesture):
+        (WebCore::Document::videoPlaybackRequiresUserGesture):
+        (WebCore::Document::storageBlockingStateDidChange):
+        (WebCore::Document::isTelephoneNumberParsingEnabled):
+        (WebCore::Document::initSecurityContext):
+        (WebCore::Document::initDNSPrefetch):
+        (WebCore::Document::getCachedLocale):
+        (WebCore::Document::shouldEnforceContentDispositionAttachmentSandbox):
+        (WebCore::Document::settings): Deleted.
+        * dom/Document.h:
+        (WebCore::Document::settings):
+        * dom/Element.cpp:
+        (WebCore::subpixelMetricsEnabled):
+        * dom/ExtensionStyleSheets.cpp:
+        (WebCore::ExtensionStyleSheets::pageUserSheet):
+        * dom/ScriptExecutionContext.cpp:
+        (WebCore::ScriptExecutionContext::dispatchErrorEvent):
+        * dom/ScriptableDocumentParser.cpp:
+        (WebCore::ScriptableDocumentParser::ScriptableDocumentParser):
+        * dom/ScriptedAnimationController.cpp:
+        (WebCore::ScriptedAnimationController::requestAnimationFrameEnabled):
+        * dom/make_names.pl:
+        (printConstructorInterior):
+        * editing/Editor.cpp:
+        * editing/markup.cpp:
+        (WebCore::createMarkupInternal):
+        * html/FTPDirectoryDocument.cpp:
+        (WebCore::createTemplateDocumentData):
+        * html/HTMLAnchorElement.cpp:
+        (WebCore::HTMLAnchorElement::setActive):
+        (WebCore::HTMLAnchorElement::sendPings):
+        (WebCore::HTMLAnchorElement::treatLinkAsLiveForEventType):
+        * html/HTMLAppletElement.cpp:
+        (WebCore::HTMLAppletElement::canEmbedJava):
+        * html/HTMLCanvasElement.cpp:
+        (WebCore::HTMLCanvasElement::getContext2d):
+        (WebCore::shouldEnableWebGL):
+        (WebCore::HTMLCanvasElement::shouldAccelerate):
+        * html/HTMLFormElement.cpp:
+        (WebCore::HTMLFormElement::submitImplicitly):
+        * html/HTMLFrameElementBase.cpp:
+        (WebCore::HTMLFrameElementBase::setLocation):
+        * html/HTMLImageElement.cpp:
+        (WebCore::HTMLImageElement::updateImageControls):
+        * html/HTMLImageLoader.cpp:
+        (WebCore::HTMLImageLoader::sourceURI):
+        * html/HTMLInputElement.cpp:
+        (WebCore::HTMLInputElement::setupDateTimeChooserParameters):
+        * html/HTMLLinkElement.cpp:
+        (WebCore::HTMLLinkElement::process):
+        * html/HTMLMediaElement.cpp:
+        (WebCore::HTMLMediaElement::HTMLMediaElement):
+        (WebCore::HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory):
+        (WebCore::HTMLMediaElement::mediaPlayerAcceleratedCompositingEnabled):
+        (WebCore::HTMLMediaElement::enterFullscreen):
+        (WebCore::HTMLMediaElement::exitFullscreen):
+        (WebCore::HTMLMediaElement::mediaPlayerNeedsSiteSpecificHacks):
+        (WebCore::HTMLMediaElement::mediaPlayerNetworkInterfaceName):
+        (WebCore::HTMLMediaElement::setMediaControlsDependOnPageScaleFactor):
+        (WebCore::HTMLMediaElement::doesHaveAttribute):
+        * html/HTMLVideoElement.cpp:
+        (WebCore::HTMLVideoElement::HTMLVideoElement):
+        * html/MediaElementSession.cpp:
+        (WebCore::MediaElementSession::wirelessVideoPlaybackDisabled):
+        (WebCore::MediaElementSession::requiresFullscreenForVideoPlayback):
+        (WebCore::MediaElementSession::allowsAutomaticMediaDataLoading):
+        (WebCore::MediaElementSession::allowsPictureInPicture):
+        (WebCore::MediaElementSession::maximumMediaSourceBufferSize):
+        * html/parser/HTMLParserOptions.cpp:
+        (WebCore::HTMLParserOptions::HTMLParserOptions):
+        * html/shadow/MediaControlElements.cpp:
+        (WebCore::MediaControlFullscreenButtonElement::defaultEventHandler):
+        * loader/LinkLoader.cpp:
+        (WebCore::LinkLoader::loadLink):
+        * page/csp/ContentSecurityPolicy.cpp:
+        (WebCore::ContentSecurityPolicy::allowContentSecurityPolicySourceStarToMatchAnyProtocol):
+        * rendering/SimpleLineLayout.cpp:
+        (WebCore::SimpleLineLayout::toggleSimpleLineLayout):
+        * style/StyleFontSizeFunctions.cpp:
+        (WebCore::Style::computedFontSizeFromSpecifiedSize):
+        (WebCore::Style::fontSizeForKeyword):
+        (WebCore::Style::legacyFontSizeForPixelSize):
+        * style/StyleScope.cpp:
+        (WebCore::Style::Scope::collectActiveStyleSheets):
+        * xml/XMLHttpRequest.cpp:
+        (WebCore::XMLHttpRequest::usesDashboardBackwardCompatibilityMode):
+
 2017-02-09  Antti Koivisto  <antti@apple.com>
 
         Use all cacheable speculatively loaded responses
index 48ae886..7e9e68c 100644 (file)
@@ -223,11 +223,7 @@ String WebKitMediaKeySession::mediaKeysStorageDirectory() const
     if (!document)
         return emptyString();
 
-    auto* settings = document->settings();
-    if (!settings)
-        return emptyString();
-
-    auto storageDirectory = settings->mediaKeysStorageDirectory();
+    auto storageDirectory = document->settings().mediaKeysStorageDirectory();
     if (storageDirectory.isEmpty())
         return emptyString();
 
index e444edc..b54c66b 100644 (file)
@@ -57,7 +57,7 @@ typedef Ref<PluginReplacement> (*CreatePluginReplacement)(HTMLPlugInElement&, co
 typedef bool (*PluginReplacementSupportsType)(const String&);
 typedef bool (*PluginReplacementSupportsFileExtension)(const String&);
 typedef bool (*PluginReplacementSupportsURL)(const URL&);
-typedef bool (*PluginReplacementEnabledForSettings)(const Settings*);
+typedef bool (*PluginReplacementEnabledForSettings)(const Settings&);
 
 class ReplacementPlugin {
 public:
@@ -83,7 +83,7 @@ public:
     bool supportsType(const String& mimeType) const { return m_supportsType(mimeType); }
     bool supportsFileExtension(const String& extension) const { return m_supportsFileExtension(extension); }
     bool supportsURL(const URL& url) const { return m_supportsURL(url); }
-    bool isEnabledBySettings(const Settings* settings) const { return m_isEnabledBySettings(settings); };
+    bool isEnabledBySettings(const Settings& settings) const { return m_isEnabledBySettings(settings); };
 
 private:
     CreatePluginReplacement m_constructor;
index c7a15f0..d574aa0 100644 (file)
@@ -49,7 +49,7 @@ private:
     static bool supportsMimeType(const String&);
     static bool supportsFileExtension(const String&);
     static bool supportsURL(const URL&) { return true; }
-    static bool isEnabledBySettings(const Settings*);
+    static bool isEnabledBySettings(const Settings&);
 
     bool installReplacement(ShadowRoot&) final;
     JSC::JSObject* scriptObject() final { return m_scriptObject; }
index 9e4070f..f429c2c 100644 (file)
@@ -115,9 +115,9 @@ bool QuickTimePluginReplacement::supportsFileExtension(const String& extension)
     return extensionSet.get().contains(extension);
 }
 
-bool QuickTimePluginReplacement::isEnabledBySettings(const Settings* settings)
+bool QuickTimePluginReplacement::isEnabledBySettings(const Settings& settings)
 {
-    return settings->quickTimePluginReplacementEnabled();
+    return settings.quickTimePluginReplacementEnabled();
 }
 
 QuickTimePluginReplacement::QuickTimePluginReplacement(HTMLPlugInElement& plugin, const Vector<String>& paramNames, const Vector<String>& paramValues)
index fc337e1..b497adc 100644 (file)
@@ -346,9 +346,9 @@ bool YouTubePluginReplacement::supportsURL(const URL& url)
     return isYouTubeURL(url);
 }
 
-bool YouTubePluginReplacement::isEnabledBySettings(const Settings* settings)
+bool YouTubePluginReplacement::isEnabledBySettings(const Settings& settings)
 {
-    return settings->youTubeFlashPluginReplacementEnabled();
+    return settings.youTubeFlashPluginReplacementEnabled();
 }
     
 }
index 327ac7a..dc8c097 100644 (file)
@@ -46,7 +46,7 @@ private:
     static bool supportsMimeType(const String&);
     static bool supportsFileExtension(const String&);
     static bool supportsURL(const URL&);
-    static bool isEnabledBySettings(const Settings*);
+    static bool isEnabledBySettings(const Settings&);
 
     bool installReplacement(ShadowRoot&) final;
 
index f417d47..0e1c78f 100644 (file)
@@ -172,7 +172,7 @@ void AudioContext::constructCommon()
     m_listener = AudioListener::create();
 
 #if PLATFORM(IOS)
-    if (!document()->settings() || document()->settings()->audioPlaybackRequiresUserGesture())
+    if (document()->settings().audioPlaybackRequiresUserGesture())
         addBehaviorRestriction(RequireUserGestureForAudioStartRestriction);
     else
         m_restrictions = NoRestrictions;
index c69e9d1..e54f785 100644 (file)
@@ -46,8 +46,7 @@ CachedResourceHandle<CachedScript> CachedScriptFetcher::requestModuleScript(Docu
 
 CachedResourceHandle<CachedScript> CachedScriptFetcher::requestScriptWithCache(Document& document, const URL& sourceURL, const String& crossOriginMode) const
 {
-    auto* settings = document.settings();
-    if (settings && !settings->isScriptEnabled())
+    if (!document.settings().isScriptEnabled())
         return nullptr;
 
     ASSERT(document.contentSecurityPolicy());
index 25671c1..63e57e5 100644 (file)
@@ -73,7 +73,7 @@ void CSSFontFace::appendSources(CSSFontFace& fontFace, CSSValueList& srcList, Do
         fontFaceElement = item.svgFontFaceElement();
 #endif
         if (!item.isLocal()) {
-            Settings* settings = document ? document->settings() : nullptr;
+            Settings* settings = document ? &document->settings() : nullptr;
             bool allowDownloading = foundSVGFont || (settings && settings->downloadableBinaryFontsEnabled());
             if (allowDownloading && item.isSupportedFormat() && document) {
                 if (CachedFont* cachedFont = item.cachedFont(document, foundSVGFont, isInitiatingElementInUserAgentShadowTree))
@@ -517,7 +517,7 @@ void CSSFontFace::fontLoaded(CSSFontFaceSource&)
 
 bool CSSFontFace::webFontsShouldAlwaysFallBack() const
 {
-    return m_fontSelector && m_fontSelector->document() && m_fontSelector->document()->settings() && m_fontSelector->document()->settings()->webFontsAlwaysFallBack();
+    return m_fontSelector && m_fontSelector->document() && m_fontSelector->document()->settings().webFontsAlwaysFallBack();
 }
 
 size_t CSSFontFace::pump()
index 656aa45..45caf19 100644 (file)
@@ -369,10 +369,7 @@ size_t CSSFontSelector::fallbackFontCount()
     if (!m_document)
         return 0;
 
-    if (Settings* settings = m_document->settings())
-        return settings->fontFallbackPrefersPictographs() ? 1 : 0;
-
-    return 0;
+    return m_document->settings().fontFallbackPrefersPictographs() ? 1 : 0;
 }
 
 RefPtr<Font> CSSFontSelector::fallbackFontAt(const FontDescription& fontDescription, size_t index)
@@ -382,11 +379,10 @@ RefPtr<Font> CSSFontSelector::fallbackFontAt(const FontDescription& fontDescript
     if (!m_document)
         return nullptr;
 
-    Settings* settings = m_document->settings();
-    if (!settings || !settings->fontFallbackPrefersPictographs())
+    if (!m_document->settings().fontFallbackPrefersPictographs())
         return nullptr;
 
-    return FontCache::singleton().fontForFamily(fontDescription, settings->pictographFontFamily());
+    return FontCache::singleton().fontForFamily(fontDescription, m_document->settings().pictographFontFamily());
 }
 
 }
index d4950a0..04e42fb 100644 (file)
@@ -558,10 +558,9 @@ inline EResize StyleBuilderConverter::convertResize(StyleResolver& styleResolver
     auto& primitiveValue = downcast<CSSPrimitiveValue>(value);
 
     EResize resize = RESIZE_NONE;
-    if (primitiveValue.valueID() == CSSValueAuto) {
-        if (Settings* settings = styleResolver.document().settings())
-            resize = settings->textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE;
-    } else
+    if (primitiveValue.valueID() == CSSValueAuto)
+        resize = styleResolver.settings().textAreasAreResizable() ? RESIZE_BOTH : RESIZE_NONE;
+    else
         resize = primitiveValue;
 
     return resize;
index fbfbd82..549516e 100644 (file)
@@ -878,8 +878,7 @@ inline void StyleBuilderCustom::applyValueFontFamily(StyleResolver& styleResolve
         } else {
             switch (contentValue.valueID()) {
             case CSSValueWebkitBody:
-                if (Settings* settings = styleResolver.document().settings())
-                    family = settings->standardFontFamily();
+                family = styleResolver.settings().standardFontFamily();
                 break;
             case CSSValueSerif:
                 family = serifFamily;
index 4a1efe2..d17e298 100644 (file)
@@ -232,7 +232,7 @@ StyleResolver::StyleResolver(Document& document)
     : m_matchedPropertiesCacheAdditionsSinceLastSweep(0)
     , m_matchedPropertiesCacheSweepTimer(*this, &StyleResolver::sweepMatchedPropertiesCache)
     , m_document(document)
-    , m_matchAuthorAndUserStyles(m_document.settings() ? m_document.settings()->authorAndUserStylesEnabled() : true)
+    , m_matchAuthorAndUserStyles(m_document.settings().authorAndUserStylesEnabled())
 #if ENABLE(CSS_DEVICE_ADAPTATION)
     , m_viewportStyleResolver(ViewportStyleResolver::create(&document))
 #endif
@@ -682,12 +682,8 @@ std::unique_ptr<RenderStyle> StyleResolver::defaultStyleForElement()
 {
     m_state.setStyle(RenderStyle::createPtr());
     // Make sure our fonts are initialized if we don't inherit them from our parent style.
-    initializeFontStyle(documentSettings());
-    if (documentSettings())
-        m_state.style()->fontCascade().update(&document().fontSelector());
-    else
-        m_state.style()->fontCascade().update(nullptr);
-
+    initializeFontStyle();
+    m_state.style()->fontCascade().update(&document().fontSelector());
     return m_state.takeStyle();
 }
 
@@ -921,7 +917,7 @@ void StyleResolver::adjustRenderStyle(RenderStyle& style, const RenderStyle& par
             || style.hasBlendMode()
             || style.hasIsolation()
             || style.position() == StickyPosition
-            || (style.position() == FixedPosition && documentSettings() && documentSettings()->fixedPositionCreatesStackingContext())
+            || (style.position() == FixedPosition && settings().fixedPositionCreatesStackingContext())
             || style.hasFlowFrom()
             || style.willChangeCreatesStackingContext())
             style.setZIndex(0);
@@ -1742,9 +1738,8 @@ void StyleResolver::checkForGenericFamilyChange(RenderStyle* style, const Render
     if (CSSValueID sizeIdentifier = childFont.keywordSizeAsIdentifier())
         size = Style::fontSizeForKeyword(sizeIdentifier, childFont.useFixedDefaultSize(), document());
     else {
-        Settings* settings = documentSettings();
-        float fixedScaleFactor = (settings && settings->defaultFixedFontSize() && settings->defaultFontSize())
-            ? static_cast<float>(settings->defaultFixedFontSize()) / settings->defaultFontSize()
+        float fixedScaleFactor = (settings().defaultFixedFontSize() && settings().defaultFontSize())
+            ? static_cast<float>(settings().defaultFixedFontSize()) / settings().defaultFontSize()
             : 1;
         size = parentFont.useFixedDefaultSize() ?
                 childFont.specifiedSize() / fixedScaleFactor :
@@ -1756,11 +1751,10 @@ void StyleResolver::checkForGenericFamilyChange(RenderStyle* style, const Render
     style->setFontDescription(newFontDescription);
 }
 
-void StyleResolver::initializeFontStyle(Settings* settings)
+void StyleResolver::initializeFontStyle()
 {
     FontCascadeDescription fontDescription;
-    if (settings)
-        fontDescription.setRenderingMode(settings->fontRenderingMode());
+    fontDescription.setRenderingMode(settings().fontRenderingMode());
     fontDescription.setOneFamily(standardFamily);
     fontDescription.setKeywordSizeFromIdentifier(CSSValueMedium);
     setFontSize(fontDescription, Style::fontSizeForKeyword(CSSValueMedium, false, document()));
index 3702686..619aba8 100644 (file)
@@ -150,7 +150,7 @@ public:
     const Element* element() { return m_state.element(); }
     Document& document() { return m_document; }
     const Document& document() const { return m_document; }
-    Settings* documentSettings() { return m_document.settings(); }
+    Settings& settings() { return m_document.settings(); }
 
     void appendAuthorStyleSheets(const Vector<RefPtr<CSSStyleSheet>>&);
 
@@ -184,7 +184,7 @@ public:
     void applyPropertyToCurrentStyle(CSSPropertyID, CSSValue*);
 
     void updateFont();
-    void initializeFontStyle(Settings*);
+    void initializeFontStyle();
 
     void setFontSize(FontCascadeDescription&, float size);
 
index 48895cc..71634a1 100644 (file)
@@ -84,16 +84,14 @@ CSSParserContext::CSSParserContext(Document& document, const URL& baseURL, const
     , cssGridLayoutEnabled(document.isCSSGridLayoutEnabled())
 #endif
 {
-    if (Settings* settings = document.settings()) {
-        needsSiteSpecificQuirks = settings->needsSiteSpecificQuirks();
-        enforcesCSSMIMETypeInNoQuirksMode = settings->enforceCSSMIMETypeInNoQuirksMode();
-        useLegacyBackgroundSizeShorthandBehavior = settings->useLegacyBackgroundSizeShorthandBehavior();
+    needsSiteSpecificQuirks = document.settings().needsSiteSpecificQuirks();
+    enforcesCSSMIMETypeInNoQuirksMode = document.settings().enforceCSSMIMETypeInNoQuirksMode();
+    useLegacyBackgroundSizeShorthandBehavior = document.settings().useLegacyBackgroundSizeShorthandBehavior();
 #if ENABLE(TEXT_AUTOSIZING)
-        textAutosizingEnabled = settings->textAutosizingEnabled();
+    textAutosizingEnabled = document.settings().textAutosizingEnabled();
 #endif
-        springTimingFunctionEnabled = settings->springTimingFunctionEnabled();
-        deferredCSSParserEnabled = settings->deferredCSSParserEnabled();
-    }
+    springTimingFunctionEnabled = document.settings().springTimingFunctionEnabled();
+    deferredCSSParserEnabled = document.settings().deferredCSSParserEnabled();
 
 #if PLATFORM(IOS)
     // FIXME: Force the site specific quirk below to work on iOS. Investigating other site specific quirks
index 440ffaf..409f82b 100644 (file)
@@ -440,6 +440,7 @@ Document::Document(Frame* frame, const URL& url, unsigned documentClasses, unsig
     , m_touchEventsChangedTimer(*this, &Document::touchEventsChangedTimerFired)
 #endif
     , m_referencingNodeCount(0)
+    , m_settings(frame ? Ref<Settings>(frame->settings()) : Settings::create(nullptr))
     , m_hasNodesWithPlaceholderStyle(false)
     , m_needsNotifyRemoveAllPendingStylesheet(false)
     , m_ignorePendingStylesheets(false)
@@ -1235,13 +1236,13 @@ void Document::setReadyState(ReadyState readyState)
     m_readyState = readyState;
     dispatchEvent(Event::create(eventNames().readystatechangeEvent, false, false));
     
-    if (settings() && settings()->suppressesIncrementalRendering())
+    if (settings().suppressesIncrementalRendering())
         setVisualUpdatesAllowed(readyState);
 }
 
 void Document::setVisualUpdatesAllowed(ReadyState readyState)
 {
-    ASSERT(settings() && settings()->suppressesIncrementalRendering());
+    ASSERT(settings().suppressesIncrementalRendering());
     switch (readyState) {
     case Loading:
         ASSERT(!m_visualUpdatesSuppressionTimer.isActive());
@@ -1275,7 +1276,7 @@ void Document::setVisualUpdatesAllowed(bool visualUpdatesAllowed)
     if (visualUpdatesAllowed)
         m_visualUpdatesSuppressionTimer.stop();
     else
-        m_visualUpdatesSuppressionTimer.startOneShot(settings()->incrementalRenderingSuppressionTimeoutInSeconds());
+        m_visualUpdatesSuppressionTimer.startOneShot(settings().incrementalRenderingSuppressionTimeoutInSeconds());
 
     if (!visualUpdatesAllowed)
         return;
@@ -1334,9 +1335,9 @@ String Document::characterSetWithUTF8Fallback() const
 
 String Document::defaultCharsetForLegacyBindings() const
 {
-    if (Settings* settings = this->settings())
-        return settings->defaultTextEncodingName();
-    return UTF8Encoding().domName();
+    if (!frame())
+        UTF8Encoding().domName();
+    return settings().defaultTextEncodingName();
 }
 
 void Document::setCharset(const String& charset)
@@ -1699,11 +1700,6 @@ Page* Document::page() const
     return m_frame ? m_frame->page() : nullptr;
 }
 
-Settings* Document::settings() const
-{
-    return m_frame ? &m_frame->settings() : nullptr;
-}
-
 Ref<Range> Document::createRange()
 {
     return Range::create(*this);
@@ -1811,10 +1807,8 @@ void Document::recalcStyle(Style::Change change)
 
             // Inserting the pictograph font at the end of the font fallback list is done by the
             // font selector, so set a font selector if needed.
-            if (Settings* settings = this->settings()) {
-                if (settings->fontFallbackPrefersPictographs())
-                    documentStyle.fontCascade().update(&fontSelector());
-            }
+            if (settings().fontFallbackPrefersPictographs())
+                documentStyle.fontCascade().update(&fontSelector());
 
             auto documentChange = Style::determineChange(documentStyle, m_renderView->style());
             if (documentChange != Style::NoChange)
@@ -2704,7 +2698,7 @@ void Document::implicitClose()
     // fires. This will improve onload scores, and other browsers do it.
     // If they wanna cheat, we can too. -dwh
 
-    if (frame()->navigationScheduler().locationChangePending() && timeSinceDocumentCreation() < settings()->layoutInterval()) {
+    if (frame()->navigationScheduler().locationChangePending() && timeSinceDocumentCreation() < settings().layoutInterval()) {
         // Just bail out. Before or during the onload we were shifted to another page.
         // The old i-Bench suite does this. When this happens don't bother painting or laying out.        
         m_processingLoadEvent = false;
@@ -2787,10 +2781,10 @@ Seconds Document::minimumLayoutDelay()
         return 0_s;
     
     auto elapsed = timeSinceDocumentCreation();
-    m_overMinimumLayoutThreshold = elapsed > settings()->layoutInterval();
+    m_overMinimumLayoutThreshold = elapsed > settings().layoutInterval();
 
     // We'll want to schedule the timer to fire at the minimum layout threshold.
-    return std::max(0_s, settings()->layoutInterval() - elapsed);
+    return std::max(0_s, settings().layoutInterval() - elapsed);
 }
 
 Seconds Document::timeSinceDocumentCreation() const
@@ -4332,7 +4326,7 @@ ExceptionOr<void> Document::setDomain(const String& newDomain)
     if (newLength >= oldLength)
         return Exception { SECURITY_ERR };
 
-    auto ipAddressSetting = settings() && settings()->treatIPAddressAsDomain() ? OriginAccessEntry::TreatIPAddressAsDomain : OriginAccessEntry::TreatIPAddressAsIPAddress;
+    auto ipAddressSetting = settings().treatIPAddressAsDomain() ? OriginAccessEntry::TreatIPAddressAsDomain : OriginAccessEntry::TreatIPAddressAsIPAddress;
     OriginAccessEntry accessEntry { securityOrigin().protocol(), newDomain, OriginAccessEntry::AllowSubdomains, ipAddressSetting };
     if (!accessEntry.matchesOrigin(securityOrigin()))
         return Exception { SECURITY_ERR };
@@ -4674,8 +4668,7 @@ bool Document::audioPlaybackRequiresUserGesture() const
             return policy == AutoplayPolicy::AllowWithoutSound || policy == AutoplayPolicy::Deny;
     }
 
-    Settings* settings = this->settings();
-    return settings && settings->audioPlaybackRequiresUserGesture();
+    return settings().audioPlaybackRequiresUserGesture();
 }
 
 bool Document::videoPlaybackRequiresUserGesture() const
@@ -4687,14 +4680,12 @@ bool Document::videoPlaybackRequiresUserGesture() const
             return policy == AutoplayPolicy::Deny;
     }
 
-    Settings* settings = this->settings();
-    return settings && settings->videoPlaybackRequiresUserGesture();
+    return settings().videoPlaybackRequiresUserGesture();
 }
 
 void Document::storageBlockingStateDidChange()
 {
-    if (Settings* settings = this->settings())
-        securityOrigin().setStorageBlockingPolicy(settings->storageBlockingPolicy());
+    securityOrigin().setStorageBlockingPolicy(settings().storageBlockingPolicy());
 }
 
 void Document::privateBrowsingStateDidChange() 
@@ -5078,8 +5069,7 @@ void Document::clearSharedObjectPool()
 
 bool Document::isTelephoneNumberParsingEnabled() const
 {
-    Settings* settings = this->settings();
-    return settings && settings->telephoneNumberParsingEnabled() && m_isTelephoneNumberParsingAllowed;
+    return settings().telephoneNumberParsingEnabled() && m_isTelephoneNumberParsingAllowed;
 }
 
 void Document::setIsTelephoneNumberParsingAllowed(bool isTelephoneNumberParsingAllowed)
@@ -5171,26 +5161,24 @@ void Document::initSecurityContext()
         enforceSandboxFlags(SandboxScripts | SandboxPlugins);
     }
 
-    if (Settings* settings = this->settings()) {
-        if (settings->needsStorageAccessFromFileURLsQuirk())
-            securityOrigin().grantStorageAccessFromFileURLsQuirk();
-        if (!settings->webSecurityEnabled()) {
-            // Web security is turned off. We should let this document access every other document. This is used primary by testing
-            // harnesses for web sites.
+    if (settings().needsStorageAccessFromFileURLsQuirk())
+        securityOrigin().grantStorageAccessFromFileURLsQuirk();
+    if (!settings().webSecurityEnabled()) {
+        // Web security is turned off. We should let this document access every other document. This is used primary by testing
+        // harnesses for web sites.
+        securityOrigin().grantUniversalAccess();
+    } else if (securityOrigin().isLocal()) {
+        if (settings().allowUniversalAccessFromFileURLs() || m_frame->loader().client().shouldForceUniversalAccessFromLocalURL(m_url)) {
+            // Some clients want local URLs to have universal access, but that setting is dangerous for other clients.
             securityOrigin().grantUniversalAccess();
-        } else if (securityOrigin().isLocal()) {
-            if (settings->allowUniversalAccessFromFileURLs() || m_frame->loader().client().shouldForceUniversalAccessFromLocalURL(m_url)) {
-                // Some clients want local URLs to have universal access, but that setting is dangerous for other clients.
-                securityOrigin().grantUniversalAccess();
-            } else if (!settings->allowFileAccessFromFileURLs()) {
-                // Some clients want local URLs to have even tighter restrictions by default, and not be able to access other local files.
-                // FIXME 81578: The naming of this is confusing. Files with restricted access to other local files
-                // still can have other privileges that can be remembered, thereby not making them unique origins.
-                securityOrigin().enforceFilePathSeparation();
-            }
+        } else if (!settings().allowFileAccessFromFileURLs()) {
+            // Some clients want local URLs to have even tighter restrictions by default, and not be able to access other local files.
+            // FIXME 81578: The naming of this is confusing. Files with restricted access to other local files
+            // still can have other privileges that can be remembered, thereby not making them unique origins.
+            securityOrigin().enforceFilePathSeparation();
         }
-        securityOrigin().setStorageBlockingPolicy(settings->storageBlockingPolicy());
     }
+    securityOrigin().setStorageBlockingPolicy(settings().storageBlockingPolicy());
 
     Document* parentDocument = ownerElement() ? &ownerElement()->document() : nullptr;
     if (parentDocument && m_frame->loader().shouldTreatURLAsSrcdocDocument(url())) {
@@ -5369,10 +5357,8 @@ void Document::clearAutoSizedNodes()
 
 void Document::initDNSPrefetch()
 {
-    Settings* settings = this->settings();
-
     m_haveExplicitlyDisabledDNSPrefetch = false;
-    m_isDNSPrefetchEnabled = settings && settings->dnsPrefetchingEnabled() && securityOrigin().protocol() == "http";
+    m_isDNSPrefetchEnabled = settings().dnsPrefetchingEnabled() && securityOrigin().protocol() == "http";
 
     // Inherit DNS prefetch opt-out from parent frame    
     if (Document* parent = parentDocument()) {
@@ -6623,7 +6609,7 @@ bool Document::haveStylesheetsLoaded() const
 Locale& Document::getCachedLocale(const AtomicString& locale)
 {
     AtomicString localeKey = locale;
-    if (locale.isEmpty() || !settings() || !settings()->langAttributeAwareFormControlUIEnabled())
+    if (locale.isEmpty() || !settings().langAttributeAwareFormControlUIEnabled())
         localeKey = defaultLanguage();
     LocaleIdentifierToLocaleMap::AddResult result = m_localeCache.add(localeKey, nullptr);
     if (result.isNewEntry)
@@ -6917,7 +6903,7 @@ bool Document::shouldEnforceContentDispositionAttachmentSandbox() const
     if (m_isSynthesized)
         return false;
 
-    bool contentDispositionAttachmentSandboxEnabled = settings() && settings()->contentDispositionAttachmentSandboxEnabled();
+    bool contentDispositionAttachmentSandboxEnabled = settings().contentDispositionAttachmentSandboxEnabled();
     bool responseIsAttachment = false;
     if (DocumentLoader* documentLoader = m_frame ? m_frame->loader().activeDocumentLoader() : nullptr)
         responseIsAttachment = documentLoader->response().isAttachment();
index 4cb75ac..2e5ad5e 100644 (file)
@@ -510,7 +510,7 @@ public:
 
     WEBCORE_EXPORT FrameView* view() const; // can be NULL
     WEBCORE_EXPORT Page* page() const; // can be NULL
-    WEBCORE_EXPORT Settings* settings() const; // can be NULL
+    Settings& settings() const { return m_settings.get(); }
 
     float deviceScaleFactor() const;
 
@@ -1383,6 +1383,8 @@ private:
 
     unsigned m_referencingNodeCount;
 
+    const Ref<Settings> m_settings;
+
     std::unique_ptr<StyleResolver> m_userAgentShadowTreeStyleResolver;
     bool m_hasNodesWithPlaceholderStyle;
     bool m_needsNotifyRemoveAllPendingStylesheet;
index 9daf9be..d25c776 100644 (file)
@@ -795,7 +795,7 @@ enum LegacyCSSOMElementMetricsRoundingStrategy { Round, Floor };
 
 static bool subpixelMetricsEnabled(const Document& document)
 {
-    return document.settings() && document.settings()->subpixelCSSOMElementMetricsEnabled();
+    return document.settings().subpixelCSSOMElementMetricsEnabled();
 }
 
 static double convertToNonSubpixelValueIfNeeded(double value, const Document& document, LegacyCSSOMElementMetricsRoundingStrategy roundStrategy = Round)
index 442633a..d0d244a 100644 (file)
@@ -79,7 +79,7 @@ CSSStyleSheet* ExtensionStyleSheets::pageUserSheet()
     if (userSheetText.isEmpty())
         return 0;
     
-    m_pageUserSheet = createExtensionsStyleSheet(m_document, m_document.settings()->userStyleSheetLocation(), userSheetText, UserStyleUserLevel);
+    m_pageUserSheet = createExtensionsStyleSheet(m_document, m_document.settings().userStyleSheetLocation(), userSheetText, UserStyleUserLevel);
 
     return m_pageUserSheet.get();
 }
index a7ff01a..e279244 100644 (file)
@@ -392,8 +392,7 @@ bool ScriptExecutionContext::dispatchErrorEvent(const String& errorMessage, int
 
 #if PLATFORM(IOS)
     if (target->toDOMWindow() && is<Document>(*this)) {
-        Settings* settings = downcast<Document>(*this).settings();
-        if (settings && !settings->shouldDispatchJavaScriptWindowOnErrorEvents())
+        if (!downcast<Document>(*this).settings().shouldDispatchJavaScriptWindowOnErrorEvents())
             return false;
     }
 #endif
index f5e4172..b9a44e5 100644 (file)
@@ -39,7 +39,7 @@ ScriptableDocumentParser::ScriptableDocumentParser(Document& document, ParserCon
     if (!pluginContentIsAllowed(m_parserContentPolicy))
         m_parserContentPolicy = allowPluginContent(m_parserContentPolicy);
 
-    if (scriptingContentIsAllowed(m_parserContentPolicy) && (document.settings() && !document.settings()->scriptMarkupEnabled()))
+    if (scriptingContentIsAllowed(m_parserContentPolicy) && !document.settings().scriptMarkupEnabled())
         m_parserContentPolicy = disallowScriptingContent(m_parserContentPolicy);
 }
 
index 33ee86f..b94ebdf 100644 (file)
@@ -67,7 +67,7 @@ ScriptedAnimationController::~ScriptedAnimationController()
 
 bool ScriptedAnimationController::requestAnimationFrameEnabled() const
 {
-    return m_document && (!m_document->settings() || m_document->settings()->requestAnimationFrameEnabled());
+    return m_document && m_document->settings().requestAnimationFrameEnabled();
 }
 
 void ScriptedAnimationController::suspend()
index d0b8249..071f22d 100755 (executable)
@@ -415,8 +415,7 @@ sub printConstructorInterior
     # instead of having all the support for this here in this script?
     if ($enabledTags{$tagName}{wrapperOnlyIfMediaIsAvailable}) {
         print F <<END
-    Settings* settings = document.settings();
-    if (!MediaPlayer::isAvailable() || (settings && !settings->mediaEnabled()))
+    if (!MediaPlayer::isAvailable() || !document.settings().mediaEnabled())
         return $parameters{fallbackInterfaceName}::create($constructorTagName, document);
     
 END
@@ -435,8 +434,7 @@ END
     my $settingsConditional = $enabledTags{$tagName}{settingsConditional};
     if ($settingsConditional) {
         print F <<END
-    Settings* settings = document.settings();
-    if (!settings || !settings->${settingsConditional}())
+    if (!document.settings().${settingsConditional}())
         return $parameters{fallbackInterfaceName}::create($constructorTagName, document);
 END
 ;
index a7d68f6..2d1e39c 100644 (file)
@@ -107,8 +107,7 @@ namespace WebCore {
 
 static bool dispatchBeforeInputEvent(Element& element, const AtomicString& inputType, const String& data = { }, RefPtr<DataTransfer>&& dataTransfer = nullptr, const Vector<RefPtr<StaticRange>>& targetRanges = { }, bool cancelable = true)
 {
-    auto* settings = element.document().settings();
-    if (!settings || !settings->inputEventsEnabled())
+    if (!element.document().settings().inputEventsEnabled())
         return true;
 
     return element.dispatchEvent(InputEvent::create(eventNames().beforeinputEvent, inputType, true, cancelable, element.document().defaultView(), data, WTFMove(dataTransfer), targetRanges, 0));
@@ -116,8 +115,7 @@ static bool dispatchBeforeInputEvent(Element& element, const AtomicString& input
 
 static void dispatchInputEvent(Element& element, const AtomicString& inputType, const String& data = { }, RefPtr<DataTransfer>&& dataTransfer = nullptr, const Vector<RefPtr<StaticRange>>& targetRanges = { })
 {
-    auto* settings = element.document().settings();
-    if (settings && settings->inputEventsEnabled()) {
+    if (element.document().settings().inputEventsEnabled()) {
         // FIXME: We should not be dispatching to the scoped queue here. Normally, input events are dispatched in CompositeEditCommand::apply after the end of the scope,
         // but TypingCommands are special in that existing TypingCommands that are applied again fire input events *from within* the scope by calling typingAddedToOpenCommand.
         // Instead, TypingCommands should always dispatch events synchronously after the end of the scoped queue in CompositeEditCommand::apply. To work around this for the
index eee9263..db57589 100644 (file)
@@ -598,7 +598,7 @@ static String createMarkupInternal(Document& document, const Range& range, Vecto
     Node* specialCommonAncestor = highestAncestorToWrapMarkup(&range, shouldAnnotate);
 
     bool needsPositionStyleConversion = body && fullySelectedRoot == body
-        && document.settings() && document.settings()->shouldConvertPositionStyleOnCopy();
+        && document.settings().shouldConvertPositionStyleOnCopy();
     StyledMarkupAccumulator accumulator(nodes, shouldResolveURLs, shouldAnnotate, &range, needsPositionStyleConversion, specialCommonAncestor);
     Node* pastEnd = range.pastLastNode();
 
index de81d42..28e3287 100644 (file)
@@ -276,11 +276,9 @@ void FTPDirectoryDocumentParser::parseAndAppendOneLine(const String& inputLine)
     appendEntry(filename, processFilesizeString(result.fileSize, result.type == FTPDirectoryEntry), processFileDateString(result.modifiedTime), result.type == FTPDirectoryEntry);
 }
 
-static inline RefPtr<SharedBuffer> createTemplateDocumentData(Settings* settings)
+static inline RefPtr<SharedBuffer> createTemplateDocumentData(Settings& settings)
 {
-    RefPtr<SharedBuffer> buffer;
-    if (settings)
-        buffer = SharedBuffer::createWithContentsOfFile(settings->ftpDirectoryTemplatePath());
+    RefPtr<SharedBuffer> buffer = SharedBuffer::createWithContentsOfFile(settings.ftpDirectoryTemplatePath());
     if (buffer)
         LOG(FTP, "Loaded FTPDirectoryTemplate of length %i\n", buffer->size());
     return buffer;
index f36dd40..e399508 100644 (file)
@@ -201,9 +201,7 @@ void HTMLAnchorElement::defaultEventHandler(Event& event)
 void HTMLAnchorElement::setActive(bool down, bool pause)
 {
     if (hasEditableStyle()) {
-        EditableLinkBehavior editableLinkBehavior = EditableLinkDefaultBehavior;
-        if (Settings* settings = document().settings())
-            editableLinkBehavior = settings->editableLinkBehavior();
+        EditableLinkBehavior editableLinkBehavior = document().settings().editableLinkBehavior();
             
         switch (editableLinkBehavior) {
             default:
@@ -353,7 +351,10 @@ bool HTMLAnchorElement::isLiveLink() const
 
 void HTMLAnchorElement::sendPings(const URL& destinationURL)
 {
-    if (!hasAttributeWithoutSynchronization(pingAttr) || !document().settings() || !document().settings()->hyperlinkAuditingEnabled())
+    if (!document().frame())
+        return;
+
+    if (!hasAttributeWithoutSynchronization(pingAttr) || !document().settings().hyperlinkAuditingEnabled())
         return;
 
     SpaceSplitString pingURLs(attributeWithoutSynchronization(pingAttr), false);
@@ -405,11 +406,7 @@ bool HTMLAnchorElement::treatLinkAsLiveForEventType(EventType eventType) const
     if (!hasEditableStyle())
         return true;
 
-    Settings* settings = document().settings();
-    if (!settings)
-        return true;
-
-    switch (settings->editableLinkBehavior()) {
+    switch (document().settings().editableLinkBehavior()) {
     case EditableLinkDefaultBehavior:
     case EditableLinkAlwaysLive:
         return true;
index 646b333..5f54f8f 100644 (file)
@@ -181,14 +181,10 @@ bool HTMLAppletElement::canEmbedJava() const
     if (document().isSandboxed(SandboxPlugins))
         return false;
 
-    Settings* settings = document().settings();
-    if (!settings)
+    if (!document().settings().isJavaEnabled())
         return false;
 
-    if (!settings->isJavaEnabled())
-        return false;
-
-    if (document().securityOrigin().isLocal() && !settings->isJavaEnabledForLocalFiles())
+    if (document().securityOrigin().isLocal() && !document().settings().isJavaEnabledForLocalFiles())
         return false;
 
     return true;
index eeea6d4..d92bddd 100644 (file)
@@ -204,8 +204,7 @@ CanvasRenderingContext* HTMLCanvasElement::getContext2d(const String& type)
     if (!m_context) {
         bool usesDashboardCompatibilityMode = false;
 #if ENABLE(DASHBOARD_SUPPORT)
-        if (Settings* settings = document().settings())
-            usesDashboardCompatibilityMode = settings->usesDashboardBackwardCompatibilityMode();
+        usesDashboardCompatibilityMode = document().settings().usesDashboardBackwardCompatibilityMode();
 #endif
 
         // Make sure we don't use more pixel memory than the system can support.
@@ -243,18 +242,15 @@ static bool requiresAcceleratedCompositingForWebGL()
 #endif
 
 }
-static bool shouldEnableWebGL(Settings* settings)
+static bool shouldEnableWebGL(Settings& settings)
 {
-    if (!settings)
-        return false;
-
-    if (!settings->webGLEnabled())
+    if (!settings.webGLEnabled())
         return false;
 
     if (!requiresAcceleratedCompositingForWebGL())
         return true;
 
-    return settings->acceleratedCompositingEnabled();
+    return settings.acceleratedCompositingEnabled();
 }
 
 bool HTMLCanvasElement::is3dType(const String& type)
@@ -540,9 +536,7 @@ SecurityOrigin* HTMLCanvasElement::securityOrigin() const
 
 bool HTMLCanvasElement::shouldAccelerate(const IntSize& size) const
 {
-    if (!document().settings())
-        return false;
-    auto& settings = *document().settings();
+    auto& settings = document().settings();
 
     auto area = size.area<RecordOverflow>();
     if (area.hasOverflowed())
index d62fcf4..8778445 100644 (file)
@@ -214,8 +214,7 @@ void HTMLFormElement::submitImplicitly(Event& event, bool fromImplicitSubmission
         return;
 
     // Older iOS apps using WebViews expect the behavior of auto submitting multi-input forms.
-    Settings* settings = document().settings();
-    if (fromImplicitSubmissionTrigger && (submissionTriggerCount == 1 || (settings && settings->allowMultiElementImplicitSubmission())))
+    if (fromImplicitSubmissionTrigger && (submissionTriggerCount == 1 || document().settings().allowMultiElementImplicitSubmission()))
         prepareForSubmission(event);
 }
 
index 5dd142a..86cba39 100644 (file)
@@ -174,8 +174,7 @@ URL HTMLFrameElementBase::location() const
 
 void HTMLFrameElementBase::setLocation(const String& str)
 {
-    Settings* settings = document().settings();
-    if (settings && settings->needsAcrobatFrameReloadingQuirk() && m_URL == str)
+    if (document().settings().needsAcrobatFrameReloadingQuirk() && m_URL == str)
         return;
 
     m_URL = AtomicString(str);
index c912ca1..94869cf 100644 (file)
@@ -582,8 +582,7 @@ void HTMLImageElement::updateImageControls()
     if (isInShadowTree())
         return;
 
-    Settings* settings = document().settings();
-    if (!settings || !settings->imageControlsEnabled())
+    if (!document().settings().imageControlsEnabled())
         return;
 
     bool hasControls = hasImageControls();
index 5e3e7b9..7f908d2 100644 (file)
@@ -66,8 +66,7 @@ void HTMLImageLoader::dispatchLoadEvent()
 String HTMLImageLoader::sourceURI(const AtomicString& attr) const
 {
 #if ENABLE(DASHBOARD_SUPPORT)
-    Settings* settings = element().document().settings();
-    if (settings && settings->usesDashboardBackwardCompatibilityMode() && attr.length() > 7 && attr.startsWith("url(\"") && attr.endsWith("\")"))
+    if (element().document().settings().usesDashboardBackwardCompatibilityMode() && attr.length() > 7 && attr.startsWith("url(\"") && attr.endsWith("\")"))
         return attr.string().substring(5, attr.length() - 7);
 #endif
 
index 42a5234..ec557d0 100644 (file)
@@ -2035,8 +2035,7 @@ bool HTMLInputElement::setupDateTimeChooserParameters(DateTimeChooserParameters&
     parameters.maximum = maximum();
     parameters.required = isRequired();
 
-    Settings* settings = document().settings();
-    if (!settings || !settings->langAttributeAwareFormControlUIEnabled())
+    if (!document().settings().langAttributeAwareFormControlUIEnabled())
         parameters.locale = defaultLanguage();
     else {
         AtomicString computedLocale = computeInheritedLanguage();
index 9eedbf1..ce21ad6 100644 (file)
@@ -230,7 +230,7 @@ void HTMLLinkElement::process()
         return;
 
     bool treatAsStyleSheet = m_relAttribute.isStyleSheet
-        || (document().settings() && document().settings()->treatsAnyTextCSSLinkAsStylesheet() && m_type.containsIgnoringASCIICase("text/css"));
+        || (document().settings().treatsAnyTextCSSLinkAsStylesheet() && m_type.containsIgnoringASCIICase("text/css"));
 
     if (m_disabledState != Disabled && treatAsStyleSheet && document().frame() && url.isValid()) {
         String charset = attributeWithoutSynchronization(charsetAttr);
index 159162a..d93b0e0 100644 (file)
@@ -452,12 +452,11 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum
     m_mediaSession->addBehaviorRestriction(MediaElementSession::RequireUserGestureToControlControlsManager);
     m_mediaSession->addBehaviorRestriction(MediaElementSession::RequirePlaybackToControlControlsManager);
 
-    Settings* settings = document.settings();
 #if PLATFORM(IOS)
     m_sendProgressEvents = false;
 #endif
 
-    if (settings && settings->invisibleAutoplayNotPermitted())
+    if (document.settings().invisibleAutoplayNotPermitted())
         m_mediaSession->addBehaviorRestriction(MediaElementSession::InvisibleAutoplayNotPermitted);
 
     if (document.ownerElement() || !document.isMediaDocument()) {
@@ -466,7 +465,7 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum
 
         if (shouldVideoPlaybackRequireUserGesture) {
             m_mediaSession->addBehaviorRestriction(MediaElementSession::RequireUserGestureForVideoRateChange);
-            if (settings && settings->requiresUserGestureToLoadVideo())
+            if (document.settings().requiresUserGestureToLoadVideo())
                 m_mediaSession->addBehaviorRestriction(MediaElementSession::RequireUserGestureForLoad);
         }
 
@@ -478,15 +477,15 @@ HTMLMediaElement::HTMLMediaElement(const QualifiedName& tagName, Document& docum
             m_mediaSession->addBehaviorRestriction(MediaElementSession::RequireUserGestureToShowPlaybackTargetPicker);
 #endif
 
-        if (!settings || !settings->mediaDataLoadsAutomatically())
+        if (!document.settings().mediaDataLoadsAutomatically())
             m_mediaSession->addBehaviorRestriction(MediaElementSession::AutoPreloadingNotPermitted);
 
-        if (settings && settings->mainContentUserGestureOverrideEnabled())
+        if (document.settings().mainContentUserGestureOverrideEnabled())
             m_mediaSession->addBehaviorRestriction(MediaElementSession::OverrideUserGestureRequirementForMainContent);
     }
 
 #if PLATFORM(IOS)
-    if (settings && !settings->videoPlaybackRequiresUserGesture() && !settings->audioPlaybackRequiresUserGesture()) {
+    if (!document.settings().videoPlaybackRequiresUserGesture() && !document.settings().audioPlaybackRequiresUserGesture()) {
         // Relax RequireUserGestureForFullscreen when videoPlaybackRequiresUserGesture and audioPlaybackRequiresUserGesture is not set:
         m_mediaSession->removeBehaviorRestriction(MediaElementSession::RequireUserGestureForFullscreen);
     }
@@ -2438,11 +2437,7 @@ bool HTMLMediaElement::mediaPlayerKeyNeeded(MediaPlayer*, Uint8Array* initData)
 
 String HTMLMediaElement::mediaPlayerMediaKeysStorageDirectory() const
 {
-    Settings* settings = document().settings();
-    if (!settings)
-        return emptyString();
-
-    String storageDirectory = settings->mediaKeysStorageDirectory();
+    String storageDirectory = document().settings().mediaKeysStorageDirectory();
     if (storageDirectory.isEmpty())
         return emptyString();
 
@@ -4578,7 +4573,7 @@ void HTMLMediaElement::mediaPlayerRenderingModeChanged(MediaPlayer*)
 
 bool HTMLMediaElement::mediaPlayerAcceleratedCompositingEnabled()
 {
-    return document().settings() && document().settings()->acceleratedCompositingEnabled();
+    return document().settings().acceleratedCompositingEnabled();
 }
 
 #if PLATFORM(WIN) && USE(AVFOUNDATION)
@@ -5431,7 +5426,7 @@ void HTMLMediaElement::enterFullscreen(VideoFullscreenMode mode)
         return;
 
 #if ENABLE(FULLSCREEN_API)
-    if (document().settings()->fullScreenEnabled()) {
+    if (document().settings().fullScreenEnabled()) {
         if (mode == VideoFullscreenModeStandard) {
             document().requestFullScreenForElement(this, Document::ExemptIFrameAllowFullScreenRequirement);
             return;
@@ -5470,7 +5465,7 @@ void HTMLMediaElement::exitFullscreen()
     LOG(Media, "HTMLMediaElement::exitFullscreen(%p)", this);
 
 #if ENABLE(FULLSCREEN_API)
-    if (document().settings() && document().settings()->fullScreenEnabled() && document().webkitCurrentFullScreenElement() == this) {
+    if (document().settings().fullScreenEnabled() && document().webkitCurrentFullScreenElement() == this) {
         if (document().webkitIsFullScreen())
             document().webkitCancelFullScreen();
         return;
@@ -5490,7 +5485,7 @@ void HTMLMediaElement::exitFullscreen()
         return;
 
     if (!paused() && m_mediaSession->requiresFullscreenForVideoPlayback(*this)) {
-        if (!document().settings() || !document().settings()->allowsInlineMediaPlaybackAfterFullscreen() || isVideoTooSmallForInlinePlayback())
+        if (!document().settings().allowsInlineMediaPlaybackAfterFullscreen() || isVideoTooSmallForInlinePlayback())
             pauseInternal();
         else {
             // Allow inline playback, but set 'playsinline' so pausing and starting again (e.g. when scrubbing) won't go back to fullscreen.
@@ -6310,8 +6305,7 @@ Vector<RefPtr<PlatformTextTrack>> HTMLMediaElement::outOfBandTrackSources()
 
 bool HTMLMediaElement::mediaPlayerNeedsSiteSpecificHacks() const
 {
-    Settings* settings = document().settings();
-    return settings && settings->needsSiteSpecificQuirks();
+    return document().settings().needsSiteSpecificQuirks();
 }
 
 String HTMLMediaElement::mediaPlayerDocumentHost() const
@@ -6453,11 +6447,7 @@ Vector<String> HTMLMediaElement::mediaPlayerPreferredAudioCharacteristics() cons
 #if PLATFORM(IOS)
 String HTMLMediaElement::mediaPlayerNetworkInterfaceName() const
 {
-    Settings* settings = document().settings();
-    if (!settings)
-        return emptyString();
-
-    return settings->networkInterfaceName();
+    return document().settings().networkInterfaceName();
 }
 
 bool HTMLMediaElement::mediaPlayerGetRawCookies(const URL& url, Vector<Cookie>& cookies) const
@@ -6702,8 +6692,7 @@ void HTMLMediaElement::setMediaControlsDependOnPageScaleFactor(bool dependsOnPag
 {
     LOG(Media, "MediaElement::setMediaControlsDependPageScaleFactor(%p) = %s", this, boolString(dependsOnPageScale));
 
-    Settings* settings = document().settings();
-    if (settings && settings->mediaControlsScaleWithPageZoom()) {
+    if (document().settings().mediaControlsScaleWithPageZoom()) {
         LOG(Media, "MediaElement::setMediaControlsDependPageScaleFactor(%p) forced to false by Settings value", this);
         m_mediaControlsDependOnPageScaleFactor = false;
         return;
@@ -7055,10 +7044,8 @@ bool HTMLMediaElement::doesHaveAttribute(const AtomicString& attribute, AtomicSt
     if (elementValue.isNull())
         return false;
     
-    if (Settings* settings = document().settings()) {
-        if (attributeName == HTMLNames::x_itunes_inherit_uri_query_componentAttr && !settings->enableInheritURIQueryComponent())
-            return false;
-    }
+    if (attributeName == HTMLNames::x_itunes_inherit_uri_query_componentAttr && !document().settings().enableInheritURIQueryComponent())
+        return false;
 
     if (value)
         *value = elementValue;
index 076dcc2..7533c85 100644 (file)
@@ -60,8 +60,7 @@ inline HTMLVideoElement::HTMLVideoElement(const QualifiedName& tagName, Document
 {
     ASSERT(hasTagName(videoTag));
     setHasCustomStyleResolveCallbacks();
-    if (document.settings())
-        m_defaultPosterURL = document.settings()->defaultVideoPosterURL();
+    m_defaultPosterURL = document.settings().defaultVideoPosterURL();
 }
 
 Ref<HTMLVideoElement> HTMLVideoElement::create(const QualifiedName& tagName, Document& document, bool createdByParser)
index 8ca3b61..4bbb3f4 100644 (file)
@@ -398,8 +398,7 @@ bool MediaElementSession::hasWirelessPlaybackTargets(const HTMLMediaElement&) co
 
 bool MediaElementSession::wirelessVideoPlaybackDisabled(const HTMLMediaElement& element) const
 {
-    Settings* settings = element.document().settings();
-    if (!settings || !settings->allowsAirPlayForMediaPlayback()) {
+    if (!element.document().settings().allowsAirPlayForMediaPlayback()) {
         LOG(Media, "MediaElementSession::wirelessVideoPlaybackDisabled - returning TRUE because of settings");
         return true;
     }
@@ -541,11 +540,10 @@ bool MediaElementSession::requiresFullscreenForVideoPlayback(const HTMLMediaElem
     if (is<HTMLAudioElement>(element))
         return false;
 
-    Settings* settings = element.document().settings();
-    if (!settings || !settings->allowsInlineMediaPlayback())
+    if (!element.document().settings().allowsInlineMediaPlayback())
         return true;
 
-    if (!settings->inlineMediaPlaybackRequiresPlaysInlineAttribute())
+    if (!element.document().settings().inlineMediaPlaybackRequiresPlaysInlineAttribute())
         return false;
 
 #if PLATFORM(IOS)
@@ -562,8 +560,7 @@ bool MediaElementSession::allowsAutomaticMediaDataLoading(const HTMLMediaElement
     if (pageExplicitlyAllowsElementToAutoplayInline(element))
         return true;
 
-    Settings* settings = element.document().settings();
-    if (settings && settings->mediaDataLoadsAutomatically())
+    if (element.document().settings().mediaDataLoadsAutomatically())
         return true;
 
     return false;
@@ -594,8 +591,7 @@ void MediaElementSession::resetPlaybackSessionState()
 
 bool MediaElementSession::allowsPictureInPicture(const HTMLMediaElement& element) const
 {
-    Settings* settings = element.document().settings();
-    return settings && settings->allowsPictureInPictureMediaPlayback() && !element.webkitCurrentPlaybackTargetIsWireless();
+    return element.document().settings().allowsPictureInPictureMediaPlayback() && !element.webkitCurrentPlaybackTargetIsWireless();
 }
 
 #if PLATFORM(IOS)
@@ -606,21 +602,13 @@ bool MediaElementSession::requiresPlaybackTargetRouteMonitoring() const
 #endif
 
 #if ENABLE(MEDIA_SOURCE)
-const unsigned fiveMinutesOf1080PVideo = 290 * 1024 * 1024; // 290 MB is approximately 5 minutes of 8Mbps (1080p) content.
-const unsigned fiveMinutesStereoAudio = 14 * 1024 * 1024; // 14 MB is approximately 5 minutes of 384kbps content.
-
 size_t MediaElementSession::maximumMediaSourceBufferSize(const SourceBuffer& buffer) const
 {
     // A good quality 1080p video uses 8,000 kbps and stereo audio uses 384 kbps, so assume 95% for video and 5% for audio.
     const float bufferBudgetPercentageForVideo = .95;
     const float bufferBudgetPercentageForAudio = .05;
 
-    size_t maximum;
-    Settings* settings = buffer.document().settings();
-    if (settings)
-        maximum = settings->maximumSourceBufferSize();
-    else
-        maximum = fiveMinutesOf1080PVideo + fiveMinutesStereoAudio;
+    size_t maximum = buffer.document().settings().maximumSourceBufferSize();
 
     // Allow a SourceBuffer to buffer as though it is audio-only even if it doesn't have any active tracks (yet).
     size_t bufferSize = static_cast<size_t>(maximum * bufferBudgetPercentageForAudio);
index d9323ee..0d2d9fb 100644 (file)
@@ -49,9 +49,8 @@ HTMLParserOptions::HTMLParserOptions(Document& document)
     scriptEnabled = frame && frame->script().canExecuteScripts(NotAboutToExecuteScript);
     pluginsEnabled = frame && frame->loader().subframeLoader().allowPlugins();
 
-    Settings* settings = document.settings();
-    usePreHTML5ParserQuirks = settings && settings->usePreHTML5ParserQuirks();
-    maximumDOMTreeDepth = settings ? settings->maximumHTMLParserDOMTreeDepth() : Settings::defaultMaximumHTMLParserDOMTreeDepth;
+    usePreHTML5ParserQuirks = document.settings().usePreHTML5ParserQuirks();
+    maximumDOMTreeDepth = document.settings().maximumHTMLParserDOMTreeDepth();
 }
 
 }
index 7052715..87da17e 100644 (file)
@@ -953,7 +953,7 @@ void MediaControlFullscreenButtonElement::defaultEventHandler(Event& event)
         // allows apps which embed a WebView to retain the existing full screen
         // video implementation without requiring them to implement their own full
         // screen behavior.
-        if (document().settings() && document().settings()->fullScreenEnabled()) {
+        if (document().settings().fullScreenEnabled()) {
             if (document().webkitIsFullScreen() && document().webkitCurrentFullScreenElement() == parentMediaElement(this))
                 document().webkitCancelFullScreen();
             else
index 10966c6..9b53ce8 100644 (file)
@@ -199,10 +199,9 @@ void LinkLoader::cancelLoad()
 bool LinkLoader::loadLink(const LinkRelAttribute& relAttribute, const URL& href, const String& as, const String& crossOrigin, Document& document)
 {
     if (relAttribute.isDNSPrefetch) {
-        Settings* settings = document.settings();
         // FIXME: The href attribute of the link element can be in "//hostname" form, and we shouldn't attempt
         // to complete that as URL <https://bugs.webkit.org/show_bug.cgi?id=48857>.
-        if (settings && settings->dnsPrefetchingEnabled() && href.isValid() && !href.isEmpty() && document.frame())
+        if (document.settings().dnsPrefetchingEnabled() && href.isValid() && !href.isEmpty() && document.frame())
             document.frame()->loader().client().prefetchDNS(href.host());
     }
 
index 9caaa6d..c3fbf6e 100644 (file)
@@ -256,7 +256,7 @@ bool ContentSecurityPolicy::urlMatchesSelf(const URL& url) const
 
 bool ContentSecurityPolicy::allowContentSecurityPolicySourceStarToMatchAnyProtocol() const
 {
-    if (Settings* settings = is<Document>(m_scriptExecutionContext) ? downcast<Document>(*m_scriptExecutionContext).settings() : nullptr)
+    if (Settings* settings = is<Document>(m_scriptExecutionContext) ? &downcast<Document>(*m_scriptExecutionContext).settings() : nullptr)
         return settings->allowContentSecurityPolicySourceStarToMatchAnyProtocol();
     return false;
 }
index 9a9fcdf..d31bca5 100644 (file)
@@ -1179,10 +1179,8 @@ static void collectNonEmptyLeafRenderBlockFlowsForCurrentPage(HashSet<const Rend
 void toggleSimpleLineLayout()
 {
     for (const auto* document : Document::allDocuments()) {
-        auto* settings = document->settings();
-        if (!settings)
-            continue;
-        settings->setSimpleLineLayoutEnabled(!settings->simpleLineLayoutEnabled());
+        auto& settings = document->settings();
+        settings.setSimpleLineLayoutEnabled(!settings.simpleLineLayoutEnabled());
     }
 }
 
index 660abbc..c92cc4c 100644 (file)
@@ -45,7 +45,7 @@ enum MinimumFontSizeRule {
     UseSmartMinimumForFontFize
 };
 
-static float computedFontSizeFromSpecifiedSize(float specifiedSize, bool isAbsoluteSize, float zoomFactor, MinimumFontSizeRule minimumSizeRule, const Settings* settings)
+static float computedFontSizeFromSpecifiedSize(float specifiedSize, bool isAbsoluteSize, float zoomFactor, MinimumFontSizeRule minimumSizeRule, const Settings& settings)
 {
     // Text with a 0px font size should not be visible and therefore needs to be
     // exempt from minimum font size rules. Acid3 relies on this for pixel-perfect
@@ -64,14 +64,11 @@ static float computedFontSizeFromSpecifiedSize(float specifiedSize, bool isAbsol
     // However we always allow the page to set an explicit pixel size that is smaller,
     // since sites will mis-render otherwise (e.g., http://www.gamespot.com with a 9px minimum).
 
-    if (!settings)
-        return 1.0f;
-
     if (minimumSizeRule == DoNotApplyMinimumFontSize)
         return specifiedSize;
 
-    int minSize = settings->minimumFontSize();
-    int minLogicalSize = settings->minimumLogicalFontSize();
+    int minSize = settings.minimumFontSize();
+    int minLogicalSize = settings.minimumLogicalFontSize();
     float zoomedSize = specifiedSize * zoomFactor;
 
     // Apply the hard minimum first. We only apply the hard minimum if after zooming we're still too small.
@@ -151,12 +148,8 @@ static const float fontSizeFactors[totalKeywords] = { 0.60f, 0.75f, 0.89f, 1.0f,
 
 float fontSizeForKeyword(unsigned keywordID, bool shouldUseFixedDefaultSize, const Document& document)
 {
-    Settings* settings = document.settings();
-    if (!settings)
-        return 1.0f;
-
     bool quirksMode = document.inQuirksMode();
-    int mediumSize = shouldUseFixedDefaultSize ? settings->defaultFixedFontSize() : settings->defaultFontSize();
+    int mediumSize = shouldUseFixedDefaultSize ? document.settings().defaultFixedFontSize() : document.settings().defaultFontSize();
     if (mediumSize >= fontSizeTableMin && mediumSize <= fontSizeTableMax) {
         // Look up the entry in the table.
         int row = mediumSize - fontSizeTableMin;
@@ -165,7 +158,7 @@ float fontSizeForKeyword(unsigned keywordID, bool shouldUseFixedDefaultSize, con
     }
 
     // Value is outside the range of the table. Apply the scale factor instead.
-    float minLogicalSize = std::max(settings->minimumLogicalFontSize(), 1);
+    float minLogicalSize = std::max(document.settings().minimumLogicalFontSize(), 1);
     return std::max(fontSizeFactors[keywordID - CSSValueXxSmall] * mediumSize, minLogicalSize);
 }
 
@@ -182,12 +175,8 @@ static int findNearestLegacyFontSize(int pixelFontSize, const T* table, int mult
 
 int legacyFontSizeForPixelSize(int pixelFontSize, bool shouldUseFixedDefaultSize, const Document& document)
 {
-    Settings* settings = document.settings();
-    if (!settings)
-        return 1;
-
     bool quirksMode = document.inQuirksMode();
-    int mediumSize = shouldUseFixedDefaultSize ? settings->defaultFixedFontSize() : settings->defaultFontSize();
+    int mediumSize = shouldUseFixedDefaultSize ? document.settings().defaultFixedFontSize() : document.settings().defaultFontSize();
     if (mediumSize >= fontSizeTableMin && mediumSize <= fontSizeTableMax) {
         int row = mediumSize - fontSizeTableMin;
         return findNearestLegacyFontSize<int>(pixelFontSize, quirksMode ? quirksFontSizeTable[row] : strictFontSizeTable[row], 1);
index 9e8b71d..1c48d43 100644 (file)
@@ -231,7 +231,7 @@ void Scope::removeStyleSheetCandidateNode(Node& node)
 
 void Scope::collectActiveStyleSheets(Vector<RefPtr<StyleSheet>>& sheets)
 {
-    if (m_document.settings() && !m_document.settings()->authorAndUserStylesEnabled())
+    if (!m_document.settings().authorAndUserStylesEnabled())
         return;
 
     for (auto& node : m_styleSheetCandidateNodes) {
index 90f9f7f..d619e68 100644 (file)
@@ -145,8 +145,7 @@ bool XMLHttpRequest::usesDashboardBackwardCompatibilityMode() const
 {
     if (scriptExecutionContext()->isWorkerGlobalScope())
         return false;
-    Settings* settings = document()->settings();
-    return settings && settings->usesDashboardBackwardCompatibilityMode();
+    return document()->settings().usesDashboardBackwardCompatibilityMode();
 }
 
 #endif