<https://webkit.org/b/119903> Make Settings ref-counted (and let Frame keep a ref!)
Reviewed by Geoff Garen.
Let Frame hold a RefPtr<Settings> so Frame::settings() isn't forced to go through Page.
It now also returns a reference, as it can never be null.
Removed 8.8 million lines of null-checking as a result.
git-svn-id: http://svn.webkit.org/repository/webkit/trunk@154219 268f45cc-cd09-0410-ab3c-d52691b4dbfc
diff --git a/Source/WebCore/ChangeLog b/Source/WebCore/ChangeLog
index 45dac44..e164445 100644
--- a/Source/WebCore/ChangeLog
+++ b/Source/WebCore/ChangeLog
@@ -1,3 +1,14 @@
+2013-08-16 Andreas Kling <akling@apple.com>
+
+ <https://webkit.org/b/119903> Make Settings ref-counted (and let Frame keep a ref!)
+
+ Reviewed by Geoff Garen.
+
+ Let Frame hold a RefPtr<Settings> so Frame::settings() isn't forced to go through Page.
+ It now also returns a reference, as it can never be null.
+
+ Removed 8.8 million lines of null-checking as a result.
+
2013-08-16 Ryosuke Niwa <rniwa@webkit.org>
<https://webkit.org/b/119536> Refactor highestEditableRoot to avoid a redundant call to rendererIsEditable
diff --git a/Source/WebCore/WebCore.exp.in b/Source/WebCore/WebCore.exp.in
index f320a1e9..e342178 100644
--- a/Source/WebCore/WebCore.exp.in
+++ b/Source/WebCore/WebCore.exp.in
@@ -1588,7 +1588,6 @@
__ZNK7WebCore5Frame18documentTypeStringEv
__ZNK7WebCore5Frame25trackedRepaintRectsAsTextEv
__ZNK7WebCore5Frame31displayStringModifiedByEncodingERKN3WTF6StringE
-__ZNK7WebCore5Frame8settingsEv
__ZNK7WebCore5Range11startOffsetERi
__ZNK7WebCore5Range12endContainerERi
__ZNK7WebCore5Range12pastLastNodeEv
diff --git a/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp b/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
index 679a739..839e94e 100644
--- a/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
+++ b/Source/WebCore/accessibility/atk/WebKitAccessibleWrapperAtk.cpp
@@ -645,8 +645,7 @@
if (!frame)
return false;
- Settings* settings = frame->settings();
- if (!settings || !settings->caretBrowsingEnabled())
+ if (!frame->settings().caretBrowsingEnabled())
return false;
// Check text objects and paragraphs only.
diff --git a/Source/WebCore/bindings/ScriptControllerBase.cpp b/Source/WebCore/bindings/ScriptControllerBase.cpp
index 9020c1e..635a12d 100644
--- a/Source/WebCore/bindings/ScriptControllerBase.cpp
+++ b/Source/WebCore/bindings/ScriptControllerBase.cpp
@@ -51,8 +51,7 @@
return true;
}
- Settings* settings = m_frame->settings();
- const bool allowed = m_frame->loader().client()->allowScript(settings && settings->isScriptEnabled());
+ const bool allowed = m_frame->loader().client()->allowScript(m_frame->settings().isScriptEnabled());
if (!allowed && reason == AboutToExecuteScript)
m_frame->loader().client()->didNotAllowScript();
return allowed;
diff --git a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
index 4ae94fa..3ab6a52 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
+++ b/Source/WebCore/bindings/js/JSDOMWindowBase.cpp
@@ -160,10 +160,7 @@
Frame* frame = thisObject->impl()->frame();
if (!frame)
return false;
- Settings* settings = frame->settings();
- if (!settings)
- return false;
- return settings->javaScriptExperimentsEnabled();
+ return frame->settings().javaScriptExperimentsEnabled();
}
void JSDOMWindowBase::willRemoveFromWindowShell()
diff --git a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
index 0cbcd4f..d889b61 100644
--- a/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
+++ b/Source/WebCore/bindings/js/JSDOMWindowCustom.cpp
@@ -501,12 +501,10 @@
// To avoid breaking old widgets, make "var location =" in a top-level frame create
// a property named "location" instead of performing a navigation (<rdar://problem/5688039>).
if (Frame* activeFrame = activeDOMWindow(exec)->frame()) {
- if (Settings* settings = activeFrame->settings()) {
- if (settings->usesDashboardBackwardCompatibilityMode() && !activeFrame->tree()->parent()) {
- if (BindingSecurity::shouldAllowAccessToDOMWindow(exec, impl()))
- putDirect(exec->vm(), Identifier(exec, "location"), value);
- return;
- }
+ if (activeFrame->settings().usesDashboardBackwardCompatibilityMode() && !activeFrame->tree()->parent()) {
+ if (BindingSecurity::shouldAllowAccessToDOMWindow(exec, impl()))
+ putDirect(exec->vm(), Identifier(exec, "location"), value);
+ return;
}
}
#endif
diff --git a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
index 9a9bc58..ecbfb8e 100644
--- a/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
+++ b/Source/WebCore/bindings/scripts/CodeGeneratorJS.pm
@@ -1994,8 +1994,10 @@
AddToImplIncludes("Frame.h");
AddToImplIncludes("Settings.h");
my $enable_function = ToMethodName($attribute->signature->extendedAttributes->{"EnabledBySetting"}) . "Enabled";
- push(@implContent, " Settings* settings = castedThis->impl()->frame() ? castedThis->impl()->frame()->settings() : 0;\n");
- push(@implContent, " if (!settings || !settings->$enable_function())\n");
+ push(@implContent, " if (!castedThis->impl()->frame())\n");
+ push(@implContent, " return jsUndefined();\n");
+ push(@implContent, " Settings& settings = castedThis->impl()->frame()->settings();\n");
+ push(@implContent, " if (!settings.$enable_function())\n");
push(@implContent, " return jsUndefined();\n");
}
}
diff --git a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
index b8a190e..887ac9c 100644
--- a/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
+++ b/Source/WebCore/bindings/scripts/test/JS/JSTestObj.cpp
@@ -460,8 +460,10 @@
JSValue jsTestObjTestSubObjEnabledBySettingConstructor(ExecState* exec, JSValue slotBase, PropertyName)
{
JSTestObj* castedThis = jsCast<JSTestObj*>(asObject(slotBase));
- Settings* settings = castedThis->impl()->frame() ? castedThis->impl()->frame()->settings() : 0;
- if (!settings || !settings->testSettingEnabled())
+ if (!castedThis->impl()->frame())
+ return jsUndefined();
+ Settings& settings = castedThis->impl()->frame()->settings();
+ if (!settings.testSettingEnabled())
return jsUndefined();
return JSTestSubObj::getConstructor(exec, castedThis->globalObject());
}
diff --git a/Source/WebCore/css/CSSFontSelector.cpp b/Source/WebCore/css/CSSFontSelector.cpp
index 400bd9a..28de7a8 100644
--- a/Source/WebCore/css/CSSFontSelector.cpp
+++ b/Source/WebCore/css/CSSFontSelector.cpp
@@ -214,7 +214,7 @@
foundSVGFont = item->isSVGFontFaceSrc() || item->svgFontFaceElement();
#endif
if (!item->isLocal()) {
- Settings* settings = m_document ? m_document->frame() ? m_document->frame()->settings() : 0 : 0;
+ Settings* settings = m_document ? m_document->frame() ? &m_document->frame()->settings() : 0 : 0;
bool allowDownloading = foundSVGFont || (settings && settings->downloadableBinaryFontsEnabled());
if (allowDownloading && item->isSupportedFormat() && m_document) {
CachedFont* cachedFont = item->cachedFont(m_document);
@@ -370,27 +370,25 @@
if (!document || !document->frame())
return 0;
- const Settings* settings = document->frame()->settings();
- if (!settings)
- return 0;
+ const Settings& settings = document->frame()->settings();
AtomicString genericFamily;
UScriptCode script = fontDescription.script();
if (familyName == serifFamily)
- genericFamily = settings->serifFontFamily(script);
+ genericFamily = settings.serifFontFamily(script);
else if (familyName == sansSerifFamily)
- genericFamily = settings->sansSerifFontFamily(script);
+ genericFamily = settings.sansSerifFontFamily(script);
else if (familyName == cursiveFamily)
- genericFamily = settings->cursiveFontFamily(script);
+ genericFamily = settings.cursiveFontFamily(script);
else if (familyName == fantasyFamily)
- genericFamily = settings->fantasyFontFamily(script);
+ genericFamily = settings.fantasyFontFamily(script);
else if (familyName == monospaceFamily)
- genericFamily = settings->fixedFontFamily(script);
+ genericFamily = settings.fixedFontFamily(script);
else if (familyName == pictographFamily)
- genericFamily = settings->pictographFontFamily(script);
+ genericFamily = settings.pictographFontFamily(script);
else if (familyName == standardFamily)
- genericFamily = settings->standardFontFamily(script);
+ genericFamily = settings.standardFontFamily(script);
if (!genericFamily.isEmpty())
return fontCache()->getCachedFontData(fontDescription, genericFamily);
diff --git a/Source/WebCore/css/MediaQueryEvaluator.cpp b/Source/WebCore/css/MediaQueryEvaluator.cpp
index 68de0f6..12ef679 100644
--- a/Source/WebCore/css/MediaQueryEvaluator.cpp
+++ b/Source/WebCore/css/MediaQueryEvaluator.cpp
@@ -635,7 +635,7 @@
static PointerDeviceType leastCapablePrimaryPointerDeviceType(Frame* frame)
{
- if (frame->settings()->deviceSupportsTouch())
+ if (frame->settings().deviceSupportsTouch())
return TouchPointer;
// FIXME: We should also try to determine if we know we have a mouse.
diff --git a/Source/WebCore/dom/DOMImplementation.cpp b/Source/WebCore/dom/DOMImplementation.cpp
index 2b5aa70..3240a1d 100644
--- a/Source/WebCore/dom/DOMImplementation.cpp
+++ b/Source/WebCore/dom/DOMImplementation.cpp
@@ -367,7 +367,7 @@
#if ENABLE(VIDEO)
// Check to see if the type can be played by our MediaPlayer, if so create a MediaDocument
// Key system is not applicable here.
- DOMImplementationSupportsTypeClient client(frame && frame->settings() && frame->settings()->needsSiteSpecificQuirks(), url.host());
+ DOMImplementationSupportsTypeClient client(frame && frame->settings().needsSiteSpecificQuirks(), url.host());
if (MediaPlayer::supportsType(ContentType(type), String(), url, &client))
return MediaDocument::create(frame, url);
#endif
diff --git a/Source/WebCore/dom/Document.cpp b/Source/WebCore/dom/Document.cpp
index f1d8e99..8be1790 100644
--- a/Source/WebCore/dom/Document.cpp
+++ b/Source/WebCore/dom/Document.cpp
@@ -1650,7 +1650,7 @@
Settings* Document::settings() const
{
- return m_frame ? m_frame->settings() : 0;
+ return m_frame ? &m_frame->settings() : 0;
}
PassRefPtr<Range> Document::createRange()
diff --git a/Source/WebCore/editing/Editor.cpp b/Source/WebCore/editing/Editor.cpp
index 481533a..d9569f8 100644
--- a/Source/WebCore/editing/Editor.cpp
+++ b/Source/WebCore/editing/Editor.cpp
@@ -182,10 +182,9 @@
// Function considers Mac editing behavior a fallback when Page or Settings is not available.
EditingBehavior Editor::behavior() const
{
- if (!m_frame || !m_frame->settings())
+ if (!m_frame)
return EditingBehavior(EditingMacBehavior);
-
- return EditingBehavior(m_frame->settings()->editingBehaviorType());
+ return EditingBehavior(m_frame->settings().editingBehaviorType());
}
EditorClient* Editor::client() const
@@ -2118,7 +2117,7 @@
return;
RefPtr<Range> paragraphRange = paragraphToCheck.paragraphRange();
- bool asynchronous = m_frame && m_frame->settings() && m_frame->settings()->asynchronousSpellCheckingEnabled() && !shouldShowCorrectionPanel;
+ bool asynchronous = m_frame && m_frame->settings().asynchronousSpellCheckingEnabled() && !shouldShowCorrectionPanel;
// In asynchronous mode, we intentionally check paragraph-wide sentence.
RefPtr<SpellCheckRequest> request = SpellCheckRequest::create(resolveTextCheckingTypeMask(textCheckingOptions), TextCheckingProcessIncremental, asynchronous ? paragraphRange : rangeToCheck, paragraphRange);
@@ -2631,7 +2630,7 @@
String Editor::selectedTextForClipboard() const
{
- if (m_frame->settings() && m_frame->settings()->selectionIncludesAltImageText())
+ if (m_frame->settings().selectionIncludesAltImageText())
return selectedText(TextIteratorEmitsImageAltText);
return selectedText();
}
@@ -2989,7 +2988,7 @@
if (isContinuousSpellCheckingEnabled) {
VisibleSelection newAdjacentWords;
VisibleSelection newSelectedSentence;
- bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsingEnabled();
+ bool caretBrowsing = m_frame->settings().caretBrowsingEnabled();
if (m_frame->selection()->selection().isContentEditable() || caretBrowsing) {
VisiblePosition newStart(m_frame->selection()->selection().visibleStart());
newAdjacentWords = VisibleSelection(startOfWord(newStart, LeftWordIfOnBoundary), endOfWord(newStart, RightWordIfOnBoundary));
diff --git a/Source/WebCore/editing/EditorCommand.cpp b/Source/WebCore/editing/EditorCommand.cpp
index dacefe1..25566fd 100644
--- a/Source/WebCore/editing/EditorCommand.cpp
+++ b/Source/WebCore/editing/EditorCommand.cpp
@@ -1172,8 +1172,7 @@
if (!frame)
return false;
- Settings* settings = frame->settings();
- bool defaultValue = settings && settings->javaScriptCanAccessClipboard();
+ bool defaultValue = frame->settings().javaScriptCanAccessClipboard();
EditorClient* client = frame->editor().client();
return client ? client->canCopyCut(frame, defaultValue) : defaultValue;
@@ -1184,8 +1183,7 @@
if (!frame)
return false;
- Settings* settings = frame->settings();
- bool defaultValue = settings && settings->javaScriptCanAccessClipboard() && settings->DOMPasteAllowed();
+ bool defaultValue = frame->settings().javaScriptCanAccessClipboard() && frame->settings().DOMPasteAllowed();
EditorClient* client = frame->editor().client();
return client ? client->canPaste(frame, defaultValue) : defaultValue;
@@ -1207,7 +1205,7 @@
static bool caretBrowsingEnabled(Frame* frame)
{
- return frame->settings() && frame->settings()->caretBrowsingEnabled();
+ return frame->settings().caretBrowsingEnabled();
}
static EditorCommandSource dummyEditorCommandSource = static_cast<EditorCommandSource>(0);
diff --git a/Source/WebCore/editing/FrameSelection.cpp b/Source/WebCore/editing/FrameSelection.cpp
index be9a643..61c54a4 100644
--- a/Source/WebCore/editing/FrameSelection.cpp
+++ b/Source/WebCore/editing/FrameSelection.cpp
@@ -560,8 +560,7 @@
VisiblePosition FrameSelection::positionForPlatform(bool isGetStart) const
{
- Settings* settings = m_frame ? m_frame->settings() : 0;
- if (settings && settings->editingBehaviorType() == EditingMacBehavior)
+ if (m_frame && m_frame->settings().editingBehaviorType() == EditingMacBehavior)
return isGetStart ? m_selection.visibleStart() : m_selection.visibleEnd();
// Linux and Windows always extend selections from the extent endpoint.
// FIXME: VisibleSelection should be fixed to ensure as an invariant that
@@ -1413,7 +1412,7 @@
{
ASSERT(view);
Frame* frame = view->frameView() ? &view->frameView()->frame() : 0; // The frame where the selection started.
- bool caretBrowsing = frame && frame->settings() && frame->settings()->caretBrowsingEnabled();
+ bool caretBrowsing = frame && frame->settings().caretBrowsingEnabled();
return (caretBrowsing || isContentEditable);
}
@@ -1770,7 +1769,7 @@
#if ENABLE(TEXT_CARET)
bool caretRectChangedOrCleared = recomputeCaretRect();
- bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsingEnabled();
+ bool caretBrowsing = m_frame->settings().caretBrowsingEnabled();
bool shouldBlink = caretIsVisible() && isCaret() && (isContentEditable() || caretBrowsing) && forwardPosition.isNull();
// If the caret moved, stop the blink timer so we can restart with a
@@ -1884,7 +1883,7 @@
if (isNone() || !isFocused())
return;
- bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsingEnabled();
+ bool caretBrowsing = m_frame->settings().caretBrowsingEnabled();
if (caretBrowsing) {
if (Element* anchor = enclosingAnchorElement(base())) {
m_frame->page()->focusController().setFocusedElement(anchor, m_frame);
@@ -2037,7 +2036,7 @@
// entire WebView is editable or designMode is on for this document).
Document* document = m_frame->document();
- bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsingEnabled();
+ bool caretBrowsing = m_frame->settings().caretBrowsingEnabled();
if (!isNone() || !(document->rendererIsEditable() || caretBrowsing))
return;
@@ -2064,8 +2063,9 @@
inline bool FrameSelection::visualWordMovementEnabled() const
{
- Settings* settings = m_frame ? m_frame->settings() : 0;
- return settings && settings->visualWordMovementEnabled();
+ if (!m_frame)
+ return false;
+ return m_frame->settings().visualWordMovementEnabled();
}
void FrameSelection::setShouldShowBlockCursor(bool shouldShowBlockCursor)
diff --git a/Source/WebCore/editing/SpellChecker.cpp b/Source/WebCore/editing/SpellChecker.cpp
index c6e028f..288b7b3 100644
--- a/Source/WebCore/editing/SpellChecker.cpp
+++ b/Source/WebCore/editing/SpellChecker.cpp
@@ -141,7 +141,7 @@
bool SpellChecker::isAsynchronousEnabled() const
{
- return m_frame->settings() && m_frame->settings()->asynchronousSpellCheckingEnabled();
+ return m_frame->settings().asynchronousSpellCheckingEnabled();
}
bool SpellChecker::canCheckAsynchronously(Range* range) const
diff --git a/Source/WebCore/editing/TextCheckingHelper.cpp b/Source/WebCore/editing/TextCheckingHelper.cpp
index abbbc18..1ba1749 100644
--- a/Source/WebCore/editing/TextCheckingHelper.cpp
+++ b/Source/WebCore/editing/TextCheckingHelper.cpp
@@ -683,12 +683,7 @@
{
if (!frame)
return false;
-
- const Settings* settings = frame->settings();
- if (!settings)
- return false;
-
- return settings->unifiedTextCheckerEnabled();
+ return frame->settings().unifiedTextCheckerEnabled();
}
}
diff --git a/Source/WebCore/html/HTMLEmbedElement.cpp b/Source/WebCore/html/HTMLEmbedElement.cpp
index 5ef0beb..455087a 100644
--- a/Source/WebCore/html/HTMLEmbedElement.cpp
+++ b/Source/WebCore/html/HTMLEmbedElement.cpp
@@ -191,11 +191,9 @@
}
#if ENABLE(DASHBOARD_SUPPORT)
- // Workaround for <rdar://problem/6642221>.
- if (Settings* settings = frame->settings()) {
- if (settings->usesDashboardBackwardCompatibilityMode())
- return true;
- }
+ // Workaround for <rdar://problem/6642221>.
+ if (frame->settings().usesDashboardBackwardCompatibilityMode())
+ return true;
#endif
return HTMLPlugInImageElement::rendererIsNeeded(context);
diff --git a/Source/WebCore/html/HTMLSelectElement.cpp b/Source/WebCore/html/HTMLSelectElement.cpp
index 6da8e71..e89fa6c 100644
--- a/Source/WebCore/html/HTMLSelectElement.cpp
+++ b/Source/WebCore/html/HTMLSelectElement.cpp
@@ -1131,7 +1131,7 @@
// When using caret browsing, we want to be able to move the focus
// out of the select element when user hits a left or right arrow key.
const Frame* frame = document()->frame();
- if (frame && frame->settings() && frame->settings()->caretBrowsingEnabled()) {
+ if (frame && frame->settings().caretBrowsingEnabled()) {
if (keyIdentifier == "Left" || keyIdentifier == "Right")
return;
}
diff --git a/Source/WebCore/html/ImageDocument.cpp b/Source/WebCore/html/ImageDocument.cpp
index db2d1d9..74d11e6 100644
--- a/Source/WebCore/html/ImageDocument.cpp
+++ b/Source/WebCore/html/ImageDocument.cpp
@@ -130,8 +130,7 @@
void ImageDocumentParser::appendBytes(DocumentWriter*, const char*, size_t)
{
Frame* frame = document()->frame();
- Settings* settings = frame->settings();
- if (!frame->loader().client()->allowImage(!settings || settings->areImagesEnabled(), document()->url()))
+ if (!frame->loader().client()->allowImage(frame->settings().areImagesEnabled(), document()->url()))
return;
CachedImage* cachedImage = document()->cachedImage();
diff --git a/Source/WebCore/html/PluginDocument.cpp b/Source/WebCore/html/PluginDocument.cpp
index 14fbcf9..6cc40c2 100644
--- a/Source/WebCore/html/PluginDocument.cpp
+++ b/Source/WebCore/html/PluginDocument.cpp
@@ -110,9 +110,6 @@
Frame* frame = document()->frame();
if (!frame)
return;
- Settings* settings = frame->settings();
- if (!settings)
- return;
document()->updateLayout();
diff --git a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
index c5610d3..54ca48b 100644
--- a/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
+++ b/Source/WebCore/html/canvas/WebGLRenderingContext.cpp
@@ -411,11 +411,10 @@
Frame* frame = document->frame();
if (!frame)
return nullptr;
- Settings* settings = frame->settings();
// The FrameLoaderClient might creation of a new WebGL context despite the page settings; in
// particular, if WebGL contexts were lost one or more times via the GL_ARB_robustness extension.
- if (!frame->loader().client()->allowWebGL(settings && settings->webGLEnabled())) {
+ if (!frame->loader().client()->allowWebGL(frame->settings().webGLEnabled())) {
canvas->dispatchEvent(WebGLContextEvent::create(eventNames().webglcontextcreationerrorEvent, false, true, "Web page was not allowed to create a WebGL context."));
return nullptr;
}
@@ -424,7 +423,7 @@
GraphicsContext3D::Attributes attributes = attrs ? attrs->attributes() : GraphicsContext3D::Attributes();
if (attributes.antialias) {
- if (settings && !settings->openGLMultisamplingEnabled())
+ if (!frame->settings().openGLMultisamplingEnabled())
attributes.antialias = false;
}
@@ -5820,7 +5819,7 @@
if (!frame)
return;
- if (!frame->loader().client()->allowWebGL(frame->settings() && frame->settings()->webGLEnabled()))
+ if (!frame->loader().client()->allowWebGL(frame->settings().webGLEnabled()))
return;
FrameView* view = frame->view();
diff --git a/Source/WebCore/html/parser/XSSAuditor.cpp b/Source/WebCore/html/parser/XSSAuditor.cpp
index 30660f9..862467b 100644
--- a/Source/WebCore/html/parser/XSSAuditor.cpp
+++ b/Source/WebCore/html/parser/XSSAuditor.cpp
@@ -239,8 +239,7 @@
m_state = Initialized;
if (Frame* frame = document->frame())
- if (Settings* settings = frame->settings())
- m_isEnabled = settings->xssAuditorEnabled();
+ m_isEnabled = frame->settings().xssAuditorEnabled();
if (!m_isEnabled)
return;
diff --git a/Source/WebCore/inspector/InspectorPageAgent.cpp b/Source/WebCore/inspector/InspectorPageAgent.cpp
index 67bed5c..3eb01f5 100644
--- a/Source/WebCore/inspector/InspectorPageAgent.cpp
+++ b/Source/WebCore/inspector/InspectorPageAgent.cpp
@@ -434,10 +434,8 @@
m_state->setBoolean(PageAgentState::pageAgentEnabled, true);
m_instrumentingAgents->setInspectorPageAgent(this);
- if (Frame* frame = mainFrame()) {
- if (Settings* settings = frame->settings())
- m_originalScriptExecutionDisabled = !settings->isScriptEnabled();
- }
+ if (Frame* frame = mainFrame())
+ m_originalScriptExecutionDisabled = !frame->settings().isScriptEnabled();
}
void InspectorPageAgent::disable(ErrorString*)
@@ -840,8 +838,7 @@
Frame* frame = mainFrame();
if (frame) {
disabledByScriptController = !frame->script().canExecuteScripts(NotAboutToExecuteScript);
- if (frame->settings())
- disabledInSettings = !frame->settings()->isScriptEnabled();
+ disabledInSettings = !frame->settings().isScriptEnabled();
}
if (!disabledByScriptController) {
@@ -861,12 +858,9 @@
if (!mainFrame())
return;
- Settings* settings = mainFrame()->settings();
- if (settings) {
- m_ignoreScriptsEnabledNotification = true;
- settings->setScriptEnabled(!value);
- m_ignoreScriptsEnabledNotification = false;
- }
+ m_ignoreScriptsEnabledNotification = true;
+ mainFrame()->settings().setScriptEnabled(!value);
+ m_ignoreScriptsEnabledNotification = false;
}
void InspectorPageAgent::didClearWindowObjectInWorld(Frame* frame, DOMWrapperWorld* world)
@@ -1171,8 +1165,8 @@
void InspectorPageAgent::updateTouchEventEmulationInPage(bool enabled)
{
m_state->setBoolean(PageAgentState::touchEventEmulationEnabled, enabled);
- if (mainFrame() && mainFrame()->settings())
- mainFrame()->settings()->setTouchEventEmulationEnabled(enabled);
+ if (mainFrame())
+ mainFrame()->settings().setTouchEventEmulationEnabled(enabled);
}
#endif
diff --git a/Source/WebCore/loader/DocumentLoader.cpp b/Source/WebCore/loader/DocumentLoader.cpp
index a7e6139..ec7fe7c 100644
--- a/Source/WebCore/loader/DocumentLoader.cpp
+++ b/Source/WebCore/loader/DocumentLoader.cpp
@@ -626,8 +626,7 @@
#if ENABLE(FTPDIR)
// Respect the hidden FTP Directory Listing pref so it can be tested even if the policy delegate might otherwise disallow it
- Settings* settings = m_frame->settings();
- if (settings && settings->forceFTPDirectoryListings() && m_response.mimeType() == "application/x-ftp-directory") {
+ if (m_frame->settings().forceFTPDirectoryListings() && m_response.mimeType() == "application/x-ftp-directory") {
continueAfterContentPolicy(PolicyUse);
return;
}
@@ -940,7 +939,7 @@
// Once a frame has loaded, we no longer need to consider subresources,
// but we still need to consider subframes.
if (frameLoader()->state() != FrameStateComplete) {
- if (m_frame->settings()->needsIsLoadingInAPISenseQuirk() && !m_subresourceLoaders.isEmpty())
+ if (m_frame->settings().needsIsLoadingInAPISenseQuirk() && !m_subresourceLoaders.isEmpty())
return true;
Document* doc = m_frame->document();
@@ -1176,7 +1175,7 @@
#if ENABLE(WEB_ARCHIVE)
case Archive::WebArchive:
// WebArchiveDebugMode means we fail loads instead of trying to fetch them from the network if they're not in the archive.
- return m_frame->settings() && m_frame->settings()->webArchiveDebugModeEnabled() && ArchiveFactory::isArchiveMimeType(responseMIMEType());
+ return m_frame->settings().webArchiveDebugModeEnabled() && ArchiveFactory::isArchiveMimeType(responseMIMEType());
#endif
#if ENABLE(MHTML)
case Archive::MHTML:
diff --git a/Source/WebCore/loader/DocumentWriter.cpp b/Source/WebCore/loader/DocumentWriter.cpp
index 9974292..b89dd3d 100644
--- a/Source/WebCore/loader/DocumentWriter.cpp
+++ b/Source/WebCore/loader/DocumentWriter.cpp
@@ -169,25 +169,21 @@
TextResourceDecoder* DocumentWriter::createDecoderIfNeeded()
{
if (!m_decoder) {
- if (Settings* settings = m_frame->settings()) {
- m_decoder = TextResourceDecoder::create(m_mimeType,
- settings->defaultTextEncodingName(),
- settings->usesEncodingDetector());
- Frame* parentFrame = m_frame->tree()->parent();
- // Set the hint encoding to the parent frame encoding only if
- // the parent and the current frames share the security origin.
- // We impose this condition because somebody can make a child frame
- // containing a carefully crafted html/javascript in one encoding
- // that can be mistaken for hintEncoding (or related encoding) by
- // an auto detector. When interpreted in the latter, it could be
- // an attack vector.
- // FIXME: This might be too cautious for non-7bit-encodings and
- // we may consider relaxing this later after testing.
- if (canReferToParentFrameEncoding(m_frame, parentFrame))
- m_decoder->setHintEncoding(parentFrame->document()->decoder());
- } else
- m_decoder = TextResourceDecoder::create(m_mimeType, String());
+ m_decoder = TextResourceDecoder::create(m_mimeType,
+ m_frame->settings().defaultTextEncodingName(),
+ m_frame->settings().usesEncodingDetector());
Frame* parentFrame = m_frame->tree()->parent();
+ // Set the hint encoding to the parent frame encoding only if
+ // the parent and the current frames share the security origin.
+ // We impose this condition because somebody can make a child frame
+ // containing a carefully crafted html/javascript in one encoding
+ // that can be mistaken for hintEncoding (or related encoding) by
+ // an auto detector. When interpreted in the latter, it could be
+ // an attack vector.
+ // FIXME: This might be too cautious for non-7bit-encodings and
+ // we may consider relaxing this later after testing.
+ if (canReferToParentFrameEncoding(m_frame, parentFrame))
+ m_decoder->setHintEncoding(parentFrame->document()->decoder());
if (m_encoding.isEmpty()) {
if (canReferToParentFrameEncoding(m_frame, parentFrame))
m_decoder->setEncoding(parentFrame->document()->inputEncoding(), TextResourceDecoder::EncodingFromParentFrame);
diff --git a/Source/WebCore/loader/FrameLoader.cpp b/Source/WebCore/loader/FrameLoader.cpp
index 197a309..b3160e9 100644
--- a/Source/WebCore/loader/FrameLoader.cpp
+++ b/Source/WebCore/loader/FrameLoader.cpp
@@ -2503,8 +2503,7 @@
// Only set fallback array if it's still empty (later attempts may be incorrect, see bug 117818).
if (request.responseContentDispositionEncodingFallbackArray().isEmpty()) {
// Always try UTF-8. If that fails, try frame encoding (if any) and then the default.
- Settings* settings = m_frame->settings();
- request.setResponseContentDispositionEncodingFallbackArray("UTF-8", m_frame->document()->encoding(), settings ? settings->defaultTextEncodingName() : String());
+ request.setResponseContentDispositionEncodingFallbackArray("UTF-8", m_frame->document()->encoding(), m_frame->settings().defaultTextEncodingName());
}
}
@@ -3422,7 +3421,7 @@
requestWithReferrer.resourceRequest().setHTTPReferrer(referrer);
FrameLoader::addHTTPOriginIfNeeded(requestWithReferrer.resourceRequest(), openerFrame->loader().outgoingOrigin());
- if (openerFrame->settings() && !openerFrame->settings()->supportsMultipleWindows()) {
+ if (!openerFrame->settings().supportsMultipleWindows()) {
created = false;
return openerFrame;
}
diff --git a/Source/WebCore/loader/HistoryController.cpp b/Source/WebCore/loader/HistoryController.cpp
index 9d7d522..f6d9e48 100644
--- a/Source/WebCore/loader/HistoryController.cpp
+++ b/Source/WebCore/loader/HistoryController.cpp
@@ -362,8 +362,7 @@
FrameLoader& frameLoader = m_frame->loader();
- Settings* settings = m_frame->settings();
- bool needPrivacy = !settings || settings->privateBrowsingEnabled();
+ bool needPrivacy = m_frame->settings().privateBrowsingEnabled();
const KURL& historyURL = frameLoader.documentLoader()->urlForHistory();
if (!frameLoader.documentLoader()->isClientRedirect()) {
@@ -400,8 +399,7 @@
LOG(History, "WebCoreHistory: Updating History for redirect load in frame %s", m_frame->loader().documentLoader()->title().string().utf8().data());
#endif
- Settings* settings = m_frame->settings();
- bool needPrivacy = !settings || settings->privateBrowsingEnabled();
+ bool needPrivacy = m_frame->settings().privateBrowsingEnabled();
const KURL& historyURL = m_frame->loader().documentLoader()->urlForHistory();
if (m_frame->loader().documentLoader()->isClientRedirect()) {
@@ -449,8 +447,7 @@
m_currentItem->clearScrollPoint();
}
- Settings* settings = m_frame->settings();
- bool needPrivacy = !settings || settings->privateBrowsingEnabled();
+ bool needPrivacy = m_frame->settings().privateBrowsingEnabled();
const KURL& historyURL = m_frame->loader().documentLoader()->urlForHistory();
if (!historyURL.isEmpty() && !needPrivacy) {
@@ -542,8 +539,7 @@
if (m_frame->document()->url().isEmpty())
return;
- Settings* settings = m_frame->settings();
- if (!settings || settings->privateBrowsingEnabled())
+ if (m_frame->settings().privateBrowsingEnabled())
return;
Page* page = m_frame->page();
@@ -871,8 +867,7 @@
page->backForward()->addItem(topItem.release());
- Settings* settings = m_frame->settings();
- if (!settings || settings->privateBrowsingEnabled())
+ if (m_frame->settings().privateBrowsingEnabled())
return;
addVisitedLink(page, KURL(ParsedURLString, urlString));
@@ -892,8 +887,7 @@
m_currentItem->setFormData(0);
m_currentItem->setFormContentType(String());
- Settings* settings = m_frame->settings();
- if (!settings || settings->privateBrowsingEnabled())
+ if (m_frame->settings().privateBrowsingEnabled())
return;
ASSERT(m_frame->page());
diff --git a/Source/WebCore/loader/MixedContentChecker.cpp b/Source/WebCore/loader/MixedContentChecker.cpp
index 8176c02..50cfbc3 100644
--- a/Source/WebCore/loader/MixedContentChecker.cpp
+++ b/Source/WebCore/loader/MixedContentChecker.cpp
@@ -68,8 +68,7 @@
if (!isMixedContent(securityOrigin, url))
return true;
- Settings* settings = m_frame->settings();
- bool allowed = client()->allowDisplayingInsecureContent(settings && settings->allowDisplayOfInsecureContent(), securityOrigin, url);
+ bool allowed = client()->allowDisplayingInsecureContent(m_frame->settings().allowDisplayOfInsecureContent(), securityOrigin, url);
logWarning(allowed, "displayed", url);
if (allowed)
@@ -83,8 +82,7 @@
if (!isMixedContent(securityOrigin, url))
return true;
- Settings* settings = m_frame->settings();
- bool allowed = client()->allowRunningInsecureContent(settings && settings->allowRunningOfInsecureContent(), securityOrigin, url);
+ bool allowed = client()->allowRunningInsecureContent(m_frame->settings().allowRunningOfInsecureContent(), securityOrigin, url);
logWarning(allowed, "ran", url);
if (allowed)
diff --git a/Source/WebCore/loader/SubframeLoader.cpp b/Source/WebCore/loader/SubframeLoader.cpp
index 144d13f..359a212 100644
--- a/Source/WebCore/loader/SubframeLoader.cpp
+++ b/Source/WebCore/loader/SubframeLoader.cpp
@@ -108,14 +108,10 @@
bool SubframeLoader::pluginIsLoadable(HTMLPlugInImageElement* pluginElement, const KURL& url, const String& mimeType)
{
- Settings* settings = m_frame->settings();
- if (!settings)
- return false;
-
if (MIMETypeRegistry::isJavaAppletMIMEType(mimeType)) {
- if (!settings->isJavaEnabled())
+ if (!m_frame->settings().isJavaEnabled())
return false;
- if (document() && document()->securityOrigin()->isLocal() && !settings->isJavaEnabledForLocalFiles())
+ if (document() && document()->securityOrigin()->isLocal() && !m_frame->settings().isJavaEnabledForLocalFiles())
return false;
}
@@ -404,8 +400,7 @@
bool SubframeLoader::allowPlugins(ReasonForCallingAllowPlugins reason)
{
- Settings* settings = m_frame->settings();
- bool allowed = m_frame->loader().client()->allowPlugins(settings && settings->arePluginsEnabled());
+ bool allowed = m_frame->loader().client()->allowPlugins(m_frame->settings().arePluginsEnabled());
if (!allowed && reason == AboutToInstantiatePlugin)
m_frame->loader().client()->didNotAllowPlugins();
return allowed;
diff --git a/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp b/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
index 268cd89f..2a83f89 100644
--- a/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
+++ b/Source/WebCore/loader/appcache/ApplicationCacheGroup.cpp
@@ -138,7 +138,7 @@
{
ASSERT(frame && frame->page());
- if (!frame->settings() || !frame->settings()->offlineWebApplicationCacheEnabled())
+ if (!frame->settings().offlineWebApplicationCacheEnabled())
return;
if (!frame->document()->securityOrigin()->canAccessApplicationCache(frame->tree()->top()->document()->securityOrigin()))
@@ -196,7 +196,7 @@
return;
// Don't change anything on disk if private browsing is enabled.
- if (frame->settings()->privateBrowsingEnabled()) {
+ if (frame->settings().privateBrowsingEnabled()) {
postListenerTask(ApplicationCacheHost::CHECKING_EVENT, documentLoader);
postListenerTask(ApplicationCacheHost::ERROR_EVENT, documentLoader);
return;
@@ -214,7 +214,7 @@
void ApplicationCacheGroup::selectCacheWithoutManifestURL(Frame* frame)
{
- if (!frame->settings() || !frame->settings()->offlineWebApplicationCacheEnabled())
+ if (!frame->settings().offlineWebApplicationCacheEnabled())
return;
if (!frame->document()->securityOrigin()->canAccessApplicationCache(frame->tree()->top()->document()->securityOrigin()))
@@ -440,7 +440,7 @@
}
// Don't change anything on disk if private browsing is enabled.
- if (!frame->settings() || frame->settings()->privateBrowsingEnabled()) {
+ if (frame->settings().privateBrowsingEnabled()) {
ASSERT(m_pendingMasterResourceLoaders.isEmpty());
ASSERT(m_pendingEntries.isEmpty());
ASSERT(!m_cacheBeingUpdated);
diff --git a/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp b/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp
index 0b0a311..5fd5900 100644
--- a/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp
+++ b/Source/WebCore/loader/appcache/ApplicationCacheHost.cpp
@@ -474,8 +474,7 @@
bool ApplicationCacheHost::isApplicationCacheEnabled()
{
- return m_documentLoader->frame() && m_documentLoader->frame()->settings()
- && m_documentLoader->frame()->settings()->offlineWebApplicationCacheEnabled();
+ return m_documentLoader->frame() && m_documentLoader->frame()->settings().offlineWebApplicationCacheEnabled();
}
} // namespace WebCore
diff --git a/Source/WebCore/loader/cache/CachedImage.cpp b/Source/WebCore/loader/cache/CachedImage.cpp
index 77158fe..a6f9adf 100644
--- a/Source/WebCore/loader/cache/CachedImage.cpp
+++ b/Source/WebCore/loader/cache/CachedImage.cpp
@@ -352,12 +352,8 @@
if (!m_loader || m_loader->reachedTerminalState())
return true;
- Settings* settings = m_loader->frameLoader()->frame()->settings();
- if (!settings)
- return true;
-
size_t estimatedDecodedImageSize = m_image->width() * m_image->height() * 4; // no overflow check
- return estimatedDecodedImageSize <= settings->maximumDecodedImageSize();
+ return estimatedDecodedImageSize <= m_loader->frameLoader()->frame()->settings().maximumDecodedImageSize();
}
void CachedImage::addIncrementalDataBuffer(ResourceBuffer* data)
diff --git a/Source/WebCore/loader/cache/CachedResourceLoader.cpp b/Source/WebCore/loader/cache/CachedResourceLoader.cpp
index 60f9696..3c3712f 100644
--- a/Source/WebCore/loader/cache/CachedResourceLoader.cpp
+++ b/Source/WebCore/loader/cache/CachedResourceLoader.cpp
@@ -365,8 +365,7 @@
return false;
if (frame()) {
- Settings* settings = frame()->settings();
- if (!frame()->loader().client()->allowScriptFromSource(!settings || settings->isScriptEnabled(), url)) {
+ if (!frame()->loader().client()->allowScriptFromSource(frame()->settings().isScriptEnabled(), url)) {
frame()->loader().client()->didNotAllowScript();
return false;
}
diff --git a/Source/WebCore/loader/icon/IconController.cpp b/Source/WebCore/loader/icon/IconController.cpp
index 7eaf88d..743a08d 100644
--- a/Source/WebCore/loader/icon/IconController.cpp
+++ b/Source/WebCore/loader/icon/IconController.cpp
@@ -147,8 +147,7 @@
// People who want to avoid loading images generally want to avoid loading all images, unless an exception has been made for site icons.
// Now that we've accounted for URL mapping, avoid starting the network load if images aren't set to display automatically.
- Settings* settings = m_frame->settings();
- if (settings && !settings->loadsImagesAutomatically() && !settings->loadsSiteIconsIgnoringImageLoadingSetting())
+ if (!m_frame->settings().loadsImagesAutomatically() && !m_frame->settings().loadsSiteIconsIgnoringImageLoadingSetting())
return;
// If we're reloading the page, always start the icon load now.
diff --git a/Source/WebCore/page/ContextMenuController.cpp b/Source/WebCore/page/ContextMenuController.cpp
index b5c8ac4..9b3ae29 100644
--- a/Source/WebCore/page/ContextMenuController.cpp
+++ b/Source/WebCore/page/ContextMenuController.cpp
@@ -183,7 +183,7 @@
if (Page* oldPage = frame->page()) {
FrameLoadRequest request(frame->document()->securityOrigin(), ResourceRequest(urlToLoad, frame->loader().outgoingReferrer()));
Page* newPage = oldPage;
- if (!frame->settings() || frame->settings()->supportsMultipleWindows()) {
+ if (frame->settings().supportsMultipleWindows()) {
newPage = oldPage->chrome().createWindow(frame, request, WindowFeatures(), NavigationAction(request.resourceRequest()));
if (!newPage)
return;
diff --git a/Source/WebCore/page/DOMWindow.cpp b/Source/WebCore/page/DOMWindow.cpp
index c1c9652..6cf7c77 100644
--- a/Source/WebCore/page/DOMWindow.cpp
+++ b/Source/WebCore/page/DOMWindow.cpp
@@ -357,8 +357,7 @@
if (ScriptController::processingUserGesture())
return true;
- Settings* settings = firstFrame->settings();
- return settings && settings->javaScriptCanOpenWindowsAutomatically();
+ return firstFrame->settings().javaScriptCanOpenWindowsAutomatically();
}
bool DOMWindow::allowPopUp()
@@ -923,7 +922,7 @@
if (!page)
return;
- bool allowFocus = WindowFocusAllowedIndicator::windowFocusAllowed() || !m_frame->settings()->windowFocusRestricted();
+ bool allowFocus = WindowFocusAllowedIndicator::windowFocusAllowed() || !m_frame->settings().windowFocusRestricted();
if (context) {
ASSERT(isMainThread());
Document* activeDocument = toDocument(context);
@@ -948,7 +947,6 @@
void DOMWindow::blur()
{
-
if (!m_frame)
return;
@@ -956,7 +954,7 @@
if (!page)
return;
- if (m_frame->settings()->windowFocusRestricted())
+ if (m_frame->settings().windowFocusRestricted())
return;
if (m_frame != page->mainFrame())
@@ -987,8 +985,7 @@
return;
}
- Settings* settings = m_frame->settings();
- bool allowScriptsToCloseWindows = settings && settings->allowScriptsToCloseWindows();
+ bool allowScriptsToCloseWindows = m_frame->settings().allowScriptsToCloseWindows();
if (!(page->openedByDOM() || page->backForward()->count() <= 1 || allowScriptsToCloseWindows))
return;
@@ -1386,10 +1383,8 @@
unsigned rulesToInclude = StyleResolver::AuthorCSSRules;
if (!authorOnly)
rulesToInclude |= StyleResolver::UAAndUserCSSRules;
- if (Settings* settings = m_frame->settings()) {
- if (settings->crossOriginCheckInGetMatchedCSSRulesDisabled())
- rulesToInclude |= StyleResolver::CrossOriginCSSRules;
- }
+ if (m_frame->settings().crossOriginCheckInGetMatchedCSSRulesDisabled())
+ rulesToInclude |= StyleResolver::CrossOriginCSSRules;
PseudoId pseudoId = CSSSelector::pseudoId(pseudoType);
diff --git a/Source/WebCore/page/DragController.cpp b/Source/WebCore/page/DragController.cpp
index c876bfb..c4aae3c 100644
--- a/Source/WebCore/page/DragController.cpp
+++ b/Source/WebCore/page/DragController.cpp
@@ -661,8 +661,7 @@
if (dragMode == DRAG_AUTO) {
if ((m_dragSourceAction & DragSourceActionImage)
&& isHTMLImageElement(node)
- && sourceFrame->settings()
- && sourceFrame->settings()->loadsImagesAutomatically()) {
+ && sourceFrame->settings().loadsImagesAutomatically()) {
state.type = static_cast<DragSourceAction>(state.type | DragSourceActionImage);
return toElement(node);
}
@@ -845,7 +844,7 @@
m_client->willPerformDragSourceAction(DragSourceActionLink, dragOrigin, clipboard);
if (!dragImage) {
- dragImage = createDragImageForLink(linkURL, hitTestResult.textContent(), src->settings() ? src->settings()->fontRenderingMode() : NormalRenderingMode);
+ dragImage = createDragImageForLink(linkURL, hitTestResult.textContent(), src->settings().fontRenderingMode());
IntSize size = dragImageSize(dragImage);
m_dragOffset = IntPoint(-size.width() / 2, -LinkDragBorderInset);
dragLoc = IntPoint(mouseDraggedPoint.x() + m_dragOffset.x(), mouseDraggedPoint.y() + m_dragOffset.y());
diff --git a/Source/WebCore/page/EventHandler.cpp b/Source/WebCore/page/EventHandler.cpp
index daf919d..9414329 100644
--- a/Source/WebCore/page/EventHandler.cpp
+++ b/Source/WebCore/page/EventHandler.cpp
@@ -946,7 +946,7 @@
&& event.event().button() != RightButton) {
VisibleSelection newSelection;
Node* node = event.targetNode();
- bool caretBrowsing = m_frame->settings() && m_frame->settings()->caretBrowsingEnabled();
+ bool caretBrowsing = m_frame->settings().caretBrowsingEnabled();
if (node && (caretBrowsing || node->rendererIsEditable()) && node->renderer()) {
VisiblePosition pos = node->renderer()->positionForPoint(event.localPoint());
newSelection = VisibleSelection(pos);
@@ -1214,8 +1214,7 @@
// If the link is editable, then we need to check the settings to see whether or not the link should be followed
if (editable) {
- ASSERT(m_frame->settings());
- switch (m_frame->settings()->editableLinkBehavior()) {
+ switch (m_frame->settings().editableLinkBehavior()) {
default:
case EditableLinkDefaultBehavior:
case EditableLinkAlwaysLive:
@@ -2635,7 +2634,7 @@
bool EventHandler::handleGestureLongPress(const PlatformGestureEvent& gestureEvent)
{
#if ENABLE(DRAG_SUPPORT)
- if (m_frame->settings() && m_frame->settings()->touchDragDropEnabled()) {
+ if (m_frame->settings().touchDragDropEnabled()) {
IntPoint adjustedPoint = gestureEvent.position();
#if ENABLE(TOUCH_ADJUSTMENT)
adjustGesturePosition(gestureEvent, adjustedPoint);
@@ -2816,7 +2815,7 @@
#if ENABLE(TOUCH_ADJUSTMENT)
bool EventHandler::shouldApplyTouchAdjustment(const PlatformGestureEvent& event) const
{
- if (m_frame->settings() && !m_frame->settings()->touchAdjustmentEnabled())
+ if (!m_frame->settings().touchAdjustmentEnabled())
return false;
return !event.area().isEmpty();
}
@@ -3030,8 +3029,7 @@
if (m_mousePositionIsUnknown)
return;
- Settings* settings = m_frame->settings();
- if (settings && !settings->deviceSupportsMouse())
+ if (!m_frame->settings().deviceSupportsMouse())
return;
// If the content has ever taken longer than fakeMouseMoveShortInterval we
@@ -3070,8 +3068,7 @@
ASSERT_UNUSED(timer, timer == &m_fakeMouseMoveEventTimer);
ASSERT(!m_mousePressed);
- Settings* settings = m_frame->settings();
- if (settings && !settings->deviceSupportsMouse())
+ if (!m_frame->settings().deviceSupportsMouse())
return;
FrameView* view = m_frame->view();
@@ -3705,7 +3702,7 @@
if (!page)
return;
- if (!m_frame->settings()->backspaceKeyNavigationEnabled())
+ if (!m_frame->settings().backspaceKeyNavigationEnabled())
return;
bool handledEvent = false;
@@ -4064,7 +4061,7 @@
bool EventHandler::dispatchSyntheticTouchEventIfEnabled(const PlatformMouseEvent& event)
{
- if (!m_frame || !m_frame->settings() || !m_frame->settings()->isTouchEventEmulationEnabled())
+ if (!m_frame || !m_frame->settings().isTouchEventEmulationEnabled())
return false;
PlatformEvent::Type eventType = event.type();
diff --git a/Source/WebCore/page/FocusController.cpp b/Source/WebCore/page/FocusController.cpp
index 2c5e75f..8fbdce6 100644
--- a/Source/WebCore/page/FocusController.cpp
+++ b/Source/WebCore/page/FocusController.cpp
@@ -287,7 +287,7 @@
Node* currentNode = document->focusedElement();
// FIXME: Not quite correct when it comes to focus transitions leaving/entering the WebView itself
- bool caretBrowsing = frame->settings() && frame->settings()->caretBrowsingEnabled();
+ bool caretBrowsing = frame->settings().caretBrowsingEnabled();
if (caretBrowsing && !currentNode)
currentNode = frame->selection()->start().deprecatedNode();
@@ -568,7 +568,7 @@
if (s->isNone())
return;
- bool caretBrowsing = oldFocusedFrame->settings()->caretBrowsingEnabled();
+ bool caretBrowsing = oldFocusedFrame->settings().caretBrowsingEnabled();
if (caretBrowsing)
return;
diff --git a/Source/WebCore/page/Frame.cpp b/Source/WebCore/page/Frame.cpp
index d3c827b..82e8ff7 100644
--- a/Source/WebCore/page/Frame.cpp
+++ b/Source/WebCore/page/Frame.cpp
@@ -151,6 +151,7 @@
inline Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoaderClient* frameLoaderClient)
: m_page(page)
+ , m_settings(&page->settings())
, m_treeNode(this, parentFromOwnerElement(ownerElement))
, m_loader(this, frameLoaderClient)
, m_navigationScheduler(this)
@@ -183,7 +184,7 @@
if (!ownerElement) {
#if USE(TILED_BACKING_STORE)
// Top level frame only for now.
- setTiledBackingStoreEnabled(page->settings().tiledBackingStoreEnabled());
+ setTiledBackingStoreEnabled(settings().tiledBackingStoreEnabled());
#endif
} else {
page->incrementSubframeCount();
@@ -326,11 +327,6 @@
doc->dispatchWindowEvent(Event::create(eventNames().orientationchangeEvent, false, false));
}
#endif // ENABLE(ORIENTATION_EVENTS)
-
-Settings* Frame::settings() const
-{
- return m_page ? &m_page->settings() : 0;
-}
static PassOwnPtr<RegularExpression> createRegExpForLabels(const Vector<String>& labels)
{
@@ -560,7 +556,7 @@
if (!m_page)
return;
- if (loader().stateMachine()->creatingInitialEmptyDocument() && !settings()->shouldInjectUserScriptsInInitialEmptyDocument())
+ if (loader().stateMachine()->creatingInitialEmptyDocument() && !settings().shouldInjectUserScriptsInInitialEmptyDocument())
return;
// Walk the hashtable. Inject by world.
@@ -946,7 +942,7 @@
Page* page = this->page();
// Main frame is scaled with respect to he container but inner frames are not scaled with respect to the main frame.
- if (!page || page->mainFrame() != this || page->settings().applyPageScaleFactorInCompositor())
+ if (!page || page->mainFrame() != this || settings().applyPageScaleFactorInCompositor())
return 1;
return page->pageScaleFactor();
diff --git a/Source/WebCore/page/Frame.h b/Source/WebCore/page/Frame.h
index 67ed375..3ab79fe 100644
--- a/Source/WebCore/page/Frame.h
+++ b/Source/WebCore/page/Frame.h
@@ -141,7 +141,7 @@
static Frame* frameForWidget(const Widget*);
- Settings* settings() const; // can be NULL
+ Settings& settings() const { return *m_settings; }
void setPrinting(bool printing, const FloatSize& pageSize, const FloatSize& originalPageSize, float maximumShrinkRatio, AdjustViewSizeOrNot);
bool shouldUsePrintingLayout() const;
@@ -210,6 +210,7 @@
HashSet<FrameDestructionObserver*> m_destructionObservers;
Page* m_page;
+ const RefPtr<Settings> m_settings;
mutable FrameTree m_treeNode;
mutable FrameLoader m_loader;
mutable NavigationScheduler m_navigationScheduler;
diff --git a/Source/WebCore/page/FrameView.cpp b/Source/WebCore/page/FrameView.cpp
index c7003ba..1d44a40d 100644
--- a/Source/WebCore/page/FrameView.cpp
+++ b/Source/WebCore/page/FrameView.cpp
@@ -495,9 +495,7 @@
bool FrameView::frameFlatteningEnabled() const
{
- if (Settings* settings = frame().settings())
- return settings->frameFlatteningEnabled();
- return false;
+ return frame().settings().frameFlatteningEnabled();
}
bool FrameView::isFrameFlatteningValidForThisFrame() const
@@ -540,10 +538,8 @@
PassRefPtr<Scrollbar> FrameView::createScrollbar(ScrollbarOrientation orientation)
{
- if (Settings* settings = frame().settings()) {
- if (!settings->allowCustomScrollbarInMainFrame() && isMainFrameView())
- return ScrollView::createScrollbar(orientation);
- }
+ if (!frame().settings().allowCustomScrollbarInMainFrame() && isMainFrameView())
+ return ScrollView::createScrollbar(orientation);
// FIXME: We need to update the scrollbar dynamically as documents change (or as doc elements and bodies get discovered that have custom styles).
Document* doc = frame().document();
@@ -797,7 +793,7 @@
RenderView* renderView = this->renderView();
if (!renderView)
return false;
- if (frame().settings() && frame().settings()->compositedScrollingForFramesEnabled())
+ if (frame().settings().compositedScrollingForFramesEnabled())
return renderView->compositor()->inForcedCompositingMode();
return false;
}
@@ -1633,10 +1629,7 @@
bool FrameView::fixedElementsLayoutRelativeToFrame() const
{
- if (!frame().settings())
- return false;
-
- return frame().settings()->fixedElementsLayoutRelativeToFrame();
+ return frame().settings().fixedElementsLayoutRelativeToFrame();
}
IntPoint FrameView::lastKnownMousePosition() const
@@ -3084,7 +3077,7 @@
float FrameView::visibleContentScaleFactor() const
{
- if (!isMainFrameView() || !frame().settings()->applyPageScaleFactorInCompositor())
+ if (!isMainFrameView() || !frame().settings().applyPageScaleFactorInCompositor())
return 1;
return frame().page()->pageScaleFactor();
diff --git a/Source/WebCore/page/Navigator.cpp b/Source/WebCore/page/Navigator.cpp
index d00f007..ab58a68 100644
--- a/Source/WebCore/page/Navigator.cpp
+++ b/Source/WebCore/page/Navigator.cpp
@@ -63,10 +63,7 @@
return false;
if (!(sourceURL->endsWith("/dqm_script.js") || sourceURL->endsWith("/dqm_loader.js") || sourceURL->endsWith("/tdqm_loader.js")))
return false;
- Settings* settings = frame->settings();
- if (!settings)
- return false;
- return settings->needsSiteSpecificQuirks();
+ return frame->settings().needsSiteSpecificQuirks();
}
String Navigator::appVersion() const
@@ -124,12 +121,12 @@
bool Navigator::javaEnabled() const
{
- if (!m_frame || !m_frame->settings())
+ if (!m_frame)
return false;
- if (!m_frame->settings()->isJavaEnabled())
+ if (!m_frame->settings().isJavaEnabled())
return false;
- if (m_frame->document()->securityOrigin()->isLocal() && !m_frame->settings()->isJavaEnabledForLocalFiles())
+ if (m_frame->document()->securityOrigin()->isLocal() && !m_frame->settings().isJavaEnabledForLocalFiles())
return false;
return true;
diff --git a/Source/WebCore/page/Page.h b/Source/WebCore/page/Page.h
index 7e69f4f..64a2b961 100644
--- a/Source/WebCore/page/Page.h
+++ b/Source/WebCore/page/Page.h
@@ -457,7 +457,7 @@
#endif
RefPtr<ScrollingCoordinator> m_scrollingCoordinator;
- const OwnPtr<Settings> m_settings;
+ const RefPtr<Settings> m_settings;
OwnPtr<ProgressTracker> m_progress;
OwnPtr<BackForwardController> m_backForwardController;
diff --git a/Source/WebCore/page/Settings.cpp b/Source/WebCore/page/Settings.cpp
index 6d18d95..20387f5 100644
--- a/Source/WebCore/page/Settings.cpp
+++ b/Source/WebCore/page/Settings.cpp
@@ -182,9 +182,9 @@
{
}
-PassOwnPtr<Settings> Settings::create(Page* page)
+PassRefPtr<Settings> Settings::create(Page* page)
{
- return adoptPtr(new Settings(page));
+ return adoptRef(new Settings(page));
}
SETTINGS_SETTER_BODIES
diff --git a/Source/WebCore/page/Settings.h b/Source/WebCore/page/Settings.h
index 80b7489..d8b7ca6 100644
--- a/Source/WebCore/page/Settings.h
+++ b/Source/WebCore/page/Settings.h
@@ -35,6 +35,7 @@
#include "SettingsMacros.h"
#include "Timer.h"
#include <wtf/HashMap.h>
+#include <wtf/RefCounted.h>
#include <wtf/text/AtomicString.h>
#include <wtf/text/AtomicStringHash.h>
#include <wtf/unicode/Unicode.h>
@@ -58,11 +59,10 @@
TextDirectionSubmenuAlwaysIncluded
};
- class Settings {
+ class Settings : public RefCounted<Settings> {
WTF_MAKE_NONCOPYABLE(Settings); WTF_MAKE_FAST_ALLOCATED;
public:
- static PassOwnPtr<Settings> create(Page*);
-
+ static PassRefPtr<Settings> create(Page*);
~Settings();
void setStandardFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
diff --git a/Source/WebCore/page/SpatialNavigation.cpp b/Source/WebCore/page/SpatialNavigation.cpp
index 7c0362b..915c5d4 100644
--- a/Source/WebCore/page/SpatialNavigation.cpp
+++ b/Source/WebCore/page/SpatialNavigation.cpp
@@ -90,7 +90,7 @@
bool isSpatialNavigationEnabled(const Frame* frame)
{
- return (frame && frame->settings() && frame->settings()->spatialNavigationEnabled());
+ return (frame && frame->settings().spatialNavigationEnabled());
}
static RectsAlignment alignmentForRects(FocusDirection direction, const LayoutRect& curRect, const LayoutRect& targetRect, const LayoutSize& viewSize)
diff --git a/Source/WebCore/page/mac/EventHandlerMac.mm b/Source/WebCore/page/mac/EventHandlerMac.mm
index dbb8d52..a9b0030 100644
--- a/Source/WebCore/page/mac/EventHandlerMac.mm
+++ b/Source/WebCore/page/mac/EventHandlerMac.mm
@@ -708,16 +708,12 @@
bool EventHandler::needsKeyboardEventDisambiguationQuirks() const
{
- Settings* settings = m_frame->settings();
- if (!settings)
- return false;
-
#if ENABLE(DASHBOARD_SUPPORT)
- if (settings->usesDashboardBackwardCompatibilityMode())
+ if (m_frame->settings().usesDashboardBackwardCompatibilityMode())
return true;
#endif
- if (settings->needsKeyboardEventDisambiguationQuirks())
+ if (m_frame->settings().needsKeyboardEventDisambiguationQuirks())
return true;
return false;
diff --git a/Source/WebCore/rendering/RenderBlock.cpp b/Source/WebCore/rendering/RenderBlock.cpp
index 6ff71b0..11b3ed3 100644
--- a/Source/WebCore/rendering/RenderBlock.cpp
+++ b/Source/WebCore/rendering/RenderBlock.cpp
@@ -3272,7 +3272,7 @@
void RenderBlock::paintCaret(PaintInfo& paintInfo, const LayoutPoint& paintOffset, CaretType type)
{
// Paint the caret if the FrameSelection says so or if caret browsing is enabled
- bool caretBrowsing = frame()->settings() && frame()->settings()->caretBrowsingEnabled();
+ bool caretBrowsing = frame()->settings().caretBrowsingEnabled();
RenderObject* caretPainter;
bool isContentEditable;
if (type == CursorCaret) {
diff --git a/Source/WebCore/rendering/RenderFrameSet.cpp b/Source/WebCore/rendering/RenderFrameSet.cpp
index 0271b1d..911d8b4 100644
--- a/Source/WebCore/rendering/RenderFrameSet.cpp
+++ b/Source/WebCore/rendering/RenderFrameSet.cpp
@@ -644,7 +644,7 @@
bool RenderFrameSet::flattenFrameSet() const
{
- return frame() && frame()->settings() && frame()->settings()->frameFlatteningEnabled();
+ return frame() && frame()->settings().frameFlatteningEnabled();
}
void RenderFrameSet::startResizing(GridAxis& axis, int position)
diff --git a/Source/WebCore/rendering/RenderIFrame.cpp b/Source/WebCore/rendering/RenderIFrame.cpp
index cff375b..5db6229 100644
--- a/Source/WebCore/rendering/RenderIFrame.cpp
+++ b/Source/WebCore/rendering/RenderIFrame.cpp
@@ -108,7 +108,7 @@
if (isSeamless())
return false; // Seamless iframes are already "flat", don't try to flatten them.
- bool enabled = frame && frame->settings() && frame->settings()->frameFlatteningEnabled();
+ bool enabled = frame && frame->settings().frameFlatteningEnabled();
if (!enabled || !frame->page())
return false;
diff --git a/Source/WebCore/rendering/RenderLayerBacking.cpp b/Source/WebCore/rendering/RenderLayerBacking.cpp
index 250a2a4..7d3d09a 100644
--- a/Source/WebCore/rendering/RenderLayerBacking.cpp
+++ b/Source/WebCore/rendering/RenderLayerBacking.cpp
@@ -145,7 +145,7 @@
if (m_isMainFrameRenderViewLayer)
tiledBacking->setUnparentsOffscreenTiles(true);
- tiledBacking->setScrollingPerformanceLoggingEnabled(frame->settings() && frame->settings()->scrollingPerformanceLoggingEnabled());
+ tiledBacking->setScrollingPerformanceLoggingEnabled(frame->settings().scrollingPerformanceLoggingEnabled());
adjustTiledBackingCoverage();
}
}
diff --git a/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp
index db50881..a9e7866 100644
--- a/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp
+++ b/Source/WebKit/efl/WebCoreSupport/EditorClientEfl.cpp
@@ -291,10 +291,7 @@
if (!keyEvent)
return false;
- if (!frame->settings())
- return false;
-
- bool caretBrowsing = frame->settings()->caretBrowsingEnabled();
+ bool caretBrowsing = frame->settings().caretBrowsingEnabled();
if (caretBrowsing) {
switch (keyEvent->windowsVirtualKeyCode()) {
case VK_LEFT:
diff --git a/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp b/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp
index e6cbd33..eee7d51 100644
--- a/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp
+++ b/Source/WebKit/efl/WebCoreSupport/FrameLoaderClientEfl.cpp
@@ -435,8 +435,7 @@
Frame* coreFrame = EWKPrivate::coreFrame(m_frame);
ASSERT(coreFrame);
- Settings* settings = coreFrame->settings();
- if (!settings || !settings->isScriptEnabled())
+ if (!coreFrame->settings().isScriptEnabled())
return;
Ewk_Window_Object_Cleared_Event event;
diff --git a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
index 00079da..fc999eb 100644
--- a/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
+++ b/Source/WebKit/gtk/WebCoreSupport/FrameLoaderClientGtk.cpp
@@ -585,8 +585,7 @@
Frame* coreFrame = core(m_frame);
ASSERT(coreFrame);
- Settings* settings = coreFrame->settings();
- if (!settings || !settings->isScriptEnabled())
+ if (!coreFrame->settings().isScriptEnabled())
return;
// TODO: Consider using g_signal_has_handler_pending() to avoid the overhead
diff --git a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
index bb5cdab..dd38ec2 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebFrameLoaderClient.mm
@@ -1668,7 +1668,7 @@
// plug-in.
Frame* frame = core(m_webFrame.get());
NSMutableArray *attributeKeys = kit(paramNames);
- if (frame && frame->settings()->needsSiteSpecificQuirks() && equalIgnoringCase(mimeType, "application/x-snkp")) {
+ if (frame && frame->settings().needsSiteSpecificQuirks() && equalIgnoringCase(mimeType, "application/x-snkp")) {
for (NSUInteger i = 0; i < [attributeKeys count]; ++i)
[attributeKeys replaceObjectAtIndex:i withObject:[[attributeKeys objectAtIndex:i] lowercaseString]];
}
diff --git a/Source/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm b/Source/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm
index ed5dce0..ad53eec 100644
--- a/Source/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm
+++ b/Source/WebKit/mac/WebCoreSupport/WebFrameNetworkingContext.mm
@@ -57,12 +57,12 @@
bool WebFrameNetworkingContext::needsSiteSpecificQuirks() const
{
- return frame() && frame()->settings() && frame()->settings()->needsSiteSpecificQuirks();
+ return frame() && frame()->settings().needsSiteSpecificQuirks();
}
bool WebFrameNetworkingContext::localFileContentSniffingEnabled() const
{
- return frame() && frame()->settings() && frame()->settings()->localFileContentSniffingEnabled();
+ return frame() && frame()->settings().localFileContentSniffingEnabled();
}
SchedulePairHashSet* WebFrameNetworkingContext::scheduledRunLoopPairs() const
@@ -93,7 +93,7 @@
{
ASSERT(isMainThread());
- if (frame() && frame()->settings() && frame()->settings()->privateBrowsingEnabled())
+ if (frame() && frame()->settings().privateBrowsingEnabled())
return *privateSession;
return NetworkStorageSession::defaultStorageSession();
diff --git a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
index 819eceb..f2efff8 100644
--- a/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
+++ b/Source/WebKit/qt/WebCoreSupport/FrameLoaderClientQt.cpp
@@ -632,7 +632,7 @@
if (MIMETypeRegistry::canShowMIMEType(type))
return true;
- if (m_frame && m_frame->settings() && m_frame->settings()->arePluginsEnabled()
+ if (m_frame && m_frame->settings().arePluginsEnabled()
&& PluginDatabase::installedPlugins()->isMIMETypeRegistered(type))
return true;
@@ -1348,7 +1348,7 @@
if (!mimeType.length())
mimeType = MIMETypeRegistry::getMIMETypeForExtension(extension);
- bool arePluginsEnabled = (m_frame && m_frame->settings() && m_frame->settings()->arePluginsEnabled());
+ bool arePluginsEnabled = (m_frame && m_frame->settings().arePluginsEnabled());
if (arePluginsEnabled && !mimeType.length())
mimeType = PluginDatabase::installedPlugins()->MIMETypeForExtension(extension);
diff --git a/Source/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp b/Source/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp
index b92378e1..6a959c8 100644
--- a/Source/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp
+++ b/Source/WebKit/win/WebCoreSupport/WebFrameNetworkingContext.cpp
@@ -108,7 +108,7 @@
{
ASSERT(isMainThread());
- if (frame() && frame()->settings() && frame()->settings()->privateBrowsingEnabled())
+ if (frame() && frame()->settings().privateBrowsingEnabled())
return *privateSession;
return NetworkStorageSession::defaultStorageSession();
diff --git a/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.cpp b/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.cpp
index 73cfea5..3078bd1 100644
--- a/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.cpp
+++ b/Source/WebKit/wince/WebCoreSupport/EditorClientWinCE.cpp
@@ -365,7 +365,7 @@
if (!keyEvent)
return false;
- bool caretBrowsing = frame->settings()->caretBrowsingEnabled();
+ bool caretBrowsing = frame->settings().caretBrowsingEnabled();
if (caretBrowsing) {
switch (keyEvent->windowsVirtualKeyCode()) {
case VK_LEFT:
diff --git a/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp b/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp
index 2014c6b..3eecdac 100644
--- a/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp
+++ b/Source/WebKit2/WebProcess/Network/WebResourceLoadScheduler.cpp
@@ -103,7 +103,7 @@
ContentSniffingPolicy contentSniffingPolicy = resourceLoader->shouldSniffContent() ? SniffContent : DoNotSniffContent;
StoredCredentials allowStoredCredentials = resourceLoader->shouldUseCredentialStorage() ? AllowStoredCredentials : DoNotAllowStoredCredentials;
- bool privateBrowsingEnabled = resourceLoader->frameLoader()->frame()->settings()->privateBrowsingEnabled();
+ bool privateBrowsingEnabled = resourceLoader->frameLoader()->frame()->settings().privateBrowsingEnabled();
// FIXME: Some entities in WebCore use WebCore's "EmptyFrameLoaderClient" instead of having a proper WebFrameLoaderClient.
// EmptyFrameLoaderClient shouldn't exist and everything should be using a WebFrameLoaderClient,
diff --git a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
index 4b6f3a8..0782ac27 100644
--- a/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
+++ b/Source/WebKit2/WebProcess/Plugins/PluginView.cpp
@@ -608,7 +608,7 @@
frame()->view()->enterCompositingMode();
m_pluginElement->setNeedsStyleRecalc(SyntheticStyleChange);
}
- if (frame() && !frame()->settings()->maximumPlugInSnapshotAttempts()) {
+ if (frame() && !frame()->settings().maximumPlugInSnapshotAttempts()) {
m_pluginElement->setDisplayState(HTMLPlugInElement::DisplayingSnapshot);
return;
}
@@ -1415,10 +1415,6 @@
if (!frame())
return false;
- Settings* settings = frame()->settings();
- if (!settings)
- return false;
-
// We know that some plug-ins can support snapshotting without needing
// accelerated compositing. Since we're trying to snapshot them anyway,
// put them into normal compositing mode. A side benefit is that this might
@@ -1426,7 +1422,7 @@
if (m_pluginElement->displayState() < HTMLPlugInElement::Restarting && m_parameters.mimeType == "application/x-shockwave-flash")
return false;
- return settings->acceleratedCompositingEnabled();
+ return frame()->settings().acceleratedCompositingEnabled();
}
void PluginView::pluginProcessCrashed()
@@ -1531,11 +1527,7 @@
if (!frame()->document()->securityOrigin()->canAccessPluginStorage(frame()->document()->topOrigin()))
return true;
- Settings* settings = frame()->settings();
- if (!settings)
- return true;
-
- return settings->privateBrowsingEnabled();
+ return frame()->settings().privateBrowsingEnabled();
}
bool PluginView::asynchronousPluginInitializationEnabled() const
@@ -1688,7 +1680,7 @@
m_pluginElement->updateSnapshot(snapshotImage.get());
#if PLATFORM(MAC)
- unsigned maximumSnapshotRetries = frame() ? frame()->settings()->maximumPlugInSnapshotAttempts() : 0;
+ unsigned maximumSnapshotRetries = frame() ? frame()->settings().maximumPlugInSnapshotAttempts() : 0;
if (snapshotImage && isAlmostSolidColor(static_cast<BitmapImage*>(snapshotImage.get())) && m_countSnapshotRetries < maximumSnapshotRetries) {
++m_countSnapshotRetries;
m_pluginSnapshotTimer.restart();
@@ -1719,7 +1711,7 @@
void PluginView::pluginDidReceiveUserInteraction()
{
- if (frame() && !frame()->settings()->plugInSnapshottingEnabled())
+ if (frame() && !frame()->settings().plugInSnapshottingEnabled())
return;
if (m_didReceiveUserInteraction)
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm
index 800b23a..10affdc 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/mac/WebFrameNetworkingContext.mm
@@ -88,12 +88,12 @@
bool WebFrameNetworkingContext::needsSiteSpecificQuirks() const
{
- return frame() && frame()->settings() && frame()->settings()->needsSiteSpecificQuirks();
+ return frame() && frame()->settings().needsSiteSpecificQuirks();
}
bool WebFrameNetworkingContext::localFileContentSniffingEnabled() const
{
- return frame() && frame()->settings() && frame()->settings()->localFileContentSniffingEnabled();
+ return frame() && frame()->settings().localFileContentSniffingEnabled();
}
SchedulePairHashSet* WebFrameNetworkingContext::scheduledRunLoopPairs() const
@@ -117,7 +117,7 @@
{
ASSERT(isMainThread());
- if (frame() && frame()->settings() && frame()->settings()->privateBrowsingEnabled())
+ if (frame() && frame()->settings().privateBrowsingEnabled())
return *privateSession;
return NetworkStorageSession::defaultStorageSession();
diff --git a/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp b/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp
index c8fb3e0..393df02 100644
--- a/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp
+++ b/Source/WebKit2/WebProcess/WebCoreSupport/soup/WebFrameNetworkingContext.cpp
@@ -65,7 +65,7 @@
NetworkStorageSession& WebFrameNetworkingContext::storageSession() const
{
- if (frame() && frame()->settings() && frame()->settings()->privateBrowsingEnabled())
+ if (frame() && frame()->settings().privateBrowsingEnabled())
return *privateSession;
return NetworkStorageSession::defaultStorageSession();