Merge "[CherryPick] Refactoring: Move the content of HTMLInputElement::subtreeHasChan...
[framework/web/webkit-efl.git] / Source / WebCore / page / Settings.h
1 /*
2  * Copyright (C) 2003, 2006, 2007, 2008, 2009, 2011 Apple Inc. All rights reserved.
3  *           (C) 2006 Graham Dennis (graham.dennis@gmail.com)
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  * 1. Redistributions of source code must retain the above copyright
9  *    notice, this list of conditions and the following disclaimer.
10  * 2. Redistributions in binary form must reproduce the above copyright
11  *    notice, this list of conditions and the following disclaimer in the
12  *    documentation and/or other materials provided with the distribution.
13  *
14  * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY
15  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
17  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE COMPUTER, INC. OR
18  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
19  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
20  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
21  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
22  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
23  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
24  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
25  */
26
27 #ifndef Settings_h
28 #define Settings_h
29
30 #include "EditingBehaviorTypes.h"
31 #include "FontRenderingMode.h"
32 #include "KURL.h"
33 #include "Timer.h"
34 #include <wtf/HashMap.h>
35 #include <wtf/text/AtomicString.h>
36 #include <wtf/text/AtomicStringHash.h>
37 #include <wtf/unicode/Unicode.h>
38
39 #if ENABLE(TEXT_AUTOSIZING)
40 #include "IntSize.h"
41 #endif
42
43 namespace WebCore {
44
45     class Page;
46
47     enum EditableLinkBehavior {
48         EditableLinkDefaultBehavior,
49         EditableLinkAlwaysLive,
50         EditableLinkOnlyLiveWithShiftKey,
51         EditableLinkLiveWhenNotFocused,
52         EditableLinkNeverLive
53     };
54
55     enum TextDirectionSubmenuInclusionBehavior {
56         TextDirectionSubmenuNeverIncluded,
57         TextDirectionSubmenuAutomaticallyIncluded,
58         TextDirectionSubmenuAlwaysIncluded
59     };
60
61     // UScriptCode uses -1 and 0 for UScriptInvalidCode and UScriptCommon.
62     // We need to use -2 and -3 for empty value and deleted value.
63     struct UScriptCodeHashTraits : WTF::GenericHashTraits<int> {
64         static const bool emptyValueIsZero = false;
65         static int emptyValue() { return -2; }
66         static void constructDeletedValue(int& slot) { slot = -3; }
67         static bool isDeletedValue(int value) { return value == -3; }
68     };
69
70     typedef HashMap<int, AtomicString, DefaultHash<int>::Hash, UScriptCodeHashTraits> ScriptFontFamilyMap;
71
72     class Settings {
73         WTF_MAKE_NONCOPYABLE(Settings); WTF_MAKE_FAST_ALLOCATED;
74     public:
75         static PassOwnPtr<Settings> create(Page*);
76
77         void setStandardFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
78         const AtomicString& standardFontFamily(UScriptCode = USCRIPT_COMMON) const;
79
80         void setFixedFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
81         const AtomicString& fixedFontFamily(UScriptCode = USCRIPT_COMMON) const;
82
83         void setSerifFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
84         const AtomicString& serifFontFamily(UScriptCode = USCRIPT_COMMON) const;
85
86         void setSansSerifFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
87         const AtomicString& sansSerifFontFamily(UScriptCode = USCRIPT_COMMON) const;
88
89         void setCursiveFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
90         const AtomicString& cursiveFontFamily(UScriptCode = USCRIPT_COMMON) const;
91
92         void setFantasyFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
93         const AtomicString& fantasyFontFamily(UScriptCode = USCRIPT_COMMON) const;
94
95         void setPictographFontFamily(const AtomicString&, UScriptCode = USCRIPT_COMMON);
96         const AtomicString& pictographFontFamily(UScriptCode = USCRIPT_COMMON) const;
97
98         void setMinimumFontSize(int);
99         int minimumFontSize() const { return m_minimumFontSize; }
100
101         void setMinimumLogicalFontSize(int);
102         int minimumLogicalFontSize() const { return m_minimumLogicalFontSize; }
103
104         void setDefaultFontSize(int);
105         int defaultFontSize() const { return m_defaultFontSize; }
106
107         void setDefaultFixedFontSize(int);
108         int defaultFixedFontSize() const { return m_defaultFixedFontSize; }
109
110 #if ENABLE(TEXT_AUTOSIZING)
111         void setTextAutosizingEnabled(bool);
112         bool textAutosizingEnabled() const { return m_textAutosizingEnabled; }
113
114         void setTextAutosizingFontScaleFactor(float);
115         float textAutosizingFontScaleFactor() const { return m_textAutosizingFontScaleFactor; }
116
117         // Only set by Layout Tests, and only used if textAutosizingEnabled() returns true.
118         void setTextAutosizingWindowSizeOverride(const IntSize&);
119         const IntSize& textAutosizingWindowSizeOverride() const { return m_textAutosizingWindowSizeOverride; }
120 #endif
121
122         // Unlike areImagesEnabled, this only suppresses the network load of
123         // the image URL.  A cached image will still be rendered if requested.
124         void setLoadsImagesAutomatically(bool);
125         bool loadsImagesAutomatically() const { return m_loadsImagesAutomatically; }
126
127         // This setting only affects site icon image loading if loadsImagesAutomatically setting is false and this setting is true.
128         // All other permutations still heed loadsImagesAutomatically setting.
129         void setLoadsSiteIconsIgnoringImageLoadingSetting(bool);
130         bool loadsSiteIconsIgnoringImageLoadingSetting() const { return m_loadsSiteIconsIgnoringImageLoadingSetting; }
131
132         void setScriptEnabled(bool);
133         // Instead of calling isScriptEnabled directly, please consider calling
134         // ScriptController::canExecuteScripts, which takes things like the
135         // HTML sandbox attribute into account.
136         bool isScriptEnabled() const { return m_isScriptEnabled; }
137
138         void setWebSecurityEnabled(bool);
139         bool isWebSecurityEnabled() const { return m_isWebSecurityEnabled; }
140
141         void setAllowUniversalAccessFromFileURLs(bool);
142         bool allowUniversalAccessFromFileURLs() const { return m_allowUniversalAccessFromFileURLs; }
143
144         void setAllowFileAccessFromFileURLs(bool);
145         bool allowFileAccessFromFileURLs() const { return m_allowFileAccessFromFileURLs; }
146
147         void setJavaScriptCanOpenWindowsAutomatically(bool);
148         bool javaScriptCanOpenWindowsAutomatically() const { return m_javaScriptCanOpenWindowsAutomatically; }
149
150         void setJavaScriptCanAccessClipboard(bool);
151         bool javaScriptCanAccessClipboard() const { return m_javaScriptCanAccessClipboard; }
152
153         void setSpatialNavigationEnabled(bool);
154         bool isSpatialNavigationEnabled() const { return m_isSpatialNavigationEnabled; }
155
156         void setJavaEnabled(bool);
157         bool isJavaEnabled() const { return m_isJavaEnabled; }
158
159         // This settings is only consulted if isJavaEnabled() returns true;
160         void setJavaEnabledForLocalFiles(bool);
161         bool isJavaEnabledForLocalFiles() const { return m_isJavaEnabledForLocalFiles; }
162
163         void setImagesEnabled(bool);
164         bool areImagesEnabled() const { return m_areImagesEnabled; }
165
166         void setMediaEnabled(bool);
167         bool isMediaEnabled() const { return m_isMediaEnabled; }
168
169         void setPluginsEnabled(bool);
170         bool arePluginsEnabled() const { return m_arePluginsEnabled; }
171
172         void setLocalStorageEnabled(bool);
173         bool localStorageEnabled() const { return m_localStorageEnabled; }
174
175         // Allow clients concerned with memory consumption to set a quota on session storage
176         // since the memory used won't be released until the Page is destroyed.
177         // Default is noQuota.
178         void setSessionStorageQuota(unsigned);
179         unsigned sessionStorageQuota() const { return m_sessionStorageQuota; }
180
181         // When this option is set, WebCore will avoid storing any record of browsing activity
182         // that may persist on disk or remain displayed when the option is reset.
183         // This option does not affect the storage of such information in RAM.
184         // The following functions respect this setting:
185         //  - HTML5/DOM Storage
186         //  - Icon Database
187         //  - Console Messages
188         //  - MemoryCache
189         //  - Application Cache
190         //  - Back/Forward Page History
191         //  - Page Search Results
192         //  - HTTP Cookies
193         //  - Plug-ins (that support NPNVprivateModeBool)
194         void setPrivateBrowsingEnabled(bool);
195         bool privateBrowsingEnabled() const { return m_privateBrowsingEnabled; }
196
197         void setCaretBrowsingEnabled(bool);
198         bool caretBrowsingEnabled() const { return m_caretBrowsingEnabled; }
199
200         void setDefaultTextEncodingName(const String&);
201         const String& defaultTextEncodingName() const { return m_defaultTextEncodingName; }
202         
203         void setUsesEncodingDetector(bool);
204         bool usesEncodingDetector() const { return m_usesEncodingDetector; }
205
206         void setDNSPrefetchingEnabled(bool);
207         bool dnsPrefetchingEnabled() const { return m_dnsPrefetchingEnabled; }
208
209         void setUserStyleSheetLocation(const KURL&);
210         const KURL& userStyleSheetLocation() const { return m_userStyleSheetLocation; }
211
212         void setFixedElementsLayoutRelativeToFrame(bool);
213         bool fixedElementsLayoutRelativeToFrame() const { return m_fixedElementsLayoutRelativeToFrame; }
214
215         void setShouldPrintBackgrounds(bool);
216         bool shouldPrintBackgrounds() const { return m_shouldPrintBackgrounds; }
217
218         void setTextAreasAreResizable(bool);
219         bool textAreasAreResizable() const { return m_textAreasAreResizable; }
220
221         void setEditableLinkBehavior(EditableLinkBehavior);
222         EditableLinkBehavior editableLinkBehavior() const { return m_editableLinkBehavior; }
223
224         void setTextDirectionSubmenuInclusionBehavior(TextDirectionSubmenuInclusionBehavior);
225         TextDirectionSubmenuInclusionBehavior textDirectionSubmenuInclusionBehavior() const { return m_textDirectionSubmenuInclusionBehavior; }
226
227 #if ENABLE(DASHBOARD_SUPPORT)
228         void setUsesDashboardBackwardCompatibilityMode(bool);
229         bool usesDashboardBackwardCompatibilityMode() const { return m_usesDashboardBackwardCompatibilityMode; }
230 #endif
231         
232         void setNeedsAdobeFrameReloadingQuirk(bool);
233         bool needsAcrobatFrameReloadingQuirk() const { return m_needsAdobeFrameReloadingQuirk; }
234
235         void setNeedsKeyboardEventDisambiguationQuirks(bool);
236         bool needsKeyboardEventDisambiguationQuirks() const { return m_needsKeyboardEventDisambiguationQuirks; }
237
238         void setTreatsAnyTextCSSLinkAsStylesheet(bool);
239         bool treatsAnyTextCSSLinkAsStylesheet() const { return m_treatsAnyTextCSSLinkAsStylesheet; }
240
241         void setNeedsLeopardMailQuirks(bool);
242         bool needsLeopardMailQuirks() const { return m_needsLeopardMailQuirks; }
243
244         void setDOMPasteAllowed(bool);
245         bool isDOMPasteAllowed() const { return m_isDOMPasteAllowed; }
246         
247         static void setDefaultMinDOMTimerInterval(double); // Interval specified in seconds.
248         static double defaultMinDOMTimerInterval();
249         
250         void setMinDOMTimerInterval(double); // Per-page; initialized to default value.
251         double minDOMTimerInterval();
252
253         void setUsesPageCache(bool);
254         bool usesPageCache() const { return m_usesPageCache; }
255         
256         void setPageCacheSupportsPlugins(bool pageCacheSupportsPlugins) { m_pageCacheSupportsPlugins = pageCacheSupportsPlugins; }
257         bool pageCacheSupportsPlugins() const { return m_pageCacheSupportsPlugins; }
258
259         void setShrinksStandaloneImagesToFit(bool);
260         bool shrinksStandaloneImagesToFit() const { return m_shrinksStandaloneImagesToFit; }
261
262         void setShowsURLsInToolTips(bool);
263         bool showsURLsInToolTips() const { return m_showsURLsInToolTips; }
264
265         void setShowsToolTipOverTruncatedText(bool);
266         bool showsToolTipOverTruncatedText() const { return m_showsToolTipOverTruncatedText; }
267
268         void setFTPDirectoryTemplatePath(const String&);
269         const String& ftpDirectoryTemplatePath() const { return m_ftpDirectoryTemplatePath; }
270         
271         void setForceFTPDirectoryListings(bool);
272         bool forceFTPDirectoryListings() const { return m_forceFTPDirectoryListings; }
273         
274         void setDeveloperExtrasEnabled(bool);
275         bool developerExtrasEnabled() const { return m_developerExtrasEnabled; }
276         
277         void setJavaScriptExperimentsEnabled(bool);
278         bool javaScriptExperimentsEnabled() const { return m_javaScriptExperimentsEnabled; }
279
280         void setFrameFlatteningEnabled(bool);
281         bool frameFlatteningEnabled() const { return m_frameFlatteningEnabled; }
282
283         void setAuthorAndUserStylesEnabled(bool);
284         bool authorAndUserStylesEnabled() const { return m_authorAndUserStylesEnabled; }
285         
286         void setFontRenderingMode(FontRenderingMode mode);
287         FontRenderingMode fontRenderingMode() const;
288
289         void setNeedsSiteSpecificQuirks(bool);
290         bool needsSiteSpecificQuirks() const { return m_needsSiteSpecificQuirks; }
291
292 #if ENABLE(WEB_ARCHIVE)
293         void setWebArchiveDebugModeEnabled(bool);
294         bool webArchiveDebugModeEnabled() const { return m_webArchiveDebugModeEnabled; }
295 #endif
296
297         void setLocalFileContentSniffingEnabled(bool);
298         bool localFileContentSniffingEnabled() const { return m_localFileContentSniffingEnabled; }
299
300         void setLocalStorageDatabasePath(const String&);
301         const String& localStorageDatabasePath() const { return m_localStorageDatabasePath; }
302
303         void setApplicationChromeMode(bool);
304         bool inApplicationChromeMode() const { return m_inApplicationChromeMode; }
305
306         void setOfflineWebApplicationCacheEnabled(bool);
307         bool offlineWebApplicationCacheEnabled() const { return m_offlineWebApplicationCacheEnabled; }
308         
309         void setEnforceCSSMIMETypeInNoQuirksMode(bool);
310         bool enforceCSSMIMETypeInNoQuirksMode() { return m_enforceCSSMIMETypeInNoQuirksMode; }
311
312         void setMaximumDecodedImageSize(size_t size) { m_maximumDecodedImageSize = size; }
313         size_t maximumDecodedImageSize() const { return m_maximumDecodedImageSize; }
314
315         void setAllowScriptsToCloseWindows(bool);
316         bool allowScriptsToCloseWindows() const { return m_allowScriptsToCloseWindows; }
317
318         void setEditingBehaviorType(EditingBehaviorType behavior) { m_editingBehaviorType = behavior; }
319         EditingBehaviorType editingBehaviorType() const { return static_cast<EditingBehaviorType>(m_editingBehaviorType); }
320
321         void setDownloadableBinaryFontsEnabled(bool);
322         bool downloadableBinaryFontsEnabled() const { return m_downloadableBinaryFontsEnabled; }
323
324         void setXSSAuditorEnabled(bool);
325         bool xssAuditorEnabled() const { return m_xssAuditorEnabled; }
326
327         void setCanvasUsesAcceleratedDrawing(bool);
328         bool canvasUsesAcceleratedDrawing() const { return m_canvasUsesAcceleratedDrawing; }
329
330         void setAcceleratedDrawingEnabled(bool enabled) { m_acceleratedDrawingEnabled = enabled; }
331         bool acceleratedDrawingEnabled() const { return m_acceleratedDrawingEnabled; }
332
333         void setAcceleratedFiltersEnabled(bool enabled) { m_acceleratedFiltersEnabled = enabled; }
334         bool acceleratedFiltersEnabled() const { return m_acceleratedFiltersEnabled; }
335
336         void setCSSCustomFilterEnabled(bool enabled) { m_isCSSCustomFilterEnabled = enabled; }
337         bool isCSSCustomFilterEnabled() const { return m_isCSSCustomFilterEnabled; }
338
339 #if ENABLE(CSS_REGIONS)
340         void setCSSRegionsEnabled(bool enabled) { m_cssRegionsEnabled = enabled; }
341         bool cssRegionsEnabled() const { return m_cssRegionsEnabled; }
342 #else
343         void setCSSRegionsEnabled(bool) { }
344         bool cssRegionsEnabled() const { return false; }
345 #endif
346
347 #if ENABLE(CSS_VARIABLES)
348         void setCSSVariablesEnabled(bool enabled) { m_cssVariablesEnabled = enabled; }
349         bool cssVariablesEnabled() const { return m_cssVariablesEnabled; }
350 #else
351         void setCSSVariablesEnabled(bool) { }
352         bool cssVariablesEnabled() const { return false; }
353 #endif
354
355         void setRegionBasedColumnsEnabled(bool enabled) { m_regionBasedColumnsEnabled = enabled; }
356         bool regionBasedColumnsEnabled() const { return m_regionBasedColumnsEnabled; }
357
358         void setCSSGridLayoutEnabled(bool enabled) { m_cssGridLayoutEnabled = enabled; }
359         bool cssGridLayoutEnabled() const { return m_cssGridLayoutEnabled; }
360
361         void setAcceleratedCompositingEnabled(bool);
362         bool acceleratedCompositingEnabled() const { return m_acceleratedCompositingEnabled; }
363
364         void setAcceleratedCompositingFor3DTransformsEnabled(bool);
365         bool acceleratedCompositingFor3DTransformsEnabled() const { return m_acceleratedCompositingFor3DTransformsEnabled; }
366
367         void setAcceleratedCompositingForVideoEnabled(bool);
368         bool acceleratedCompositingForVideoEnabled() const { return m_acceleratedCompositingForVideoEnabled; }
369
370         void setAcceleratedCompositingForPluginsEnabled(bool);
371         bool acceleratedCompositingForPluginsEnabled() const { return m_acceleratedCompositingForPluginsEnabled; }
372
373         void setAcceleratedCompositingForCanvasEnabled(bool);
374         bool acceleratedCompositingForCanvasEnabled() const { return m_acceleratedCompositingForCanvasEnabled; }
375
376         void setAcceleratedCompositingForAnimationEnabled(bool);
377         bool acceleratedCompositingForAnimationEnabled() const { return m_acceleratedCompositingForAnimationEnabled; }
378
379         void setAcceleratedCompositingForFixedPositionEnabled(bool enabled) { m_acceleratedCompositingForFixedPositionEnabled = enabled; }
380         bool acceleratedCompositingForFixedPositionEnabled() const { return m_acceleratedCompositingForFixedPositionEnabled; }
381
382         void setAcceleratedCompositingForScrollableFramesEnabled(bool enabled) { m_acceleratedCompositingForScrollableFramesEnabled = enabled; }
383         bool acceleratedCompositingForScrollableFramesEnabled() const { return m_acceleratedCompositingForScrollableFramesEnabled; }
384
385         void setShowDebugBorders(bool);
386         bool showDebugBorders() const { return m_showDebugBorders; }
387
388         void setShowRepaintCounter(bool);
389         bool showRepaintCounter() const { return m_showRepaintCounter; }
390
391         void setExperimentalNotificationsEnabled(bool);
392         bool experimentalNotificationsEnabled() const { return m_experimentalNotificationsEnabled; }
393
394 #if PLATFORM(WIN) || (OS(WINDOWS) && PLATFORM(WX))
395         static void setShouldUseHighResolutionTimers(bool);
396         static bool shouldUseHighResolutionTimers() { return gShouldUseHighResolutionTimers; }
397 #endif
398
399         void setWebAudioEnabled(bool);
400         bool webAudioEnabled() const { return m_webAudioEnabled; }
401
402         void setWebGLEnabled(bool);
403         bool webGLEnabled() const { return m_webGLEnabled; }
404
405         void setWebGLErrorsToConsoleEnabled(bool);
406         bool webGLErrorsToConsoleEnabled() const { return m_webGLErrorsToConsoleEnabled; }
407
408         void setOpenGLMultisamplingEnabled(bool);
409         bool openGLMultisamplingEnabled() const { return m_openGLMultisamplingEnabled; }
410
411         void setPrivilegedWebGLExtensionsEnabled(bool);
412         bool privilegedWebGLExtensionsEnabled() const { return m_privilegedWebGLExtensionsEnabled; }
413
414         void setAccelerated2dCanvasEnabled(bool);
415         bool accelerated2dCanvasEnabled() const { return m_acceleratedCanvas2dEnabled; }
416
417         void setDeferred2dCanvasEnabled(bool);
418         bool deferred2dCanvasEnabled() const { return m_deferredCanvas2dEnabled; }
419
420         // Number of pixels below which 2D canvas is rendered in software
421         // even if hardware acceleration is enabled.
422         // Hardware acceleration is useful for large canvases where it can avoid the
423         // pixel bandwidth between the CPU and GPU. But GPU acceleration comes at
424         // a price - extra back-buffer and texture copy. Small canvases are also
425         // widely used for stylized fonts. Anti-aliasing text in hardware at that
426         // scale is generally slower. So below a certain size it is better to
427         // draw canvas in software.
428         void setMinimumAccelerated2dCanvasSize(int);
429         int minimumAccelerated2dCanvasSize() const { return m_minimumAccelerated2dCanvasSize; }
430
431         void setLoadDeferringEnabled(bool);
432         bool loadDeferringEnabled() const { return m_loadDeferringEnabled; }
433         
434         void setTiledBackingStoreEnabled(bool);
435         bool tiledBackingStoreEnabled() const { return m_tiledBackingStoreEnabled; }
436
437         void setPaginateDuringLayoutEnabled(bool flag) { m_paginateDuringLayoutEnabled = flag; }
438         bool paginateDuringLayoutEnabled() const { return m_paginateDuringLayoutEnabled; }
439
440 #if ENABLE(FULLSCREEN_API)
441         void setFullScreenEnabled(bool flag) { m_fullScreenAPIEnabled = flag; }
442         bool fullScreenEnabled() const  { return m_fullScreenAPIEnabled; }
443 #endif
444
445 #if USE(AVFOUNDATION)
446         static void setAVFoundationEnabled(bool flag) { gAVFoundationEnabled = flag; }
447         static bool isAVFoundationEnabled() { return gAVFoundationEnabled; }
448 #endif
449
450         void setAsynchronousSpellCheckingEnabled(bool flag) { m_asynchronousSpellCheckingEnabled = flag; }
451         bool asynchronousSpellCheckingEnabled() const  { return m_asynchronousSpellCheckingEnabled; }
452
453         void setUnifiedTextCheckerEnabled(bool flag) { m_unifiedTextCheckerEnabled = flag; }
454         bool unifiedTextCheckerEnabled() const { return m_unifiedTextCheckerEnabled; }
455
456         void setMemoryInfoEnabled(bool flag) { m_memoryInfoEnabled = flag; }
457         bool memoryInfoEnabled() const { return m_memoryInfoEnabled; }
458
459         void setQuantizedMemoryInfoEnabled(bool flag) { m_quantizedMemoryInfoEnabled = flag; }
460         bool quantizedMemoryInfoEnabled() const { return m_quantizedMemoryInfoEnabled; }
461
462         // This setting will be removed when an HTML5 compatibility issue is
463         // resolved and WebKit implementation of interactive validation is
464         // completed. See http://webkit.org/b/40520, http://webkit.org/b/40747,
465         // and http://webkit.org/b/40908
466         void setInteractiveFormValidationEnabled(bool flag) { m_interactiveFormValidation = flag; }
467         bool interactiveFormValidationEnabled() const { return m_interactiveFormValidation; }
468
469         // Sets the maginication value for validation message timer.
470         // If the maginication value is N, a validation message disappears
471         // automatically after <message length> * N / 1000 seconds. If N is
472         // equal to or less than 0, a validation message doesn't disappears
473         // automaticaly. The default value is 50.
474         void setValidationMessageTimerMagnification(int newValue) { m_validationMessageTimerMagnification = newValue; }
475         int validationMessageTimerMaginification() const { return m_validationMessageTimerMagnification; }
476         
477         void setUsePreHTML5ParserQuirks(bool flag) { m_usePreHTML5ParserQuirks = flag; }
478         bool usePreHTML5ParserQuirks() const { return m_usePreHTML5ParserQuirks; }
479
480         static const unsigned defaultMaximumHTMLParserDOMTreeDepth = 512;
481         void setMaximumHTMLParserDOMTreeDepth(unsigned maximumHTMLParserDOMTreeDepth) { m_maximumHTMLParserDOMTreeDepth = maximumHTMLParserDOMTreeDepth; }
482         unsigned maximumHTMLParserDOMTreeDepth() const { return m_maximumHTMLParserDOMTreeDepth; }
483
484         void setHyperlinkAuditingEnabled(bool flag) { m_hyperlinkAuditingEnabled = flag; }
485         bool hyperlinkAuditingEnabled() const { return m_hyperlinkAuditingEnabled; }
486
487         void setCrossOriginCheckInGetMatchedCSSRulesDisabled(bool flag) { m_crossOriginCheckInGetMatchedCSSRulesDisabled = flag; }
488         bool crossOriginCheckInGetMatchedCSSRulesDisabled() const { return m_crossOriginCheckInGetMatchedCSSRulesDisabled; }
489         
490 #if ENABLE(TIZEN_LOAD_REMOTE_IMAGES)
491         void setLoadRemoteImages(bool loadRemoteImages);
492         bool loadRemoteImages() { return m_loadRemoteImages; }
493 #endif
494
495 #if ENABLE(TIZEN_ISF_PORT)
496         void setEnableDefaultKeypad(bool flag) { m_defaultKeypadEnabled = flag; }
497         bool defaultKeypadEnabled() const { return m_defaultKeypadEnabled; }
498 #endif
499
500 #if ENABLE(TIZEN_WEBKIT2_MEMORY_SAVING_MODE)
501         void setMemorySavingMode(bool memorySavingMode) { m_memorySavingModeEnabled = memorySavingMode; }
502         bool memorySavingModeEnabled() const { return m_memorySavingModeEnabled; }
503 #endif
504
505         void setLayoutFallbackWidth(int width) { m_layoutFallbackWidth = width; }
506         int layoutFallbackWidth() const { return m_layoutFallbackWidth; }
507
508         void setDeviceWidth(int width) { m_deviceWidth = width; }
509         int deviceWidth() const { return m_deviceWidth; }
510
511         void setDeviceHeight(int height) { m_deviceHeight = height; }
512         int deviceHeight() const { return m_deviceHeight; }
513
514         void setForceCompositingMode(bool flag) { m_forceCompositingMode = flag; }
515         bool forceCompositingMode() { return m_forceCompositingMode; }
516
517         void setShouldInjectUserScriptsInInitialEmptyDocument(bool flag) { m_shouldInjectUserScriptsInInitialEmptyDocument = flag; }
518         bool shouldInjectUserScriptsInInitialEmptyDocument() { return m_shouldInjectUserScriptsInInitialEmptyDocument; }
519
520         void setAllowDisplayOfInsecureContent(bool flag) { m_allowDisplayOfInsecureContent = flag; }
521         bool allowDisplayOfInsecureContent() const { return m_allowDisplayOfInsecureContent; }
522         void setAllowRunningOfInsecureContent(bool flag) { m_allowRunningOfInsecureContent = flag; }
523         bool allowRunningOfInsecureContent() const { return m_allowRunningOfInsecureContent; }
524
525 #if ENABLE(SMOOTH_SCROLLING)
526         void setEnableScrollAnimator(bool flag) { m_scrollAnimatorEnabled = flag; }
527         bool scrollAnimatorEnabled() const { return m_scrollAnimatorEnabled; }
528 #endif
529
530 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
531         void setAlwaysUseAcceleratedOverflowScroll(bool flag) { m_alwaysUseAcceleratedOverflowScroll = flag; }
532         bool alwaysUseAcceleratedOverflowScroll() const { return m_alwaysUseAcceleratedOverflowScroll; }
533 #endif
534         void setMediaPlaybackRequiresUserGesture(bool flag) { m_mediaPlaybackRequiresUserGesture = flag; };
535         bool mediaPlaybackRequiresUserGesture() const { return m_mediaPlaybackRequiresUserGesture; }
536
537         void setMediaPlaybackAllowsInline(bool flag) { m_mediaPlaybackAllowsInline = flag; };
538         bool mediaPlaybackAllowsInline() const { return m_mediaPlaybackAllowsInline; }
539
540         void setPasswordEchoEnabled(bool flag) { m_passwordEchoEnabled = flag; }
541         bool passwordEchoEnabled() const { return m_passwordEchoEnabled; }
542
543         void setSuppressesIncrementalRendering(bool flag) { m_suppressesIncrementalRendering = flag; }
544         bool suppressesIncrementalRendering() const { return m_suppressesIncrementalRendering; }
545         
546         void setBackspaceKeyNavigationEnabled(bool flag) { m_backspaceKeyNavigationEnabled = flag; }
547         bool backspaceKeyNavigationEnabled() const { return m_backspaceKeyNavigationEnabled; }
548         
549         void setPasswordEchoDurationInSeconds(double durationInSeconds) { m_passwordEchoDurationInSeconds = durationInSeconds; }
550         double passwordEchoDurationInSeconds() const { return m_passwordEchoDurationInSeconds; }
551
552 #if USE(SAFARI_THEME)
553         // Windows debugging pref (global) for switching between the Aqua look and a native windows look.
554         static void setShouldPaintNativeControls(bool);
555         static bool shouldPaintNativeControls() { return gShouldPaintNativeControls; }
556 #endif
557
558         static void setMockScrollbarsEnabled(bool flag);
559         static bool mockScrollbarsEnabled();
560
561         void setVisualWordMovementEnabled(bool enabled) { m_visualWordMovementEnabled = enabled; }
562         bool visualWordMovementEnabled() const { return m_visualWordMovementEnabled; }
563
564 #if ENABLE(VIDEO_TRACK)
565         void setShouldDisplaySubtitles(bool flag) { m_shouldDisplaySubtitles = flag; }
566         bool shouldDisplaySubtitles() const { return m_shouldDisplaySubtitles; }
567
568         void setShouldDisplayCaptions(bool flag) { m_shouldDisplayCaptions = flag; }
569         bool shouldDisplayCaptions() const { return m_shouldDisplayCaptions; }
570
571         void setShouldDisplayTextDescriptions(bool flag) { m_shouldDisplayTextDescriptions = flag; }
572         bool shouldDisplayTextDescriptions() const { return m_shouldDisplayTextDescriptions; }
573 #endif
574
575         void setScrollingCoordinatorEnabled(bool enabled) { m_scrollingCoordinatorEnabled = enabled; }
576         bool scrollingCoordinatorEnabled() const { return m_scrollingCoordinatorEnabled; }
577
578         void setNotificationsEnabled(bool enabled) { m_notificationsEnabled = enabled; }
579         bool notificationsEnabled() const { return m_notificationsEnabled; }
580
581         // Some apps needs isLoadingInAPISense to account for active subresource loaders.
582         void setNeedsIsLoadingInAPISenseQuirk(bool enabled) { m_needsIsLoadingInAPISenseQuirk = enabled; }
583         bool needsIsLoadingInAPISenseQuirk() const { return m_needsIsLoadingInAPISenseQuirk; }
584
585 #if ENABLE(TOUCH_EVENTS)
586         void setTouchEventEmulationEnabled(bool enabled) { m_touchEventEmulationEnabled = enabled; }
587         bool isTouchEventEmulationEnabled() const { return m_touchEventEmulationEnabled; }
588 #endif
589
590         void setShouldRespectImageOrientation(bool enabled) { m_shouldRespectImageOrientation = enabled; }
591         bool shouldRespectImageOrientation() const { return m_shouldRespectImageOrientation; }
592
593         void setWantsBalancedSetDefersLoadingBehavior(bool flag) { m_wantsBalancedSetDefersLoadingBehavior = flag; }
594         bool wantsBalancedSetDefersLoadingBehavior() const { return m_wantsBalancedSetDefersLoadingBehavior; }
595
596         void setIncrementalRenderingSuppressionTimeoutInSeconds(double timeout) { m_incrementalRenderingSuppressionTimeoutInSeconds = timeout; }
597         double incrementalRenderingSuppressionTimeoutInSeconds() const { return m_incrementalRenderingSuppressionTimeoutInSeconds; }
598
599         void setRequestAnimationFrameEnabled(bool enabled) { m_requestAnimationFrameEnabled = enabled; }
600         bool requestAnimationFrameEnabled() const { return m_requestAnimationFrameEnabled; }
601
602         void setDeviceSupportsTouch(bool enabled) { m_deviceSupportsTouch = enabled; }
603         bool deviceSupportsTouch() const { return m_deviceSupportsTouch; }
604
605         void setDeviceSupportsMouse(bool enabled) { m_deviceSupportsMouse = enabled; }
606         bool deviceSupportsMouse() const { return m_deviceSupportsMouse; }
607
608         void setNeedsDidFinishLoadOrderQuirk(bool needsQuirk) { m_needsDidFinishLoadOrderQuirk = needsQuirk; }
609         bool needsDidFinishLoadOrderQuirk() const { return m_needsDidFinishLoadOrderQuirk; }
610
611         void setFixedPositionCreatesStackingContext(bool creates) { m_fixedPositionCreatesStackingContext = creates; }
612         bool fixedPositionCreatesStackingContext() const { return m_fixedPositionCreatesStackingContext; }
613
614         void setSyncXHRInDocumentsEnabled(bool enabled) { m_syncXHRInDocumentsEnabled = enabled; }
615         bool syncXHRInDocumentsEnabled() const { return m_syncXHRInDocumentsEnabled; }
616
617         // When enabled, window.blur() does not change focus, and
618         // window.focus() only changes focus when invoked from the context that
619         // created the window.
620         void setWindowFocusRestricted(bool restricted) { m_windowFocusRestricted = restricted; }
621         bool windowFocusRestricted() const { return m_windowFocusRestricted; }
622
623 #if USE(JSC)
624         static void setShouldRespectPriorityInCSSAttributeSetters(bool);
625         static bool shouldRespectPriorityInCSSAttributeSetters();
626 #endif
627
628         void setCookieEnabled(bool enabled) { m_cookieEnabled = enabled; }
629         bool cookieEnabled() const { return m_cookieEnabled; }
630
631         void setDiagnosticLoggingEnabled(bool enabled) { m_diagnosticLoggingEnabled = enabled; }
632         bool diagnosticLoggingEnabled() const { return m_diagnosticLoggingEnabled; }
633
634         void setApplyPageScaleFactorInCompositor(bool enabled) { m_applyPageScaleFactorInCompositor = enabled; } 
635         bool applyPageScaleFactorInCompositor() const { return m_applyPageScaleFactorInCompositor; } 
636
637     private:
638         explicit Settings(Page*);
639
640         void initializeDefaultFontFamilies();
641
642         Page* m_page;
643
644         String m_defaultTextEncodingName;
645         String m_ftpDirectoryTemplatePath;
646         String m_localStorageDatabasePath;
647         KURL m_userStyleSheetLocation;
648         ScriptFontFamilyMap m_standardFontFamilyMap;
649         ScriptFontFamilyMap m_serifFontFamilyMap;
650         ScriptFontFamilyMap m_fixedFontFamilyMap;
651         ScriptFontFamilyMap m_sansSerifFontFamilyMap;
652         ScriptFontFamilyMap m_cursiveFontFamilyMap;
653         ScriptFontFamilyMap m_fantasyFontFamilyMap;
654         ScriptFontFamilyMap m_pictographFontFamilyMap;
655         EditableLinkBehavior m_editableLinkBehavior;
656         TextDirectionSubmenuInclusionBehavior m_textDirectionSubmenuInclusionBehavior;
657         double m_passwordEchoDurationInSeconds;
658         int m_minimumFontSize;
659         int m_minimumLogicalFontSize;
660         int m_defaultFontSize;
661         int m_defaultFixedFontSize;
662         int m_validationMessageTimerMagnification;
663         int m_minimumAccelerated2dCanvasSize;
664         int m_layoutFallbackWidth;
665         size_t m_maximumDecodedImageSize;
666         int m_deviceWidth;
667         int m_deviceHeight;
668         unsigned m_sessionStorageQuota;
669         unsigned m_editingBehaviorType;
670         unsigned m_maximumHTMLParserDOMTreeDepth;
671 #if ENABLE(TEXT_AUTOSIZING)
672         float m_textAutosizingFontScaleFactor;
673         IntSize m_textAutosizingWindowSizeOverride;
674         bool m_textAutosizingEnabled : 1;
675 #endif
676         bool m_isSpatialNavigationEnabled : 1;
677         bool m_isJavaEnabled : 1;
678         bool m_isJavaEnabledForLocalFiles : 1;
679         bool m_loadsImagesAutomatically : 1;
680         bool m_loadsSiteIconsIgnoringImageLoadingSetting : 1;
681         bool m_privateBrowsingEnabled : 1;
682         bool m_caretBrowsingEnabled : 1;
683         bool m_areImagesEnabled : 1;
684         bool m_isMediaEnabled : 1;
685         bool m_arePluginsEnabled : 1;
686         bool m_localStorageEnabled : 1;
687         bool m_isScriptEnabled : 1;
688         bool m_isWebSecurityEnabled : 1;
689         bool m_allowUniversalAccessFromFileURLs: 1;
690         bool m_allowFileAccessFromFileURLs: 1;
691         bool m_javaScriptCanOpenWindowsAutomatically : 1;
692         bool m_javaScriptCanAccessClipboard : 1;
693         bool m_shouldPrintBackgrounds : 1;
694         bool m_textAreasAreResizable : 1;
695 #if ENABLE(DASHBOARD_SUPPORT)
696         bool m_usesDashboardBackwardCompatibilityMode : 1;
697 #endif
698         bool m_needsAdobeFrameReloadingQuirk : 1;
699         bool m_needsKeyboardEventDisambiguationQuirks : 1;
700         bool m_treatsAnyTextCSSLinkAsStylesheet : 1;
701         bool m_needsLeopardMailQuirks : 1;
702         bool m_isDOMPasteAllowed : 1;
703         bool m_shrinksStandaloneImagesToFit : 1;
704         bool m_usesPageCache : 1;
705         bool m_pageCacheSupportsPlugins : 1;
706         bool m_showsURLsInToolTips : 1;
707         bool m_showsToolTipOverTruncatedText : 1;
708         bool m_forceFTPDirectoryListings : 1;
709         bool m_developerExtrasEnabled : 1;
710         bool m_javaScriptExperimentsEnabled : 1;
711         bool m_authorAndUserStylesEnabled : 1;
712         bool m_needsSiteSpecificQuirks : 1;
713         unsigned m_fontRenderingMode : 1;
714         bool m_frameFlatteningEnabled : 1;
715 #if ENABLE(WEB_ARCHIVE)
716         bool m_webArchiveDebugModeEnabled : 1;
717 #endif
718         bool m_localFileContentSniffingEnabled : 1;
719         bool m_inApplicationChromeMode : 1;
720         bool m_offlineWebApplicationCacheEnabled : 1;
721         bool m_enforceCSSMIMETypeInNoQuirksMode : 1;
722         bool m_usesEncodingDetector : 1;
723         bool m_allowScriptsToCloseWindows : 1;
724         bool m_canvasUsesAcceleratedDrawing : 1;
725         bool m_acceleratedDrawingEnabled : 1;
726         bool m_acceleratedFiltersEnabled : 1;
727         bool m_isCSSCustomFilterEnabled : 1;
728 #if ENABLE(CSS_REGIONS)
729         bool m_cssRegionsEnabled : 1;
730 #endif
731 #if ENABLE(CSS_VARIABLES)
732         bool m_cssVariablesEnabled : 1;
733 #endif
734         bool m_regionBasedColumnsEnabled : 1;
735         bool m_cssGridLayoutEnabled : 1;
736         bool m_downloadableBinaryFontsEnabled : 1;
737         bool m_xssAuditorEnabled : 1;
738         bool m_acceleratedCompositingEnabled : 1;
739         bool m_acceleratedCompositingFor3DTransformsEnabled : 1;
740         bool m_acceleratedCompositingForVideoEnabled : 1;
741         bool m_acceleratedCompositingForPluginsEnabled : 1;
742         bool m_acceleratedCompositingForCanvasEnabled : 1;
743         bool m_acceleratedCompositingForAnimationEnabled : 1;
744         bool m_acceleratedCompositingForFixedPositionEnabled : 1;
745         bool m_acceleratedCompositingForScrollableFramesEnabled : 1; // Works only in conjunction with forceCompositingMode
746 #if ENABLE(TIZEN_CSS_OVERFLOW_SCROLL_ACCELERATION)
747         bool m_alwaysUseAcceleratedOverflowScroll : 1;
748 #endif
749         bool m_showDebugBorders : 1;
750         bool m_showRepaintCounter : 1;
751         bool m_experimentalNotificationsEnabled : 1;
752         bool m_webGLEnabled : 1;
753         bool m_webGLErrorsToConsoleEnabled : 1;
754         bool m_openGLMultisamplingEnabled : 1;
755         bool m_privilegedWebGLExtensionsEnabled : 1;
756         bool m_webAudioEnabled : 1;
757         bool m_acceleratedCanvas2dEnabled : 1;
758         bool m_deferredCanvas2dEnabled : 1;
759         bool m_loadDeferringEnabled : 1;
760         bool m_tiledBackingStoreEnabled : 1;
761         bool m_paginateDuringLayoutEnabled : 1;
762         bool m_dnsPrefetchingEnabled : 1;
763 #if ENABLE(FULLSCREEN_API)
764         bool m_fullScreenAPIEnabled : 1;
765 #endif
766         bool m_asynchronousSpellCheckingEnabled : 1;
767         bool m_unifiedTextCheckerEnabled : 1;
768         bool m_memoryInfoEnabled : 1;
769         bool m_quantizedMemoryInfoEnabled : 1;
770         bool m_interactiveFormValidation : 1;
771         bool m_usePreHTML5ParserQuirks : 1;
772         bool m_hyperlinkAuditingEnabled : 1;
773         bool m_crossOriginCheckInGetMatchedCSSRulesDisabled : 1;
774         bool m_forceCompositingMode : 1;
775         bool m_shouldInjectUserScriptsInInitialEmptyDocument : 1;
776         bool m_fixedElementsLayoutRelativeToFrame : 1;
777         bool m_allowDisplayOfInsecureContent : 1;
778         bool m_allowRunningOfInsecureContent : 1;
779 #if ENABLE(SMOOTH_SCROLLING)
780         bool m_scrollAnimatorEnabled : 1;
781 #endif
782         bool m_mediaPlaybackRequiresUserGesture : 1;
783         bool m_mediaPlaybackAllowsInline : 1;
784         bool m_passwordEchoEnabled : 1;
785         bool m_suppressesIncrementalRendering : 1;
786         bool m_backspaceKeyNavigationEnabled : 1;
787         bool m_visualWordMovementEnabled : 1;
788
789 #if ENABLE(VIDEO_TRACK)
790         bool m_shouldDisplaySubtitles : 1;
791         bool m_shouldDisplayCaptions : 1;
792         bool m_shouldDisplayTextDescriptions : 1;
793 #endif
794         bool m_scrollingCoordinatorEnabled : 1;
795
796         bool m_notificationsEnabled : 1;
797         bool m_needsIsLoadingInAPISenseQuirk : 1;
798
799 #if ENABLE(TOUCH_EVENTS)
800         bool m_touchEventEmulationEnabled : 1;
801 #endif
802         bool m_shouldRespectImageOrientation : 1;
803         bool m_wantsBalancedSetDefersLoadingBehavior : 1;
804         bool m_requestAnimationFrameEnabled : 1;
805         bool m_deviceSupportsTouch : 1;
806         bool m_deviceSupportsMouse : 1;
807         bool m_needsDidFinishLoadOrderQuirk : 1;
808
809         bool m_fixedPositionCreatesStackingContext : 1;
810         bool m_syncXHRInDocumentsEnabled : 1;
811         bool m_cookieEnabled : 1;
812
813         bool m_windowFocusRestricted : 1;
814
815         bool m_diagnosticLoggingEnabled : 1;
816
817         bool m_applyPageScaleFactorInCompositor : 1;
818
819         Timer<Settings> m_loadsImagesAutomaticallyTimer;
820         void loadsImagesAutomaticallyTimerFired(Timer<Settings>*);
821         
822         double m_incrementalRenderingSuppressionTimeoutInSeconds;
823
824 #if USE(AVFOUNDATION)
825         static bool gAVFoundationEnabled;
826 #endif
827         static bool gMockScrollbarsEnabled;
828
829 #if USE(SAFARI_THEME)
830         static bool gShouldPaintNativeControls;
831 #endif
832 #if PLATFORM(WIN) || (OS(WINDOWS) && PLATFORM(WX))
833         static bool gShouldUseHighResolutionTimers;
834 #endif
835 #if USE(JSC)
836         static bool gShouldRespectPriorityInCSSAttributeSetters;
837 #endif
838 #if ENABLE(TIZEN_LOAD_REMOTE_IMAGES)
839         Timer<Settings> m_loadRemoteImagesTimer;
840         void loadRemoteImagesTimerFired(Timer<Settings>*);
841         bool m_loadRemoteImages;
842 #endif
843 #if ENABLE(TIZEN_ISF_PORT)
844         bool m_defaultKeypadEnabled :1;
845 #endif
846 #if ENABLE(TIZEN_WEBKIT2_MEMORY_SAVING_MODE)
847         bool m_memorySavingModeEnabled;
848 #endif
849     };
850
851 } // namespace WebCore
852
853 #endif // Settings_h