2 * Copyright (C) 2003, 2006, 2007, 2008, 2009 Apple Inc. All rights reserved.
3 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions
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.
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.
30 #include "EditingBehaviorTypes.h"
31 #include "FontRenderingMode.h"
34 #include <wtf/text/AtomicString.h>
40 enum EditableLinkBehavior {
41 EditableLinkDefaultBehavior,
42 EditableLinkAlwaysLive,
43 EditableLinkOnlyLiveWithShiftKey,
44 EditableLinkLiveWhenNotFocused,
48 enum TextDirectionSubmenuInclusionBehavior {
49 TextDirectionSubmenuNeverIncluded,
50 TextDirectionSubmenuAutomaticallyIncluded,
51 TextDirectionSubmenuAlwaysIncluded
54 class Settings : public Noncopyable {
58 void setStandardFontFamily(const AtomicString&);
59 const AtomicString& standardFontFamily() const { return m_standardFontFamily; }
61 void setFixedFontFamily(const AtomicString&);
62 const AtomicString& fixedFontFamily() const { return m_fixedFontFamily; }
64 void setSerifFontFamily(const AtomicString&);
65 const AtomicString& serifFontFamily() const { return m_serifFontFamily; }
67 void setSansSerifFontFamily(const AtomicString&);
68 const AtomicString& sansSerifFontFamily() const { return m_sansSerifFontFamily; }
70 void setCursiveFontFamily(const AtomicString&);
71 const AtomicString& cursiveFontFamily() const { return m_cursiveFontFamily; }
73 void setFantasyFontFamily(const AtomicString&);
74 const AtomicString& fantasyFontFamily() const { return m_fantasyFontFamily; }
76 void setMinimumFontSize(int);
77 int minimumFontSize() const { return m_minimumFontSize; }
79 void setMinimumLogicalFontSize(int);
80 int minimumLogicalFontSize() const { return m_minimumLogicalFontSize; }
82 void setDefaultFontSize(int);
83 int defaultFontSize() const { return m_defaultFontSize; }
85 void setDefaultFixedFontSize(int);
86 int defaultFixedFontSize() const { return m_defaultFixedFontSize; }
88 // Unlike areImagesEnabled, this only suppresses the network load of
89 // the image URL. A cached image will still be rendered if requested.
90 void setLoadsImagesAutomatically(bool);
91 bool loadsImagesAutomatically() const { return m_loadsImagesAutomatically; }
93 void setJavaScriptEnabled(bool);
94 // Instead of calling isJavaScriptEnabled directly, please consider calling
95 // ScriptController::canExecuteScripts, which takes things like the
96 // HTML sandbox attribute into account.
97 bool isJavaScriptEnabled() const { return m_isJavaScriptEnabled; }
99 void setWebSecurityEnabled(bool);
100 bool isWebSecurityEnabled() const { return m_isWebSecurityEnabled; }
102 void setAllowUniversalAccessFromFileURLs(bool);
103 bool allowUniversalAccessFromFileURLs() const { return m_allowUniversalAccessFromFileURLs; }
105 void setAllowFileAccessFromFileURLs(bool);
106 bool allowFileAccessFromFileURLs() const { return m_allowFileAccessFromFileURLs; }
108 void setJavaScriptCanOpenWindowsAutomatically(bool);
109 bool javaScriptCanOpenWindowsAutomatically() const { return m_javaScriptCanOpenWindowsAutomatically; }
111 void setJavaScriptCanAccessClipboard(bool);
112 bool javaScriptCanAccessClipboard() const { return m_javaScriptCanAccessClipboard; }
114 void setSpatialNavigationEnabled(bool);
115 bool isSpatialNavigationEnabled() const { return m_isSpatialNavigationEnabled; }
117 void setJavaEnabled(bool);
118 bool isJavaEnabled() const { return m_isJavaEnabled; }
120 void setImagesEnabled(bool);
121 bool areImagesEnabled() const { return m_areImagesEnabled; }
123 void setMediaEnabled(bool);
124 bool isMediaEnabled() const { return m_isMediaEnabled; }
126 void setPluginsEnabled(bool);
127 bool arePluginsEnabled() const { return m_arePluginsEnabled; }
129 void setLocalStorageEnabled(bool);
130 bool localStorageEnabled() const { return m_localStorageEnabled; }
132 #if ENABLE(DOM_STORAGE)
133 // Allow clients concerned with memory consumption to set a quota on session storage
134 // since the memory used won't be released until the Page is destroyed.
135 // Default is noQuota.
136 void setSessionStorageQuota(unsigned);
137 unsigned sessionStorageQuota() const { return m_sessionStorageQuota; }
140 // When this option is set, WebCore will avoid storing any record of browsing activity
141 // that may persist on disk or remain displayed when the option is reset.
142 // This option does not affect the storage of such information in RAM.
143 // The following functions respect this setting:
144 // - HTML5/DOM Storage
146 // - Console Messages
148 // - Application Cache
149 // - Back/Forward Page History
150 // - Page Search Results
151 void setPrivateBrowsingEnabled(bool);
152 bool privateBrowsingEnabled() const { return m_privateBrowsingEnabled; }
154 void setCaretBrowsingEnabled(bool);
155 bool caretBrowsingEnabled() const { return m_caretBrowsingEnabled; }
157 void setDefaultTextEncodingName(const String&);
158 const String& defaultTextEncodingName() const { return m_defaultTextEncodingName; }
160 void setUsesEncodingDetector(bool);
161 bool usesEncodingDetector() const { return m_usesEncodingDetector; }
163 void setDNSPrefetchingEnabled(bool);
164 bool dnsPrefetchingEnabled() const { return m_dnsPrefetchingEnabled; }
166 void setUserStyleSheetLocation(const KURL&);
167 const KURL& userStyleSheetLocation() const { return m_userStyleSheetLocation; }
169 void setShouldPrintBackgrounds(bool);
170 bool shouldPrintBackgrounds() const { return m_shouldPrintBackgrounds; }
172 void setTextAreasAreResizable(bool);
173 bool textAreasAreResizable() const { return m_textAreasAreResizable; }
175 void setEditableLinkBehavior(EditableLinkBehavior);
176 EditableLinkBehavior editableLinkBehavior() const { return m_editableLinkBehavior; }
178 void setTextDirectionSubmenuInclusionBehavior(TextDirectionSubmenuInclusionBehavior);
179 TextDirectionSubmenuInclusionBehavior textDirectionSubmenuInclusionBehavior() const { return m_textDirectionSubmenuInclusionBehavior; }
181 #if ENABLE(DASHBOARD_SUPPORT)
182 void setUsesDashboardBackwardCompatibilityMode(bool);
183 bool usesDashboardBackwardCompatibilityMode() const { return m_usesDashboardBackwardCompatibilityMode; }
186 void setNeedsAdobeFrameReloadingQuirk(bool);
187 bool needsAcrobatFrameReloadingQuirk() const { return m_needsAdobeFrameReloadingQuirk; }
189 void setNeedsKeyboardEventDisambiguationQuirks(bool);
190 bool needsKeyboardEventDisambiguationQuirks() const { return m_needsKeyboardEventDisambiguationQuirks; }
192 void setTreatsAnyTextCSSLinkAsStylesheet(bool);
193 bool treatsAnyTextCSSLinkAsStylesheet() const { return m_treatsAnyTextCSSLinkAsStylesheet; }
195 void setNeedsLeopardMailQuirks(bool);
196 bool needsLeopardMailQuirks() const { return m_needsLeopardMailQuirks; }
198 void setNeedsTigerMailQuirks(bool);
199 bool needsTigerMailQuirks() const { return m_needsTigerMailQuirks; }
201 void setDOMPasteAllowed(bool);
202 bool isDOMPasteAllowed() const { return m_isDOMPasteAllowed; }
204 void setUsesPageCache(bool);
205 bool usesPageCache() const { return m_usesPageCache; }
207 void setShrinksStandaloneImagesToFit(bool);
208 bool shrinksStandaloneImagesToFit() const { return m_shrinksStandaloneImagesToFit; }
210 void setShowsURLsInToolTips(bool);
211 bool showsURLsInToolTips() const { return m_showsURLsInToolTips; }
213 void setFTPDirectoryTemplatePath(const String&);
214 const String& ftpDirectoryTemplatePath() const { return m_ftpDirectoryTemplatePath; }
216 void setForceFTPDirectoryListings(bool);
217 bool forceFTPDirectoryListings() const { return m_forceFTPDirectoryListings; }
219 void setDeveloperExtrasEnabled(bool);
220 bool developerExtrasEnabled() const { return m_developerExtrasEnabled; }
222 void setFrameFlatteningEnabled(bool);
223 bool frameFlatteningEnabled() const { return m_frameFlatteningEnabled; }
225 void setAuthorAndUserStylesEnabled(bool);
226 bool authorAndUserStylesEnabled() const { return m_authorAndUserStylesEnabled; }
228 void setFontRenderingMode(FontRenderingMode mode);
229 FontRenderingMode fontRenderingMode() const;
231 void setNeedsSiteSpecificQuirks(bool);
232 bool needsSiteSpecificQuirks() const { return m_needsSiteSpecificQuirks; }
234 void setWebArchiveDebugModeEnabled(bool);
235 bool webArchiveDebugModeEnabled() const { return m_webArchiveDebugModeEnabled; }
237 void setLocalFileContentSniffingEnabled(bool);
238 bool localFileContentSniffingEnabled() const { return m_localFileContentSniffingEnabled; }
240 void setLocalStorageDatabasePath(const String&);
241 const String& localStorageDatabasePath() const { return m_localStorageDatabasePath; }
243 void setApplicationChromeMode(bool);
244 bool inApplicationChromeMode() const { return m_inApplicationChromeMode; }
246 void setOfflineWebApplicationCacheEnabled(bool);
247 bool offlineWebApplicationCacheEnabled() const { return m_offlineWebApplicationCacheEnabled; }
249 void setShouldPaintCustomScrollbars(bool);
250 bool shouldPaintCustomScrollbars() const { return m_shouldPaintCustomScrollbars; }
252 void setZoomMode(ZoomMode);
253 ZoomMode zoomMode() const { return m_zoomMode; }
255 void setEnforceCSSMIMETypeInStrictMode(bool);
256 bool enforceCSSMIMETypeInStrictMode() { return m_enforceCSSMIMETypeInStrictMode; }
258 void setMaximumDecodedImageSize(size_t size) { m_maximumDecodedImageSize = size; }
259 size_t maximumDecodedImageSize() const { return m_maximumDecodedImageSize; }
261 #if USE(SAFARI_THEME)
262 // Windows debugging pref (global) for switching between the Aqua look and a native windows look.
263 static void setShouldPaintNativeControls(bool);
264 static bool shouldPaintNativeControls() { return gShouldPaintNativeControls; }
267 void setAllowScriptsToCloseWindows(bool);
268 bool allowScriptsToCloseWindows() const { return m_allowScriptsToCloseWindows; }
270 void setEditingBehaviorType(EditingBehaviorType behavior) { m_editingBehaviorType = behavior; }
271 EditingBehaviorType editingBehaviorType() const { return static_cast<EditingBehaviorType>(m_editingBehaviorType); }
273 void setDownloadableBinaryFontsEnabled(bool);
274 bool downloadableBinaryFontsEnabled() const { return m_downloadableBinaryFontsEnabled; }
276 void setXSSAuditorEnabled(bool);
277 bool xssAuditorEnabled() const { return m_xssAuditorEnabled; }
279 void setAcceleratedCompositingEnabled(bool);
280 bool acceleratedCompositingEnabled() const { return m_acceleratedCompositingEnabled; }
282 void setShowDebugBorders(bool);
283 bool showDebugBorders() const { return m_showDebugBorders; }
285 void setShowRepaintCounter(bool);
286 bool showRepaintCounter() const { return m_showRepaintCounter; }
288 void setExperimentalNotificationsEnabled(bool);
289 bool experimentalNotificationsEnabled() const { return m_experimentalNotificationsEnabled; }
291 #if PLATFORM(WIN) || (OS(WINDOWS) && PLATFORM(WX))
292 static void setShouldUseHighResolutionTimers(bool);
293 static bool shouldUseHighResolutionTimers() { return gShouldUseHighResolutionTimers; }
296 void setPluginAllowedRunTime(unsigned);
297 unsigned pluginAllowedRunTime() const { return m_pluginAllowedRunTime; }
299 void setWebGLEnabled(bool);
300 bool webGLEnabled() const { return m_webGLEnabled; }
302 void setAccelerated2dCanvasEnabled(bool);
303 bool accelerated2dCanvasEnabled() const { return m_acceleratedCanvas2dEnabled; }
305 void setLoadDeferringEnabled(bool);
306 bool loadDeferringEnabled() const { return m_loadDeferringEnabled; }
308 void setTiledBackingStoreEnabled(bool);
309 bool tiledBackingStoreEnabled() const { return m_tiledBackingStoreEnabled; }
311 void setPaginateDuringLayoutEnabled(bool flag) { m_paginateDuringLayoutEnabled = flag; }
312 bool paginateDuringLayoutEnabled() const { return m_paginateDuringLayoutEnabled; }
314 void setMemoryInfoEnabled(bool flag) { m_memoryInfoEnabled = flag; }
315 bool memoryInfoEnabled() const { return m_memoryInfoEnabled; }
317 // This setting will be removed when an HTML5 compatibility issue is
318 // resolved and WebKit implementation of interactive validation is
319 // completed. See http://webkit.org/b/40520, http://webkit.org/b/40747,
320 // and http://webkit.org/b/40908
321 void setInteractiveFormValidationEnabled(bool flag) { m_interactiveFormValidation = flag; }
322 bool interactiveFormValidationEnabled() const { return m_interactiveFormValidation; }
327 String m_defaultTextEncodingName;
328 String m_ftpDirectoryTemplatePath;
329 String m_localStorageDatabasePath;
330 KURL m_userStyleSheetLocation;
331 AtomicString m_standardFontFamily;
332 AtomicString m_fixedFontFamily;
333 AtomicString m_serifFontFamily;
334 AtomicString m_sansSerifFontFamily;
335 AtomicString m_cursiveFontFamily;
336 AtomicString m_fantasyFontFamily;
337 EditableLinkBehavior m_editableLinkBehavior;
338 TextDirectionSubmenuInclusionBehavior m_textDirectionSubmenuInclusionBehavior;
339 int m_minimumFontSize;
340 int m_minimumLogicalFontSize;
341 int m_defaultFontSize;
342 int m_defaultFixedFontSize;
343 size_t m_maximumDecodedImageSize;
344 #if ENABLE(DOM_STORAGE)
345 unsigned m_sessionStorageQuota;
347 unsigned m_pluginAllowedRunTime;
349 bool m_isSpatialNavigationEnabled : 1;
350 bool m_isJavaEnabled : 1;
351 bool m_loadsImagesAutomatically : 1;
352 bool m_privateBrowsingEnabled : 1;
353 bool m_caretBrowsingEnabled : 1;
354 bool m_areImagesEnabled : 1;
355 bool m_isMediaEnabled : 1;
356 bool m_arePluginsEnabled : 1;
357 bool m_localStorageEnabled : 1;
358 bool m_isJavaScriptEnabled : 1;
359 bool m_isWebSecurityEnabled : 1;
360 bool m_allowUniversalAccessFromFileURLs: 1;
361 bool m_allowFileAccessFromFileURLs: 1;
362 bool m_javaScriptCanOpenWindowsAutomatically : 1;
363 bool m_javaScriptCanAccessClipboard : 1;
364 bool m_shouldPrintBackgrounds : 1;
365 bool m_textAreasAreResizable : 1;
366 #if ENABLE(DASHBOARD_SUPPORT)
367 bool m_usesDashboardBackwardCompatibilityMode : 1;
369 bool m_needsAdobeFrameReloadingQuirk : 1;
370 bool m_needsKeyboardEventDisambiguationQuirks : 1;
371 bool m_treatsAnyTextCSSLinkAsStylesheet : 1;
372 bool m_needsLeopardMailQuirks : 1;
373 bool m_needsTigerMailQuirks : 1;
374 bool m_isDOMPasteAllowed : 1;
375 bool m_shrinksStandaloneImagesToFit : 1;
376 bool m_usesPageCache: 1;
377 bool m_showsURLsInToolTips : 1;
378 bool m_forceFTPDirectoryListings : 1;
379 bool m_developerExtrasEnabled : 1;
380 bool m_authorAndUserStylesEnabled : 1;
381 bool m_needsSiteSpecificQuirks : 1;
382 unsigned m_fontRenderingMode : 1;
383 bool m_frameFlatteningEnabled : 1;
384 bool m_webArchiveDebugModeEnabled : 1;
385 bool m_localFileContentSniffingEnabled : 1;
386 bool m_inApplicationChromeMode : 1;
387 bool m_offlineWebApplicationCacheEnabled : 1;
388 bool m_shouldPaintCustomScrollbars : 1;
389 bool m_enforceCSSMIMETypeInStrictMode : 1;
390 bool m_usesEncodingDetector : 1;
391 bool m_allowScriptsToCloseWindows : 1;
392 unsigned m_editingBehaviorType : 1;
393 bool m_downloadableBinaryFontsEnabled : 1;
394 bool m_xssAuditorEnabled : 1;
395 bool m_acceleratedCompositingEnabled : 1;
396 bool m_showDebugBorders : 1;
397 bool m_showRepaintCounter : 1;
398 bool m_experimentalNotificationsEnabled : 1;
399 bool m_webGLEnabled : 1;
400 bool m_acceleratedCanvas2dEnabled : 1;
401 bool m_loadDeferringEnabled : 1;
402 bool m_tiledBackingStoreEnabled : 1;
403 bool m_paginateDuringLayoutEnabled : 1;
404 bool m_dnsPrefetchingEnabled : 1;
405 bool m_memoryInfoEnabled: 1;
406 bool m_interactiveFormValidation: 1;
408 #if USE(SAFARI_THEME)
409 static bool gShouldPaintNativeControls;
411 #if PLATFORM(WIN) || (OS(WINDOWS) && PLATFORM(WX))
412 static bool gShouldUseHighResolutionTimers;
416 } // namespace WebCore