2 * Copyright (C) 2005-2016 Apple Inc. All rights reserved.
4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions
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 * 3. Neither the name of Apple Inc. ("Apple") nor the names of
14 * its contributors may be used to endorse or promote products derived
15 * from this software without specific prior written permission.
17 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
18 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
19 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
20 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
21 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
22 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
23 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
24 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
26 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29 #import <WebKitLegacy/WebPreferences.h>
32 #import <Quartz/Quartz.h>
36 WebKitEditableLinkDefaultBehavior,
37 WebKitEditableLinkAlwaysLive,
38 WebKitEditableLinkOnlyLiveWithShiftKey,
39 WebKitEditableLinkLiveWhenNotFocused,
40 WebKitEditableLinkNeverLive
41 } WebKitEditableLinkBehavior;
44 WebTextDirectionSubmenuNeverIncluded,
45 WebTextDirectionSubmenuAutomaticallyIncluded,
46 WebTextDirectionSubmenuAlwaysIncluded
47 } WebTextDirectionSubmenuInclusionBehavior;
50 WebAllowAllStorage = 0,
51 WebBlockThirdPartyStorage,
53 } WebStorageBlockingPolicy;
56 WebKitJavaScriptRuntimeFlagsAllEnabled = 0
57 } WebKitJavaScriptRuntimeFlags;
59 extern NSString *WebPreferencesChangedNotification;
60 extern NSString *WebPreferencesRemovedNotification;
61 extern NSString *WebPreferencesChangedInternalNotification;
62 extern NSString *WebPreferencesCacheModelChangedInternalNotification;
64 @interface WebPreferences (WebPrivate)
66 // Preferences that might be public in a future release
68 - (BOOL)isDNSPrefetchingEnabled;
69 - (void)setDNSPrefetchingEnabled:(BOOL)flag;
71 - (BOOL)developerExtrasEnabled;
72 - (void)setDeveloperExtrasEnabled:(BOOL)flag;
74 - (WebKitJavaScriptRuntimeFlags)javaScriptRuntimeFlags;
75 - (void)setJavaScriptRuntimeFlags:(WebKitJavaScriptRuntimeFlags)flags;
77 - (BOOL)authorAndUserStylesEnabled;
78 - (void)setAuthorAndUserStylesEnabled:(BOOL)flag;
80 - (BOOL)applicationChromeModeEnabled;
81 - (void)setApplicationChromeModeEnabled:(BOOL)flag;
83 - (BOOL)usesEncodingDetector;
84 - (void)setUsesEncodingDetector:(BOOL)flag;
87 - (BOOL)respectStandardStyleKeyEquivalents;
88 - (void)setRespectStandardStyleKeyEquivalents:(BOOL)flag;
90 - (BOOL)showsURLsInToolTips;
91 - (void)setShowsURLsInToolTips:(BOOL)flag;
93 - (BOOL)showsToolTipOverTruncatedText;
94 - (void)setShowsToolTipOverTruncatedText:(BOOL)flag;
96 - (BOOL)textAreasAreResizable;
97 - (void)setTextAreasAreResizable:(BOOL)flag;
99 - (PDFDisplayMode)PDFDisplayMode;
100 - (void)setPDFDisplayMode:(PDFDisplayMode)mode;
103 - (BOOL)shrinksStandaloneImagesToFit;
104 - (void)setShrinksStandaloneImagesToFit:(BOOL)flag;
106 - (BOOL)automaticallyDetectsCacheModel;
107 - (void)setAutomaticallyDetectsCacheModel:(BOOL)automaticallyDetectsCacheModel;
109 - (BOOL)domTimersThrottlingEnabled;
110 - (void)setDOMTimersThrottlingEnabled:(BOOL)domTimersThrottlingEnabled;
112 - (BOOL)webArchiveDebugModeEnabled;
113 - (void)setWebArchiveDebugModeEnabled:(BOOL)webArchiveDebugModeEnabled;
115 - (BOOL)localFileContentSniffingEnabled;
116 - (void)setLocalFileContentSniffingEnabled:(BOOL)localFileContentSniffingEnabled;
118 - (BOOL)offlineWebApplicationCacheEnabled;
119 - (void)setOfflineWebApplicationCacheEnabled:(BOOL)offlineWebApplicationCacheEnabled;
121 - (BOOL)databasesEnabled;
122 - (void)setDatabasesEnabled:(BOOL)databasesEnabled;
125 - (BOOL)storageTrackerEnabled;
126 - (void)setStorageTrackerEnabled:(BOOL)storageTrackerEnabled;
129 - (BOOL)localStorageEnabled;
130 - (void)setLocalStorageEnabled:(BOOL)localStorageEnabled;
132 - (BOOL)isWebSecurityEnabled;
133 - (void)setWebSecurityEnabled:(BOOL)flag;
135 - (BOOL)allowUniversalAccessFromFileURLs;
136 - (void)setAllowUniversalAccessFromFileURLs:(BOOL)flag;
138 - (BOOL)allowFileAccessFromFileURLs;
139 - (void)setAllowFileAccessFromFileURLs:(BOOL)flag;
141 - (BOOL)needsStorageAccessFromFileURLsQuirk;
142 - (void)setNeedsStorageAccessFromFileURLsQuirk:(BOOL)flag;
144 - (BOOL)zoomsTextOnly;
145 - (void)setZoomsTextOnly:(BOOL)zoomsTextOnly;
147 - (BOOL)javaScriptCanAccessClipboard;
148 - (void)setJavaScriptCanAccessClipboard:(BOOL)flag;
150 - (BOOL)isXSSAuditorEnabled;
151 - (void)setXSSAuditorEnabled:(BOOL)flag;
153 - (BOOL)experimentalNotificationsEnabled;
154 - (void)setExperimentalNotificationsEnabled:(BOOL)notificationsEnabled;
156 - (BOOL)isFrameFlatteningEnabled;
157 - (void)setFrameFlatteningEnabled:(BOOL)flag;
159 - (BOOL)isSpatialNavigationEnabled;
160 - (void)setSpatialNavigationEnabled:(BOOL)flag;
162 - (void)setSubtleCryptoEnabled:(BOOL)flag;
163 - (BOOL)subtleCryptoEnabled;
165 #if !TARGET_OS_IPHONE
166 // zero means do AutoScale
167 - (float)PDFScaleFactor;
168 - (void)setPDFScaleFactor:(float)scale;
171 - (int64_t)applicationCacheTotalQuota;
172 - (void)setApplicationCacheTotalQuota:(int64_t)quota;
174 - (int64_t)applicationCacheDefaultOriginQuota;
175 - (void)setApplicationCacheDefaultOriginQuota:(int64_t)quota;
177 - (WebKitEditableLinkBehavior)editableLinkBehavior;
178 - (void)setEditableLinkBehavior:(WebKitEditableLinkBehavior)behavior;
180 - (WebTextDirectionSubmenuInclusionBehavior)textDirectionSubmenuInclusionBehavior;
181 - (void)setTextDirectionSubmenuInclusionBehavior:(WebTextDirectionSubmenuInclusionBehavior)behavior;
183 // Used to set preference specified in the test via LayoutTestController.overridePreference(..).
184 // For use with DumpRenderTree only.
185 - (void)_setPreferenceForTestWithValue:(NSString *)value forKey:(NSString *)key;
187 // If site-specific spoofing is enabled, some pages that do inappropriate user-agent string checks will be
188 // passed a nonstandard user-agent string to get them to work correctly. This method might be removed in
189 // the future when there's no more need for it.
190 - (BOOL)_useSiteSpecificSpoofing;
191 - (void)_setUseSiteSpecificSpoofing:(BOOL)newValue;
193 // WARNING: Allowing paste through the DOM API opens a security hole. We only use it for testing purposes.
194 - (BOOL)isDOMPasteAllowed;
195 - (void)setDOMPasteAllowed:(BOOL)DOMPasteAllowed;
197 - (NSString *)_ftpDirectoryTemplatePath;
198 - (void)_setFTPDirectoryTemplatePath:(NSString *)path;
200 - (void)_setForceFTPDirectoryListings:(BOOL)force;
201 - (BOOL)_forceFTPDirectoryListings;
203 - (NSString *)_localStorageDatabasePath;
204 - (void)_setLocalStorageDatabasePath:(NSString *)path;
206 - (BOOL)acceleratedDrawingEnabled;
207 - (void)setAcceleratedDrawingEnabled:(BOOL)enabled;
209 - (BOOL)displayListDrawingEnabled;
210 - (void)setDisplayListDrawingEnabled:(BOOL)enabled;
212 - (BOOL)resourceLoadStatisticsEnabled;
213 - (void)setResourceLoadStatisticsEnabled:(BOOL)enabled;
215 - (BOOL)canvasUsesAcceleratedDrawing;
216 - (void)setCanvasUsesAcceleratedDrawing:(BOOL)enabled;
218 - (BOOL)acceleratedCompositingEnabled;
219 - (void)setAcceleratedCompositingEnabled:(BOOL)enabled;
221 - (BOOL)showDebugBorders;
222 - (void)setShowDebugBorders:(BOOL)show;
224 - (BOOL)simpleLineLayoutDebugBordersEnabled;
225 - (void)setSimpleLineLayoutDebugBordersEnabled:(BOOL)enabled;
227 - (BOOL)showRepaintCounter;
228 - (void)setShowRepaintCounter:(BOOL)show;
230 - (BOOL)webAudioEnabled;
231 - (void)setWebAudioEnabled:(BOOL)enabled;
233 - (BOOL)subpixelCSSOMElementMetricsEnabled;
234 - (void)setSubpixelCSSOMElementMetricsEnabled:(BOOL)enabled;
236 - (BOOL)webGLEnabled;
237 - (void)setWebGLEnabled:(BOOL)enabled;
239 - (BOOL)webGL2Enabled;
240 - (void)setWebGL2Enabled:(BOOL)enabled;
242 - (BOOL)forceSoftwareWebGLRendering;
243 - (void)setForceSoftwareWebGLRendering:(BOOL)forced;
245 - (BOOL)accelerated2dCanvasEnabled;
246 - (void)setAccelerated2dCanvasEnabled:(BOOL)enabled;
248 - (BOOL)paginateDuringLayoutEnabled;
249 - (void)setPaginateDuringLayoutEnabled:(BOOL)flag;
251 - (BOOL)hyperlinkAuditingEnabled;
252 - (void)setHyperlinkAuditingEnabled:(BOOL)enabled;
254 // Deprecated. Use -setVideoPlaybackRequiresUserGesture and -setAudioPlaybackRequiresUserGesture instead.
255 - (void)setMediaPlaybackRequiresUserGesture:(BOOL)flag;
256 // Deprecated. Use -videoPlaybackRequiresUserGesture and -audioPlaybackRequiresUserGesture instead.
257 - (BOOL)mediaPlaybackRequiresUserGesture;
259 - (void)setVideoPlaybackRequiresUserGesture:(BOOL)flag;
260 - (BOOL)videoPlaybackRequiresUserGesture;
262 - (void)setAudioPlaybackRequiresUserGesture:(BOOL)flag;
263 - (BOOL)audioPlaybackRequiresUserGesture;
265 - (void)setOverrideUserGestureRequirementForMainContent:(BOOL)flag;
266 - (BOOL)overrideUserGestureRequirementForMainContent;
268 - (void)setMediaPlaybackAllowsInline:(BOOL)flag;
269 - (BOOL)mediaPlaybackAllowsInline;
271 - (void)setInlineMediaPlaybackRequiresPlaysInlineAttribute:(BOOL)flag;
272 - (BOOL)inlineMediaPlaybackRequiresPlaysInlineAttribute;
274 - (void)setInvisibleAutoplayNotPermitted:(BOOL)flag;
275 - (BOOL)invisibleAutoplayNotPermitted;
277 - (void)setMediaControlsScaleWithPageZoom:(BOOL)flag;
278 - (BOOL)mediaControlsScaleWithPageZoom;
280 - (void)setAllowsAlternateFullscreen:(BOOL)flag;
281 - (BOOL)allowsAlternateFullscreen;
283 - (void)setAllowsPictureInPictureMediaPlayback:(BOOL)flag;
284 - (BOOL)allowsPictureInPictureMediaPlayback;
286 - (NSString *)pictographFontFamily;
287 - (void)setPictographFontFamily:(NSString *)family;
289 - (BOOL)pageCacheSupportsPlugins;
290 - (void)setPageCacheSupportsPlugins:(BOOL)flag;
292 // This is a global setting.
293 - (BOOL)mockScrollbarsEnabled;
294 - (void)setMockScrollbarsEnabled:(BOOL)flag;
297 // This is a global setting.
298 - (unsigned)audioSessionCategoryOverride;
299 - (void)setAudioSessionCategoryOverride:(unsigned)override;
301 - (BOOL)avKitEnabled;
302 - (void)setAVKitEnabled:(bool)flag;
304 // WARNING: this affect network performance. This must not be enabled for production use.
305 // Enabling this makes WebCore reports the network data usage.
306 // This is a global setting.
307 - (void)setNetworkDataUsageTrackingEnabled:(bool)trackingEnabled;
308 - (BOOL)networkDataUsageTrackingEnabled;
310 - (void)setNetworkInterfaceName:(NSString *)name;
311 - (NSString *)networkInterfaceName;
313 - (void)_setMinimumZoomFontSize:(float)size;
314 - (float)_minimumZoomFontSize;
316 // Deprecated. Has no effect.
317 - (void)setDiskImageCacheEnabled:(BOOL)enabled;
319 - (void)setMediaPlaybackAllowsAirPlay:(BOOL)flag;
320 - (BOOL)mediaPlaybackAllowsAirPlay;
323 - (void)_setTextAutosizingEnabled:(BOOL)enabled;
324 - (BOOL)_textAutosizingEnabled;
326 - (BOOL)isInheritURIQueryComponentEnabled;
327 - (void)setEnableInheritURIQueryComponent:(BOOL)flag;
329 // Other private methods
332 - (void)_setStandalone:(BOOL)flag;
333 - (void)_setTelephoneNumberParsingEnabled:(BOOL)flag;
334 - (BOOL)_telephoneNumberParsingEnabled;
335 - (void)_setAllowMultiElementImplicitFormSubmission:(BOOL)flag;
336 - (BOOL)_allowMultiElementImplicitFormSubmission;
337 - (void)_setAlwaysRequestGeolocationPermission:(BOOL)flag;
338 - (BOOL)_alwaysRequestGeolocationPermission;
339 - (void)_setAlwaysUseAcceleratedOverflowScroll:(BOOL)flag;
340 - (BOOL)_alwaysUseAcceleratedOverflowScroll;
341 - (void)_setLayoutInterval:(int)milliseconds;
342 - (int)_layoutInterval; // Milliseonds.
343 - (void)_setMaxParseDuration:(float)d;
344 - (float)_maxParseDuration;
345 - (void)_setInterpolationQuality:(int)quality;
346 - (int)_interpolationQuality;
347 - (BOOL)_allowPasswordEcho;
348 - (float)_passwordEchoDuration;
350 - (void)_postPreferencesChangedNotification;
351 - (void)_postPreferencesChangedAPINotification;
352 + (WebPreferences *)_getInstanceForIdentifier:(NSString *)identifier;
353 + (void)_setInstance:(WebPreferences *)instance forIdentifier:(NSString *)identifier;
354 + (void)_removeReferenceForIdentifier:(NSString *)identifier;
355 - (NSTimeInterval)_backForwardCacheExpirationInterval;
356 + (CFStringEncoding)_systemCFStringEncoding;
357 + (void)_setInitialDefaultTextEncodingToSystemEncoding;
358 + (void)_setIBCreatorID:(NSString *)string;
360 // For DumpRenderTree use only.
361 + (void)_switchNetworkLoaderToNewTestingSession;
362 + (void)_setCurrentNetworkLoaderSessionCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)cookieAcceptPolicy;
363 + (void)_clearNetworkLoaderSession;
365 + (void)setWebKitLinkTimeVersion:(int)version;
367 // For WebView's use only.
368 - (void)willAddToWebView;
369 - (void)didRemoveFromWebView;
371 // Full screen support is dependent on WebCore/WebKit being
372 // compiled with ENABLE_FULLSCREEN_API.
373 - (void)setFullScreenEnabled:(BOOL)flag;
374 - (BOOL)fullScreenEnabled;
376 - (void)setAsynchronousSpellCheckingEnabled:(BOOL)flag;
377 - (BOOL)asynchronousSpellCheckingEnabled;
379 - (void)setUsePreHTML5ParserQuirks:(BOOL)flag;
380 - (BOOL)usePreHTML5ParserQuirks;
382 - (void)setLoadsSiteIconsIgnoringImageLoadingPreference: (BOOL)flag;
383 - (BOOL)loadsSiteIconsIgnoringImageLoadingPreference;
385 // AVFoundation support is dependent on WebCore/WebKit being
386 // compiled with USE_AVFOUNDATION.
387 - (void)setAVFoundationEnabled:(BOOL)flag;
388 - (BOOL)isAVFoundationEnabled;
390 - (void)setAVFoundationNSURLSessionEnabled:(BOOL)flag;
391 - (BOOL)isAVFoundationNSURLSessionEnabled;
393 - (void)setQTKitEnabled:(BOOL)flag;
394 - (BOOL)isQTKitEnabled;
396 // Deprecated, has no effect.
397 - (void)setVideoPluginProxyEnabled:(BOOL)flag;
398 - (BOOL)isVideoPluginProxyEnabled;
400 // WebSocket support depends on ENABLE(WEB_SOCKETS).
401 - (void)setHixie76WebSocketProtocolEnabled:(BOOL)flag;
402 - (BOOL)isHixie76WebSocketProtocolEnabled;
405 - (void)_invalidateCachedPreferences;
406 - (void)_synchronizeWebStoragePolicyWithCookiePolicy;
409 - (void)setBackspaceKeyNavigationEnabled:(BOOL)flag;
410 - (BOOL)backspaceKeyNavigationEnabled;
412 - (void)setWantsBalancedSetDefersLoadingBehavior:(BOOL)flag;
413 - (BOOL)wantsBalancedSetDefersLoadingBehavior;
415 - (void)setShouldDisplaySubtitles:(BOOL)flag;
416 - (BOOL)shouldDisplaySubtitles;
418 - (void)setShouldDisplayCaptions:(BOOL)flag;
419 - (BOOL)shouldDisplayCaptions;
421 - (void)setShouldDisplayTextDescriptions:(BOOL)flag;
422 - (BOOL)shouldDisplayTextDescriptions;
424 - (void)setNotificationsEnabled:(BOOL)flag;
425 - (BOOL)notificationsEnabled;
427 - (void)setShouldRespectImageOrientation:(BOOL)flag;
428 - (BOOL)shouldRespectImageOrientation;
430 - (BOOL)requestAnimationFrameEnabled;
431 - (void)setRequestAnimationFrameEnabled:(BOOL)enabled;
433 - (void)setIncrementalRenderingSuppressionTimeoutInSeconds:(NSTimeInterval)timeout;
434 - (NSTimeInterval)incrementalRenderingSuppressionTimeoutInSeconds;
436 - (BOOL)diagnosticLoggingEnabled;
437 - (void)setDiagnosticLoggingEnabled:(BOOL)enabled;
439 - (void)setStorageBlockingPolicy:(WebStorageBlockingPolicy)storageBlockingPolicy;
440 - (WebStorageBlockingPolicy)storageBlockingPolicy;
442 - (BOOL)plugInSnapshottingEnabled;
443 - (void)setPlugInSnapshottingEnabled:(BOOL)enabled;
445 - (BOOL)hiddenPageDOMTimerThrottlingEnabled;
446 - (void)setHiddenPageDOMTimerThrottlingEnabled:(BOOL)flag;
448 - (BOOL)hiddenPageCSSAnimationSuspensionEnabled;
449 - (void)setHiddenPageCSSAnimationSuspensionEnabled:(BOOL)flag;
451 - (BOOL)lowPowerVideoAudioBufferSizeEnabled;
452 - (void)setLowPowerVideoAudioBufferSizeEnabled:(BOOL)enabled;
454 - (void)setUseLegacyTextAlignPositionedElementBehavior:(BOOL)flag;
455 - (BOOL)useLegacyTextAlignPositionedElementBehavior;
457 - (void)setMediaSourceEnabled:(BOOL)flag;
458 - (BOOL)mediaSourceEnabled;
460 - (void)setShouldConvertPositionStyleOnCopy:(BOOL)flag;
461 - (BOOL)shouldConvertPositionStyleOnCopy;
463 - (void)setImageControlsEnabled:(BOOL)flag;
464 - (BOOL)imageControlsEnabled;
466 - (void)setServiceControlsEnabled:(BOOL)flag;
467 - (BOOL)serviceControlsEnabled;
469 - (void)setGamepadsEnabled:(BOOL)flag;
470 - (BOOL)gamepadsEnabled;
472 - (void)setMediaKeysStorageDirectory:(NSString *)directory;
473 - (NSString *)mediaKeysStorageDirectory;
475 - (void)setMetaRefreshEnabled:(BOOL)flag;
476 - (BOOL)metaRefreshEnabled;
478 - (void)setHTTPEquivEnabled:(BOOL)flag;
479 - (BOOL)httpEquivEnabled;
481 - (void)setMockCaptureDevicesEnabled:(BOOL)flag;
482 - (BOOL)mockCaptureDevicesEnabled;
484 - (void)setMediaCaptureRequiresSecureConnection:(BOOL)flag;
485 - (BOOL)mediaCaptureRequiresSecureConnection;
487 - (void)setShadowDOMEnabled:(BOOL)flag;
488 - (BOOL)shadowDOMEnabled;
490 - (void)setCustomElementsEnabled:(BOOL)flag;
491 - (BOOL)customElementsEnabled;
493 - (void)setDOMIteratorEnabled:(BOOL)flag;
494 - (BOOL)DOMIteratorEnabled;
496 - (void)setFetchAPIEnabled:(BOOL)flag;
497 - (BOOL)fetchAPIEnabled;
499 - (void)setDownloadAttributeEnabled:(BOOL)flag;
500 - (BOOL)downloadAttributeEnabled;
502 - (void)setES6ModulesEnabled:(BOOL)flag;
503 - (BOOL)es6ModulesEnabled;
505 - (void)setCSSGridLayoutEnabled:(BOOL)flag;
506 - (BOOL)isCSSGridLayoutEnabled;
508 - (void)setWebAnimationsEnabled:(BOOL)flag;
509 - (BOOL)webAnimationsEnabled;
511 - (void)setModernMediaControlsEnabled:(BOOL)flag;
512 - (BOOL)modernMediaControlsEnabled;
514 @property (nonatomic) BOOL visualViewportEnabled;
515 @property (nonatomic) BOOL largeImageAsyncDecodingEnabled;
516 @property (nonatomic) BOOL animatedImageAsyncDecodingEnabled;
517 @property (nonatomic) BOOL javaScriptMarkupEnabled;
518 @property (nonatomic) BOOL mediaDataLoadsAutomatically;
519 @property (nonatomic) BOOL attachmentElementEnabled;
520 @property (nonatomic) BOOL allowsInlineMediaPlaybackAfterFullscreen;
521 @property (nonatomic) BOOL intersectionObserverEnabled;