2 * Copyright (C) 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
7 * 1. Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer.
9 * 2. Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the
11 * documentation and/or other materials provided with the distribution.
13 * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16 * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR
17 * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18 * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20 * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21 * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #include "BackForwardController.h"
30 #include "CachedResourceLoader.h"
31 #include "CookieStorage.h"
36 #include "FrameTree.h"
37 #include "FrameView.h"
38 #include "HistoryItem.h"
40 #include "PageCache.h"
41 #include "ResourceHandle.h"
42 #include "StorageMap.h"
49 static void setLoadsImagesAutomaticallyInAllFrames(Page* page)
51 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
52 frame->document()->cachedResourceLoader()->setAutoLoadImages(page->settings()->loadsImagesAutomatically());
55 #if ENABLE(TIZEN_LOAD_REMOTE_IMAGES)
56 static void setLoadsRemoteImagesInAllFrames(Page* page)
58 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
59 frame->document()->cachedResourceLoader()->setLoadRemoteImages(page->settings()->loadRemoteImages());
63 // Sets the entry in the font map for the given script. If family is the empty string, removes the entry instead.
64 static inline void setGenericFontFamilyMap(ScriptFontFamilyMap& fontMap, const AtomicString& family, UScriptCode script, Page* page)
66 ScriptFontFamilyMap::iterator it = fontMap.find(static_cast<int>(script));
67 if (family.isEmpty()) {
68 if (it == fontMap.end())
71 } else if (it != fontMap.end() && it->second == family)
74 fontMap.set(static_cast<int>(script), family);
77 page->setNeedsRecalcStyleInAllFrames();
80 static inline const AtomicString& getGenericFontFamilyForScript(const ScriptFontFamilyMap& fontMap, UScriptCode script)
82 ScriptFontFamilyMap::const_iterator it = fontMap.find(static_cast<int>(script));
83 if (it != fontMap.end())
85 if (script != USCRIPT_COMMON)
86 return getGenericFontFamilyForScript(fontMap, USCRIPT_COMMON);
91 bool Settings::gShouldPaintNativeControls = true;
95 bool Settings::gAVFoundationEnabled(false);
98 bool Settings::gMockScrollbarsEnabled = false;
100 #if PLATFORM(WIN) || (OS(WINDOWS) && PLATFORM(WX))
101 bool Settings::gShouldUseHighResolutionTimers = true;
105 bool Settings::gShouldRespectPriorityInCSSAttributeSetters = false;
109 // 1) EditingMacBehavior comprises Tiger, Leopard, SnowLeopard and iOS builds, as well QtWebKit and Chromium when built on Mac;
110 // 2) EditingWindowsBehavior comprises Win32 and WinCE builds, as well as QtWebKit and Chromium when built on Windows;
111 // 3) EditingUnixBehavior comprises all unix-based systems, but Darwin/MacOS (and then abusing the terminology);
112 // 99) MacEditingBehavior is used a fallback.
113 static EditingBehaviorType editingBehaviorTypeForPlatform()
119 EditingWindowsBehavior
129 static const double defaultIncrementalRenderingSuppressionTimeoutInSeconds = 5;
131 Settings::Settings(Page* page)
133 , m_editableLinkBehavior(EditableLinkDefaultBehavior)
134 , m_textDirectionSubmenuInclusionBehavior(TextDirectionSubmenuAutomaticallyIncluded)
135 , m_passwordEchoDurationInSeconds(1)
136 , m_minimumFontSize(0)
137 , m_minimumLogicalFontSize(0)
138 , m_defaultFontSize(0)
139 , m_defaultFixedFontSize(0)
140 , m_validationMessageTimerMagnification(50)
141 , m_minimumAccelerated2dCanvasSize(257 * 256)
142 , m_layoutFallbackWidth(980)
143 , m_maximumDecodedImageSize(numeric_limits<size_t>::max())
146 , m_sessionStorageQuota(StorageMap::noQuota)
147 , m_editingBehaviorType(editingBehaviorTypeForPlatform())
148 , m_maximumHTMLParserDOMTreeDepth(defaultMaximumHTMLParserDOMTreeDepth)
149 #if ENABLE(TEXT_AUTOSIZING)
150 , m_textAutosizingFontScaleFactor(1)
151 #if HACK_FORCE_TEXT_AUTOSIZING_ON_DESKTOP
152 , m_textAutosizingWindowSizeOverride(320, 480)
153 , m_textAutosizingEnabled(true)
155 , m_textAutosizingEnabled(false)
158 , m_isSpatialNavigationEnabled(false)
159 , m_isJavaEnabled(false)
160 , m_isJavaEnabledForLocalFiles(true)
161 , m_loadsImagesAutomatically(false)
162 , m_loadsSiteIconsIgnoringImageLoadingSetting(false)
163 , m_privateBrowsingEnabled(false)
164 , m_caretBrowsingEnabled(false)
165 , m_areImagesEnabled(true)
166 , m_isMediaEnabled(true)
167 , m_arePluginsEnabled(false)
168 , m_localStorageEnabled(false)
169 , m_isScriptEnabled(false)
170 , m_isWebSecurityEnabled(true)
171 , m_allowUniversalAccessFromFileURLs(true)
172 , m_allowFileAccessFromFileURLs(true)
173 , m_javaScriptCanOpenWindowsAutomatically(false)
174 , m_javaScriptCanAccessClipboard(false)
175 , m_shouldPrintBackgrounds(false)
176 , m_textAreasAreResizable(false)
177 #if ENABLE(DASHBOARD_SUPPORT)
178 , m_usesDashboardBackwardCompatibilityMode(false)
180 , m_needsAdobeFrameReloadingQuirk(false)
181 , m_needsKeyboardEventDisambiguationQuirks(false)
182 , m_treatsAnyTextCSSLinkAsStylesheet(false)
183 , m_needsLeopardMailQuirks(false)
184 , m_isDOMPasteAllowed(false)
185 , m_shrinksStandaloneImagesToFit(true)
186 , m_usesPageCache(false)
187 , m_pageCacheSupportsPlugins(false)
188 , m_showsURLsInToolTips(false)
189 , m_showsToolTipOverTruncatedText(false)
190 , m_forceFTPDirectoryListings(false)
191 , m_developerExtrasEnabled(false)
192 , m_javaScriptExperimentsEnabled(false)
193 , m_authorAndUserStylesEnabled(true)
194 , m_needsSiteSpecificQuirks(false)
195 , m_fontRenderingMode(0)
196 , m_frameFlatteningEnabled(false)
197 #if ENABLE(WEB_ARCHIVE)
198 , m_webArchiveDebugModeEnabled(false)
200 , m_localFileContentSniffingEnabled(false)
201 , m_inApplicationChromeMode(false)
202 , m_offlineWebApplicationCacheEnabled(false)
203 , m_enforceCSSMIMETypeInNoQuirksMode(true)
204 , m_usesEncodingDetector(false)
205 , m_allowScriptsToCloseWindows(false)
206 , m_canvasUsesAcceleratedDrawing(false)
207 , m_acceleratedDrawingEnabled(false)
208 , m_acceleratedFiltersEnabled(false)
209 , m_isCSSCustomFilterEnabled(false)
210 #if ENABLE(CSS_REGIONS)
211 , m_cssRegionsEnabled(false)
213 #if ENABLE(CSS_VARIABLES)
214 , m_cssVariablesEnabled(false)
216 , m_regionBasedColumnsEnabled(false)
217 , m_cssGridLayoutEnabled(false)
218 // FIXME: This should really be disabled by default as it makes platforms that don't support the feature download files
219 // they can't use by. Leaving enabled for now to not change existing behavior.
220 , m_downloadableBinaryFontsEnabled(true)
221 , m_xssAuditorEnabled(false)
222 , m_acceleratedCompositingEnabled(true)
223 , m_acceleratedCompositingFor3DTransformsEnabled(true)
224 , m_acceleratedCompositingForVideoEnabled(true)
225 , m_acceleratedCompositingForPluginsEnabled(true)
226 , m_acceleratedCompositingForCanvasEnabled(true)
227 , m_acceleratedCompositingForAnimationEnabled(true)
228 , m_acceleratedCompositingForFixedPositionEnabled(false)
229 , m_acceleratedCompositingForScrollableFramesEnabled(false)
230 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
231 , m_alwaysUseAcceleratedOverflowScroll(false)
233 , m_showDebugBorders(false)
234 , m_showRepaintCounter(false)
235 , m_experimentalNotificationsEnabled(false)
236 , m_webGLEnabled(false)
237 , m_webGLErrorsToConsoleEnabled(false)
238 , m_openGLMultisamplingEnabled(true)
239 , m_privilegedWebGLExtensionsEnabled(false)
240 , m_webAudioEnabled(false)
241 , m_acceleratedCanvas2dEnabled(false)
242 , m_deferredCanvas2dEnabled(false)
243 , m_loadDeferringEnabled(true)
244 , m_tiledBackingStoreEnabled(false)
245 , m_paginateDuringLayoutEnabled(false)
246 , m_dnsPrefetchingEnabled(false)
247 #if ENABLE(FULLSCREEN_API)
248 , m_fullScreenAPIEnabled(false)
250 , m_asynchronousSpellCheckingEnabled(false)
251 #if USE(UNIFIED_TEXT_CHECKING)
252 , m_unifiedTextCheckerEnabled(true)
254 , m_unifiedTextCheckerEnabled(false)
256 , m_memoryInfoEnabled(false)
257 , m_quantizedMemoryInfoEnabled(false)
258 , m_interactiveFormValidation(false)
259 , m_usePreHTML5ParserQuirks(false)
260 , m_hyperlinkAuditingEnabled(false)
261 , m_crossOriginCheckInGetMatchedCSSRulesDisabled(false)
262 , m_forceCompositingMode(false)
263 , m_shouldInjectUserScriptsInInitialEmptyDocument(false)
264 , m_fixedElementsLayoutRelativeToFrame(false)
265 , m_allowDisplayOfInsecureContent(true)
266 , m_allowRunningOfInsecureContent(true)
267 #if ENABLE(SMOOTH_SCROLLING)
268 , m_scrollAnimatorEnabled(true)
270 , m_mediaPlaybackRequiresUserGesture(false)
271 , m_mediaPlaybackAllowsInline(true)
272 , m_passwordEchoEnabled(false)
273 , m_suppressesIncrementalRendering(false)
274 , m_backspaceKeyNavigationEnabled(true)
275 , m_visualWordMovementEnabled(false)
276 #if ENABLE(VIDEO_TRACK)
277 , m_shouldDisplaySubtitles(false)
278 , m_shouldDisplayCaptions(false)
279 , m_shouldDisplayTextDescriptions(false)
281 , m_scrollingCoordinatorEnabled(false)
282 , m_notificationsEnabled(true)
283 , m_needsIsLoadingInAPISenseQuirk(false)
284 #if ENABLE(TOUCH_EVENTS)
285 , m_touchEventEmulationEnabled(false)
287 , m_shouldRespectImageOrientation(false)
288 , m_wantsBalancedSetDefersLoadingBehavior(false)
289 , m_requestAnimationFrameEnabled(true)
290 , m_deviceSupportsTouch(false)
291 #if ENABLE(TIZEN_DONT_DISPATCH_FAKEMOUSEMOVEEVENT_WHEN_SCROLLING_ON_TOUCH_DEVICES)
292 , m_deviceSupportsMouse(false)
294 , m_deviceSupportsMouse(true)
296 , m_needsDidFinishLoadOrderQuirk(false)
297 , m_fixedPositionCreatesStackingContext(false)
298 , m_syncXHRInDocumentsEnabled(true)
299 , m_cookieEnabled(true)
300 , m_windowFocusRestricted(true)
301 , m_diagnosticLoggingEnabled(false)
302 , m_applyPageScaleFactorInCompositor(false)
303 , m_loadsImagesAutomaticallyTimer(this, &Settings::loadsImagesAutomaticallyTimerFired)
304 , m_incrementalRenderingSuppressionTimeoutInSeconds(defaultIncrementalRenderingSuppressionTimeoutInSeconds)
305 #if ENABLE(TIZEN_LOAD_REMOTE_IMAGES)
306 , m_loadRemoteImagesTimer(this, &Settings::loadRemoteImagesTimerFired)
307 , m_loadRemoteImages(true)
309 #if ENABLE(TIZEN_WEBKIT2_MEMORY_SAVING_MODE)
310 , m_memorySavingModeEnabled(false)
313 // A Frame may not have been created yet, so we initialize the AtomicString
314 // hash before trying to use it.
315 AtomicString::init();
316 initializeDefaultFontFamilies();
317 m_page = page; // Page is not yet fully initialized wen constructing Settings, so keeping m_page null over initializeDefaultFontFamilies() call.
320 PassOwnPtr<Settings> Settings::create(Page* page)
322 return adoptPtr(new Settings(page));
325 #if !PLATFORM(MAC) && !PLATFORM(BLACKBERRY)
326 void Settings::initializeDefaultFontFamilies()
328 // Other platforms can set up fonts from a client, but on Mac, we want it in WebCore to share code between WebKit1 and WebKit2.
332 const AtomicString& Settings::standardFontFamily(UScriptCode script) const
334 return getGenericFontFamilyForScript(m_standardFontFamilyMap, script);
337 void Settings::setStandardFontFamily(const AtomicString& family, UScriptCode script)
339 setGenericFontFamilyMap(m_standardFontFamilyMap, family, script, m_page);
342 const AtomicString& Settings::fixedFontFamily(UScriptCode script) const
344 return getGenericFontFamilyForScript(m_fixedFontFamilyMap, script);
347 void Settings::setFixedFontFamily(const AtomicString& family, UScriptCode script)
349 setGenericFontFamilyMap(m_fixedFontFamilyMap, family, script, m_page);
352 const AtomicString& Settings::serifFontFamily(UScriptCode script) const
354 return getGenericFontFamilyForScript(m_serifFontFamilyMap, script);
357 void Settings::setSerifFontFamily(const AtomicString& family, UScriptCode script)
359 setGenericFontFamilyMap(m_serifFontFamilyMap, family, script, m_page);
362 const AtomicString& Settings::sansSerifFontFamily(UScriptCode script) const
364 return getGenericFontFamilyForScript(m_sansSerifFontFamilyMap, script);
367 void Settings::setSansSerifFontFamily(const AtomicString& family, UScriptCode script)
369 setGenericFontFamilyMap(m_sansSerifFontFamilyMap, family, script, m_page);
372 const AtomicString& Settings::cursiveFontFamily(UScriptCode script) const
374 return getGenericFontFamilyForScript(m_cursiveFontFamilyMap, script);
377 void Settings::setCursiveFontFamily(const AtomicString& family, UScriptCode script)
379 setGenericFontFamilyMap(m_cursiveFontFamilyMap, family, script, m_page);
382 const AtomicString& Settings::fantasyFontFamily(UScriptCode script) const
384 return getGenericFontFamilyForScript(m_fantasyFontFamilyMap, script);
387 void Settings::setFantasyFontFamily(const AtomicString& family, UScriptCode script)
389 setGenericFontFamilyMap(m_fantasyFontFamilyMap, family, script, m_page);
392 const AtomicString& Settings::pictographFontFamily(UScriptCode script) const
394 return getGenericFontFamilyForScript(m_pictographFontFamilyMap, script);
397 void Settings::setPictographFontFamily(const AtomicString& family, UScriptCode script)
399 setGenericFontFamilyMap(m_pictographFontFamilyMap, family, script, m_page);
402 void Settings::setMinimumFontSize(int minimumFontSize)
404 if (m_minimumFontSize == minimumFontSize)
407 m_minimumFontSize = minimumFontSize;
408 m_page->setNeedsRecalcStyleInAllFrames();
411 void Settings::setMinimumLogicalFontSize(int minimumLogicalFontSize)
413 if (m_minimumLogicalFontSize == minimumLogicalFontSize)
416 m_minimumLogicalFontSize = minimumLogicalFontSize;
417 m_page->setNeedsRecalcStyleInAllFrames();
420 void Settings::setDefaultFontSize(int defaultFontSize)
422 if (m_defaultFontSize == defaultFontSize)
425 m_defaultFontSize = defaultFontSize;
426 m_page->setNeedsRecalcStyleInAllFrames();
429 void Settings::setDefaultFixedFontSize(int defaultFontSize)
431 if (m_defaultFixedFontSize == defaultFontSize)
434 m_defaultFixedFontSize = defaultFontSize;
435 m_page->setNeedsRecalcStyleInAllFrames();
438 #if ENABLE(TEXT_AUTOSIZING)
439 void Settings::setTextAutosizingEnabled(bool textAutosizingEnabled)
441 if (m_textAutosizingEnabled == textAutosizingEnabled)
444 m_textAutosizingEnabled = textAutosizingEnabled;
445 m_page->setNeedsRecalcStyleInAllFrames();
448 void Settings::setTextAutosizingWindowSizeOverride(const IntSize& textAutosizingWindowSizeOverride)
450 if (m_textAutosizingWindowSizeOverride == textAutosizingWindowSizeOverride)
453 m_textAutosizingWindowSizeOverride = textAutosizingWindowSizeOverride;
454 m_page->setNeedsRecalcStyleInAllFrames();
457 void Settings::setTextAutosizingFontScaleFactor(float fontScaleFactor)
459 m_textAutosizingFontScaleFactor = fontScaleFactor;
460 m_page->setNeedsRecalcStyleInAllFrames();
465 void Settings::setLoadsImagesAutomatically(bool loadsImagesAutomatically)
467 m_loadsImagesAutomatically = loadsImagesAutomatically;
469 // Changing this setting to true might immediately start new loads for images that had previously had loading disabled.
470 // If this happens while a WebView is being dealloc'ed, and we don't know the WebView is being dealloc'ed, these new loads
471 // can cause crashes downstream when the WebView memory has actually been free'd.
472 // One example where this can happen is in Mac apps that subclass WebView then do work in their overridden dealloc methods.
473 // Starting these loads synchronously is not important. By putting it on a 0-delay, properly closing the Page cancels them
474 // before they have a chance to really start.
475 // See http://webkit.org/b/60572 for more discussion.
476 m_loadsImagesAutomaticallyTimer.startOneShot(0);
479 void Settings::loadsImagesAutomaticallyTimerFired(Timer<Settings>*)
481 setLoadsImagesAutomaticallyInAllFrames(m_page);
484 void Settings::setLoadsSiteIconsIgnoringImageLoadingSetting(bool loadsSiteIcons)
486 m_loadsSiteIconsIgnoringImageLoadingSetting = loadsSiteIcons;
489 void Settings::setScriptEnabled(bool isScriptEnabled)
491 m_isScriptEnabled = isScriptEnabled;
494 void Settings::setWebSecurityEnabled(bool isWebSecurityEnabled)
496 m_isWebSecurityEnabled = isWebSecurityEnabled;
499 void Settings::setAllowUniversalAccessFromFileURLs(bool allowUniversalAccessFromFileURLs)
501 m_allowUniversalAccessFromFileURLs = allowUniversalAccessFromFileURLs;
504 void Settings::setAllowFileAccessFromFileURLs(bool allowFileAccessFromFileURLs)
506 m_allowFileAccessFromFileURLs = allowFileAccessFromFileURLs;
509 void Settings::setSpatialNavigationEnabled(bool isSpatialNavigationEnabled)
511 m_isSpatialNavigationEnabled = isSpatialNavigationEnabled;
514 void Settings::setJavaEnabled(bool isJavaEnabled)
516 m_isJavaEnabled = isJavaEnabled;
519 void Settings::setJavaEnabledForLocalFiles(bool isJavaEnabledForLocalFiles)
521 m_isJavaEnabledForLocalFiles = isJavaEnabledForLocalFiles;
524 void Settings::setImagesEnabled(bool areImagesEnabled)
526 m_areImagesEnabled = areImagesEnabled;
529 void Settings::setMediaEnabled(bool isMediaEnabled)
531 m_isMediaEnabled = isMediaEnabled;
534 void Settings::setPluginsEnabled(bool arePluginsEnabled)
536 m_arePluginsEnabled = arePluginsEnabled;
539 void Settings::setLocalStorageEnabled(bool localStorageEnabled)
541 m_localStorageEnabled = localStorageEnabled;
544 void Settings::setSessionStorageQuota(unsigned sessionStorageQuota)
546 m_sessionStorageQuota = sessionStorageQuota;
549 void Settings::setPrivateBrowsingEnabled(bool privateBrowsingEnabled)
551 // FIXME http://webkit.org/b/67870: The private browsing storage session and cookie private
552 // browsing mode (which is used if storage sessions are not available) are global settings, so
553 // it is misleading to have them as per-page settings.
554 // In addition, if they are treated as a per Page settings, the global values can get out of
555 // sync with the per Page value in the following situation:
556 // 1. The global values get set to true when setPrivateBrowsingEnabled(true) is called.
557 // 2. All Pages are closed, so all Settings objects go away.
558 // 3. A new Page is created, and a corresponding new Settings object is created - with
559 // m_privateBrowsingEnabled starting out as false in the constructor.
560 // 4. The WebPage settings get applied to the new Page and setPrivateBrowsingEnabled(false)
561 // is called, but an if (m_privateBrowsingEnabled == privateBrowsingEnabled) early return
562 // prevents the global values from getting changed from true to false.
563 #if USE(CFURLSTORAGESESSIONS) || ENABLE(TIZEN_PRIVATE_BROWSING)
564 ResourceHandle::setPrivateBrowsingEnabled(privateBrowsingEnabled);
566 setCookieStoragePrivateBrowsingEnabled(privateBrowsingEnabled);
568 if (m_privateBrowsingEnabled == privateBrowsingEnabled)
571 m_privateBrowsingEnabled = privateBrowsingEnabled;
572 m_page->privateBrowsingStateChanged();
575 void Settings::setJavaScriptCanOpenWindowsAutomatically(bool javaScriptCanOpenWindowsAutomatically)
577 m_javaScriptCanOpenWindowsAutomatically = javaScriptCanOpenWindowsAutomatically;
580 void Settings::setJavaScriptCanAccessClipboard(bool javaScriptCanAccessClipboard)
582 m_javaScriptCanAccessClipboard = javaScriptCanAccessClipboard;
585 void Settings::setDefaultTextEncodingName(const String& defaultTextEncodingName)
587 m_defaultTextEncodingName = defaultTextEncodingName;
590 void Settings::setUserStyleSheetLocation(const KURL& userStyleSheetLocation)
592 if (m_userStyleSheetLocation == userStyleSheetLocation)
595 m_userStyleSheetLocation = userStyleSheetLocation;
597 m_page->userStyleSheetLocationChanged();
600 void Settings::setFixedElementsLayoutRelativeToFrame(bool fixedElementsLayoutRelativeToFrame)
602 m_fixedElementsLayoutRelativeToFrame = fixedElementsLayoutRelativeToFrame;
605 void Settings::setShouldPrintBackgrounds(bool shouldPrintBackgrounds)
607 m_shouldPrintBackgrounds = shouldPrintBackgrounds;
610 void Settings::setTextAreasAreResizable(bool textAreasAreResizable)
612 if (m_textAreasAreResizable == textAreasAreResizable)
615 m_textAreasAreResizable = textAreasAreResizable;
616 m_page->setNeedsRecalcStyleInAllFrames();
619 void Settings::setEditableLinkBehavior(EditableLinkBehavior editableLinkBehavior)
621 m_editableLinkBehavior = editableLinkBehavior;
624 void Settings::setTextDirectionSubmenuInclusionBehavior(TextDirectionSubmenuInclusionBehavior behavior)
626 m_textDirectionSubmenuInclusionBehavior = behavior;
629 #if ENABLE(DASHBOARD_SUPPORT)
630 void Settings::setUsesDashboardBackwardCompatibilityMode(bool usesDashboardBackwardCompatibilityMode)
632 m_usesDashboardBackwardCompatibilityMode = usesDashboardBackwardCompatibilityMode;
636 // FIXME: This quirk is needed because of Radar 4674537 and 5211271. We need to phase it out once Adobe
637 // can fix the bug from their end.
638 void Settings::setNeedsAdobeFrameReloadingQuirk(bool shouldNotReloadIFramesForUnchangedSRC)
640 m_needsAdobeFrameReloadingQuirk = shouldNotReloadIFramesForUnchangedSRC;
643 // This is a quirk we are pro-actively applying to old applications. It changes keyboard event dispatching,
644 // making keyIdentifier available on keypress events, making charCode available on keydown/keyup events,
645 // and getting keypress dispatched in more cases.
646 void Settings::setNeedsKeyboardEventDisambiguationQuirks(bool needsQuirks)
648 m_needsKeyboardEventDisambiguationQuirks = needsQuirks;
651 void Settings::setTreatsAnyTextCSSLinkAsStylesheet(bool treatsAnyTextCSSLinkAsStylesheet)
653 m_treatsAnyTextCSSLinkAsStylesheet = treatsAnyTextCSSLinkAsStylesheet;
656 void Settings::setNeedsLeopardMailQuirks(bool needsQuirks)
658 m_needsLeopardMailQuirks = needsQuirks;
661 void Settings::setDOMPasteAllowed(bool DOMPasteAllowed)
663 m_isDOMPasteAllowed = DOMPasteAllowed;
666 void Settings::setDefaultMinDOMTimerInterval(double interval)
668 DOMTimer::setDefaultMinTimerInterval(interval);
671 double Settings::defaultMinDOMTimerInterval()
673 return DOMTimer::defaultMinTimerInterval();
676 void Settings::setMinDOMTimerInterval(double interval)
678 m_page->setMinimumTimerInterval(interval);
681 double Settings::minDOMTimerInterval()
683 return m_page->minimumTimerInterval();
686 void Settings::setUsesPageCache(bool usesPageCache)
688 if (m_usesPageCache == usesPageCache)
691 m_usesPageCache = usesPageCache;
692 if (!m_usesPageCache) {
693 int first = -m_page->backForward()->backCount();
694 int last = m_page->backForward()->forwardCount();
695 for (int i = first; i <= last; i++)
696 pageCache()->remove(m_page->backForward()->itemAtIndex(i));
697 pageCache()->releaseAutoreleasedPagesNow();
701 void Settings::setShrinksStandaloneImagesToFit(bool shrinksStandaloneImagesToFit)
703 m_shrinksStandaloneImagesToFit = shrinksStandaloneImagesToFit;
706 void Settings::setShowsURLsInToolTips(bool showsURLsInToolTips)
708 m_showsURLsInToolTips = showsURLsInToolTips;
711 void Settings::setShowsToolTipOverTruncatedText(bool showsToolTipForTruncatedText)
713 m_showsToolTipOverTruncatedText = showsToolTipForTruncatedText;
716 void Settings::setFTPDirectoryTemplatePath(const String& path)
718 m_ftpDirectoryTemplatePath = path;
721 void Settings::setForceFTPDirectoryListings(bool force)
723 m_forceFTPDirectoryListings = force;
726 void Settings::setDeveloperExtrasEnabled(bool developerExtrasEnabled)
728 m_developerExtrasEnabled = developerExtrasEnabled;
731 void Settings::setJavaScriptExperimentsEnabled(bool javaScriptExperimentsEnabled)
733 m_javaScriptExperimentsEnabled = javaScriptExperimentsEnabled;
736 void Settings::setAuthorAndUserStylesEnabled(bool authorAndUserStylesEnabled)
738 if (m_authorAndUserStylesEnabled == authorAndUserStylesEnabled)
741 m_authorAndUserStylesEnabled = authorAndUserStylesEnabled;
742 m_page->setNeedsRecalcStyleInAllFrames();
745 void Settings::setFontRenderingMode(FontRenderingMode mode)
747 if (fontRenderingMode() == mode)
749 m_fontRenderingMode = mode;
750 m_page->setNeedsRecalcStyleInAllFrames();
753 FontRenderingMode Settings::fontRenderingMode() const
755 return static_cast<FontRenderingMode>(m_fontRenderingMode);
758 void Settings::setNeedsSiteSpecificQuirks(bool needsQuirks)
760 m_needsSiteSpecificQuirks = needsQuirks;
763 void Settings::setFrameFlatteningEnabled(bool frameFlatteningEnabled)
765 m_frameFlatteningEnabled = frameFlatteningEnabled;
768 #if ENABLE(WEB_ARCHIVE)
769 void Settings::setWebArchiveDebugModeEnabled(bool enabled)
771 m_webArchiveDebugModeEnabled = enabled;
775 void Settings::setLocalFileContentSniffingEnabled(bool enabled)
777 m_localFileContentSniffingEnabled = enabled;
780 void Settings::setLocalStorageDatabasePath(const String& path)
782 m_localStorageDatabasePath = path;
785 void Settings::setApplicationChromeMode(bool mode)
787 m_inApplicationChromeMode = mode;
790 void Settings::setOfflineWebApplicationCacheEnabled(bool enabled)
792 m_offlineWebApplicationCacheEnabled = enabled;
795 void Settings::setEnforceCSSMIMETypeInNoQuirksMode(bool enforceCSSMIMETypeInNoQuirksMode)
797 m_enforceCSSMIMETypeInNoQuirksMode = enforceCSSMIMETypeInNoQuirksMode;
800 #if USE(SAFARI_THEME)
801 void Settings::setShouldPaintNativeControls(bool shouldPaintNativeControls)
803 gShouldPaintNativeControls = shouldPaintNativeControls;
807 void Settings::setUsesEncodingDetector(bool usesEncodingDetector)
809 m_usesEncodingDetector = usesEncodingDetector;
812 void Settings::setDNSPrefetchingEnabled(bool dnsPrefetchingEnabled)
814 if (m_dnsPrefetchingEnabled == dnsPrefetchingEnabled)
817 m_dnsPrefetchingEnabled = dnsPrefetchingEnabled;
818 m_page->dnsPrefetchingStateChanged();
821 void Settings::setAllowScriptsToCloseWindows(bool allowScriptsToCloseWindows)
823 m_allowScriptsToCloseWindows = allowScriptsToCloseWindows;
826 void Settings::setCaretBrowsingEnabled(bool caretBrowsingEnabled)
828 m_caretBrowsingEnabled = caretBrowsingEnabled;
831 void Settings::setDownloadableBinaryFontsEnabled(bool downloadableBinaryFontsEnabled)
833 m_downloadableBinaryFontsEnabled = downloadableBinaryFontsEnabled;
836 void Settings::setXSSAuditorEnabled(bool xssAuditorEnabled)
838 m_xssAuditorEnabled = xssAuditorEnabled;
841 void Settings::setAcceleratedCompositingEnabled(bool enabled)
843 if (m_acceleratedCompositingEnabled == enabled)
846 m_acceleratedCompositingEnabled = enabled;
847 m_page->setNeedsRecalcStyleInAllFrames();
850 void Settings::setCanvasUsesAcceleratedDrawing(bool enabled)
852 m_canvasUsesAcceleratedDrawing = enabled;
855 void Settings::setAcceleratedCompositingFor3DTransformsEnabled(bool enabled)
857 m_acceleratedCompositingFor3DTransformsEnabled = enabled;
860 void Settings::setAcceleratedCompositingForVideoEnabled(bool enabled)
862 m_acceleratedCompositingForVideoEnabled = enabled;
865 void Settings::setAcceleratedCompositingForPluginsEnabled(bool enabled)
867 m_acceleratedCompositingForPluginsEnabled = enabled;
870 void Settings::setAcceleratedCompositingForCanvasEnabled(bool enabled)
872 m_acceleratedCompositingForCanvasEnabled = enabled;
875 void Settings::setAcceleratedCompositingForAnimationEnabled(bool enabled)
877 m_acceleratedCompositingForAnimationEnabled = enabled;
880 void Settings::setShowDebugBorders(bool enabled)
882 if (m_showDebugBorders == enabled)
885 m_showDebugBorders = enabled;
886 m_page->setNeedsRecalcStyleInAllFrames();
889 void Settings::setShowRepaintCounter(bool enabled)
891 if (m_showRepaintCounter == enabled)
894 m_showRepaintCounter = enabled;
895 m_page->setNeedsRecalcStyleInAllFrames();
898 void Settings::setExperimentalNotificationsEnabled(bool enabled)
900 m_experimentalNotificationsEnabled = enabled;
903 #if PLATFORM(WIN) || (OS(WINDOWS) && PLATFORM(WX))
904 void Settings::setShouldUseHighResolutionTimers(bool shouldUseHighResolutionTimers)
906 gShouldUseHighResolutionTimers = shouldUseHighResolutionTimers;
910 void Settings::setWebAudioEnabled(bool enabled)
912 m_webAudioEnabled = enabled;
915 void Settings::setWebGLEnabled(bool enabled)
917 m_webGLEnabled = enabled;
920 void Settings::setWebGLErrorsToConsoleEnabled(bool enabled)
922 m_webGLErrorsToConsoleEnabled = enabled;
925 void Settings::setOpenGLMultisamplingEnabled(bool enabled)
927 m_openGLMultisamplingEnabled = enabled;
930 void Settings::setPrivilegedWebGLExtensionsEnabled(bool enabled)
932 m_privilegedWebGLExtensionsEnabled = enabled;
935 void Settings::setAccelerated2dCanvasEnabled(bool enabled)
937 m_acceleratedCanvas2dEnabled = enabled;
940 void Settings::setDeferred2dCanvasEnabled(bool enabled)
942 m_deferredCanvas2dEnabled = enabled;
945 void Settings::setMinimumAccelerated2dCanvasSize(int numPixels)
947 m_minimumAccelerated2dCanvasSize = numPixels;
950 void Settings::setLoadDeferringEnabled(bool enabled)
952 m_loadDeferringEnabled = enabled;
955 void Settings::setTiledBackingStoreEnabled(bool enabled)
957 m_tiledBackingStoreEnabled = enabled;
958 #if USE(TILED_BACKING_STORE)
959 if (m_page->mainFrame())
960 m_page->mainFrame()->setTiledBackingStoreEnabled(enabled);
964 void Settings::setMockScrollbarsEnabled(bool flag)
966 gMockScrollbarsEnabled = flag;
969 bool Settings::mockScrollbarsEnabled()
971 return gMockScrollbarsEnabled;
974 #if ENABLE(TIZEN_LOAD_REMOTE_IMAGES)
975 void Settings::setLoadRemoteImages(bool loadRemoteImages)
977 m_loadRemoteImages = loadRemoteImages;
979 m_loadRemoteImagesTimer.startOneShot(0);
982 void Settings::loadRemoteImagesTimerFired(Timer<Settings>*)
984 setLoadsRemoteImagesInAllFrames(m_page);
989 void Settings::setShouldRespectPriorityInCSSAttributeSetters(bool flag)
991 gShouldRespectPriorityInCSSAttributeSetters = flag;
994 bool Settings::shouldRespectPriorityInCSSAttributeSetters()
996 return gShouldRespectPriorityInCSSAttributeSetters;
1000 } // namespace WebCore