Commit ff5990f3 authored by akling@apple.com's avatar akling@apple.com

Make Page::settings() return a reference.

<http://webkit.org/b/119662>

Reviewed by Anders Carlsson.

...and remove some pointless null checks that were exposed by doing this.

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@153927 268f45cc-cd09-0410-ab3c-d52691b4dbfc
parent ad1137cb
2013-08-11 Andreas Kling <akling@apple.com>
Make Page::settings() return a reference.
<http://webkit.org/b/119662>
Reviewed by Anders Carlsson.
...and remove some pointless null checks that were exposed by doing this.
2013-08-11 Andreas Kling <akling@apple.com>
Make some things that return never-null pointers return references instead.
......@@ -206,7 +206,7 @@ bool DatabaseContext::allowDatabaseAccess() const
{
if (m_scriptExecutionContext->isDocument()) {
Document* document = toDocument(m_scriptExecutionContext);
if (!document->page() || (document->page()->settings()->privateBrowsingEnabled() && !SchemeRegistry::allowsDatabaseAccessInPrivateBrowsing(document->securityOrigin()->protocol())))
if (!document->page() || (document->page()->settings().privateBrowsingEnabled() && !SchemeRegistry::allowsDatabaseAccessInPrivateBrowsing(document->securityOrigin()->protocol())))
return false;
return true;
}
......
......@@ -1292,7 +1292,7 @@ void StyleResolver::adjustRenderStyle(RenderStyle* style, RenderStyle* parentSty
|| style->hasFilter()
|| style->hasBlendMode()
|| style->position() == StickyPosition
|| (style->position() == FixedPosition && e && e->document()->page() && e->document()->page()->settings()->fixedPositionCreatesStackingContext())
|| (style->position() == FixedPosition && e && e->document()->page() && e->document()->page()->settings().fixedPositionCreatesStackingContext())
#if ENABLE(DIALOG_ELEMENT)
|| (e && e->isInTopLayer())
#endif
......
......@@ -2563,7 +2563,7 @@ double Document::minimumTimerInterval() const
Page* p = page();
if (!p)
return ScriptExecutionContext::minimumTimerInterval();
return p->settings()->minDOMTimerInterval();
return p->settings().minDOMTimerInterval();
}
double Document::timerAlignmentInterval() const
......@@ -2571,7 +2571,7 @@ double Document::timerAlignmentInterval() const
Page* p = page();
if (!p)
return ScriptExecutionContext::timerAlignmentInterval();
return p->settings()->domTimerAlignmentInterval();
return p->settings().domTimerAlignmentInterval();
}
EventTarget* Document::errorEventTarget()
......@@ -3688,7 +3688,7 @@ HTMLFrameOwnerElement* Document::ownerElement() const
String Document::cookie(ExceptionCode& ec) const
{
if (page() && !page()->settings()->cookieEnabled())
if (page() && !page()->settings().cookieEnabled())
return String();
// FIXME: The HTML5 DOM spec states that this attribute can raise an
......@@ -3709,7 +3709,7 @@ String Document::cookie(ExceptionCode& ec) const
void Document::setCookie(const String& value, ExceptionCode& ec)
{
if (page() && !page()->settings()->cookieEnabled())
if (page() && !page()->settings().cookieEnabled())
return;
// FIXME: The HTML5 DOM spec states that this attribute can raise an
......@@ -4997,7 +4997,7 @@ void Document::requestFullScreenForElement(Element* element, unsigned short flag
break;
// There is a previously-established user preference, security risk, or platform limitation.
if (!page() || !page()->settings()->fullScreenEnabled())
if (!page() || !page()->settings().fullScreenEnabled())
break;
if (!page()->chrome().client()->supportsFullScreenForElement(element, flags & Element::ALLOW_KEYBOARD_INPUT)) {
......@@ -5179,7 +5179,7 @@ void Document::webkitWillEnterFullScreenForElement(Element* element)
if (!page())
return;
ASSERT(page()->settings()->fullScreenEnabled());
ASSERT(page()->settings().fullScreenEnabled());
if (m_fullScreenRenderer)
m_fullScreenRenderer->unwrapRenderer();
......
......@@ -52,7 +52,7 @@ PassRefPtr<CachedPage> CachedPage::create(Page* page)
CachedPage::CachedPage(Page* page)
: m_timeStamp(currentTime())
, m_expirationTime(m_timeStamp + page->settings()->backForwardCacheExpirationInterval())
, m_expirationTime(m_timeStamp + page->settings().backForwardCacheExpirationInterval())
, m_cachedMainFrame(CachedFrame::create(page->mainFrame()))
, m_needStyleRecalcForVisitedLinks(false)
, m_needsFullStyleRecalc(false)
......
......@@ -110,7 +110,7 @@ static unsigned logCanCacheFrameDecision(Frame* frame, int indentLevel)
PCLOG(" -Frame is an error page");
rejectReasons |= 1 << IsErrorPage;
}
if (frame->loader()->subframeLoader()->containsPlugins() && !frame->page()->settings()->pageCacheSupportsPlugins()) {
if (frame->loader()->subframeLoader()->containsPlugins() && !frame->page()->settings().pageCacheSupportsPlugins()) {
PCLOG(" -Frame contains plugins");
rejectReasons |= 1 << HasPlugins;
}
......@@ -220,7 +220,7 @@ static void logCanCachePageDecision(Page* page)
PCLOG(" -The back/forward list is disabled or has 0 capacity");
rejectReasons |= 1 << DisabledBackForwardList;
}
if (!page->settings()->usesPageCache()) {
if (!page->settings().usesPageCache()) {
PCLOG(" -Page settings says b/f cache disabled");
rejectReasons |= 1 << DisabledPageCache;
}
......@@ -316,7 +316,7 @@ bool PageCache::canCachePageContainingThisFrame(Frame* frame)
&& documentLoader->mainDocumentError().isNull()
// Do not cache error pages (these can be recognized as pages with substitute data or unreachable URLs).
&& !(documentLoader->substituteData().isValid() && !documentLoader->substituteData().failingURL().isEmpty())
&& (!frameLoader->subframeLoader()->containsPlugins() || frame->page()->settings()->pageCacheSupportsPlugins())
&& (!frameLoader->subframeLoader()->containsPlugins() || frame->page()->settings().pageCacheSupportsPlugins())
&& (!document->url().protocolIs("https") || (!documentLoader->response().cacheControlContainsNoCache() && !documentLoader->response().cacheControlContainsNoStore()))
&& (!document->domWindow() || !document->domWindow()->hasEventListeners(eventNames().unloadEvent))
#if ENABLE(SQL_DATABASE)
......@@ -355,7 +355,7 @@ bool PageCache::canCache(Page* page) const
return m_capacity > 0
&& canCachePageContainingThisFrame(page->mainFrame())
&& page->backForward()->isActive()
&& page->settings()->usesPageCache()
&& page->settings().usesPageCache()
#if ENABLE(DEVICE_ORIENTATION)
&& !DeviceMotionController::isActiveAt(page)
&& !DeviceOrientationController::isActiveAt(page)
......
......@@ -202,7 +202,7 @@ static inline HTMLFormControlElement* submitElementFromEvent(const Event* event)
bool HTMLFormElement::validateInteractively(Event* event)
{
ASSERT(event);
if (!document()->page() || !document()->page()->settings()->interactiveFormValidationEnabled() || noValidate())
if (!document()->page() || !document()->page()->settings().interactiveFormValidationEnabled() || noValidate())
return true;
HTMLFormControlElement* submitElement = submitElementFromEvent(event);
......
......@@ -184,7 +184,7 @@ void HTMLLinkElement::process()
if (!m_linkLoader.loadLink(m_relAttribute, type, m_sizes->toString(), url, document()))
return;
bool acceptIfTypeContainsTextCSS = document()->page() && document()->page()->settings() && document()->page()->settings()->treatsAnyTextCSSLinkAsStylesheet();
bool acceptIfTypeContainsTextCSS = document()->page() && document()->page()->settings().treatsAnyTextCSSLinkAsStylesheet();
if (m_disabledState != Disabled && (m_relAttribute.m_isStyleSheet || (acceptIfTypeContainsTextCSS && type.contains("text/css")))
&& document()->frame() && url.isValid()) {
......
......@@ -1684,7 +1684,7 @@ void HTMLMediaElement::mediaPlayerNetworkStateChanged(MediaPlayer*)
static void logMediaLoadRequest(Page* page, const String& mediaEngine, const String& errorMessage, bool succeeded)
{
if (!page || !page->settings()->diagnosticLoggingEnabled())
if (!page || !page->settings().diagnosticLoggingEnabled())
return;
ChromeClient* client = page->chrome().client();
......
......@@ -237,7 +237,7 @@ bool HTMLObjectElement::shouldAllowQuickTimeClassIdQuirk()
// fallback content, which ensures the quirk will disable itself if Wiki
// Server is updated to generate an alternate embed tag as fallback content.
if (!document()->page()
|| !document()->page()->settings()->needsSiteSpecificQuirks()
|| !document()->page()->settings().needsSiteSpecificQuirks()
|| hasFallbackContent()
|| !equalIgnoringCase(classId(), "clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B"))
return false;
......
......@@ -488,7 +488,7 @@ void HTMLPlugInImageElement::userDidClickSnapshot(PassRefPtr<MouseEvent> event,
m_pendingClickEventFromSnapshot = event;
String plugInOrigin = m_loadedUrl.host();
if (document()->page() && !SchemeRegistry::shouldTreatURLSchemeAsLocal(document()->page()->mainFrame()->document()->baseURL().protocol()) && document()->page()->settings()->autostartOriginPlugInSnapshottingEnabled())
if (document()->page() && !SchemeRegistry::shouldTreatURLSchemeAsLocal(document()->page()->mainFrame()->document()->baseURL().protocol()) && document()->page()->settings().autostartOriginPlugInSnapshottingEnabled())
document()->page()->plugInClient()->didStartFromOrigin(document()->page()->mainFrame()->document()->baseURL().host(), plugInOrigin, loadedMimeType());
LOG(Plugins, "%p User clicked on snapshotted plug-in. Restart.", this);
......@@ -500,7 +500,7 @@ void HTMLPlugInImageElement::userDidClickSnapshot(PassRefPtr<MouseEvent> event,
void HTMLPlugInImageElement::setIsPrimarySnapshottedPlugIn(bool isPrimarySnapshottedPlugIn)
{
if (!document()->page() || !document()->page()->settings()->primaryPlugInSnapshotDetectionEnabled() || document()->page()->settings()->snapshotAllPlugIns())
if (!document()->page() || !document()->page()->settings().primaryPlugInSnapshotDetectionEnabled() || document()->page()->settings().snapshotAllPlugIns())
return;
if (isPrimarySnapshottedPlugIn) {
......@@ -585,7 +585,7 @@ void HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn(const KURL& url)
m_plugInWasCreated = false;
m_deferredPromotionToPrimaryPlugIn = false;
if (!document()->page() || !document()->page()->settings()->plugInSnapshottingEnabled()) {
if (!document()->page() || !document()->page()->settings().plugInSnapshottingEnabled()) {
m_snapshotDecision = NeverSnapshot;
return;
}
......@@ -634,14 +634,14 @@ void HTMLPlugInImageElement::subframeLoaderWillCreatePlugIn(const KURL& url)
return;
}
if (document()->page()->settings()->snapshotAllPlugIns()) {
if (document()->page()->settings().snapshotAllPlugIns()) {
LOG(Plugins, "%p Plug-in forced to snapshot by user preference", this);
m_snapshotDecision = Snapshotted;
setDisplayState(WaitingForSnapshot);
return;
}
if (document()->page()->settings()->autostartOriginPlugInSnapshottingEnabled() && document()->page()->plugInClient() && document()->page()->plugInClient()->shouldAutoStartFromOrigin(document()->page()->mainFrame()->document()->baseURL().host(), url.host(), loadedMimeType())) {
if (document()->page()->settings().autostartOriginPlugInSnapshottingEnabled() && document()->page()->plugInClient() && document()->page()->plugInClient()->shouldAutoStartFromOrigin(document()->page()->mainFrame()->document()->baseURL().host(), url.host(), loadedMimeType())) {
LOG(Plugins, "%p Plug-in from (%s, %s) is marked to auto-start, set to play", this, document()->page()->mainFrame()->document()->baseURL().host().utf8().data(), url.host().utf8().data());
m_snapshotDecision = NeverSnapshot;
return;
......
......@@ -374,12 +374,9 @@ CachedImage* ImageDocument::cachedImage()
bool ImageDocument::shouldShrinkToFit() const
{
return frame()->page()->settings()->shrinksStandaloneImagesToFit() &&
frame()->page()->mainFrame() == frame();
return frame()->page()->settings().shrinksStandaloneImagesToFit() && frame()->page()->mainFrame() == frame();
}
// --------
void ImageEventListener::handleEvent(ScriptExecutionContext*, Event* event)
{
if (event->type() == eventNames().resizeEvent)
......
......@@ -139,7 +139,7 @@ void ValidationMessage::setMessageDOMAndStartTimer(Timer<ValidationMessage>*)
m_messageHeading->setInnerText(lines[i], ASSERT_NO_EXCEPTION);
}
int magnification = doc->page() ? doc->page()->settings()->validationMessageTimerMagnification() : -1;
int magnification = doc->page() ? doc->page()->settings().validationMessageTimerMagnification() : -1;
if (magnification <= 0)
m_timer.clear();
else {
......
......@@ -562,9 +562,8 @@ void WebGLRenderingContext::setupFlags()
{
ASSERT(m_context);
Page* p = canvas()->document()->page();
if (p)
m_synthesizedErrorsToConsole = p->settings()->webGLErrorsToConsoleEnabled();
if (Page* page = canvas()->document()->page())
m_synthesizedErrorsToConsole = page->settings().webGLErrorsToConsoleEnabled();
m_isGLES2Compliant = m_context->isGLES2Compliant();
m_isErrorGeneratedOnOutOfBoundsAccesses = m_context->getExtensions()->isEnabled("GL_CHROMIUM_strict_attribs");
......@@ -581,9 +580,8 @@ void WebGLRenderingContext::setupFlags()
bool WebGLRenderingContext::allowPrivilegedExtensions() const
{
Page* p = canvas()->document()->page();
if (p && p->settings())
return p->settings()->privilegedWebGLExtensionsEnabled();
if (Page* page = canvas()->document()->page())
return page->settings().privilegedWebGLExtensionsEnabled();
return false;
}
......
......@@ -355,7 +355,7 @@ void MediaControls::startHideFullscreenControlsTimer()
if (!page)
return;
m_hideFullscreenControlsTimer.startOneShot(page->settings()->timeWithoutMouseMovementBeforeHidingControls());
m_hideFullscreenControlsTimer.startOneShot(page->settings().timeWithoutMouseMovementBeforeHidingControls());
}
void MediaControls::stopHideFullscreenControlsTimer()
......
......@@ -185,7 +185,7 @@ bool InspectorAgent::developerExtrasEnabled() const
{
if (!m_inspectedPage)
return false;
return m_inspectedPage->settings()->developerExtrasEnabled();
return m_inspectedPage->settings().developerExtrasEnabled();
}
} // namespace WebCore
......
......@@ -121,7 +121,7 @@ InspectorFrontendClientLocal::InspectorFrontendClientLocal(InspectorController*
, m_frontendLoaded(false)
, m_dockSide(UNDOCKED)
{
m_frontendPage->settings()->setAllowFileAccessFromFileURLs(true);
m_frontendPage->settings().setAllowFileAccessFromFileURLs(true);
m_dispatchTask = adoptPtr(new InspectorBackendDispatchTask(inspectorController));
}
......
......@@ -436,20 +436,20 @@ Page* InspectorOverlay::overlayPage()
fillWithEmptyClients(pageClients);
m_overlayPage = adoptPtr(new Page(pageClients));
Settings* settings = m_page->settings();
Settings* overlaySettings = m_overlayPage->settings();
overlaySettings->setStandardFontFamily(settings->standardFontFamily());
overlaySettings->setSerifFontFamily(settings->serifFontFamily());
overlaySettings->setSansSerifFontFamily(settings->sansSerifFontFamily());
overlaySettings->setCursiveFontFamily(settings->cursiveFontFamily());
overlaySettings->setFantasyFontFamily(settings->fantasyFontFamily());
overlaySettings->setPictographFontFamily(settings->pictographFontFamily());
overlaySettings->setMinimumFontSize(settings->minimumFontSize());
overlaySettings->setMinimumLogicalFontSize(settings->minimumLogicalFontSize());
overlaySettings->setMediaEnabled(false);
overlaySettings->setScriptEnabled(true);
overlaySettings->setPluginsEnabled(false);
Settings& settings = m_page->settings();
Settings& overlaySettings = m_overlayPage->settings();
overlaySettings.setStandardFontFamily(settings.standardFontFamily());
overlaySettings.setSerifFontFamily(settings.serifFontFamily());
overlaySettings.setSansSerifFontFamily(settings.sansSerifFontFamily());
overlaySettings.setCursiveFontFamily(settings.cursiveFontFamily());
overlaySettings.setFantasyFontFamily(settings.fantasyFontFamily());
overlaySettings.setPictographFontFamily(settings.pictographFontFamily());
overlaySettings.setMinimumFontSize(settings.minimumFontSize());
overlaySettings.setMinimumLogicalFontSize(settings.minimumLogicalFontSize());
overlaySettings.setMediaEnabled(false);
overlaySettings.setScriptEnabled(true);
overlaySettings.setPluginsEnabled(false);
RefPtr<Frame> frame = Frame::create(m_overlayPage.get(), 0, dummyFrameLoaderClient);
frame->setView(FrameView::create(frame.get()));
......
......@@ -1310,25 +1310,15 @@ void InspectorPageAgent::applyEmulatedMedia(String* media)
*media = emulatedMedia;
}
void InspectorPageAgent::getCompositingBordersVisible(ErrorString* error, bool* outParam)
void InspectorPageAgent::getCompositingBordersVisible(ErrorString*, bool* outParam)
{
Settings* settings = m_page->settings();
if (!settings) {
*error = "Internal error: unable to read settings";
return;
}
*outParam = settings->showDebugBorders() || settings->showRepaintCounter();
*outParam = m_page->settings().showDebugBorders() || m_page->settings().showRepaintCounter();
}
void InspectorPageAgent::setCompositingBordersVisible(ErrorString*, bool visible)
{
Settings* settings = m_page->settings();
if (!settings)
return;
settings->setShowDebugBorders(visible);
settings->setShowRepaintCounter(visible);
m_page->settings().setShowDebugBorders(visible);
m_page->settings().setShowRepaintCounter(visible);
}
void InspectorPageAgent::captureScreenshot(ErrorString* errorString, String* data)
......
......@@ -188,7 +188,7 @@ static String findPluginMIMETypeFromURL(Page* page, const String& url)
static void logPluginRequest(Page* page, const String& mimeType, const String& url, bool success)
{
if (!page || !page->settings()->diagnosticLoggingEnabled())
if (!page || !page->settings().diagnosticLoggingEnabled())
return;
String newMIMEType = mimeType;
......
......@@ -436,7 +436,7 @@ PassRefPtr<LegacyWebArchive> LegacyWebArchive::create(Node* node, FrameFilter* f
// In practice we don't actually know whether scripting was enabled when the page was originally loaded
// but we can approximate that by checking if scripting is enabled right now.
OwnPtr<Vector<QualifiedName> > tagNamesToFilter;
if (frame->page() && frame->page()->settings()->isScriptEnabled()) {
if (frame->page() && frame->page()->settings().isScriptEnabled()) {
tagNamesToFilter = adoptPtr(new Vector<QualifiedName>);
tagNamesToFilter->append(HTMLNames::noscriptTag);
}
......
......@@ -203,7 +203,7 @@ void IconController::continueLoadWithDecision(IconLoadDecision iconLoadDecision)
ASSERT(iconLoadDecision != IconLoadUnknown);
// FIXME (<rdar://problem/9168605>) - We should support in-memory-only private browsing icons in asynchronous icon database mode.
if (iconDatabase().supportsAsynchronousMode() && m_frame->page()->settings()->privateBrowsingEnabled())
if (iconDatabase().supportsAsynchronousMode() && m_frame->page()->settings().privateBrowsingEnabled())
return;
if (iconLoadDecision == IconLoadNo) {
......
......@@ -84,7 +84,7 @@ bool CaptionUserPreferences::userPrefersCaptions() const
if (!page)
return false;
return page->settings()->shouldDisplayCaptions();
return page->settings().shouldDisplayCaptions();
}
void CaptionUserPreferences::setUserPrefersCaptions(bool preference)
......@@ -93,7 +93,7 @@ void CaptionUserPreferences::setUserPrefersCaptions(bool preference)
if (!page)
return;
page->settings()->setShouldDisplayCaptions(preference);
page->settings().setShouldDisplayCaptions(preference);
notify();
}
......@@ -103,7 +103,7 @@ bool CaptionUserPreferences::userPrefersSubtitles() const
if (!page)
return false;
return page->settings()->shouldDisplaySubtitles();
return page->settings().shouldDisplaySubtitles();
}
void CaptionUserPreferences::setUserPrefersSubtitles(bool preference)
......@@ -112,7 +112,7 @@ void CaptionUserPreferences::setUserPrefersSubtitles(bool preference)
if (!page)
return;
page->settings()->setShouldDisplaySubtitles(preference);
page->settings().setShouldDisplaySubtitles(preference);
notify();
}
......@@ -122,7 +122,7 @@ bool CaptionUserPreferences::userPrefersTextDescriptions() const
if (!page)
return false;
return page->settings()->shouldDisplayTextDescriptions();
return page->settings().shouldDisplayTextDescriptions();
}
void CaptionUserPreferences::setUserPrefersTextDescriptions(bool preference)
......@@ -131,7 +131,7 @@ void CaptionUserPreferences::setUserPrefersTextDescriptions(bool preference)
if (!page)
return;
page->settings()->setShouldDisplayTextDescriptions(preference);
page->settings().setShouldDisplayTextDescriptions(preference);
notify();
}
......
......@@ -404,7 +404,7 @@ void Chrome::setToolTip(const HitTestResult& result)
String toolTip = result.spellingToolTip(toolTipDirection);
// Next priority is a toolTip from a URL beneath the mouse (if preference is set to show those).
if (toolTip.isEmpty() && m_page->settings()->showsURLsInToolTips()) {
if (toolTip.isEmpty() && m_page->settings().showsURLsInToolTips()) {
if (Node* node = result.innerNonSharedNode()) {
// Get tooltip representing form action, if relevant
if (isHTMLInputElement(node)) {
......@@ -433,7 +433,7 @@ void Chrome::setToolTip(const HitTestResult& result)
if (toolTip.isEmpty())
toolTip = result.title(toolTipDirection);
if (toolTip.isEmpty() && m_page->settings()->showsToolTipOverTruncatedText())
if (toolTip.isEmpty() && m_page->settings().showsToolTipOverTruncatedText())
toolTip = result.innerTextIfTruncated(toolTipDirection);
// Lastly, for <input type="file"> that allow multiple files, we'll consider a tooltip for the selected filenames
......
......@@ -83,13 +83,13 @@ static void internalAddMessage(Page* page, MessageType type, MessageLevel level,
bool gotMessage = arguments->getFirstArgumentAsString(message);
InspectorInstrumentation::addMessageToConsole(page, ConsoleAPIMessageSource, type, level, message, state, arguments);
if (page->settings()->privateBrowsingEnabled())
if (page->settings().privateBrowsingEnabled())
return;
if (gotMessage)
page->chrome().client()->addMessageToConsole(ConsoleAPIMessageSource, type, level, message, lastCaller.lineNumber(), lastCaller.columnNumber(), lastCaller.sourceURL());
if (!page->settings()->logsPageMessagesToSystemConsoleEnabled() && !PageConsole::shouldPrintExceptions())
if (!page->settings().logsPageMessagesToSystemConsoleEnabled() && !PageConsole::shouldPrintExceptions())
return;
PageConsole::printSourceURLAndLine(lastCaller.sourceURL(), lastCaller.lineNumber());
......
......@@ -1108,15 +1108,12 @@ void ContextMenuController::populate()
createAndAppendWritingDirectionSubMenu(WritingDirectionMenuItem);
appendItem(WritingDirectionMenuItem, m_contextMenu.get());
if (Page* page = frame->page()) {
if (Settings* settings = page->settings()) {
bool includeTextDirectionSubmenu = settings->textDirectionSubmenuInclusionBehavior() == TextDirectionSubmenuAlwaysIncluded
|| (settings->textDirectionSubmenuInclusionBehavior() == TextDirectionSubmenuAutomaticallyIncluded && frame->editor().hasBidiSelection());
if (includeTextDirectionSubmenu) {
ContextMenuItem TextDirectionMenuItem(SubmenuType, ContextMenuItemTagTextDirectionMenu,
contextMenuItemTagTextDirectionMenu());
createAndAppendTextDirectionSubMenu(TextDirectionMenuItem);
appendItem(TextDirectionMenuItem, m_contextMenu.get());
}
bool includeTextDirectionSubmenu = page->settings().textDirectionSubmenuInclusionBehavior() == TextDirectionSubmenuAlwaysIncluded
|| (page->settings().textDirectionSubmenuInclusionBehavior() == TextDirectionSubmenuAutomaticallyIncluded && frame->editor().hasBidiSelection());
if (includeTextDirectionSubmenu) {
ContextMenuItem TextDirectionMenuItem(SubmenuType, ContextMenuItemTagTextDirectionMenu, contextMenuItemTagTextDirectionMenu());
createAndAppendTextDirectionSubMenu(TextDirectionMenuItem);
appendItem(TextDirectionMenuItem, m_contextMenu.get());
}
}
#endif
......
......@@ -795,7 +795,7 @@ Storage* DOMWindow::localStorage(ExceptionCode& ec) const
if (!page)
return 0;
if (!page->settings()->localStorageEnabled())
if (!page->settings().localStorageEnabled())
return 0;
RefPtr<StorageArea> storageArea;
......
......@@ -1467,7 +1467,7 @@ void EventHandler::startAutoHideCursorTimer()
if (!page)
return;
m_autoHideCursorTimer.startOneShot(page->settings()->timeWithoutMouseMovementBeforeHidingControls());
m_autoHideCursorTimer.startOneShot(page->settings().timeWithoutMouseMovementBeforeHidingControls());
// The fake mouse move event screws up the auto-hide feature (by resetting the auto-hide timer)
// so cancel any pending fake mouse moves.
......
......@@ -183,7 +183,7 @@ inline Frame::Frame(Page* page, HTMLFrameOwnerElement* ownerElement, FrameLoader
if (!ownerElement) {
#if USE(TILED_BACKING_STORE)
// Top level frame only for now.
setTiledBackingStoreEnabled(page->settings()->tiledBackingStoreEnabled());
setTiledBackingStoreEnabled(page->settings().tiledBackingStoreEnabled());
#endif
} else {
page->incrementSubframeCount();
......@@ -329,7 +329,7 @@ void Frame::sendOrientationChangeEvent(int orientation)
Settings* Frame::settings() const
{
return m_page ? m_page->settings() : 0;
return m_page ? &m_page->settings() : 0;
}
static PassOwnPtr<RegularExpression> createRegExpForLabels(const Vector<String>& labels)
......@@ -948,7 +948,7 @@ float Frame::frameScaleFactor() const
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 || page->settings().applyPageScaleFactorInCompositor())
return 1;
return page->pageScaleFactor();
......
......@@ -463,7 +463,7 @@ void FrameView::setFrameRect(const IntRect& newRect)
// Autosized font sizes depend on the width of the viewing area.
if (newRect.width() != oldRect.width()) {
Page* page = m_frame ? m_frame->page() : 0;
if (page && page->mainFrame() == m_frame && page->settings()->textAutosizingEnabled()) {
if (page && page->mainFrame() == m_frame && page->settings().textAutosizingEnabled()) {
for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
m_frame->document()->textAutosizer()->recalculateMultipliers();
}
......@@ -1991,7 +1991,7 @@ void FrameView::setFixedVisibleContentRect(const IntRect& visibleContentRect)
ScrollView::setFixedVisibleContentRect(visibleContentRect);
if (offset != scrollOffset()) {
repaintFixedElementsAfterScrolling();
if (m_frame->page()->settings()->acceleratedCompositingForFixedPositionEnabled())
if (m_frame->page()->settings().acceleratedCompositingForFixedPositionEnabled())
updateFixedElementsAfterScrolling();
scrollAnimator()->setCurrentPosition(scrollPosition());
scrollPositionChanged();
......@@ -3286,7 +3286,7 @@ bool FrameView::scrollAnimatorEnabled() const
{
#if ENABLE(SMOOTH_SCROLLING)
if (Page* page = m_frame->page())
return page->settings()->scrollAnimatorEnabled();
return page->settings().scrollAnimatorEnabled();
#endif
return false;
......
......@@ -116,7 +116,7 @@ bool Navigator::cookieEnabled() const
if (!m_frame)
return false;
if (m_frame->page() && !m_frame->page()->settings()->cookieEnabled())
if (m_frame->page() && !m_frame->page()->settings().cookieEnabled())
return false;
return cookiesEnabled(m_frame->document());
......
......@@ -207,7 +207,7 @@ public:
String mainThreadScrollingReasonsAsText();
PassRefPtr<ClientRectList> nonFastScrollableRects(const Frame*);
Settings* settings() const { return m_settings.get(); }
Settings& settings() const { return *m_settings; }
ProgressTracker* progress() const { return m_progress.get(); }
BackForwardController* backForward() const { return m_backForwardController.get(); }
......@@ -457,7 +457,7 @@ private:
#endif
RefPtr<ScrollingCoordinator> m_scrollingCoordinator;
OwnPtr<Settings> m_settings;
const OwnPtr<Settings> m_settings;
OwnPtr<ProgressTracker> m_progress;
OwnPtr<BackForwardController> m_backForwardController;
......
......@@ -168,12 +168,12 @@ void PageConsole::addMessage(MessageSource source, MessageLevel level, const Str
if (source == CSSMessageSource)
return;
if (page->settings()->privateBrowsingEnabled())
if (page->settings().privateBrowsingEnabled())
return;
page->chrome().client()->addMessageToConsole(source, level, message, lineNumber, columnNumber, url);
if (!page->settings()->logsPageMessagesToSystemConsoleEnabled() && !shouldPrintExceptions())
if (!page->settings().logsPageMessagesToSystemConsoleEnabled() && !shouldPrintExceptions())
return;
printSourceURLAndLine(url, lineNumber);
......