1 /*
2 * Copyright (C) 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved.
3 *
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
6 * are met:
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.
12 *
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.
24 */
25
26 #include "config.h"
27 #include "Settings.h"
28
29 #include "BackForwardController.h"
30 #include "CachedResourceLoader.h"
31 #include "CookieStorage.h"
32 #include "DOMTimer.h"
33 #include "Database.h"
34 #include "Document.h"
35 #include "Frame.h"
36 #include "FrameTree.h"
37 #include "FrameView.h"
38 #include "HistoryItem.h"
39 #include "Page.h"
40 #include "PageCache.h"
41 #include "ResourceHandle.h"
42 #include "StorageMap.h"
43 #include <limits>
44
45 using namespace std;
46
47 namespace WebCore {
48
setLoadsImagesAutomaticallyInAllFrames(Page * page)49 static void setLoadsImagesAutomaticallyInAllFrames(Page* page)
50 {
51 for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
52 frame->document()->cachedResourceLoader()->setAutoLoadImages(page->settings()->loadsImagesAutomatically());
53 }
54
55 #if USE(SAFARI_THEME)
56 bool Settings::gShouldPaintNativeControls = true;
57 #endif
58
59 #if USE(AVFOUNDATION)
60 bool Settings::gAVFoundationEnabled(false);
61 #endif
62
63 #if PLATFORM(WIN) || (OS(WINDOWS) && PLATFORM(WX))
64 bool Settings::gShouldUseHighResolutionTimers = true;
65 #endif
66
67 // NOTEs
68 // 1) EditingMacBehavior comprises Tiger, Leopard, SnowLeopard and iOS builds, as well QtWebKit and Chromium when built on Mac;
69 // 2) EditingWindowsBehavior comprises Win32 and WinCE builds, as well as QtWebKit and Chromium when built on Windows;
70 // 3) EditingUnixBehavior comprises all unix-based systems, but Darwin/MacOS (and then abusing the terminology);
71 // 99) MacEditingBehavior is used a fallback.
editingBehaviorTypeForPlatform()72 static EditingBehaviorType editingBehaviorTypeForPlatform()
73 {
74 return
75 #if OS(DARWIN)
76 EditingMacBehavior
77 #elif OS(WINDOWS)
78 EditingWindowsBehavior
79 #elif OS(UNIX)
80 EditingUnixBehavior
81 #else
82 // Fallback
83 EditingMacBehavior
84 #endif
85 ;
86 }
87
Settings(Page * page)88 Settings::Settings(Page* page)
89 : m_page(page)
90 , m_printingMediaType("print")
91 , m_editableLinkBehavior(EditableLinkDefaultBehavior)
92 , m_textDirectionSubmenuInclusionBehavior(TextDirectionSubmenuAutomaticallyIncluded)
93 , m_passwordEchoDurationInSeconds(1)
94 , m_minimumFontSize(0)
95 , m_minimumLogicalFontSize(0)
96 , m_defaultFontSize(0)
97 , m_defaultFixedFontSize(0)
98 , m_validationMessageTimerMagnification(50)
99 , m_maximumDecodedImageSize(numeric_limits<size_t>::max())
100 #if ENABLE(DOM_STORAGE)
101 , m_sessionStorageQuota(StorageMap::noQuota)
102 #endif
103 , m_pluginAllowedRunTime(numeric_limits<unsigned>::max())
104 , m_editingBehaviorType(editingBehaviorTypeForPlatform())
105 , m_isSpatialNavigationEnabled(false)
106 , m_isJavaEnabled(false)
107 , m_loadsImagesAutomatically(false)
108 , m_loadsSiteIconsIgnoringImageLoadingSetting(false)
109 , m_privateBrowsingEnabled(false)
110 , m_caretBrowsingEnabled(false)
111 , m_areImagesEnabled(true)
112 , m_isMediaEnabled(true)
113 , m_arePluginsEnabled(false)
114 , m_localStorageEnabled(false)
115 , m_isJavaScriptEnabled(false)
116 , m_isWebSecurityEnabled(true)
117 , m_allowUniversalAccessFromFileURLs(true)
118 , m_allowFileAccessFromFileURLs(true)
119 , m_javaScriptCanOpenWindowsAutomatically(false)
120 , m_javaScriptCanAccessClipboard(false)
121 , m_shouldPrintBackgrounds(false)
122 , m_textAreasAreResizable(false)
123 #if ENABLE(DASHBOARD_SUPPORT)
124 , m_usesDashboardBackwardCompatibilityMode(false)
125 #endif
126 , m_needsAdobeFrameReloadingQuirk(false)
127 , m_needsKeyboardEventDisambiguationQuirks(false)
128 , m_treatsAnyTextCSSLinkAsStylesheet(false)
129 , m_needsLeopardMailQuirks(false)
130 , m_needsTigerMailQuirks(false)
131 , m_isDOMPasteAllowed(false)
132 , m_shrinksStandaloneImagesToFit(true)
133 , m_usesPageCache(false)
134 , m_showsURLsInToolTips(false)
135 , m_forceFTPDirectoryListings(false)
136 , m_developerExtrasEnabled(false)
137 , m_authorAndUserStylesEnabled(true)
138 , m_needsSiteSpecificQuirks(false)
139 , m_fontRenderingMode(0)
140 , m_frameFlatteningEnabled(false)
141 , m_webArchiveDebugModeEnabled(false)
142 , m_localFileContentSniffingEnabled(false)
143 , m_inApplicationChromeMode(false)
144 , m_offlineWebApplicationCacheEnabled(false)
145 , m_shouldPaintCustomScrollbars(false)
146 , m_enforceCSSMIMETypeInNoQuirksMode(true)
147 , m_usesEncodingDetector(false)
148 , m_allowScriptsToCloseWindows(false)
149 , m_canvasUsesAcceleratedDrawing(false)
150 , m_acceleratedDrawingEnabled(false)
151 // FIXME: This should really be disabled by default as it makes platforms that don't support the feature download files
152 // they can't use by. Leaving enabled for now to not change existing behavior.
153 , m_downloadableBinaryFontsEnabled(true)
154 , m_xssAuditorEnabled(false)
155 , m_acceleratedCompositingEnabled(true)
156 , m_acceleratedCompositingFor3DTransformsEnabled(true)
157 , m_acceleratedCompositingForVideoEnabled(true)
158 , m_acceleratedCompositingForPluginsEnabled(true)
159 , m_acceleratedCompositingForCanvasEnabled(true)
160 , m_acceleratedCompositingForAnimationEnabled(true)
161 , m_showDebugBorders(false)
162 , m_showRepaintCounter(false)
163 , m_experimentalNotificationsEnabled(false)
164 , m_webGLEnabled(false)
165 , m_openGLMultisamplingEnabled(true)
166 , m_webAudioEnabled(false)
167 , m_acceleratedCanvas2dEnabled(false)
168 , m_legacyAcceleratedCanvas2dEnabled(false)
169 , m_loadDeferringEnabled(true)
170 , m_tiledBackingStoreEnabled(false)
171 , m_paginateDuringLayoutEnabled(false)
172 , m_dnsPrefetchingEnabled(false)
173 #if ENABLE(FULLSCREEN_API)
174 , m_fullScreenAPIEnabled(false)
175 #endif
176 , m_asynchronousSpellCheckingEnabled(false)
177 , m_memoryInfoEnabled(false)
178 , m_interactiveFormValidation(false)
179 , m_usePreHTML5ParserQuirks(false)
180 , m_hyperlinkAuditingEnabled(false)
181 , m_crossOriginCheckInGetMatchedCSSRulesDisabled(false)
182 , m_useQuickLookResourceCachingQuirks(false)
183 , m_forceCompositingMode(false)
184 , m_shouldInjectUserScriptsInInitialEmptyDocument(false)
185 , m_allowDisplayOfInsecureContent(true)
186 , m_allowRunningOfInsecureContent(true)
187 , m_passwordEchoEnabled(false)
188 , m_printingMinimumShrinkFactor(0.0)
189 , m_printingMaximumShrinkFactor(0.0)
190 {
191 // A Frame may not have been created yet, so we initialize the AtomicString
192 // hash before trying to use it.
193 AtomicString::init();
194 }
195
setStandardFontFamily(const AtomicString & standardFontFamily)196 void Settings::setStandardFontFamily(const AtomicString& standardFontFamily)
197 {
198 if (standardFontFamily == m_standardFontFamily)
199 return;
200
201 m_standardFontFamily = standardFontFamily;
202 m_page->setNeedsRecalcStyleInAllFrames();
203 }
204
setFixedFontFamily(const AtomicString & fixedFontFamily)205 void Settings::setFixedFontFamily(const AtomicString& fixedFontFamily)
206 {
207 if (m_fixedFontFamily == fixedFontFamily)
208 return;
209
210 m_fixedFontFamily = fixedFontFamily;
211 m_page->setNeedsRecalcStyleInAllFrames();
212 }
213
setSerifFontFamily(const AtomicString & serifFontFamily)214 void Settings::setSerifFontFamily(const AtomicString& serifFontFamily)
215 {
216 if (m_serifFontFamily == serifFontFamily)
217 return;
218
219 m_serifFontFamily = serifFontFamily;
220 m_page->setNeedsRecalcStyleInAllFrames();
221 }
222
setSansSerifFontFamily(const AtomicString & sansSerifFontFamily)223 void Settings::setSansSerifFontFamily(const AtomicString& sansSerifFontFamily)
224 {
225 if (m_sansSerifFontFamily == sansSerifFontFamily)
226 return;
227
228 m_sansSerifFontFamily = sansSerifFontFamily;
229 m_page->setNeedsRecalcStyleInAllFrames();
230 }
231
setCursiveFontFamily(const AtomicString & cursiveFontFamily)232 void Settings::setCursiveFontFamily(const AtomicString& cursiveFontFamily)
233 {
234 if (m_cursiveFontFamily == cursiveFontFamily)
235 return;
236
237 m_cursiveFontFamily = cursiveFontFamily;
238 m_page->setNeedsRecalcStyleInAllFrames();
239 }
240
setFantasyFontFamily(const AtomicString & fantasyFontFamily)241 void Settings::setFantasyFontFamily(const AtomicString& fantasyFontFamily)
242 {
243 if (m_fantasyFontFamily == fantasyFontFamily)
244 return;
245
246 m_fantasyFontFamily = fantasyFontFamily;
247 m_page->setNeedsRecalcStyleInAllFrames();
248 }
249
setMinimumFontSize(int minimumFontSize)250 void Settings::setMinimumFontSize(int minimumFontSize)
251 {
252 if (m_minimumFontSize == minimumFontSize)
253 return;
254
255 m_minimumFontSize = minimumFontSize;
256 m_page->setNeedsRecalcStyleInAllFrames();
257 }
258
setMinimumLogicalFontSize(int minimumLogicalFontSize)259 void Settings::setMinimumLogicalFontSize(int minimumLogicalFontSize)
260 {
261 if (m_minimumLogicalFontSize == minimumLogicalFontSize)
262 return;
263
264 m_minimumLogicalFontSize = minimumLogicalFontSize;
265 m_page->setNeedsRecalcStyleInAllFrames();
266 }
267
setDefaultFontSize(int defaultFontSize)268 void Settings::setDefaultFontSize(int defaultFontSize)
269 {
270 if (m_defaultFontSize == defaultFontSize)
271 return;
272
273 m_defaultFontSize = defaultFontSize;
274 m_page->setNeedsRecalcStyleInAllFrames();
275 }
276
setDefaultFixedFontSize(int defaultFontSize)277 void Settings::setDefaultFixedFontSize(int defaultFontSize)
278 {
279 if (m_defaultFixedFontSize == defaultFontSize)
280 return;
281
282 m_defaultFixedFontSize = defaultFontSize;
283 m_page->setNeedsRecalcStyleInAllFrames();
284 }
285
setLoadsImagesAutomatically(bool loadsImagesAutomatically)286 void Settings::setLoadsImagesAutomatically(bool loadsImagesAutomatically)
287 {
288 m_loadsImagesAutomatically = loadsImagesAutomatically;
289 setLoadsImagesAutomaticallyInAllFrames(m_page);
290 }
291
setLoadsSiteIconsIgnoringImageLoadingSetting(bool loadsSiteIcons)292 void Settings::setLoadsSiteIconsIgnoringImageLoadingSetting(bool loadsSiteIcons)
293 {
294 m_loadsSiteIconsIgnoringImageLoadingSetting = loadsSiteIcons;
295 }
296
setJavaScriptEnabled(bool isJavaScriptEnabled)297 void Settings::setJavaScriptEnabled(bool isJavaScriptEnabled)
298 {
299 m_isJavaScriptEnabled = isJavaScriptEnabled;
300 }
301
setWebSecurityEnabled(bool isWebSecurityEnabled)302 void Settings::setWebSecurityEnabled(bool isWebSecurityEnabled)
303 {
304 m_isWebSecurityEnabled = isWebSecurityEnabled;
305 }
306
setAllowUniversalAccessFromFileURLs(bool allowUniversalAccessFromFileURLs)307 void Settings::setAllowUniversalAccessFromFileURLs(bool allowUniversalAccessFromFileURLs)
308 {
309 m_allowUniversalAccessFromFileURLs = allowUniversalAccessFromFileURLs;
310 }
311
setAllowFileAccessFromFileURLs(bool allowFileAccessFromFileURLs)312 void Settings::setAllowFileAccessFromFileURLs(bool allowFileAccessFromFileURLs)
313 {
314 m_allowFileAccessFromFileURLs = allowFileAccessFromFileURLs;
315 }
316
setSpatialNavigationEnabled(bool isSpatialNavigationEnabled)317 void Settings::setSpatialNavigationEnabled(bool isSpatialNavigationEnabled)
318 {
319 m_isSpatialNavigationEnabled = isSpatialNavigationEnabled;
320 }
321
setJavaEnabled(bool isJavaEnabled)322 void Settings::setJavaEnabled(bool isJavaEnabled)
323 {
324 m_isJavaEnabled = isJavaEnabled;
325 }
326
setImagesEnabled(bool areImagesEnabled)327 void Settings::setImagesEnabled(bool areImagesEnabled)
328 {
329 m_areImagesEnabled = areImagesEnabled;
330 }
331
setMediaEnabled(bool isMediaEnabled)332 void Settings::setMediaEnabled(bool isMediaEnabled)
333 {
334 m_isMediaEnabled = isMediaEnabled;
335 }
336
setPluginsEnabled(bool arePluginsEnabled)337 void Settings::setPluginsEnabled(bool arePluginsEnabled)
338 {
339 m_arePluginsEnabled = arePluginsEnabled;
340 }
341
setLocalStorageEnabled(bool localStorageEnabled)342 void Settings::setLocalStorageEnabled(bool localStorageEnabled)
343 {
344 m_localStorageEnabled = localStorageEnabled;
345 }
346
347 #if ENABLE(DOM_STORAGE)
setSessionStorageQuota(unsigned sessionStorageQuota)348 void Settings::setSessionStorageQuota(unsigned sessionStorageQuota)
349 {
350 m_sessionStorageQuota = sessionStorageQuota;
351 }
352 #endif
353
setPrivateBrowsingEnabled(bool privateBrowsingEnabled)354 void Settings::setPrivateBrowsingEnabled(bool privateBrowsingEnabled)
355 {
356 if (m_privateBrowsingEnabled == privateBrowsingEnabled)
357 return;
358
359 #if USE(CFURLSTORAGESESSIONS)
360 ResourceHandle::setPrivateBrowsingEnabled(privateBrowsingEnabled);
361 #endif
362
363 // FIXME: We can only enable cookie private browsing mode globally, so it's misleading to have it as a per-page setting.
364 setCookieStoragePrivateBrowsingEnabled(privateBrowsingEnabled);
365
366 m_privateBrowsingEnabled = privateBrowsingEnabled;
367 m_page->privateBrowsingStateChanged();
368 }
369
setJavaScriptCanOpenWindowsAutomatically(bool javaScriptCanOpenWindowsAutomatically)370 void Settings::setJavaScriptCanOpenWindowsAutomatically(bool javaScriptCanOpenWindowsAutomatically)
371 {
372 m_javaScriptCanOpenWindowsAutomatically = javaScriptCanOpenWindowsAutomatically;
373 }
374
setJavaScriptCanAccessClipboard(bool javaScriptCanAccessClipboard)375 void Settings::setJavaScriptCanAccessClipboard(bool javaScriptCanAccessClipboard)
376 {
377 m_javaScriptCanAccessClipboard = javaScriptCanAccessClipboard;
378 }
379
setDefaultTextEncodingName(const String & defaultTextEncodingName)380 void Settings::setDefaultTextEncodingName(const String& defaultTextEncodingName)
381 {
382 m_defaultTextEncodingName = defaultTextEncodingName;
383 }
384
setUserStyleSheetLocation(const KURL & userStyleSheetLocation)385 void Settings::setUserStyleSheetLocation(const KURL& userStyleSheetLocation)
386 {
387 if (m_userStyleSheetLocation == userStyleSheetLocation)
388 return;
389
390 m_userStyleSheetLocation = userStyleSheetLocation;
391
392 m_page->userStyleSheetLocationChanged();
393 }
394
setShouldPrintBackgrounds(bool shouldPrintBackgrounds)395 void Settings::setShouldPrintBackgrounds(bool shouldPrintBackgrounds)
396 {
397 m_shouldPrintBackgrounds = shouldPrintBackgrounds;
398 }
399
setTextAreasAreResizable(bool textAreasAreResizable)400 void Settings::setTextAreasAreResizable(bool textAreasAreResizable)
401 {
402 if (m_textAreasAreResizable == textAreasAreResizable)
403 return;
404
405 m_textAreasAreResizable = textAreasAreResizable;
406 m_page->setNeedsRecalcStyleInAllFrames();
407 }
408
setEditableLinkBehavior(EditableLinkBehavior editableLinkBehavior)409 void Settings::setEditableLinkBehavior(EditableLinkBehavior editableLinkBehavior)
410 {
411 m_editableLinkBehavior = editableLinkBehavior;
412 }
413
setTextDirectionSubmenuInclusionBehavior(TextDirectionSubmenuInclusionBehavior behavior)414 void Settings::setTextDirectionSubmenuInclusionBehavior(TextDirectionSubmenuInclusionBehavior behavior)
415 {
416 m_textDirectionSubmenuInclusionBehavior = behavior;
417 }
418
419 #if ENABLE(DASHBOARD_SUPPORT)
setUsesDashboardBackwardCompatibilityMode(bool usesDashboardBackwardCompatibilityMode)420 void Settings::setUsesDashboardBackwardCompatibilityMode(bool usesDashboardBackwardCompatibilityMode)
421 {
422 m_usesDashboardBackwardCompatibilityMode = usesDashboardBackwardCompatibilityMode;
423 }
424 #endif
425
426 // FIXME: This quirk is needed because of Radar 4674537 and 5211271. We need to phase it out once Adobe
427 // can fix the bug from their end.
setNeedsAdobeFrameReloadingQuirk(bool shouldNotReloadIFramesForUnchangedSRC)428 void Settings::setNeedsAdobeFrameReloadingQuirk(bool shouldNotReloadIFramesForUnchangedSRC)
429 {
430 m_needsAdobeFrameReloadingQuirk = shouldNotReloadIFramesForUnchangedSRC;
431 }
432
433 // This is a quirk we are pro-actively applying to old applications. It changes keyboard event dispatching,
434 // making keyIdentifier available on keypress events, making charCode available on keydown/keyup events,
435 // and getting keypress dispatched in more cases.
setNeedsKeyboardEventDisambiguationQuirks(bool needsQuirks)436 void Settings::setNeedsKeyboardEventDisambiguationQuirks(bool needsQuirks)
437 {
438 m_needsKeyboardEventDisambiguationQuirks = needsQuirks;
439 }
440
setTreatsAnyTextCSSLinkAsStylesheet(bool treatsAnyTextCSSLinkAsStylesheet)441 void Settings::setTreatsAnyTextCSSLinkAsStylesheet(bool treatsAnyTextCSSLinkAsStylesheet)
442 {
443 m_treatsAnyTextCSSLinkAsStylesheet = treatsAnyTextCSSLinkAsStylesheet;
444 }
445
setNeedsLeopardMailQuirks(bool needsQuirks)446 void Settings::setNeedsLeopardMailQuirks(bool needsQuirks)
447 {
448 m_needsLeopardMailQuirks = needsQuirks;
449 }
450
setNeedsTigerMailQuirks(bool needsQuirks)451 void Settings::setNeedsTigerMailQuirks(bool needsQuirks)
452 {
453 m_needsTigerMailQuirks = needsQuirks;
454 }
455
setDOMPasteAllowed(bool DOMPasteAllowed)456 void Settings::setDOMPasteAllowed(bool DOMPasteAllowed)
457 {
458 m_isDOMPasteAllowed = DOMPasteAllowed;
459 }
460
setDefaultMinDOMTimerInterval(double interval)461 void Settings::setDefaultMinDOMTimerInterval(double interval)
462 {
463 DOMTimer::setDefaultMinTimerInterval(interval);
464 }
465
defaultMinDOMTimerInterval()466 double Settings::defaultMinDOMTimerInterval()
467 {
468 return DOMTimer::defaultMinTimerInterval();
469 }
470
setMinDOMTimerInterval(double interval)471 void Settings::setMinDOMTimerInterval(double interval)
472 {
473 m_page->setMinimumTimerInterval(interval);
474 }
475
minDOMTimerInterval()476 double Settings::minDOMTimerInterval()
477 {
478 return m_page->minimumTimerInterval();
479 }
480
setUsesPageCache(bool usesPageCache)481 void Settings::setUsesPageCache(bool usesPageCache)
482 {
483 if (m_usesPageCache == usesPageCache)
484 return;
485
486 m_usesPageCache = usesPageCache;
487 if (!m_usesPageCache) {
488 int first = -m_page->backForward()->backCount();
489 int last = m_page->backForward()->forwardCount();
490 for (int i = first; i <= last; i++)
491 pageCache()->remove(m_page->backForward()->itemAtIndex(i));
492 pageCache()->releaseAutoreleasedPagesNow();
493 }
494 }
495
setShrinksStandaloneImagesToFit(bool shrinksStandaloneImagesToFit)496 void Settings::setShrinksStandaloneImagesToFit(bool shrinksStandaloneImagesToFit)
497 {
498 m_shrinksStandaloneImagesToFit = shrinksStandaloneImagesToFit;
499 }
500
setShowsURLsInToolTips(bool showsURLsInToolTips)501 void Settings::setShowsURLsInToolTips(bool showsURLsInToolTips)
502 {
503 m_showsURLsInToolTips = showsURLsInToolTips;
504 }
505
setFTPDirectoryTemplatePath(const String & path)506 void Settings::setFTPDirectoryTemplatePath(const String& path)
507 {
508 m_ftpDirectoryTemplatePath = path;
509 }
510
setForceFTPDirectoryListings(bool force)511 void Settings::setForceFTPDirectoryListings(bool force)
512 {
513 m_forceFTPDirectoryListings = force;
514 }
515
setDeveloperExtrasEnabled(bool developerExtrasEnabled)516 void Settings::setDeveloperExtrasEnabled(bool developerExtrasEnabled)
517 {
518 m_developerExtrasEnabled = developerExtrasEnabled;
519 }
520
setAuthorAndUserStylesEnabled(bool authorAndUserStylesEnabled)521 void Settings::setAuthorAndUserStylesEnabled(bool authorAndUserStylesEnabled)
522 {
523 if (m_authorAndUserStylesEnabled == authorAndUserStylesEnabled)
524 return;
525
526 m_authorAndUserStylesEnabled = authorAndUserStylesEnabled;
527 m_page->setNeedsRecalcStyleInAllFrames();
528 }
529
setFontRenderingMode(FontRenderingMode mode)530 void Settings::setFontRenderingMode(FontRenderingMode mode)
531 {
532 if (fontRenderingMode() == mode)
533 return;
534 m_fontRenderingMode = mode;
535 m_page->setNeedsRecalcStyleInAllFrames();
536 }
537
fontRenderingMode() const538 FontRenderingMode Settings::fontRenderingMode() const
539 {
540 return static_cast<FontRenderingMode>(m_fontRenderingMode);
541 }
542
setNeedsSiteSpecificQuirks(bool needsQuirks)543 void Settings::setNeedsSiteSpecificQuirks(bool needsQuirks)
544 {
545 m_needsSiteSpecificQuirks = needsQuirks;
546 }
547
setFrameFlatteningEnabled(bool frameFlatteningEnabled)548 void Settings::setFrameFlatteningEnabled(bool frameFlatteningEnabled)
549 {
550 m_frameFlatteningEnabled = frameFlatteningEnabled;
551 }
552
553 #if ENABLE(WEB_ARCHIVE)
setWebArchiveDebugModeEnabled(bool enabled)554 void Settings::setWebArchiveDebugModeEnabled(bool enabled)
555 {
556 m_webArchiveDebugModeEnabled = enabled;
557 }
558 #endif
559
setLocalFileContentSniffingEnabled(bool enabled)560 void Settings::setLocalFileContentSniffingEnabled(bool enabled)
561 {
562 m_localFileContentSniffingEnabled = enabled;
563 }
564
setLocalStorageDatabasePath(const String & path)565 void Settings::setLocalStorageDatabasePath(const String& path)
566 {
567 m_localStorageDatabasePath = path;
568 }
569
setApplicationChromeMode(bool mode)570 void Settings::setApplicationChromeMode(bool mode)
571 {
572 m_inApplicationChromeMode = mode;
573 }
574
setPrintingMediaType(const String & type)575 void Settings::setPrintingMediaType(const String& type)
576 {
577 m_printingMediaType = type;
578 }
579
setOfflineWebApplicationCacheEnabled(bool enabled)580 void Settings::setOfflineWebApplicationCacheEnabled(bool enabled)
581 {
582 m_offlineWebApplicationCacheEnabled = enabled;
583 }
584
setShouldPaintCustomScrollbars(bool shouldPaintCustomScrollbars)585 void Settings::setShouldPaintCustomScrollbars(bool shouldPaintCustomScrollbars)
586 {
587 m_shouldPaintCustomScrollbars = shouldPaintCustomScrollbars;
588 }
589
setEnforceCSSMIMETypeInNoQuirksMode(bool enforceCSSMIMETypeInNoQuirksMode)590 void Settings::setEnforceCSSMIMETypeInNoQuirksMode(bool enforceCSSMIMETypeInNoQuirksMode)
591 {
592 m_enforceCSSMIMETypeInNoQuirksMode = enforceCSSMIMETypeInNoQuirksMode;
593 }
594
595 #if USE(SAFARI_THEME)
setShouldPaintNativeControls(bool shouldPaintNativeControls)596 void Settings::setShouldPaintNativeControls(bool shouldPaintNativeControls)
597 {
598 gShouldPaintNativeControls = shouldPaintNativeControls;
599 }
600 #endif
601
setUsesEncodingDetector(bool usesEncodingDetector)602 void Settings::setUsesEncodingDetector(bool usesEncodingDetector)
603 {
604 m_usesEncodingDetector = usesEncodingDetector;
605 }
606
setDNSPrefetchingEnabled(bool dnsPrefetchingEnabled)607 void Settings::setDNSPrefetchingEnabled(bool dnsPrefetchingEnabled)
608 {
609 if (m_dnsPrefetchingEnabled == dnsPrefetchingEnabled)
610 return;
611
612 m_dnsPrefetchingEnabled = dnsPrefetchingEnabled;
613 m_page->dnsPrefetchingStateChanged();
614 }
615
setAllowScriptsToCloseWindows(bool allowScriptsToCloseWindows)616 void Settings::setAllowScriptsToCloseWindows(bool allowScriptsToCloseWindows)
617 {
618 m_allowScriptsToCloseWindows = allowScriptsToCloseWindows;
619 }
620
setCaretBrowsingEnabled(bool caretBrowsingEnabled)621 void Settings::setCaretBrowsingEnabled(bool caretBrowsingEnabled)
622 {
623 m_caretBrowsingEnabled = caretBrowsingEnabled;
624 }
625
setDownloadableBinaryFontsEnabled(bool downloadableBinaryFontsEnabled)626 void Settings::setDownloadableBinaryFontsEnabled(bool downloadableBinaryFontsEnabled)
627 {
628 m_downloadableBinaryFontsEnabled = downloadableBinaryFontsEnabled;
629 }
630
setXSSAuditorEnabled(bool xssAuditorEnabled)631 void Settings::setXSSAuditorEnabled(bool xssAuditorEnabled)
632 {
633 m_xssAuditorEnabled = xssAuditorEnabled;
634 }
635
setAcceleratedCompositingEnabled(bool enabled)636 void Settings::setAcceleratedCompositingEnabled(bool enabled)
637 {
638 if (m_acceleratedCompositingEnabled == enabled)
639 return;
640
641 m_acceleratedCompositingEnabled = enabled;
642 m_page->setNeedsRecalcStyleInAllFrames();
643 }
644
setCanvasUsesAcceleratedDrawing(bool enabled)645 void Settings::setCanvasUsesAcceleratedDrawing(bool enabled)
646 {
647 m_canvasUsesAcceleratedDrawing = enabled;
648 }
649
setAcceleratedDrawingEnabled(bool enabled)650 void Settings::setAcceleratedDrawingEnabled(bool enabled)
651 {
652 m_acceleratedDrawingEnabled = enabled;
653 }
654
setAcceleratedCompositingFor3DTransformsEnabled(bool enabled)655 void Settings::setAcceleratedCompositingFor3DTransformsEnabled(bool enabled)
656 {
657 m_acceleratedCompositingFor3DTransformsEnabled = enabled;
658 }
659
setAcceleratedCompositingForVideoEnabled(bool enabled)660 void Settings::setAcceleratedCompositingForVideoEnabled(bool enabled)
661 {
662 m_acceleratedCompositingForVideoEnabled = enabled;
663 }
664
setAcceleratedCompositingForPluginsEnabled(bool enabled)665 void Settings::setAcceleratedCompositingForPluginsEnabled(bool enabled)
666 {
667 m_acceleratedCompositingForPluginsEnabled = enabled;
668 }
669
setAcceleratedCompositingForCanvasEnabled(bool enabled)670 void Settings::setAcceleratedCompositingForCanvasEnabled(bool enabled)
671 {
672 m_acceleratedCompositingForCanvasEnabled = enabled;
673 }
674
setAcceleratedCompositingForAnimationEnabled(bool enabled)675 void Settings::setAcceleratedCompositingForAnimationEnabled(bool enabled)
676 {
677 m_acceleratedCompositingForAnimationEnabled = enabled;
678 }
679
setShowDebugBorders(bool enabled)680 void Settings::setShowDebugBorders(bool enabled)
681 {
682 if (m_showDebugBorders == enabled)
683 return;
684
685 m_showDebugBorders = enabled;
686 m_page->setNeedsRecalcStyleInAllFrames();
687 }
688
setShowRepaintCounter(bool enabled)689 void Settings::setShowRepaintCounter(bool enabled)
690 {
691 if (m_showRepaintCounter == enabled)
692 return;
693
694 m_showRepaintCounter = enabled;
695 m_page->setNeedsRecalcStyleInAllFrames();
696 }
697
setExperimentalNotificationsEnabled(bool enabled)698 void Settings::setExperimentalNotificationsEnabled(bool enabled)
699 {
700 m_experimentalNotificationsEnabled = enabled;
701 }
702
setPluginAllowedRunTime(unsigned runTime)703 void Settings::setPluginAllowedRunTime(unsigned runTime)
704 {
705 m_pluginAllowedRunTime = runTime;
706 m_page->pluginAllowedRunTimeChanged();
707 }
708
709 #if PLATFORM(WIN) || (OS(WINDOWS) && PLATFORM(WX))
setShouldUseHighResolutionTimers(bool shouldUseHighResolutionTimers)710 void Settings::setShouldUseHighResolutionTimers(bool shouldUseHighResolutionTimers)
711 {
712 gShouldUseHighResolutionTimers = shouldUseHighResolutionTimers;
713 }
714 #endif
715
setWebAudioEnabled(bool enabled)716 void Settings::setWebAudioEnabled(bool enabled)
717 {
718 m_webAudioEnabled = enabled;
719 }
720
setWebGLEnabled(bool enabled)721 void Settings::setWebGLEnabled(bool enabled)
722 {
723 m_webGLEnabled = enabled;
724 }
725
setOpenGLMultisamplingEnabled(bool enabled)726 void Settings::setOpenGLMultisamplingEnabled(bool enabled)
727 {
728 m_openGLMultisamplingEnabled = enabled;
729 }
730
setAccelerated2dCanvasEnabled(bool enabled)731 void Settings::setAccelerated2dCanvasEnabled(bool enabled)
732 {
733 m_acceleratedCanvas2dEnabled = enabled;
734 }
735
setLegacyAccelerated2dCanvasEnabled(bool enabled)736 void Settings::setLegacyAccelerated2dCanvasEnabled(bool enabled)
737 {
738 m_legacyAcceleratedCanvas2dEnabled = enabled;
739 }
740
setLoadDeferringEnabled(bool enabled)741 void Settings::setLoadDeferringEnabled(bool enabled)
742 {
743 m_loadDeferringEnabled = enabled;
744 }
745
setTiledBackingStoreEnabled(bool enabled)746 void Settings::setTiledBackingStoreEnabled(bool enabled)
747 {
748 m_tiledBackingStoreEnabled = enabled;
749 #if ENABLE(TILED_BACKING_STORE)
750 if (m_page->mainFrame())
751 m_page->mainFrame()->setTiledBackingStoreEnabled(enabled);
752 #endif
753 }
754
setPrintingMinimumShrinkFactor(float printingMinimumShrinkFactor)755 void Settings::setPrintingMinimumShrinkFactor(float printingMinimumShrinkFactor)
756 {
757 m_printingMinimumShrinkFactor = printingMinimumShrinkFactor;
758 }
759
setPrintingMaximumShrinkFactor(float printingMaximumShrinkFactor)760 void Settings::setPrintingMaximumShrinkFactor(float printingMaximumShrinkFactor)
761 {
762 m_printingMaximumShrinkFactor = printingMaximumShrinkFactor;
763 }
764
765
766 } // namespace WebCore
767