OSDN Git Service

883875b8f4070d5fa4c19699974dcc9956fe5f70
[android-x86/external-webkit.git] / WebCore / page / Settings.cpp
1 /*
2  * Copyright (C) 2006, 2007, 2008, 2009 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 "BackForwardList.h"
30 #include "Database.h"
31 #include "Frame.h"
32 #include "FrameTree.h"
33 #include "FrameView.h"
34 #include "HistoryItem.h"
35 #include "Page.h"
36 #include "PageCache.h"
37 #include "StorageMap.h"
38 #include <limits>
39
40 using namespace std;
41
42 namespace WebCore {
43
44 static void setNeedsReapplyStylesInAllFrames(Page* page)
45 {
46     for (Frame* frame = page->mainFrame(); frame; frame = frame->tree()->traverseNext())
47         frame->setNeedsReapplyStyles();
48 }
49
50 #if USE(SAFARI_THEME)
51 bool Settings::gShouldPaintNativeControls = true;
52 #endif
53
54 #if PLATFORM(WIN) || (OS(WINDOWS) && PLATFORM(WX))
55 bool Settings::gShouldUseHighResolutionTimers = true;
56 #endif
57
58 Settings::Settings(Page* page)
59     : m_page(page)
60 #ifdef ANDROID_LAYOUT
61     , m_layoutAlgorithm(kLayoutFitColumnToScreen)
62 #endif
63     , m_editableLinkBehavior(EditableLinkDefaultBehavior)
64     , m_textDirectionSubmenuInclusionBehavior(TextDirectionSubmenuAutomaticallyIncluded)
65     , m_minimumFontSize(0)
66     , m_minimumLogicalFontSize(0)
67     , m_defaultFontSize(0)
68     , m_defaultFixedFontSize(0)
69 #ifdef ANDROID_LAYOUT
70     , m_useWideViewport(false)
71 #endif
72 #ifdef ANDROID_MULTIPLE_WINDOWS
73     , m_supportMultipleWindows(true)
74 #endif
75 #ifdef ANDROID_BLOCK_NETWORK_IMAGE
76     , m_blockNetworkImage(false)
77 #endif
78     , m_maximumDecodedImageSize(numeric_limits<size_t>::max())
79 #if ENABLE(DOM_STORAGE)            
80     , m_localStorageQuota(5 * 1024 * 1024)  // Suggested by the HTML5 spec.
81     , m_sessionStorageQuota(StorageMap::noQuota)
82 #endif
83     , m_pluginAllowedRunTime(numeric_limits<unsigned>::max())
84     , m_zoomMode(ZoomPage)
85     , m_isSpatialNavigationEnabled(false)
86     , m_isJavaEnabled(false)
87     , m_loadsImagesAutomatically(false)
88     , m_privateBrowsingEnabled(false)
89     , m_caretBrowsingEnabled(false)
90     , m_areImagesEnabled(true)
91     , m_isMediaEnabled(true)
92     , m_arePluginsEnabled(false)
93     , m_localStorageEnabled(false)
94     , m_isJavaScriptEnabled(false)
95     , m_isWebSecurityEnabled(true)
96     , m_allowUniversalAccessFromFileURLs(true)
97     , m_allowFileAccessFromFileURLs(true)
98     , m_javaScriptCanOpenWindowsAutomatically(false)
99     , m_javaScriptCanAccessClipboard(false)
100     , m_shouldPrintBackgrounds(false)
101     , m_textAreasAreResizable(false)
102 #if ENABLE(DASHBOARD_SUPPORT)
103     , m_usesDashboardBackwardCompatibilityMode(false)
104 #endif
105     , m_needsAdobeFrameReloadingQuirk(false)
106     , m_needsKeyboardEventDisambiguationQuirks(false)
107     , m_treatsAnyTextCSSLinkAsStylesheet(false)
108     , m_needsLeopardMailQuirks(false)
109     , m_needsTigerMailQuirks(false)
110     , m_isDOMPasteAllowed(false)
111     , m_shrinksStandaloneImagesToFit(true)
112     , m_usesPageCache(false)
113     , m_showsURLsInToolTips(false)
114     , m_forceFTPDirectoryListings(false)
115     , m_developerExtrasEnabled(false)
116     , m_authorAndUserStylesEnabled(true)
117     , m_needsSiteSpecificQuirks(false)
118     , m_fontRenderingMode(0)
119     , m_frameFlatteningEnabled(false)
120     , m_webArchiveDebugModeEnabled(false)
121     , m_localFileContentSniffingEnabled(false)
122     , m_inApplicationChromeMode(false)
123     , m_offlineWebApplicationCacheEnabled(false)
124     , m_shouldPaintCustomScrollbars(false)
125     , m_enforceCSSMIMETypeInStrictMode(true)
126     , m_usesEncodingDetector(false)
127     , m_allowScriptsToCloseWindows(false)
128     , m_editingBehavior(
129 #if PLATFORM(MAC) || (PLATFORM(CHROMIUM) && OS(DARWIN))
130         // (PLATFORM(MAC) is always false in Chromium, hence the extra condition.)
131         EditingMacBehavior
132 #else
133         EditingWindowsBehavior
134 #endif
135         )
136     // FIXME: This should really be disabled by default as it makes platforms that don't support the feature download files
137     // they can't use by. Leaving enabled for now to not change existing behavior.
138     , m_downloadableBinaryFontsEnabled(true)
139     , m_xssAuditorEnabled(false)
140     , m_acceleratedCompositingEnabled(true)
141     , m_showDebugBorders(false)
142     , m_showRepaintCounter(false)
143     , m_experimentalNotificationsEnabled(false)
144     , m_webGLEnabled(false)
145     , m_loadDeferringEnabled(true)
146     , m_tiledBackingStoreEnabled(false)
147 <<<<<<< HEAD
148 #ifdef ANDROID_PLUGINS
149     , m_pluginsOnDemand(false)
150 #endif
151 =======
152     , m_html5ParserEnabled(false)
153 >>>>>>> webkit.org at r60074
154 {
155     // A Frame may not have been created yet, so we initialize the AtomicString 
156     // hash before trying to use it.
157     AtomicString::init();
158 #ifdef ANDROID_META_SUPPORT
159     resetMetadataSettings();
160 #endif
161 }
162
163 void Settings::setStandardFontFamily(const AtomicString& standardFontFamily)
164 {
165     if (standardFontFamily == m_standardFontFamily)
166         return;
167
168     m_standardFontFamily = standardFontFamily;
169     setNeedsReapplyStylesInAllFrames(m_page);
170 }
171
172 void Settings::setFixedFontFamily(const AtomicString& fixedFontFamily)
173 {
174     if (m_fixedFontFamily == fixedFontFamily)
175         return;
176         
177     m_fixedFontFamily = fixedFontFamily;
178     setNeedsReapplyStylesInAllFrames(m_page);
179 }
180
181 void Settings::setSerifFontFamily(const AtomicString& serifFontFamily)
182 {
183     if (m_serifFontFamily == serifFontFamily)
184         return;
185         
186     m_serifFontFamily = serifFontFamily;
187     setNeedsReapplyStylesInAllFrames(m_page);
188 }
189
190 void Settings::setSansSerifFontFamily(const AtomicString& sansSerifFontFamily)
191 {
192     if (m_sansSerifFontFamily == sansSerifFontFamily)
193         return;
194         
195     m_sansSerifFontFamily = sansSerifFontFamily; 
196     setNeedsReapplyStylesInAllFrames(m_page);
197 }
198
199 void Settings::setCursiveFontFamily(const AtomicString& cursiveFontFamily)
200 {
201     if (m_cursiveFontFamily == cursiveFontFamily)
202         return;
203         
204     m_cursiveFontFamily = cursiveFontFamily;
205     setNeedsReapplyStylesInAllFrames(m_page);
206 }
207
208 void Settings::setFantasyFontFamily(const AtomicString& fantasyFontFamily)
209 {
210     if (m_fantasyFontFamily == fantasyFontFamily)
211         return;
212         
213     m_fantasyFontFamily = fantasyFontFamily;
214     setNeedsReapplyStylesInAllFrames(m_page);
215 }
216
217 void Settings::setMinimumFontSize(int minimumFontSize)
218 {
219     if (m_minimumFontSize == minimumFontSize)
220         return;
221
222     m_minimumFontSize = minimumFontSize;
223     setNeedsReapplyStylesInAllFrames(m_page);
224 }
225
226 void Settings::setMinimumLogicalFontSize(int minimumLogicalFontSize)
227 {
228     if (m_minimumLogicalFontSize == minimumLogicalFontSize)
229         return;
230
231     m_minimumLogicalFontSize = minimumLogicalFontSize;
232     setNeedsReapplyStylesInAllFrames(m_page);
233 }
234
235 void Settings::setDefaultFontSize(int defaultFontSize)
236 {
237     if (m_defaultFontSize == defaultFontSize)
238         return;
239
240     m_defaultFontSize = defaultFontSize;
241     setNeedsReapplyStylesInAllFrames(m_page);
242 }
243
244 void Settings::setDefaultFixedFontSize(int defaultFontSize)
245 {
246     if (m_defaultFixedFontSize == defaultFontSize)
247         return;
248
249     m_defaultFixedFontSize = defaultFontSize;
250     setNeedsReapplyStylesInAllFrames(m_page);
251 }
252
253 #ifdef ANDROID_BLOCK_NETWORK_IMAGE
254 void Settings::setBlockNetworkImage(bool blockNetworkImage)
255 {
256     m_blockNetworkImage = blockNetworkImage;
257 }
258 #endif
259
260 void Settings::setLoadsImagesAutomatically(bool loadsImagesAutomatically)
261 {
262     m_loadsImagesAutomatically = loadsImagesAutomatically;
263 }
264
265 void Settings::setJavaScriptEnabled(bool isJavaScriptEnabled)
266 {
267     m_isJavaScriptEnabled = isJavaScriptEnabled;
268 }
269
270 void Settings::setWebSecurityEnabled(bool isWebSecurityEnabled)
271 {
272     m_isWebSecurityEnabled = isWebSecurityEnabled;
273 }
274
275 void Settings::setAllowUniversalAccessFromFileURLs(bool allowUniversalAccessFromFileURLs)
276 {
277     m_allowUniversalAccessFromFileURLs = allowUniversalAccessFromFileURLs;
278 }
279
280 void Settings::setAllowFileAccessFromFileURLs(bool allowFileAccessFromFileURLs)
281 {
282     m_allowFileAccessFromFileURLs = allowFileAccessFromFileURLs;
283 }
284
285 void Settings::setSpatialNavigationEnabled(bool isSpatialNavigationEnabled)
286 {
287     m_isSpatialNavigationEnabled = isSpatialNavigationEnabled;
288 }
289
290 void Settings::setJavaEnabled(bool isJavaEnabled)
291 {
292     m_isJavaEnabled = isJavaEnabled;
293 }
294
295 void Settings::setImagesEnabled(bool areImagesEnabled)
296 {
297     m_areImagesEnabled = areImagesEnabled;
298 }
299
300 void Settings::setMediaEnabled(bool isMediaEnabled)
301 {
302     m_isMediaEnabled = isMediaEnabled;
303 }
304
305 void Settings::setPluginsEnabled(bool arePluginsEnabled)
306 {
307     m_arePluginsEnabled = arePluginsEnabled;
308 }
309
310 void Settings::setLocalStorageEnabled(bool localStorageEnabled)
311 {
312     m_localStorageEnabled = localStorageEnabled;
313 }
314
315 #if ENABLE(DOM_STORAGE)        
316 void Settings::setLocalStorageQuota(unsigned localStorageQuota)
317 {
318     m_localStorageQuota = localStorageQuota;
319 }
320
321 void Settings::setSessionStorageQuota(unsigned sessionStorageQuota)
322 {
323     m_sessionStorageQuota = sessionStorageQuota;
324 }
325 #endif
326
327 void Settings::setPrivateBrowsingEnabled(bool privateBrowsingEnabled)
328 {
329     if (m_privateBrowsingEnabled == privateBrowsingEnabled)
330         return;
331
332     m_privateBrowsingEnabled = privateBrowsingEnabled;
333     m_page->privateBrowsingStateChanged();
334 }
335
336 void Settings::setJavaScriptCanOpenWindowsAutomatically(bool javaScriptCanOpenWindowsAutomatically)
337 {
338     m_javaScriptCanOpenWindowsAutomatically = javaScriptCanOpenWindowsAutomatically;
339 }
340
341 void Settings::setJavaScriptCanAccessClipboard(bool javaScriptCanAccessClipboard)
342 {
343     m_javaScriptCanAccessClipboard = javaScriptCanAccessClipboard;
344 }
345
346 void Settings::setDefaultTextEncodingName(const String& defaultTextEncodingName)
347 {
348     m_defaultTextEncodingName = defaultTextEncodingName;
349 }
350
351 void Settings::setUserStyleSheetLocation(const KURL& userStyleSheetLocation)
352 {
353     if (m_userStyleSheetLocation == userStyleSheetLocation)
354         return;
355
356     m_userStyleSheetLocation = userStyleSheetLocation;
357
358     m_page->userStyleSheetLocationChanged();
359 }
360
361 void Settings::setShouldPrintBackgrounds(bool shouldPrintBackgrounds)
362 {
363     m_shouldPrintBackgrounds = shouldPrintBackgrounds;
364 }
365
366 void Settings::setTextAreasAreResizable(bool textAreasAreResizable)
367 {
368     if (m_textAreasAreResizable == textAreasAreResizable)
369         return;
370
371     m_textAreasAreResizable = textAreasAreResizable;
372     setNeedsReapplyStylesInAllFrames(m_page);
373 }
374
375 void Settings::setEditableLinkBehavior(EditableLinkBehavior editableLinkBehavior)
376 {
377     m_editableLinkBehavior = editableLinkBehavior;
378 }
379
380 void Settings::setTextDirectionSubmenuInclusionBehavior(TextDirectionSubmenuInclusionBehavior behavior)
381 {
382     m_textDirectionSubmenuInclusionBehavior = behavior;
383 }
384
385 #if ENABLE(DASHBOARD_SUPPORT)
386 void Settings::setUsesDashboardBackwardCompatibilityMode(bool usesDashboardBackwardCompatibilityMode)
387 {
388     m_usesDashboardBackwardCompatibilityMode = usesDashboardBackwardCompatibilityMode;
389 }
390 #endif
391
392 // FIXME: This quirk is needed because of Radar 4674537 and 5211271. We need to phase it out once Adobe
393 // can fix the bug from their end.
394 void Settings::setNeedsAdobeFrameReloadingQuirk(bool shouldNotReloadIFramesForUnchangedSRC)
395 {
396     m_needsAdobeFrameReloadingQuirk = shouldNotReloadIFramesForUnchangedSRC;
397 }
398
399 // This is a quirk we are pro-actively applying to old applications. It changes keyboard event dispatching,
400 // making keyIdentifier available on keypress events, making charCode available on keydown/keyup events,
401 // and getting keypress dispatched in more cases.
402 void Settings::setNeedsKeyboardEventDisambiguationQuirks(bool needsQuirks)
403 {
404     m_needsKeyboardEventDisambiguationQuirks = needsQuirks;
405 }
406
407 void Settings::setTreatsAnyTextCSSLinkAsStylesheet(bool treatsAnyTextCSSLinkAsStylesheet)
408 {
409     m_treatsAnyTextCSSLinkAsStylesheet = treatsAnyTextCSSLinkAsStylesheet;
410 }
411
412 void Settings::setNeedsLeopardMailQuirks(bool needsQuirks)
413 {
414     m_needsLeopardMailQuirks = needsQuirks;
415 }
416
417 void Settings::setNeedsTigerMailQuirks(bool needsQuirks)
418 {
419     m_needsTigerMailQuirks = needsQuirks;
420 }
421     
422 void Settings::setDOMPasteAllowed(bool DOMPasteAllowed)
423 {
424     m_isDOMPasteAllowed = DOMPasteAllowed;
425 }
426
427 void Settings::setUsesPageCache(bool usesPageCache)
428 {
429     if (m_usesPageCache == usesPageCache)
430         return;
431         
432     m_usesPageCache = usesPageCache;
433     if (!m_usesPageCache) {
434         HistoryItemVector& historyItems = m_page->backForwardList()->entries();
435         for (unsigned i = 0; i < historyItems.size(); i++)
436             pageCache()->remove(historyItems[i].get());
437         pageCache()->releaseAutoreleasedPagesNow();
438     }
439 }
440
441 void Settings::setShrinksStandaloneImagesToFit(bool shrinksStandaloneImagesToFit)
442 {
443     m_shrinksStandaloneImagesToFit = shrinksStandaloneImagesToFit;
444 }
445
446 void Settings::setShowsURLsInToolTips(bool showsURLsInToolTips)
447 {
448     m_showsURLsInToolTips = showsURLsInToolTips;
449 }
450
451 void Settings::setFTPDirectoryTemplatePath(const String& path)
452 {
453     m_ftpDirectoryTemplatePath = path;
454 }
455
456 void Settings::setForceFTPDirectoryListings(bool force)
457 {
458     m_forceFTPDirectoryListings = force;
459 }
460
461 void Settings::setDeveloperExtrasEnabled(bool developerExtrasEnabled)
462 {
463     m_developerExtrasEnabled = developerExtrasEnabled;
464 }
465
466 #ifdef ANDROID_META_SUPPORT
467 void Settings::resetMetadataSettings()
468 {
469     m_viewport_width = -1;
470     m_viewport_height = -1;
471     m_viewport_initial_scale = 0;
472     m_viewport_minimum_scale = 0;
473     m_viewport_maximum_scale = 0;
474     m_viewport_user_scalable = true;
475     m_viewport_target_densitydpi = -1;
476     m_format_detection_telephone = true;
477     m_format_detection_address = true;
478     m_format_detection_email = true;
479 }
480
481 void Settings::setMetadataSettings(const String& key, const String& value)
482 {
483     if (key == "width") {
484         if (value == "device-width") {
485             m_viewport_width = 0;
486         } else {
487             int width = value.toInt();
488             if (width <= 10000) {
489                 if (width <= 320) {
490                     // This is a hack to accommodate the pages designed for the
491                     // original iPhone. The new version, since 10/2007, is to
492                     // use device-width which works for both portrait and
493                     // landscape modes.
494                     m_viewport_width = 0;
495                 } else {
496                     m_viewport_width = width;
497                 }
498             }
499         }
500     } else if (key == "height") {
501         if (value == "device-height") {
502             m_viewport_height = 0;
503         } else {
504             int height = value.toInt();
505             if (height >= 200 && height <= 10000) {
506                 m_viewport_height = height;
507             }
508         }
509     } else if (key == "initial-scale") {
510         int scale = int(value.toFloat() * 100);
511         if (scale >= 1 && scale <= 1000) {
512             m_viewport_initial_scale = scale;
513         }
514     } else if (key == "minimum-scale") {
515         int scale = int(value.toFloat() * 100);
516         if (scale >= 1 && scale <= 1000) {
517             m_viewport_minimum_scale = scale;
518         }
519     } else if (key == "maximum-scale") {
520         int scale = int(value.toFloat() * 100);
521         if (scale >= 1 && scale <= 1000) {
522             m_viewport_maximum_scale = scale;
523         }
524     } else if (key == "user-scalable") {
525         // even Apple doc says using "no", "0" is common in the real world, and
526         // some sites, e.g. gomoviesapp.com, use "false".
527         if (value == "no" || value == "0" || value == "false") {
528             m_viewport_user_scalable = false;
529         }
530     } else if (key == "target-densitydpi") {
531         if (value == "device-dpi") {
532             m_viewport_target_densitydpi = 0;
533         } else if (value == "low-dpi") {
534             m_viewport_target_densitydpi = 120;
535         } else if (value == "medium-dpi") {
536             m_viewport_target_densitydpi = 160;
537         } else if (value == "high-dpi") {
538             m_viewport_target_densitydpi = 240;
539         } else {
540             int dpi = value.toInt();
541             if (dpi >= 70 && dpi <= 400) {
542                 m_viewport_target_densitydpi = dpi;
543             }
544         }
545     } else if (key == "telephone") {
546         if (value == "no") {
547             m_format_detection_telephone = false;
548         }
549     } else if (key == "address") {
550         if (value == "no") {
551             m_format_detection_address = false;
552         }
553     } else if (key == "email") {
554         if (value == "no") {
555             m_format_detection_email = false;
556         }
557     } else if (key == "format-detection") {
558         // even Apple doc says "format-detection" should be the name of the
559         // <meta> tag. In the real world, e.g. amazon.com, use
560         // "format-detection=no" in the "viewport" <meta> tag to disable all
561         // format detection.
562         if (value == "no") {
563             m_format_detection_telephone = false;
564             m_format_detection_address = false;
565             m_format_detection_email = false;
566         }
567     }
568 }
569
570 void Settings::setViewportWidth(int width)
571 {
572     if (width < 0 || width > 10000)
573         m_viewport_width = -1;
574     else
575         m_viewport_width = width;
576 }
577
578 void Settings::setViewportHeight(int height)
579 {
580     if (height < 0 || height > 10000)
581         m_viewport_height = -1;
582     else
583         m_viewport_height = height;
584 }
585
586 void Settings::setViewportInitialScale(int scale)
587 {
588     if (scale < 1 || scale > 1000)
589         m_viewport_initial_scale = 0;
590     else
591         m_viewport_initial_scale = scale;
592 }
593
594 void Settings::setViewportMinimumScale(int scale)
595 {
596     if (scale < 1 || scale > 1000)
597         m_viewport_minimum_scale = 0;
598     else
599         m_viewport_minimum_scale = scale;
600 }
601
602 void Settings::setViewportMaximumScale(int scale)
603 {
604     if (scale < 1 || scale > 1000)
605         m_viewport_maximum_scale = 0;
606     else
607         m_viewport_maximum_scale = scale;
608 }
609
610 void Settings::setViewportUserScalable(bool scalable)
611 {
612     m_viewport_user_scalable = scalable;
613 }
614
615 void Settings::setViewportTargetDensityDpi(int dpi)
616 {
617     if (dpi < 0 || dpi > 400)
618         m_viewport_target_densitydpi = -1;
619     else
620         m_viewport_target_densitydpi = dpi;
621 }
622
623 void Settings::setFormatDetectionAddress(bool detect)
624 {
625     m_format_detection_address = detect;
626 }
627
628 void Settings::setFormatDetectionEmail(bool detect)
629 {
630     m_format_detection_email = detect;
631 }
632
633 void Settings::setFormatDetectionTelephone(bool detect)
634 {
635     m_format_detection_telephone = detect;
636 }
637 #endif
638
639 void Settings::setAuthorAndUserStylesEnabled(bool authorAndUserStylesEnabled)
640 {
641     if (m_authorAndUserStylesEnabled == authorAndUserStylesEnabled)
642         return;
643
644     m_authorAndUserStylesEnabled = authorAndUserStylesEnabled;
645     setNeedsReapplyStylesInAllFrames(m_page);
646 }
647
648 void Settings::setFontRenderingMode(FontRenderingMode mode)
649 {
650     if (fontRenderingMode() == mode)
651         return;
652     m_fontRenderingMode = mode;
653     setNeedsReapplyStylesInAllFrames(m_page);
654 }
655
656 FontRenderingMode Settings::fontRenderingMode() const
657 {
658     return static_cast<FontRenderingMode>(m_fontRenderingMode);
659 }
660
661 void Settings::setNeedsSiteSpecificQuirks(bool needsQuirks)
662 {
663     m_needsSiteSpecificQuirks = needsQuirks;
664 }
665
666 void Settings::setFrameFlatteningEnabled(bool frameFlatteningEnabled)
667 {
668     m_frameFlatteningEnabled = frameFlatteningEnabled;
669 }
670
671 void Settings::setWebArchiveDebugModeEnabled(bool enabled)
672 {
673     m_webArchiveDebugModeEnabled = enabled;
674 }
675
676 void Settings::setLocalFileContentSniffingEnabled(bool enabled)
677 {
678     m_localFileContentSniffingEnabled = enabled;
679 }
680
681 void Settings::setLocalStorageDatabasePath(const String& path)
682 {
683     m_localStorageDatabasePath = path;
684 }
685
686 void Settings::setApplicationChromeMode(bool mode)
687 {
688     m_inApplicationChromeMode = mode;
689 }
690
691 void Settings::setOfflineWebApplicationCacheEnabled(bool enabled)
692 {
693     m_offlineWebApplicationCacheEnabled = enabled;
694 }
695
696 void Settings::setShouldPaintCustomScrollbars(bool shouldPaintCustomScrollbars)
697 {
698     m_shouldPaintCustomScrollbars = shouldPaintCustomScrollbars;
699 }
700
701 void Settings::setZoomMode(ZoomMode mode)
702 {
703     if (mode == m_zoomMode)
704         return;
705     
706     m_zoomMode = mode;
707     setNeedsReapplyStylesInAllFrames(m_page);
708 }
709
710 void Settings::setEnforceCSSMIMETypeInStrictMode(bool enforceCSSMIMETypeInStrictMode)
711 {
712     m_enforceCSSMIMETypeInStrictMode = enforceCSSMIMETypeInStrictMode;
713 }
714
715 #if USE(SAFARI_THEME)
716 void Settings::setShouldPaintNativeControls(bool shouldPaintNativeControls)
717 {
718     gShouldPaintNativeControls = shouldPaintNativeControls;
719 }
720 #endif
721
722 void Settings::setUsesEncodingDetector(bool usesEncodingDetector)
723 {
724     m_usesEncodingDetector = usesEncodingDetector;
725 }
726
727 void Settings::setAllowScriptsToCloseWindows(bool allowScriptsToCloseWindows)
728 {
729     m_allowScriptsToCloseWindows = allowScriptsToCloseWindows;
730 }
731
732 void Settings::setCaretBrowsingEnabled(bool caretBrowsingEnabled)
733 {
734     m_caretBrowsingEnabled = caretBrowsingEnabled;
735 }
736
737 void Settings::setDownloadableBinaryFontsEnabled(bool downloadableBinaryFontsEnabled)
738 {
739     m_downloadableBinaryFontsEnabled = downloadableBinaryFontsEnabled;
740 }
741
742 void Settings::setXSSAuditorEnabled(bool xssAuditorEnabled)
743 {
744     m_xssAuditorEnabled = xssAuditorEnabled;
745 }
746
747 void Settings::setAcceleratedCompositingEnabled(bool enabled)
748 {
749     if (m_acceleratedCompositingEnabled == enabled)
750         return;
751         
752     m_acceleratedCompositingEnabled = enabled;
753     setNeedsReapplyStylesInAllFrames(m_page);
754 }
755
756 void Settings::setShowDebugBorders(bool enabled)
757 {
758     if (m_showDebugBorders == enabled)
759         return;
760         
761     m_showDebugBorders = enabled;
762     setNeedsReapplyStylesInAllFrames(m_page);
763 }
764
765 void Settings::setShowRepaintCounter(bool enabled)
766 {
767     if (m_showRepaintCounter == enabled)
768         return;
769         
770     m_showRepaintCounter = enabled;
771     setNeedsReapplyStylesInAllFrames(m_page);
772 }
773
774 void Settings::setExperimentalNotificationsEnabled(bool enabled)
775 {
776     m_experimentalNotificationsEnabled = enabled;
777 }
778
779 void Settings::setPluginAllowedRunTime(unsigned runTime)
780 {
781     m_pluginAllowedRunTime = runTime;
782     m_page->pluginAllowedRunTimeChanged();
783 }
784
785 #if PLATFORM(WIN) || (OS(WINDOWS) && PLATFORM(WX))
786 void Settings::setShouldUseHighResolutionTimers(bool shouldUseHighResolutionTimers)
787 {
788     gShouldUseHighResolutionTimers = shouldUseHighResolutionTimers;
789 }
790 #endif
791
792 void Settings::setWebGLEnabled(bool enabled)
793 {
794     m_webGLEnabled = enabled;
795 }
796
797 void Settings::setLoadDeferringEnabled(bool enabled)
798 {
799     m_loadDeferringEnabled = enabled;
800 }
801
802 void Settings::setTiledBackingStoreEnabled(bool enabled)
803 {
804     m_tiledBackingStoreEnabled = enabled;
805 #if ENABLE(TILED_BACKING_STORE)
806     if (m_page->mainFrame())
807         m_page->mainFrame()->setTiledBackingStoreEnabled(enabled);
808 #endif
809 }
810
811 } // namespace WebCore