2 * Copyright (C) 2005-2017 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
9 * 1. Redistributions of source code must retain the above copyright
10 * notice, this list of conditions and the following disclaimer.
11 * 2. Redistributions in binary form must reproduce the above copyright
12 * notice, this list of conditions and the following disclaimer in the
13 * documentation and/or other materials provided with the distribution.
14 * 3. Neither the name of Apple Inc. ("Apple") nor the names of
15 * its contributors may be used to endorse or promote products derived
16 * from this software without specific prior written permission.
18 * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
19 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
20 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
21 * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
22 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
23 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
24 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
25 * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
26 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
27 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30 #import "WebPreferencesPrivate.h"
31 #import "WebPreferenceKeysPrivate.h"
33 #import "NetworkStorageSessionMap.h"
34 #import "WebApplicationCache.h"
35 #import "WebFrameNetworkingContext.h"
36 #import "WebKitLogging.h"
37 #import "WebKitNSStringExtras.h"
38 #import "WebKitVersionChecks.h"
39 #import "WebNSDictionaryExtras.h"
40 #import "WebNSURLExtras.h"
41 #import <JavaScriptCore/InitializeThreading.h>
42 #import <WebCore/ApplicationCacheStorage.h>
43 #import <WebCore/AudioSession.h>
44 #import <WebCore/DeprecatedGlobalSettings.h>
45 #import <WebCore/NetworkStorageSession.h>
46 #import <WebCore/RuntimeApplicationChecks.h>
47 #import <WebCore/Settings.h>
48 #import <WebCore/TextEncodingRegistry.h>
49 #import <pal/spi/cf/CFNetworkSPI.h>
50 #import <wtf/MainThread.h>
51 #import <wtf/RetainPtr.h>
52 #import <wtf/RunLoop.h>
54 using namespace WebCore;
56 #if PLATFORM(IOS_FAMILY)
57 #import <WebCore/Device.h>
58 #import <WebCore/GraphicsContext.h>
59 #import <WebCore/WebCoreThreadMessage.h>
62 NSString *WebPreferencesChangedNotification = @"WebPreferencesChangedNotification";
63 NSString *WebPreferencesRemovedNotification = @"WebPreferencesRemovedNotification";
64 NSString *WebPreferencesChangedInternalNotification = @"WebPreferencesChangedInternalNotification";
65 NSString *WebPreferencesCacheModelChangedInternalNotification = @"WebPreferencesCacheModelChangedInternalNotification";
67 #define KEY(x) (_private->identifier ? [_private->identifier.get() stringByAppendingString:(x)] : (x))
69 enum { WebPreferencesVersion = 1 };
71 static WebPreferences *_standardPreferences;
72 static NSMutableDictionary *webPreferencesInstances;
74 static unsigned webPreferencesInstanceCountWithPrivateBrowsingEnabled;
76 template<unsigned size> static bool contains(const char* const (&array)[size], const char* item)
80 for (auto* string : array) {
81 if (equalIgnoringASCIICase(string, item))
87 static WebCacheModel cacheModelForMainBundle(void)
90 // Apps that probably need the small setting
91 static const char* const documentViewerIDs[] = {
92 "Microsoft/com.microsoft.Messenger",
94 "com.alientechnology.Proteus",
97 "com.barebones.bbedit",
98 "com.barebones.textwrangler",
99 "com.barebones.yojimbo",
100 "com.equinux.iSale4",
101 "com.growl.growlframework",
102 "com.intrarts.PandoraMan",
103 "com.karelia.Sandvox",
104 "com.macromates.textmate",
105 "com.realmacsoftware.rapidweaverpro",
106 "com.red-sweater.marsedit",
107 "com.yahoo.messenger3",
108 "de.codingmonkeys.SubEthaEdit",
114 // Apps that probably need the medium setting
115 static const char* const documentBrowserIDs[] = {
116 "com.apple.Dictionary",
118 "com.apple.helpviewer",
119 "com.culturedcode.xyle",
120 "com.macrabbit.CSSEdit",
122 "com.ranchero.NetNewsWire",
123 "com.thinkmac.NewsLife",
124 "org.xlife.NewsFire",
125 "uk.co.opencommunity.vienna2",
128 // Apps that probably need the large setting
129 static const char* const primaryWebBrowserIDs[] = {
130 "com.app4mac.KidsBrowser"
131 "com.app4mac.wKiosk",
132 "com.freeverse.bumpercar",
133 "com.omnigroup.OmniWeb5",
134 "com.sunrisebrowser.Sunrise",
135 "net.hmdt-web.Shiira",
138 const char* bundleID = [[[NSBundle mainBundle] bundleIdentifier] UTF8String];
139 if (contains(documentViewerIDs, bundleID))
140 return WebCacheModelDocumentViewer;
141 if (contains(documentBrowserIDs, bundleID))
142 return WebCacheModelDocumentBrowser;
143 if (contains(primaryWebBrowserIDs, bundleID))
144 return WebCacheModelPrimaryWebBrowser;
146 bool isLinkedAgainstWebKit = WebKitLinkedOnOrAfter(0);
147 if (!isLinkedAgainstWebKit)
148 return WebCacheModelDocumentViewer; // Apps that don't link against WebKit probably aren't meant to be browsers.
150 #if !PLATFORM(IOS_FAMILY)
151 bool isLegacyApp = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_CACHE_MODEL_API);
153 bool isLegacyApp = false;
156 return WebCacheModelDocumentBrowser; // To avoid regressions in apps that depended on old WebKit's large cache.
158 return WebCacheModelDocumentViewer; // To save memory.
162 @interface WebPreferences ()
163 - (void)_postCacheModelChangedNotification;
166 @interface WebPreferences (WebInternal)
167 + (NSString *)_concatenateKeyWithIBCreatorID:(NSString *)key;
168 + (NSString *)_IBCreatorID;
171 struct WebPreferencesPrivate
174 WebPreferencesPrivate()
175 : inPrivateBrowsing(NO)
177 , automaticallyDetectsCacheModel(NO)
179 #if PLATFORM(IOS_FAMILY)
180 , readWriteQueue(dispatch_queue_create("com.apple.WebPreferences.ReadWriteQueue", DISPATCH_QUEUE_CONCURRENT))
185 #if PLATFORM(IOS_FAMILY)
186 ~WebPreferencesPrivate()
188 dispatch_release(readWriteQueue);
192 RetainPtr<NSMutableDictionary> values;
193 BOOL inPrivateBrowsing;
194 RetainPtr<NSString> identifier;
196 BOOL automaticallyDetectsCacheModel;
197 unsigned numWebViews;
198 #if PLATFORM(IOS_FAMILY)
199 dispatch_queue_t readWriteQueue;
203 @interface WebPreferences (WebForwardDeclarations)
204 // This pseudo-category is needed so these methods can be used from within other category implementations
205 // without being in the public header file.
206 - (BOOL)_boolValueForKey:(NSString *)key;
207 - (void)_setBoolValue:(BOOL)value forKey:(NSString *)key;
208 - (int)_integerValueForKey:(NSString *)key;
209 - (void)_setIntegerValue:(int)value forKey:(NSString *)key;
210 - (float)_floatValueForKey:(NSString *)key;
211 - (void)_setFloatValue:(float)value forKey:(NSString *)key;
212 - (void)_setLongLongValue:(long long)value forKey:(NSString *)key;
213 - (long long)_longLongValueForKey:(NSString *)key;
214 - (void)_setUnsignedLongLongValue:(unsigned long long)value forKey:(NSString *)key;
215 - (unsigned long long)_unsignedLongLongValueForKey:(NSString *)key;
218 #if PLATFORM(IOS_FAMILY)
219 @interface WebPreferences ()
220 - (id)initWithIdentifier:(NSString *)anIdentifier sendChangeNotification:(BOOL)sendChangeNotification;
224 @implementation WebPreferences
228 // Create fake identifier
229 static int instanceCount = 1;
230 NSString *fakeIdentifier;
232 // At least ensure that identifier hasn't been already used.
233 fakeIdentifier = [NSString stringWithFormat:@"WebPreferences%d", instanceCount++];
234 while ([[self class] _getInstanceForIdentifier:fakeIdentifier]){
235 fakeIdentifier = [NSString stringWithFormat:@"WebPreferences%d", instanceCount++];
238 return [self initWithIdentifier:fakeIdentifier];
241 #if PLATFORM(IOS_FAMILY)
242 - (id)initWithIdentifier:(NSString *)anIdentifier
244 return [self initWithIdentifier:anIdentifier sendChangeNotification:YES];
248 #if PLATFORM(IOS_FAMILY)
249 - (instancetype)initWithIdentifier:(NSString *)anIdentifier sendChangeNotification:(BOOL)sendChangeNotification
251 - (instancetype)initWithIdentifier:(NSString *)anIdentifier
254 WebPreferences *instance = [[self class] _getInstanceForIdentifier:anIdentifier];
257 return [instance retain];
264 _private = new WebPreferencesPrivate;
265 _private->values = adoptNS([[NSMutableDictionary alloc] init]);
266 _private->identifier = adoptNS([anIdentifier copy]);
267 _private->automaticallyDetectsCacheModel = YES;
269 [[self class] _setInstance:self forIdentifier:_private->identifier.get()];
271 [self _updatePrivateBrowsingStateTo:[self privateBrowsingEnabled]];
273 #if PLATFORM(IOS_FAMILY)
274 if (sendChangeNotification) {
275 [self _postPreferencesChangedNotification];
276 [self _postCacheModelChangedNotification];
279 [self _postPreferencesChangedNotification];
280 [self _postCacheModelChangedNotification];
286 - (instancetype)initWithCoder:(NSCoder *)decoder
292 _private = new WebPreferencesPrivate;
293 _private->automaticallyDetectsCacheModel = YES;
298 if ([decoder allowsKeyedCoding]) {
299 identifier = [decoder decodeObjectForKey:@"Identifier"];
300 values = [decoder decodeObjectForKey:@"Values"];
303 [decoder decodeValueOfObjCType:@encode(int) at:&version];
305 identifier = [decoder decodeObject];
306 values = [decoder decodeObject];
310 if ([identifier isKindOfClass:[NSString class]])
311 _private->identifier = adoptNS([identifier copy]);
312 if ([values isKindOfClass:[NSDictionary class]])
313 _private->values = adoptNS([values mutableCopy]); // ensure dictionary is mutable
315 LOG(Encoding, "Identifier = %@, Values = %@\n", _private->identifier.get(), _private->values.get());
321 // If we load a nib multiple times, or have instances in multiple
322 // nibs with the same name, the first guy up wins.
323 WebPreferences *instance = [[self class] _getInstanceForIdentifier:_private->identifier.get()];
326 self = [instance retain];
328 [[self class] _setInstance:self forIdentifier:_private->identifier.get()];
329 [self _updatePrivateBrowsingStateTo:[self privateBrowsingEnabled]];
335 - (void)encodeWithCoder:(NSCoder *)encoder
337 if ([encoder allowsKeyedCoding]){
338 [encoder encodeObject:_private->identifier.get() forKey:@"Identifier"];
339 #if PLATFORM(IOS_FAMILY)
340 dispatch_sync(_private->readWriteQueue, ^{
342 [encoder encodeObject:_private->values.get() forKey:@"Values"];
343 LOG (Encoding, "Identifier = %@, Values = %@\n", _private->identifier.get(), _private->values.get());
344 #if PLATFORM(IOS_FAMILY)
349 int version = WebPreferencesVersion;
350 [encoder encodeValueOfObjCType:@encode(int) at:&version];
351 [encoder encodeObject:_private->identifier.get()];
352 #if PLATFORM(IOS_FAMILY)
353 dispatch_sync(_private->readWriteQueue, ^{
355 [encoder encodeObject:_private->values.get()];
356 #if PLATFORM(IOS_FAMILY)
362 + (WebPreferences *)standardPreferences
364 #if !PLATFORM(IOS_FAMILY)
365 if (_standardPreferences == nil) {
366 _standardPreferences = [[WebPreferences alloc] initWithIdentifier:nil];
367 [_standardPreferences setAutosaves:YES];
370 // FIXME: This check is necessary to avoid recursion (see <rdar://problem/9564337>), but it also makes _standardPreferences construction not thread safe.
371 if (_standardPreferences)
372 return _standardPreferences;
374 static dispatch_once_t pred;
375 dispatch_once(&pred, ^{
376 _standardPreferences = [[WebPreferences alloc] initWithIdentifier:nil sendChangeNotification:NO];
377 [_standardPreferences _postPreferencesChangedNotification];
378 [_standardPreferences setAutosaves:YES];
382 return _standardPreferences;
385 // if we ever have more than one WebPreferences object, this would move to init
388 #if !PLATFORM(IOS_FAMILY)
389 JSC::initializeThreading();
390 WTF::initializeMainThreadToProcessMainThread();
391 RunLoop::initializeMainRunLoop();
392 bool attachmentElementEnabled = MacApplication::isAppleMail();
394 bool allowsInlineMediaPlayback = WebCore::deviceClass() == MGDeviceClassiPad;
395 bool allowsInlineMediaPlaybackAfterFullscreen = WebCore::deviceClass() != MGDeviceClassiPad;
396 bool requiresPlaysInlineAttribute = !allowsInlineMediaPlayback;
397 bool attachmentElementEnabled = IOSApplication::isMobileMail();
400 NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
401 @"Times", WebKitStandardFontPreferenceKey,
402 @"Courier", WebKitFixedFontPreferenceKey,
403 @"Times", WebKitSerifFontPreferenceKey,
404 @"Helvetica", WebKitSansSerifFontPreferenceKey,
405 #if !PLATFORM(IOS_FAMILY)
406 @"Apple Chancery", WebKitCursiveFontPreferenceKey,
408 @"Snell Roundhand", WebKitCursiveFontPreferenceKey,
410 @"Papyrus", WebKitFantasyFontPreferenceKey,
411 #if PLATFORM(IOS_FAMILY)
412 @"AppleColorEmoji", WebKitPictographFontPreferenceKey,
414 @"Apple Color Emoji", WebKitPictographFontPreferenceKey,
416 @"0", WebKitMinimumFontSizePreferenceKey,
417 @"9", WebKitMinimumLogicalFontSizePreferenceKey,
418 @"16", WebKitDefaultFontSizePreferenceKey,
419 @"13", WebKitDefaultFixedFontSizePreferenceKey,
420 @"ISO-8859-1", WebKitDefaultTextEncodingNamePreferenceKey,
421 @NO, WebKitUsesEncodingDetectorPreferenceKey,
422 @NO, WebKitUserStyleSheetEnabledPreferenceKey,
423 @"", WebKitUserStyleSheetLocationPreferenceKey,
424 #if !PLATFORM(IOS_FAMILY)
425 @NO, WebKitShouldPrintBackgroundsPreferenceKey,
426 @NO, WebKitTextAreasAreResizablePreferenceKey,
428 @NO, WebKitShrinksStandaloneImagesToFitPreferenceKey,
429 #if !PLATFORM(IOS_FAMILY)
430 @YES, WebKitJavaEnabledPreferenceKey,
432 @YES, WebKitJavaScriptEnabledPreferenceKey,
433 @YES, WebKitJavaScriptMarkupEnabledPreferenceKey,
434 @YES, WebKitWebSecurityEnabledPreferenceKey,
435 @YES, WebKitAllowUniversalAccessFromFileURLsPreferenceKey,
436 @YES, WebKitAllowFileAccessFromFileURLsPreferenceKey,
437 #if PLATFORM(IOS_FAMILY)
438 @NO, WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey,
440 @YES, WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey,
442 @YES, WebKitPluginsEnabledPreferenceKey,
443 @YES, WebKitDatabasesEnabledPreferenceKey,
444 @YES, WebKitHTTPEquivEnabledPreferenceKey,
446 #if PLATFORM(IOS_FAMILY)
447 @NO, WebKitStorageTrackerEnabledPreferenceKey,
449 @YES, WebKitLocalStorageEnabledPreferenceKey,
450 @NO, WebKitExperimentalNotificationsEnabledPreferenceKey,
451 @YES, WebKitAllowAnimatedImagesPreferenceKey,
452 @YES, WebKitAllowAnimatedImageLoopingPreferenceKey,
453 @YES, WebKitDisplayImagesKey,
454 @NO, WebKitLoadSiteIconsKey,
455 @"1800", WebKitBackForwardCacheExpirationIntervalKey,
456 #if !PLATFORM(IOS_FAMILY)
457 @NO, WebKitTabToLinksPreferenceKey,
459 @NO, WebKitPrivateBrowsingEnabledPreferenceKey,
460 #if !PLATFORM(IOS_FAMILY)
461 @NO, WebKitRespectStandardStyleKeyEquivalentsPreferenceKey,
462 @NO, WebKitShowsURLsInToolTipsPreferenceKey,
463 @NO, WebKitShowsToolTipOverTruncatedTextPreferenceKey,
464 @"1", WebKitPDFDisplayModePreferenceKey,
465 @"0", WebKitPDFScaleFactorPreferenceKey,
467 @"0", WebKitUseSiteSpecificSpoofingPreferenceKey,
468 [NSNumber numberWithInt:WebKitEditableLinkDefaultBehavior], WebKitEditableLinkBehaviorPreferenceKey,
469 #if !PLATFORM(IOS_FAMILY)
470 [NSNumber numberWithInt:WebTextDirectionSubmenuAutomaticallyIncluded],
471 WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey,
472 @NO, WebKitDOMPasteAllowedPreferenceKey,
474 @YES, WebKitUsesPageCachePreferenceKey,
475 [NSNumber numberWithInt:cacheModelForMainBundle()], WebKitCacheModelPreferenceKey,
476 @YES, WebKitPageCacheSupportsPluginsPreferenceKey,
477 @NO, WebKitDeveloperExtrasEnabledPreferenceKey,
478 [NSNumber numberWithUnsignedInt:0], WebKitJavaScriptRuntimeFlagsPreferenceKey,
479 @YES, WebKitAuthorAndUserStylesEnabledPreferenceKey,
480 @YES, WebKitDOMTimersThrottlingEnabledPreferenceKey,
481 @NO, WebKitWebArchiveDebugModeEnabledPreferenceKey,
482 @NO, WebKitLocalFileContentSniffingEnabledPreferenceKey,
483 @NO, WebKitOfflineWebApplicationCacheEnabledPreferenceKey,
484 @YES, WebKitZoomsTextOnlyPreferenceKey,
485 @NO, WebKitJavaScriptCanAccessClipboardPreferenceKey,
486 @YES, WebKitXSSAuditorEnabledPreferenceKey,
487 @YES, WebKitAcceleratedCompositingEnabledPreferenceKey,
489 #define DEFAULT_SUBPIXEL_ANTIALIASED_LAYER_TEXT_ENABLED YES
491 #define DEFAULT_SUBPIXEL_ANTIALIASED_LAYER_TEXT_ENABLED NO
493 [NSNumber numberWithBool:DEFAULT_SUBPIXEL_ANTIALIASED_LAYER_TEXT_ENABLED], WebKitSubpixelAntialiasedLayerTextEnabledPreferenceKey,
494 @NO, WebKitDisplayListDrawingEnabledPreferenceKey,
495 #if PLATFORM(IOS_FAMILY) && !PLATFORM(IOS_FAMILY_SIMULATOR)
496 @YES, WebKitAcceleratedDrawingEnabledPreferenceKey,
497 @YES, WebKitCanvasUsesAcceleratedDrawingPreferenceKey,
499 @NO, WebKitAcceleratedDrawingEnabledPreferenceKey,
500 @NO, WebKitCanvasUsesAcceleratedDrawingPreferenceKey,
502 @NO, WebKitShowDebugBordersPreferenceKey,
503 @YES, WebKitSimpleLineLayoutEnabledPreferenceKey,
504 @NO, WebKitSimpleLineLayoutDebugBordersEnabledPreferenceKey,
505 @NO, WebKitShowRepaintCounterPreferenceKey,
506 @YES, WebKitWebGLEnabledPreferenceKey,
507 @YES, WebKitForceWebGLUsesLowPowerPreferenceKey,
508 @NO, WebKitAccelerated2dCanvasEnabledPreferenceKey,
509 @NO, WebKitSubpixelCSSOMElementMetricsEnabledPreferenceKey,
510 @NO, WebKitResourceLoadStatisticsEnabledPreferenceKey,
511 @YES, WebKitLargeImageAsyncDecodingEnabledPreferenceKey,
512 @YES, WebKitAnimatedImageAsyncDecodingEnabledPreferenceKey,
513 #if PLATFORM(IOS_FAMILY)
514 [NSNumber numberWithUnsignedInt:static_cast<uint32_t>(FrameFlattening::FullyEnabled)], WebKitFrameFlatteningPreferenceKey,
516 [NSNumber numberWithUnsignedInt:static_cast<uint32_t>(FrameFlattening::Disabled)], WebKitFrameFlatteningPreferenceKey,
518 @NO, WebKitAsyncFrameScrollingEnabledPreferenceKey,
519 @NO, WebKitSpatialNavigationEnabledPreferenceKey,
520 @NO, WebKitDNSPrefetchingEnabledPreferenceKey,
521 @NO, WebKitFullScreenEnabledPreferenceKey,
522 @NO, WebKitAsynchronousSpellCheckingEnabledPreferenceKey,
523 @YES, WebKitHyperlinkAuditingEnabledPreferenceKey,
524 @NO, WebKitUsePreHTML5ParserQuirksKey,
525 @YES, WebKitAVFoundationEnabledKey,
526 @YES, WebKitAVFoundationNSURLSessionEnabledKey,
527 @NO, WebKitSuppressesIncrementalRenderingKey,
528 [NSNumber numberWithBool:attachmentElementEnabled], WebKitAttachmentElementEnabledPreferenceKey,
529 #if !PLATFORM(IOS_FAMILY)
530 @YES, WebKitAllowsInlineMediaPlaybackPreferenceKey,
531 @NO, WebKitAllowsInlineMediaPlaybackAfterFullscreenPreferenceKey,
532 @NO, WebKitInlineMediaPlaybackRequiresPlaysInlineAttributeKey,
533 @YES, WebKitMediaControlsScaleWithPageZoomPreferenceKey,
534 @NO, WebKitWebAudioEnabledPreferenceKey,
535 @YES, WebKitBackspaceKeyNavigationEnabledKey,
536 @NO, WebKitShouldDisplaySubtitlesPreferenceKey,
537 @NO, WebKitShouldDisplayCaptionsPreferenceKey,
538 @NO, WebKitShouldDisplayTextDescriptionsPreferenceKey,
539 @YES, WebKitNotificationsEnabledKey,
540 @NO, WebKitShouldRespectImageOrientationKey,
541 @YES, WebKitMediaDataLoadsAutomaticallyPreferenceKey,
543 [NSNumber numberWithBool:allowsInlineMediaPlayback], WebKitAllowsInlineMediaPlaybackPreferenceKey,
544 [NSNumber numberWithBool:allowsInlineMediaPlaybackAfterFullscreen], WebKitAllowsInlineMediaPlaybackAfterFullscreenPreferenceKey,
545 [NSNumber numberWithBool:requiresPlaysInlineAttribute], WebKitInlineMediaPlaybackRequiresPlaysInlineAttributeKey,
546 @NO, WebKitMediaControlsScaleWithPageZoomPreferenceKey,
547 [NSNumber numberWithUnsignedInt:AudioSession::None], WebKitAudioSessionCategoryOverride,
548 @NO, WebKitMediaDataLoadsAutomaticallyPreferenceKey,
550 @YES, WebKitAVKitEnabled,
552 @YES, WebKitRequiresUserGestureForMediaPlaybackPreferenceKey,
553 @NO, WebKitRequiresUserGestureForVideoPlaybackPreferenceKey,
554 @NO, WebKitRequiresUserGestureForAudioPlaybackPreferenceKey,
555 [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
557 // Per-Origin Quota on iOS is 25MB. When the quota is reached for a particular origin
558 // the quota for that origin can be increased. See also webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:totalSpaceNeeded in WebUI/WebUIDelegate.m.
559 [NSNumber numberWithLongLong:(25 * 1024 * 1024)], WebKitApplicationCacheDefaultOriginQuota,
561 // Enable WebAudio by default in all iOS UIWebViews
562 @YES, WebKitWebAudioEnabledPreferenceKey,
564 @YES, WebKitShouldRespectImageOrientationKey,
565 #endif // PLATFORM(IOS_FAMILY)
566 #if ENABLE(WIRELESS_TARGET_PLAYBACK)
567 @YES, WebKitAllowsAirPlayForMediaPlaybackPreferenceKey,
569 @YES, WebKitAllowsPictureInPictureMediaPlaybackPreferenceKey,
570 @YES, WebKitRequestAnimationFrameEnabledPreferenceKey,
571 @NO, WebKitWantsBalancedSetDefersLoadingBehaviorKey,
572 @NO, WebKitDiagnosticLoggingEnabledKey,
573 [NSNumber numberWithInt:WebAllowAllStorage], WebKitStorageBlockingPolicyKey,
574 @NO, WebKitPlugInSnapshottingEnabledPreferenceKey,
576 #if PLATFORM(IOS_FAMILY)
577 @YES, WebKitContentChangeObserverEnabledPreferenceKey,
578 @NO, WebKitTelephoneParsingEnabledPreferenceKey,
579 [NSNumber numberWithInt:-1], WebKitLayoutIntervalPreferenceKey,
580 [NSNumber numberWithFloat:-1.0f], WebKitMaxParseDurationPreferenceKey,
581 @NO, WebKitAllowMultiElementImplicitFormSubmissionPreferenceKey,
582 @NO, WebKitAlwaysRequestGeolocationPermissionPreferenceKey,
583 [NSNumber numberWithInt:InterpolationLow], WebKitInterpolationQualityPreferenceKey,
584 @YES, WebKitPasswordEchoEnabledPreferenceKey,
585 [NSNumber numberWithFloat:2.0f], WebKitPasswordEchoDurationPreferenceKey,
586 @NO, WebKitNetworkDataUsageTrackingEnabledPreferenceKey,
587 @"", WebKitNetworkInterfaceNamePreferenceKey,
589 #if ENABLE(TEXT_AUTOSIZING)
590 [NSNumber numberWithFloat:Settings::defaultMinimumZoomFontSize()], WebKitMinimumZoomFontSizePreferenceKey,
591 [NSNumber numberWithBool:Settings::defaultTextAutosizingEnabled()], WebKitTextAutosizingEnabledPreferenceKey,
593 [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
594 [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota,
595 @NO, WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey,
596 @NO, WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey,
597 @NO, WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey,
599 @NO, WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey,
600 #if ENABLE(MEDIA_SOURCE)
601 @YES, WebKitMediaSourceEnabledPreferenceKey,
602 @YES, WebKitSourceBufferChangeTypeEnabledPreferenceKey,
604 #if ENABLE(SERVICE_CONTROLS)
605 @NO, WebKitImageControlsEnabledPreferenceKey,
606 @NO, WebKitServiceControlsEnabledPreferenceKey,
608 @NO, WebKitEnableInheritURIQueryComponentPreferenceKey,
609 #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
610 @"~/Library/WebKit/MediaKeys", WebKitMediaKeysStorageDirectoryKey,
612 #if ENABLE(MEDIA_STREAM)
613 @NO, WebKitMockCaptureDevicesEnabledPreferenceKey,
614 @YES, WebKitMockCaptureDevicesPromptEnabledPreferenceKey,
615 @YES, WebKitMediaCaptureRequiresSecureConnectionPreferenceKey,
617 @YES, WebKitShadowDOMEnabledPreferenceKey,
618 @YES, WebKitCustomElementsEnabledPreferenceKey,
619 @YES, WebKitDataTransferItemsEnabledPreferenceKey,
620 @NO, WebKitCustomPasteboardDataEnabledPreferenceKey,
621 @NO, WebKitDialogElementEnabledPreferenceKey,
622 @YES, WebKitModernMediaControlsEnabledPreferenceKey,
623 @NO, WebKitWebAnimationsCSSIntegrationEnabledPreferenceKey,
626 @NO, WebKitWebGL2EnabledPreferenceKey,
629 @NO, WebKitWebGPUEnabledPreferenceKey,
631 @NO, WebKitCacheAPIEnabledPreferenceKey,
632 @YES, WebKitFetchAPIEnabledPreferenceKey,
634 #if ENABLE(STREAMS_API)
635 @NO, WebKitReadableByteStreamAPIEnabledPreferenceKey,
636 @NO, WebKitWritableStreamAPIEnabledPreferenceKey,
638 #if ENABLE(DOWNLOAD_ATTRIBUTE)
639 @NO, WebKitDownloadAttributeEnabledPreferenceKey,
641 @NO, WebKitDirectoryUploadEnabledPreferenceKey,
642 @YES, WebKitWebAnimationsEnabledPreferenceKey,
643 @YES, WebKitPointerEventsEnabledPreferenceKey,
644 @YES, WebKitSyntheticEditingCommandsEnabledPreferenceKey,
646 #if PLATFORM(IOS_FAMILY)
647 @NO, WebKitVisualViewportAPIEnabledPreferenceKey,
649 @YES, WebKitVisualViewportAPIEnabledPreferenceKey,
652 @YES, WebKitCSSOMViewScrollingAPIEnabledPreferenceKey,
653 @YES, WebKitNeedsStorageAccessFromFileURLsQuirkKey,
654 @NO, WebKitAllowCrossOriginSubresourcesToAskForCredentialsKey,
655 #if ENABLE(MEDIA_STREAM)
656 @NO, WebKitMediaDevicesEnabledPreferenceKey,
657 @YES, WebKitMediaStreamEnabledPreferenceKey,
658 @NO, WebKitMediaRecorderEnabledPreferenceKey,
661 @YES, WebKitPeerConnectionEnabledPreferenceKey,
663 @YES, WebKitSelectionAcrossShadowBoundariesEnabledPreferenceKey,
664 @NO, WebKitCSSLogicalEnabledPreferenceKey,
665 @NO, WebKitAdClickAttributionEnabledPreferenceKey,
666 #if ENABLE(INTERSECTION_OBSERVER)
667 @NO, WebKitIntersectionObserverEnabledPreferenceKey,
669 @YES, WebKitDisplayContentsEnabledPreferenceKey,
670 @NO, WebKitUserTimingEnabledPreferenceKey,
671 @NO, WebKitResourceTimingEnabledPreferenceKey,
672 @NO, WebKitMediaUserGestureInheritsFromDocument,
673 @NO, WebKitIsSecureContextAttributeEnabledPreferenceKey,
674 @YES, WebKitLegacyEncryptedMediaAPIEnabledKey,
675 @NO, WebKitEncryptedMediaAPIEnabledKey,
676 @YES, WebKitViewportFitEnabledPreferenceKey,
677 @YES, WebKitConstantPropertiesEnabledPreferenceKey,
678 @NO, WebKitColorFilterEnabledPreferenceKey,
679 @NO, WebKitPunchOutWhiteBackgroundsInDarkModePreferenceKey,
680 @YES, WebKitAllowMediaContentTypesRequiringHardwareSupportAsFallbackKey,
681 @NO, WebKitInspectorAdditionsEnabledPreferenceKey,
682 (NSString *)Settings::defaultMediaContentTypesRequiringHardwareSupport(), WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey,
683 @NO, WebKitAccessibilityObjectModelEnabledPreferenceKey,
684 @YES, WebKitAriaReflectionEnabledPreferenceKey,
685 @NO, WebKitMediaCapabilitiesEnabledPreferenceKey,
686 @NO, WebKitFetchAPIKeepAliveEnabledPreferenceKey,
687 @NO, WebKitServerTimingEnabledPreferenceKey,
688 @NO, WebKitReferrerPolicyAttributeEnabledPreferenceKey,
689 #if ENABLE(RESIZE_OBSERVER)
690 @NO, WebKitResizeObserverEnabledPreferenceKey,
692 @NO, WebKitCoreMathMLEnabledPreferenceKey,
693 @NO, WebKitLinkPreloadResponsiveImagesEnabledPreferenceKey,
696 #if !PLATFORM(IOS_FAMILY)
697 // This value shouldn't ever change, which is assumed in the initialization of WebKitPDFDisplayModePreferenceKey above
698 ASSERT(kPDFDisplaySinglePageContinuous == 1);
700 [[NSUserDefaults standardUserDefaults] registerDefaults:dict];
705 [self _updatePrivateBrowsingStateTo:NO];
711 - (NSString *)identifier
713 return _private->identifier.get();
716 - (id)_valueForKey:(NSString *)key
718 NSString *_key = KEY(key);
719 #if PLATFORM(IOS_FAMILY)
721 dispatch_sync(_private->readWriteQueue, ^{
722 o = [_private->values.get() objectForKey:_key];
725 id o = [_private->values.get() objectForKey:_key];
729 o = [[NSUserDefaults standardUserDefaults] objectForKey:_key];
730 if (!o && key != _key)
731 o = [[NSUserDefaults standardUserDefaults] objectForKey:key];
735 - (NSString *)_stringValueForKey:(NSString *)key
737 id s = [self _valueForKey:key];
738 return [s isKindOfClass:[NSString class]] ? (NSString *)s : nil;
741 - (void)_setStringValue:(NSString *)value forKey:(NSString *)key
743 if ([[self _stringValueForKey:key] isEqualToString:value])
745 NSString *_key = KEY(key);
746 #if PLATFORM(IOS_FAMILY)
747 dispatch_barrier_sync(_private->readWriteQueue, ^{
749 [_private->values.get() setObject:value forKey:_key];
750 #if PLATFORM(IOS_FAMILY)
753 if (_private->autosaves)
754 [[NSUserDefaults standardUserDefaults] setObject:value forKey:_key];
755 [self _postPreferencesChangedNotification];
758 - (NSArray<NSString *> *)_stringArrayValueForKey:(NSString *)key
760 id value = [self _valueForKey:key];
761 if (![value isKindOfClass:[NSArray class]])
764 NSArray *array = (NSArray *)value;
765 for (id object in array) {
766 if (![object isKindOfClass:[NSString class]])
770 return (NSArray<NSString *> *)array;
773 - (void)_setStringArrayValueForKey:(NSArray<NSString *> *)value forKey:(NSString *)key
775 NSString *_key = KEY(key);
776 #if PLATFORM(IOS_FAMILY)
777 dispatch_barrier_sync(_private->readWriteQueue, ^{
779 [_private->values.get() setObject:value forKey:_key];
780 #if PLATFORM(IOS_FAMILY)
783 if (_private->autosaves)
784 [[NSUserDefaults standardUserDefaults] setObject:value forKey:_key];
785 [self _postPreferencesChangedNotification];
788 - (int)_integerValueForKey:(NSString *)key
790 id o = [self _valueForKey:key];
791 return [o respondsToSelector:@selector(intValue)] ? [o intValue] : 0;
794 - (void)_setIntegerValue:(int)value forKey:(NSString *)key
796 if ([self _integerValueForKey:key] == value)
798 NSString *_key = KEY(key);
799 #if PLATFORM(IOS_FAMILY)
800 dispatch_barrier_sync(_private->readWriteQueue, ^{
802 [_private->values.get() setObject:@(value) forKey:_key];
803 #if PLATFORM(IOS_FAMILY)
806 if (_private->autosaves)
807 [[NSUserDefaults standardUserDefaults] setInteger:value forKey:_key];
808 [self _postPreferencesChangedNotification];
811 - (unsigned int)_unsignedIntValueForKey:(NSString *)key
813 id o = [self _valueForKey:key];
814 return [o respondsToSelector:@selector(unsignedIntValue)] ? [o unsignedIntValue] : 0;
817 - (void)_setUnsignedIntValue:(unsigned int)value forKey:(NSString *)key
819 if ([self _unsignedIntValueForKey:key] == value)
821 NSString *_key = KEY(key);
822 #if PLATFORM(IOS_FAMILY)
823 dispatch_barrier_sync(_private->readWriteQueue, ^{
825 [_private->values.get() setObject:@(value) forKey:_key];
826 #if PLATFORM(IOS_FAMILY)
829 if (_private->autosaves)
830 [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithUnsignedInt:value] forKey:_key];
831 [self _postPreferencesChangedNotification];
834 - (float)_floatValueForKey:(NSString *)key
836 id o = [self _valueForKey:key];
837 return [o respondsToSelector:@selector(floatValue)] ? [o floatValue] : 0.0f;
840 - (void)_setFloatValue:(float)value forKey:(NSString *)key
842 if ([self _floatValueForKey:key] == value)
844 NSString *_key = KEY(key);
845 #if PLATFORM(IOS_FAMILY)
846 dispatch_barrier_sync(_private->readWriteQueue, ^{
848 [_private->values.get() setObject:@(value) forKey:_key];
849 #if PLATFORM(IOS_FAMILY)
852 if (_private->autosaves)
853 [[NSUserDefaults standardUserDefaults] setFloat:value forKey:_key];
854 [self _postPreferencesChangedNotification];
857 - (BOOL)_boolValueForKey:(NSString *)key
859 return [self _integerValueForKey:key] != 0;
862 - (void)_setBoolValue:(BOOL)value forKey:(NSString *)key
864 if ([self _boolValueForKey:key] == value)
866 NSString *_key = KEY(key);
867 #if PLATFORM(IOS_FAMILY)
868 dispatch_barrier_sync(_private->readWriteQueue, ^{
870 [_private->values.get() setObject:@(value) forKey:_key];
871 #if PLATFORM(IOS_FAMILY)
874 if (_private->autosaves)
875 [[NSUserDefaults standardUserDefaults] setBool:value forKey:_key];
876 [self _postPreferencesChangedNotification];
879 - (long long)_longLongValueForKey:(NSString *)key
881 id o = [self _valueForKey:key];
882 return [o respondsToSelector:@selector(longLongValue)] ? [o longLongValue] : 0;
885 - (void)_setLongLongValue:(long long)value forKey:(NSString *)key
887 if ([self _longLongValueForKey:key] == value)
889 NSString *_key = KEY(key);
890 #if PLATFORM(IOS_FAMILY)
891 dispatch_barrier_sync(_private->readWriteQueue, ^{
893 [_private->values.get() setObject:@(value) forKey:_key];
894 #if PLATFORM(IOS_FAMILY)
897 if (_private->autosaves)
898 [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithLongLong:value] forKey:_key];
899 [self _postPreferencesChangedNotification];
902 - (unsigned long long)_unsignedLongLongValueForKey:(NSString *)key
904 id o = [self _valueForKey:key];
905 return [o respondsToSelector:@selector(unsignedLongLongValue)] ? [o unsignedLongLongValue] : 0;
908 - (void)_setUnsignedLongLongValue:(unsigned long long)value forKey:(NSString *)key
910 if ([self _unsignedLongLongValueForKey:key] == value)
912 NSString *_key = KEY(key);
913 #if PLATFORM(IOS_FAMILY)
914 dispatch_barrier_sync(_private->readWriteQueue, ^{
916 [_private->values.get() setObject:@(value) forKey:_key];
917 #if PLATFORM(IOS_FAMILY)
920 if (_private->autosaves)
921 [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithUnsignedLongLong:value] forKey:_key];
922 [self _postPreferencesChangedNotification];
925 - (NSString *)standardFontFamily
927 return [self _stringValueForKey: WebKitStandardFontPreferenceKey];
930 - (void)setStandardFontFamily:(NSString *)family
932 [self _setStringValue: family forKey: WebKitStandardFontPreferenceKey];
935 - (NSString *)fixedFontFamily
937 return [self _stringValueForKey: WebKitFixedFontPreferenceKey];
940 - (void)setFixedFontFamily:(NSString *)family
942 [self _setStringValue: family forKey: WebKitFixedFontPreferenceKey];
945 - (NSString *)serifFontFamily
947 return [self _stringValueForKey: WebKitSerifFontPreferenceKey];
950 - (void)setSerifFontFamily:(NSString *)family
952 [self _setStringValue: family forKey: WebKitSerifFontPreferenceKey];
955 - (NSString *)sansSerifFontFamily
957 return [self _stringValueForKey: WebKitSansSerifFontPreferenceKey];
960 - (void)setSansSerifFontFamily:(NSString *)family
962 [self _setStringValue: family forKey: WebKitSansSerifFontPreferenceKey];
965 - (NSString *)cursiveFontFamily
967 return [self _stringValueForKey: WebKitCursiveFontPreferenceKey];
970 - (void)setCursiveFontFamily:(NSString *)family
972 [self _setStringValue: family forKey: WebKitCursiveFontPreferenceKey];
975 - (NSString *)fantasyFontFamily
977 return [self _stringValueForKey: WebKitFantasyFontPreferenceKey];
980 - (void)setFantasyFontFamily:(NSString *)family
982 [self _setStringValue: family forKey: WebKitFantasyFontPreferenceKey];
985 - (int)defaultFontSize
987 return [self _integerValueForKey: WebKitDefaultFontSizePreferenceKey];
990 - (void)setDefaultFontSize:(int)size
992 [self _setIntegerValue: size forKey: WebKitDefaultFontSizePreferenceKey];
995 - (int)defaultFixedFontSize
997 return [self _integerValueForKey: WebKitDefaultFixedFontSizePreferenceKey];
1000 - (void)setDefaultFixedFontSize:(int)size
1002 [self _setIntegerValue: size forKey: WebKitDefaultFixedFontSizePreferenceKey];
1005 - (int)minimumFontSize
1007 return [self _integerValueForKey: WebKitMinimumFontSizePreferenceKey];
1010 - (void)setMinimumFontSize:(int)size
1012 [self _setIntegerValue: size forKey: WebKitMinimumFontSizePreferenceKey];
1015 - (int)minimumLogicalFontSize
1017 return [self _integerValueForKey: WebKitMinimumLogicalFontSizePreferenceKey];
1020 - (void)setMinimumLogicalFontSize:(int)size
1022 [self _setIntegerValue: size forKey: WebKitMinimumLogicalFontSizePreferenceKey];
1025 - (NSString *)defaultTextEncodingName
1027 return [self _stringValueForKey: WebKitDefaultTextEncodingNamePreferenceKey];
1030 - (void)setDefaultTextEncodingName:(NSString *)encoding
1032 [self _setStringValue: encoding forKey: WebKitDefaultTextEncodingNamePreferenceKey];
1035 #if !PLATFORM(IOS_FAMILY)
1036 - (BOOL)userStyleSheetEnabled
1038 return [self _boolValueForKey: WebKitUserStyleSheetEnabledPreferenceKey];
1041 - (void)setUserStyleSheetEnabled:(BOOL)flag
1043 [self _setBoolValue: flag forKey: WebKitUserStyleSheetEnabledPreferenceKey];
1046 - (NSURL *)userStyleSheetLocation
1048 NSString *locationString = [self _stringValueForKey: WebKitUserStyleSheetLocationPreferenceKey];
1050 if ([locationString _webkit_looksLikeAbsoluteURL]) {
1051 return [NSURL _web_URLWithDataAsString:locationString];
1053 locationString = [locationString stringByExpandingTildeInPath];
1054 return [NSURL fileURLWithPath:locationString isDirectory:NO];
1058 - (void)setUserStyleSheetLocation:(NSURL *)URL
1060 NSString *locationString;
1062 if ([URL isFileURL]) {
1063 locationString = [[URL path] _web_stringByAbbreviatingWithTildeInPath];
1065 locationString = [URL _web_originalDataAsString];
1068 if (!locationString)
1069 locationString = @"";
1071 [self _setStringValue:locationString forKey: WebKitUserStyleSheetLocationPreferenceKey];
1075 // These methods have had their implementations removed on iOS since it
1076 // is wrong to have such a setting stored in preferences that, when read,
1077 // is applied to all WebViews in a iOS process. Such a design might work
1078 // OK for an application like Safari on Mac OS X, where the only WebViews
1079 // in use display web content in a straightforward manner. However, it is
1080 // wrong for iOS, where WebViews are used for various purposes, like
1081 // text editing, text rendering, and displaying web content.
1083 // I have changed the user style sheet mechanism to be a per-WebView
1084 // setting, rather than a per-process preference. This seems to give the
1085 // behavior we want for iOS.
1087 - (BOOL)userStyleSheetEnabled
1092 - (void)setUserStyleSheetEnabled:(BOOL)flag
1097 - (NSURL *)userStyleSheetLocation
1102 - (void)setUserStyleSheetLocation:(NSURL *)URL
1106 #endif // PLATFORM(IOS_FAMILY)
1108 #if !PLATFORM(IOS_FAMILY)
1109 - (BOOL)shouldPrintBackgrounds
1111 return [self _boolValueForKey: WebKitShouldPrintBackgroundsPreferenceKey];
1114 - (void)setShouldPrintBackgrounds:(BOOL)flag
1116 [self _setBoolValue: flag forKey: WebKitShouldPrintBackgroundsPreferenceKey];
1120 - (BOOL)isJavaEnabled
1122 return [self _boolValueForKey: WebKitJavaEnabledPreferenceKey];
1125 - (void)setJavaEnabled:(BOOL)flag
1127 [self _setBoolValue: flag forKey: WebKitJavaEnabledPreferenceKey];
1130 - (BOOL)isJavaScriptEnabled
1132 return [self _boolValueForKey: WebKitJavaScriptEnabledPreferenceKey];
1135 - (void)setJavaScriptEnabled:(BOOL)flag
1137 [self _setBoolValue: flag forKey: WebKitJavaScriptEnabledPreferenceKey];
1140 - (BOOL)javaScriptCanOpenWindowsAutomatically
1142 return [self _boolValueForKey: WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey];
1145 - (void)setJavaScriptCanOpenWindowsAutomatically:(BOOL)flag
1147 [self _setBoolValue: flag forKey: WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey];
1150 - (BOOL)arePlugInsEnabled
1152 return [self _boolValueForKey: WebKitPluginsEnabledPreferenceKey];
1155 - (void)setPlugInsEnabled:(BOOL)flag
1157 [self _setBoolValue: flag forKey: WebKitPluginsEnabledPreferenceKey];
1160 - (BOOL)allowsAnimatedImages
1162 return [self _boolValueForKey: WebKitAllowAnimatedImagesPreferenceKey];
1165 - (void)setAllowsAnimatedImages:(BOOL)flag
1167 [self _setBoolValue: flag forKey: WebKitAllowAnimatedImagesPreferenceKey];
1170 - (BOOL)allowsAnimatedImageLooping
1172 return [self _boolValueForKey: WebKitAllowAnimatedImageLoopingPreferenceKey];
1175 - (void)setAllowsAnimatedImageLooping: (BOOL)flag
1177 [self _setBoolValue: flag forKey: WebKitAllowAnimatedImageLoopingPreferenceKey];
1180 - (void)setLoadsImagesAutomatically: (BOOL)flag
1182 [self _setBoolValue: flag forKey: WebKitDisplayImagesKey];
1185 - (BOOL)loadsImagesAutomatically
1187 return [self _boolValueForKey: WebKitDisplayImagesKey];
1190 - (void)setAdditionalSupportedImageTypes:(NSArray<NSString*> *)imageTypes
1192 [self _setStringArrayValueForKey:imageTypes forKey:WebKitAdditionalSupportedImageTypesKey];
1195 - (NSArray<NSString *> *)additionalSupportedImageTypes
1197 return [self _stringArrayValueForKey:WebKitAdditionalSupportedImageTypesKey];
1200 - (void)setAutosaves:(BOOL)flag
1202 _private->autosaves = flag;
1207 return _private->autosaves;
1210 #if !PLATFORM(IOS_FAMILY)
1211 - (void)setTabsToLinks:(BOOL)flag
1213 [self _setBoolValue: flag forKey: WebKitTabToLinksPreferenceKey];
1218 return [self _boolValueForKey:WebKitTabToLinksPreferenceKey];
1222 - (void)setPrivateBrowsingEnabled:(BOOL)enabled
1224 [self _updatePrivateBrowsingStateTo:enabled];
1225 [self _setBoolValue:enabled forKey:WebKitPrivateBrowsingEnabledPreferenceKey];
1228 - (BOOL)privateBrowsingEnabled
1230 // Changes to private browsing defaults do not have effect on existing WebPreferences, and must be done through -setPrivateBrowsingEnabled.
1231 // This is needed to accurately track private browsing sessions in the process.
1232 return _private->inPrivateBrowsing;
1235 - (void)_updatePrivateBrowsingStateTo:(BOOL)enabled
1242 if (enabled == _private->inPrivateBrowsing)
1244 if (enabled > _private->inPrivateBrowsing) {
1245 WebFrameNetworkingContext::ensurePrivateBrowsingSession();
1246 ++webPreferencesInstanceCountWithPrivateBrowsingEnabled;
1248 ASSERT(webPreferencesInstanceCountWithPrivateBrowsingEnabled);
1249 --webPreferencesInstanceCountWithPrivateBrowsingEnabled;
1250 if (!webPreferencesInstanceCountWithPrivateBrowsingEnabled)
1251 WebFrameNetworkingContext::destroyPrivateBrowsingSession();
1253 _private->inPrivateBrowsing = enabled;
1256 - (void)setUsesPageCache:(BOOL)usesPageCache
1258 [self _setBoolValue:usesPageCache forKey:WebKitUsesPageCachePreferenceKey];
1261 - (BOOL)usesPageCache
1263 return [self _boolValueForKey:WebKitUsesPageCachePreferenceKey];
1266 - (void)_postCacheModelChangedNotification
1268 #if !PLATFORM(IOS_FAMILY)
1269 if (!pthread_main_np()) {
1270 [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO];
1275 [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesCacheModelChangedInternalNotification object:self userInfo:nil];
1278 - (void)setCacheModel:(WebCacheModel)cacheModel
1280 [self _setIntegerValue:cacheModel forKey:WebKitCacheModelPreferenceKey];
1281 [self setAutomaticallyDetectsCacheModel:NO];
1282 [self _postCacheModelChangedNotification];
1285 - (WebCacheModel)cacheModel
1287 return (WebCacheModel)[self _integerValueForKey:WebKitCacheModelPreferenceKey];
1291 - (void)setSuppressesIncrementalRendering:(BOOL)suppressesIncrementalRendering
1293 [self _setBoolValue:suppressesIncrementalRendering forKey:WebKitSuppressesIncrementalRenderingKey];
1296 - (BOOL)suppressesIncrementalRendering
1298 return [self _boolValueForKey:WebKitSuppressesIncrementalRenderingKey];
1301 - (BOOL)allowsAirPlayForMediaPlayback
1303 #if ENABLE(WIRELESS_TARGET_PLAYBACK)
1304 return [self _boolValueForKey:WebKitAllowsAirPlayForMediaPlaybackPreferenceKey];
1310 - (void)setAllowsAirPlayForMediaPlayback:(BOOL)flag
1312 #if ENABLE(WIRELESS_TARGET_PLAYBACK)
1313 [self _setBoolValue:flag forKey:WebKitAllowsAirPlayForMediaPlaybackPreferenceKey];
1319 @implementation WebPreferences (WebPrivate)
1321 - (BOOL)isDNSPrefetchingEnabled
1323 return [self _boolValueForKey:WebKitDNSPrefetchingEnabledPreferenceKey];
1326 - (void)setDNSPrefetchingEnabled:(BOOL)flag
1328 [self _setBoolValue:flag forKey:WebKitDNSPrefetchingEnabledPreferenceKey];
1331 - (BOOL)developerExtrasEnabled
1333 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1334 if ([defaults boolForKey:@"DisableWebKitDeveloperExtras"])
1337 if ([defaults boolForKey:@"WebKitDeveloperExtras"] || [defaults boolForKey:@"IncludeDebugMenu"])
1339 return [self _boolValueForKey:WebKitDeveloperExtrasEnabledPreferenceKey];
1341 return YES; // always enable in debug builds
1345 - (WebKitJavaScriptRuntimeFlags)javaScriptRuntimeFlags
1347 return static_cast<WebKitJavaScriptRuntimeFlags>([self _unsignedIntValueForKey:WebKitJavaScriptRuntimeFlagsPreferenceKey]);
1350 - (void)setJavaScriptRuntimeFlags:(WebKitJavaScriptRuntimeFlags)flags
1352 [self _setUnsignedIntValue:flags forKey:WebKitJavaScriptRuntimeFlagsPreferenceKey];
1355 - (void)setDeveloperExtrasEnabled:(BOOL)flag
1357 [self _setBoolValue:flag forKey:WebKitDeveloperExtrasEnabledPreferenceKey];
1360 - (BOOL)authorAndUserStylesEnabled
1362 return [self _boolValueForKey:WebKitAuthorAndUserStylesEnabledPreferenceKey];
1365 - (void)setAuthorAndUserStylesEnabled:(BOOL)flag
1367 [self _setBoolValue:flag forKey:WebKitAuthorAndUserStylesEnabledPreferenceKey];
1370 // FIXME: applicationChromeMode is no longer needed by ToT, but is still used in Safari 8.
1371 - (BOOL)applicationChromeModeEnabled
1376 - (void)setApplicationChromeModeEnabled:(BOOL)flag
1380 - (BOOL)domTimersThrottlingEnabled
1382 return [self _boolValueForKey:WebKitDOMTimersThrottlingEnabledPreferenceKey];
1385 - (void)setDOMTimersThrottlingEnabled:(BOOL)flag
1387 [self _setBoolValue:flag forKey:WebKitDOMTimersThrottlingEnabledPreferenceKey];
1390 - (BOOL)webArchiveDebugModeEnabled
1392 return [self _boolValueForKey:WebKitWebArchiveDebugModeEnabledPreferenceKey];
1395 - (void)setWebArchiveDebugModeEnabled:(BOOL)flag
1397 [self _setBoolValue:flag forKey:WebKitWebArchiveDebugModeEnabledPreferenceKey];
1400 - (BOOL)localFileContentSniffingEnabled
1402 return [self _boolValueForKey:WebKitLocalFileContentSniffingEnabledPreferenceKey];
1405 - (void)setLocalFileContentSniffingEnabled:(BOOL)flag
1407 [self _setBoolValue:flag forKey:WebKitLocalFileContentSniffingEnabledPreferenceKey];
1410 - (BOOL)offlineWebApplicationCacheEnabled
1412 return [self _boolValueForKey:WebKitOfflineWebApplicationCacheEnabledPreferenceKey];
1415 - (void)setOfflineWebApplicationCacheEnabled:(BOOL)flag
1417 [self _setBoolValue:flag forKey:WebKitOfflineWebApplicationCacheEnabledPreferenceKey];
1420 - (BOOL)zoomsTextOnly
1422 return [self _boolValueForKey:WebKitZoomsTextOnlyPreferenceKey];
1425 - (void)setZoomsTextOnly:(BOOL)flag
1427 [self _setBoolValue:flag forKey:WebKitZoomsTextOnlyPreferenceKey];
1430 - (BOOL)javaScriptCanAccessClipboard
1432 return [self _boolValueForKey:WebKitJavaScriptCanAccessClipboardPreferenceKey];
1435 - (void)setJavaScriptCanAccessClipboard:(BOOL)flag
1437 [self _setBoolValue:flag forKey:WebKitJavaScriptCanAccessClipboardPreferenceKey];
1440 - (BOOL)isXSSAuditorEnabled
1442 return [self _boolValueForKey:WebKitXSSAuditorEnabledPreferenceKey];
1445 - (void)setXSSAuditorEnabled:(BOOL)flag
1447 [self _setBoolValue:flag forKey:WebKitXSSAuditorEnabledPreferenceKey];
1450 #if !PLATFORM(IOS_FAMILY)
1451 - (BOOL)respectStandardStyleKeyEquivalents
1453 return [self _boolValueForKey:WebKitRespectStandardStyleKeyEquivalentsPreferenceKey];
1456 - (void)setRespectStandardStyleKeyEquivalents:(BOOL)flag
1458 [self _setBoolValue:flag forKey:WebKitRespectStandardStyleKeyEquivalentsPreferenceKey];
1461 - (BOOL)showsURLsInToolTips
1463 return [self _boolValueForKey:WebKitShowsURLsInToolTipsPreferenceKey];
1466 - (void)setShowsURLsInToolTips:(BOOL)flag
1468 [self _setBoolValue:flag forKey:WebKitShowsURLsInToolTipsPreferenceKey];
1471 - (BOOL)showsToolTipOverTruncatedText
1473 return [self _boolValueForKey:WebKitShowsToolTipOverTruncatedTextPreferenceKey];
1476 - (void)setShowsToolTipOverTruncatedText:(BOOL)flag
1478 [self _setBoolValue:flag forKey:WebKitShowsToolTipOverTruncatedTextPreferenceKey];
1481 - (BOOL)textAreasAreResizable
1483 return [self _boolValueForKey: WebKitTextAreasAreResizablePreferenceKey];
1486 - (void)setTextAreasAreResizable:(BOOL)flag
1488 [self _setBoolValue: flag forKey: WebKitTextAreasAreResizablePreferenceKey];
1490 #endif // !PLATFORM(IOS_FAMILY)
1492 - (BOOL)shrinksStandaloneImagesToFit
1494 return [self _boolValueForKey:WebKitShrinksStandaloneImagesToFitPreferenceKey];
1497 - (void)setShrinksStandaloneImagesToFit:(BOOL)flag
1499 [self _setBoolValue:flag forKey:WebKitShrinksStandaloneImagesToFitPreferenceKey];
1502 - (BOOL)automaticallyDetectsCacheModel
1504 return _private->automaticallyDetectsCacheModel;
1507 - (void)setAutomaticallyDetectsCacheModel:(BOOL)automaticallyDetectsCacheModel
1509 _private->automaticallyDetectsCacheModel = automaticallyDetectsCacheModel;
1512 - (BOOL)usesEncodingDetector
1514 return [self _boolValueForKey: WebKitUsesEncodingDetectorPreferenceKey];
1517 - (void)setUsesEncodingDetector:(BOOL)flag
1519 [self _setBoolValue: flag forKey: WebKitUsesEncodingDetectorPreferenceKey];
1522 - (BOOL)isWebSecurityEnabled
1524 return [self _boolValueForKey: WebKitWebSecurityEnabledPreferenceKey];
1527 - (void)setWebSecurityEnabled:(BOOL)flag
1529 [self _setBoolValue: flag forKey: WebKitWebSecurityEnabledPreferenceKey];
1532 - (BOOL)allowUniversalAccessFromFileURLs
1534 return [self _boolValueForKey: WebKitAllowUniversalAccessFromFileURLsPreferenceKey];
1537 - (void)setAllowUniversalAccessFromFileURLs:(BOOL)flag
1539 [self _setBoolValue: flag forKey: WebKitAllowUniversalAccessFromFileURLsPreferenceKey];
1542 - (BOOL)allowFileAccessFromFileURLs
1544 return [self _boolValueForKey: WebKitAllowFileAccessFromFileURLsPreferenceKey];
1547 - (void)setAllowFileAccessFromFileURLs:(BOOL)flag
1549 [self _setBoolValue: flag forKey: WebKitAllowFileAccessFromFileURLsPreferenceKey];
1552 - (BOOL)allowCrossOriginSubresourcesToAskForCredentials
1554 return [self _boolValueForKey:WebKitAllowCrossOriginSubresourcesToAskForCredentialsKey];
1557 - (void)setAllowCrossOriginSubresourcesToAskForCredentials:(BOOL)flag
1559 [self _setBoolValue:flag forKey:WebKitAllowCrossOriginSubresourcesToAskForCredentialsKey];
1562 - (BOOL)needsStorageAccessFromFileURLsQuirk
1564 return [self _boolValueForKey: WebKitNeedsStorageAccessFromFileURLsQuirkKey];
1567 -(void)setNeedsStorageAccessFromFileURLsQuirk:(BOOL)flag
1569 [self _setBoolValue: flag forKey: WebKitNeedsStorageAccessFromFileURLsQuirkKey];
1572 - (NSTimeInterval)_backForwardCacheExpirationInterval
1574 return (NSTimeInterval)[self _floatValueForKey:WebKitBackForwardCacheExpirationIntervalKey];
1577 - (BOOL)_mediaRecorderEnabled
1579 return [self _boolValueForKey:WebKitMediaRecorderEnabledPreferenceKey];
1582 - (void)_setMediaRecorderEnabled:(BOOL)flag
1584 [self _setBoolValue:flag forKey:WebKitMediaRecorderEnabledPreferenceKey];
1587 #if PLATFORM(IOS_FAMILY)
1590 return [self _boolValueForKey:WebKitStandalonePreferenceKey];
1593 - (void)_setStandalone:(BOOL)flag
1595 [self _setBoolValue:flag forKey:WebKitStandalonePreferenceKey];
1598 - (void)_setTelephoneNumberParsingEnabled:(BOOL)flag
1600 [self _setBoolValue:flag forKey:WebKitTelephoneParsingEnabledPreferenceKey];
1603 - (BOOL)_telephoneNumberParsingEnabled
1605 return [self _boolValueForKey:WebKitTelephoneParsingEnabledPreferenceKey];
1608 - (BOOL)contentChangeObserverEnabled
1610 return [self _boolValueForKey:WebKitContentChangeObserverEnabledPreferenceKey];
1613 - (void)setContentChangeObserverEnabled:(BOOL)enabled
1615 [self _setBoolValue:enabled forKey:WebKitContentChangeObserverEnabledPreferenceKey];
1619 #if ENABLE(TEXT_AUTOSIZING)
1620 - (void)_setMinimumZoomFontSize:(float)size
1622 [self _setFloatValue:size forKey:WebKitMinimumZoomFontSizePreferenceKey];
1625 - (float)_minimumZoomFontSize
1627 return [self _floatValueForKey:WebKitMinimumZoomFontSizePreferenceKey];
1630 - (void)_setTextAutosizingEnabled:(BOOL)enabled
1632 [self _setBoolValue:enabled forKey:WebKitTextAutosizingEnabledPreferenceKey];
1635 - (BOOL)_textAutosizingEnabled
1637 return [self _boolValueForKey:WebKitTextAutosizingEnabledPreferenceKey];
1641 #if PLATFORM(IOS_FAMILY)
1642 - (void)_setLayoutInterval:(int)l
1644 [self _setIntegerValue:l forKey:WebKitLayoutIntervalPreferenceKey];
1647 - (int)_layoutInterval
1649 return [self _integerValueForKey:WebKitLayoutIntervalPreferenceKey];
1652 - (void)_setMaxParseDuration:(float)d
1654 [self _setFloatValue:d forKey:WebKitMaxParseDurationPreferenceKey];
1657 - (float)_maxParseDuration
1659 return [self _floatValueForKey:WebKitMaxParseDurationPreferenceKey];
1662 - (void)_setAllowMultiElementImplicitFormSubmission:(BOOL)flag
1664 [self _setBoolValue:flag forKey:WebKitAllowMultiElementImplicitFormSubmissionPreferenceKey];
1667 - (BOOL)_allowMultiElementImplicitFormSubmission
1669 return [self _boolValueForKey:WebKitAllowMultiElementImplicitFormSubmissionPreferenceKey];
1672 - (void)_setAlwaysRequestGeolocationPermission:(BOOL)flag
1674 [self _setBoolValue:flag forKey:WebKitAlwaysRequestGeolocationPermissionPreferenceKey];
1677 - (BOOL)_alwaysRequestGeolocationPermission
1679 return [self _boolValueForKey:WebKitAlwaysRequestGeolocationPermissionPreferenceKey];
1682 - (void)_setAlwaysUseAcceleratedOverflowScroll:(BOOL)flag
1684 [self _setBoolValue:flag forKey:WebKitAlwaysUseAcceleratedOverflowScrollPreferenceKey];
1687 - (BOOL)_alwaysUseAcceleratedOverflowScroll
1689 return [self _boolValueForKey:WebKitAlwaysUseAcceleratedOverflowScrollPreferenceKey];
1692 - (void)_setInterpolationQuality:(int)quality
1694 [self _setIntegerValue:quality forKey:WebKitInterpolationQualityPreferenceKey];
1697 - (int)_interpolationQuality
1699 return [self _integerValueForKey:WebKitInterpolationQualityPreferenceKey];
1702 - (BOOL)_allowPasswordEcho
1704 return [self _boolValueForKey:WebKitPasswordEchoEnabledPreferenceKey];
1707 - (float)_passwordEchoDuration
1709 return [self _floatValueForKey:WebKitPasswordEchoDurationPreferenceKey];
1712 #endif // PLATFORM(IOS_FAMILY)
1714 #if !PLATFORM(IOS_FAMILY)
1715 - (float)PDFScaleFactor
1717 return [self _floatValueForKey:WebKitPDFScaleFactorPreferenceKey];
1720 - (void)setPDFScaleFactor:(float)factor
1722 [self _setFloatValue:factor forKey:WebKitPDFScaleFactorPreferenceKey];
1726 - (int64_t)applicationCacheTotalQuota
1728 return [self _longLongValueForKey:WebKitApplicationCacheTotalQuota];
1731 - (void)setApplicationCacheTotalQuota:(int64_t)quota
1733 [self _setLongLongValue:quota forKey:WebKitApplicationCacheTotalQuota];
1735 // Application Cache Preferences are stored on the global cache storage manager, not in Settings.
1736 [WebApplicationCache setMaximumSize:quota];
1739 - (int64_t)applicationCacheDefaultOriginQuota
1741 return [self _longLongValueForKey:WebKitApplicationCacheDefaultOriginQuota];
1744 - (void)setApplicationCacheDefaultOriginQuota:(int64_t)quota
1746 [self _setLongLongValue:quota forKey:WebKitApplicationCacheDefaultOriginQuota];
1749 #if !PLATFORM(IOS_FAMILY)
1750 - (PDFDisplayMode)PDFDisplayMode
1752 PDFDisplayMode value = static_cast<PDFDisplayMode>([self _integerValueForKey:WebKitPDFDisplayModePreferenceKey]);
1753 if (value != kPDFDisplaySinglePage && value != kPDFDisplaySinglePageContinuous && value != kPDFDisplayTwoUp && value != kPDFDisplayTwoUpContinuous) {
1754 // protect against new modes from future versions of OS X stored in defaults
1755 value = kPDFDisplaySinglePageContinuous;
1760 - (void)setPDFDisplayMode:(PDFDisplayMode)mode
1762 [self _setIntegerValue:mode forKey:WebKitPDFDisplayModePreferenceKey];
1766 - (WebKitEditableLinkBehavior)editableLinkBehavior
1768 WebKitEditableLinkBehavior value = static_cast<WebKitEditableLinkBehavior> ([self _integerValueForKey:WebKitEditableLinkBehaviorPreferenceKey]);
1769 if (value != WebKitEditableLinkDefaultBehavior &&
1770 value != WebKitEditableLinkAlwaysLive &&
1771 value != WebKitEditableLinkNeverLive &&
1772 value != WebKitEditableLinkOnlyLiveWithShiftKey &&
1773 value != WebKitEditableLinkLiveWhenNotFocused) {
1774 // ensure that a valid result is returned
1775 value = WebKitEditableLinkDefaultBehavior;
1781 - (void)setEditableLinkBehavior:(WebKitEditableLinkBehavior)behavior
1783 [self _setIntegerValue:behavior forKey:WebKitEditableLinkBehaviorPreferenceKey];
1786 - (WebTextDirectionSubmenuInclusionBehavior)textDirectionSubmenuInclusionBehavior
1788 WebTextDirectionSubmenuInclusionBehavior value = static_cast<WebTextDirectionSubmenuInclusionBehavior>([self _integerValueForKey:WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey]);
1789 if (value != WebTextDirectionSubmenuNeverIncluded &&
1790 value != WebTextDirectionSubmenuAutomaticallyIncluded &&
1791 value != WebTextDirectionSubmenuAlwaysIncluded) {
1792 // Ensure that a valid result is returned.
1793 value = WebTextDirectionSubmenuNeverIncluded;
1798 - (void)setTextDirectionSubmenuInclusionBehavior:(WebTextDirectionSubmenuInclusionBehavior)behavior
1800 [self _setIntegerValue:behavior forKey:WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey];
1803 - (BOOL)_useSiteSpecificSpoofing
1805 return [self _boolValueForKey:WebKitUseSiteSpecificSpoofingPreferenceKey];
1808 - (void)_setUseSiteSpecificSpoofing:(BOOL)newValue
1810 [self _setBoolValue:newValue forKey:WebKitUseSiteSpecificSpoofingPreferenceKey];
1813 - (BOOL)databasesEnabled
1815 return [self _boolValueForKey:WebKitDatabasesEnabledPreferenceKey];
1818 - (void)setDatabasesEnabled:(BOOL)databasesEnabled
1820 [self _setBoolValue:databasesEnabled forKey:WebKitDatabasesEnabledPreferenceKey];
1823 #if PLATFORM(IOS_FAMILY)
1824 - (BOOL)storageTrackerEnabled
1826 return [self _boolValueForKey:WebKitStorageTrackerEnabledPreferenceKey];
1829 - (void)setStorageTrackerEnabled:(BOOL)storageTrackerEnabled
1831 [self _setBoolValue:storageTrackerEnabled forKey:WebKitStorageTrackerEnabledPreferenceKey];
1835 - (BOOL)localStorageEnabled
1837 return [self _boolValueForKey:WebKitLocalStorageEnabledPreferenceKey];
1840 - (void)setLocalStorageEnabled:(BOOL)localStorageEnabled
1842 [self _setBoolValue:localStorageEnabled forKey:WebKitLocalStorageEnabledPreferenceKey];
1845 - (BOOL)experimentalNotificationsEnabled
1847 return [self _boolValueForKey:WebKitExperimentalNotificationsEnabledPreferenceKey];
1850 - (void)setExperimentalNotificationsEnabled:(BOOL)experimentalNotificationsEnabled
1852 [self _setBoolValue:experimentalNotificationsEnabled forKey:WebKitExperimentalNotificationsEnabledPreferenceKey];
1855 + (WebPreferences *)_getInstanceForIdentifier:(NSString *)ident
1857 LOG(Encoding, "requesting for %@\n", ident);
1860 return _standardPreferences;
1862 WebPreferences *instance = [webPreferencesInstances objectForKey:[self _concatenateKeyWithIBCreatorID:ident]];
1867 + (void)_setInstance:(WebPreferences *)instance forIdentifier:(NSString *)ident
1869 if (!webPreferencesInstances)
1870 webPreferencesInstances = [[NSMutableDictionary alloc] init];
1872 [webPreferencesInstances setObject:instance forKey:[self _concatenateKeyWithIBCreatorID:ident]];
1873 LOG(Encoding, "recording %p for %@\n", instance, [self _concatenateKeyWithIBCreatorID:ident]);
1877 + (void)_checkLastReferenceForIdentifier:(id)identifier
1879 // FIXME: This won't work at all under garbage collection because retainCount returns a constant.
1880 // We may need to change WebPreferences API so there's an explicit way to end the lifetime of one.
1881 WebPreferences *instance = [webPreferencesInstances objectForKey:identifier];
1882 if ([instance retainCount] == 1)
1883 [webPreferencesInstances removeObjectForKey:identifier];
1886 + (void)_removeReferenceForIdentifier:(NSString *)ident
1889 [self performSelector:@selector(_checkLastReferenceForIdentifier:) withObject:[self _concatenateKeyWithIBCreatorID:ident] afterDelay:0.1];
1892 - (void)_postPreferencesChangedNotification
1894 #if !PLATFORM(IOS_FAMILY)
1895 if (!pthread_main_np()) {
1896 [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO];
1901 [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedInternalNotification object:self userInfo:nil];
1902 [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedNotification object:self userInfo:nil];
1905 - (void)_postPreferencesChangedAPINotification
1907 if (!pthread_main_np()) {
1908 [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO];
1912 [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedNotification object:self userInfo:nil];
1915 + (CFStringEncoding)_systemCFStringEncoding
1917 return webDefaultCFStringEncoding();
1920 + (void)_setInitialDefaultTextEncodingToSystemEncoding
1922 [[NSUserDefaults standardUserDefaults] registerDefaults:
1923 [NSDictionary dictionaryWithObject:defaultTextEncodingNameForSystemLanguage() forKey:WebKitDefaultTextEncodingNamePreferenceKey]];
1926 static NSString *classIBCreatorID = nil;
1928 + (void)_setIBCreatorID:(NSString *)string
1930 NSString *old = classIBCreatorID;
1931 classIBCreatorID = [string copy];
1935 + (void)_switchNetworkLoaderToNewTestingSession
1937 #if PLATFORM(IOS_FAMILY)
1940 NetworkStorageSessionMap::switchToNewTestingSession();
1943 + (void)_clearNetworkLoaderSession
1945 NetworkStorageSessionMap::defaultStorageSession().deleteAllCookies();
1948 + (void)_setCurrentNetworkLoaderSessionCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy
1950 RetainPtr<CFHTTPCookieStorageRef> cookieStorage = NetworkStorageSessionMap::defaultStorageSession().cookieStorage();
1951 ASSERT(cookieStorage); // Will fail when NetworkStorageSessionMap::switchToNewTestingSession() was not called beforehand.
1952 CFHTTPCookieStorageSetCookieAcceptPolicy(cookieStorage.get(), policy);
1955 - (BOOL)isDOMPasteAllowed
1957 return [self _boolValueForKey:WebKitDOMPasteAllowedPreferenceKey];
1960 - (void)setDOMPasteAllowed:(BOOL)DOMPasteAllowed
1962 [self _setBoolValue:DOMPasteAllowed forKey:WebKitDOMPasteAllowedPreferenceKey];
1965 - (NSString *)_localStorageDatabasePath
1967 return [[self _stringValueForKey:WebKitLocalStorageDatabasePathPreferenceKey] stringByStandardizingPath];
1970 - (void)_setLocalStorageDatabasePath:(NSString *)path
1972 [self _setStringValue:[path stringByStandardizingPath] forKey:WebKitLocalStorageDatabasePathPreferenceKey];
1975 - (NSString *)_ftpDirectoryTemplatePath
1977 return [[self _stringValueForKey:WebKitFTPDirectoryTemplatePath] stringByStandardizingPath];
1980 - (void)_setFTPDirectoryTemplatePath:(NSString *)path
1982 [self _setStringValue:[path stringByStandardizingPath] forKey:WebKitFTPDirectoryTemplatePath];
1985 - (BOOL)_forceFTPDirectoryListings
1987 return [self _boolValueForKey:WebKitForceFTPDirectoryListings];
1990 - (void)_setForceFTPDirectoryListings:(BOOL)force
1992 [self _setBoolValue:force forKey:WebKitForceFTPDirectoryListings];
1995 - (BOOL)acceleratedDrawingEnabled
1997 return [self _boolValueForKey:WebKitAcceleratedDrawingEnabledPreferenceKey];
2000 - (void)setAcceleratedDrawingEnabled:(BOOL)enabled
2002 [self _setBoolValue:enabled forKey:WebKitAcceleratedDrawingEnabledPreferenceKey];
2005 - (BOOL)displayListDrawingEnabled
2007 return [self _boolValueForKey:WebKitDisplayListDrawingEnabledPreferenceKey];
2010 - (void)setDisplayListDrawingEnabled:(BOOL)enabled
2012 [self _setBoolValue:enabled forKey:WebKitDisplayListDrawingEnabledPreferenceKey];
2015 - (BOOL)resourceLoadStatisticsEnabled
2017 return [self _boolValueForKey:WebKitResourceLoadStatisticsEnabledPreferenceKey];
2020 - (void)setResourceLoadStatisticsEnabled:(BOOL)enabled
2022 [self _setBoolValue:enabled forKey:WebKitResourceLoadStatisticsEnabledPreferenceKey];
2025 - (BOOL)largeImageAsyncDecodingEnabled
2027 return [self _boolValueForKey:WebKitLargeImageAsyncDecodingEnabledPreferenceKey];
2030 - (void)setLargeImageAsyncDecodingEnabled:(BOOL)enabled
2032 [self _setBoolValue:enabled forKey:WebKitLargeImageAsyncDecodingEnabledPreferenceKey];
2035 - (BOOL)animatedImageAsyncDecodingEnabled
2037 return [self _boolValueForKey:WebKitAnimatedImageAsyncDecodingEnabledPreferenceKey];
2040 - (void)setAnimatedImageAsyncDecodingEnabled:(BOOL)enabled
2042 [self _setBoolValue:enabled forKey:WebKitAnimatedImageAsyncDecodingEnabledPreferenceKey];
2045 - (BOOL)canvasUsesAcceleratedDrawing
2047 return [self _boolValueForKey:WebKitCanvasUsesAcceleratedDrawingPreferenceKey];
2050 - (void)setCanvasUsesAcceleratedDrawing:(BOOL)enabled
2052 [self _setBoolValue:enabled forKey:WebKitCanvasUsesAcceleratedDrawingPreferenceKey];
2055 - (BOOL)acceleratedCompositingEnabled
2057 return [self _boolValueForKey:WebKitAcceleratedCompositingEnabledPreferenceKey];
2060 - (void)setAcceleratedCompositingEnabled:(BOOL)enabled
2062 [self _setBoolValue:enabled forKey:WebKitAcceleratedCompositingEnabledPreferenceKey];
2065 - (BOOL)showDebugBorders
2067 return [self _boolValueForKey:WebKitShowDebugBordersPreferenceKey];
2070 - (void)setShowDebugBorders:(BOOL)enabled
2072 [self _setBoolValue:enabled forKey:WebKitShowDebugBordersPreferenceKey];
2075 - (BOOL)subpixelAntialiasedLayerTextEnabled
2077 return [self _boolValueForKey:WebKitSubpixelAntialiasedLayerTextEnabledPreferenceKey];
2080 - (void)setSubpixelAntialiasedLayerTextEnabled:(BOOL)enabled
2082 [self _setBoolValue:enabled forKey:WebKitSubpixelAntialiasedLayerTextEnabledPreferenceKey];
2085 - (BOOL)simpleLineLayoutEnabled
2087 return [self _boolValueForKey:WebKitSimpleLineLayoutEnabledPreferenceKey];
2090 - (void)setSimpleLineLayoutEnabled:(BOOL)enabled
2092 [self _setBoolValue:enabled forKey:WebKitSimpleLineLayoutEnabledPreferenceKey];
2095 - (BOOL)simpleLineLayoutDebugBordersEnabled
2097 return [self _boolValueForKey:WebKitSimpleLineLayoutDebugBordersEnabledPreferenceKey];
2100 - (void)setSimpleLineLayoutDebugBordersEnabled:(BOOL)enabled
2102 [self _setBoolValue:enabled forKey:WebKitSimpleLineLayoutDebugBordersEnabledPreferenceKey];
2105 - (BOOL)showRepaintCounter
2107 return [self _boolValueForKey:WebKitShowRepaintCounterPreferenceKey];
2110 - (void)setShowRepaintCounter:(BOOL)enabled
2112 [self _setBoolValue:enabled forKey:WebKitShowRepaintCounterPreferenceKey];
2115 - (BOOL)webAudioEnabled
2117 return [self _boolValueForKey:WebKitWebAudioEnabledPreferenceKey];
2120 - (void)setWebAudioEnabled:(BOOL)enabled
2122 [self _setBoolValue:enabled forKey:WebKitWebAudioEnabledPreferenceKey];
2125 - (BOOL)subpixelCSSOMElementMetricsEnabled
2127 return [self _boolValueForKey:WebKitSubpixelCSSOMElementMetricsEnabledPreferenceKey];
2130 - (void)setSubpixelCSSOMElementMetricsEnabled:(BOOL)enabled
2132 [self _setBoolValue:enabled forKey:WebKitSubpixelCSSOMElementMetricsEnabledPreferenceKey];
2135 - (BOOL)webGLEnabled
2137 return [self _boolValueForKey:WebKitWebGLEnabledPreferenceKey];
2140 - (void)setWebGLEnabled:(BOOL)enabled
2142 [self _setBoolValue:enabled forKey:WebKitWebGLEnabledPreferenceKey];
2145 - (BOOL)webGL2Enabled
2147 return [self _boolValueForKey:WebKitWebGL2EnabledPreferenceKey];
2150 - (void)setWebGL2Enabled:(BOOL)enabled
2152 [self _setBoolValue:enabled forKey:WebKitWebGL2EnabledPreferenceKey];
2155 - (BOOL)forceLowPowerGPUForWebGL
2157 return [self _boolValueForKey:WebKitForceWebGLUsesLowPowerPreferenceKey];
2160 - (void)setForceWebGLUsesLowPower:(BOOL)forceLowPower
2162 [self _setBoolValue:forceLowPower forKey:WebKitForceWebGLUsesLowPowerPreferenceKey];
2165 - (BOOL)webGPUEnabled
2167 return [self _boolValueForKey:WebKitWebGPUEnabledPreferenceKey];
2170 - (void)setWebGPUEnabled:(BOOL)enabled
2172 [self _setBoolValue:enabled forKey:WebKitWebGPUEnabledPreferenceKey];
2175 - (BOOL)accelerated2dCanvasEnabled
2177 return [self _boolValueForKey:WebKitAccelerated2dCanvasEnabledPreferenceKey];
2180 - (void)setAccelerated2dCanvasEnabled:(BOOL)enabled
2182 [self _setBoolValue:enabled forKey:WebKitAccelerated2dCanvasEnabledPreferenceKey];
2185 - (void)setDiskImageCacheEnabled:(BOOL)enabled
2187 // Staging. Can be removed once there are no more callers.
2190 - (BOOL)isFrameFlatteningEnabled
2192 return [self _unsignedIntValueForKey:WebKitFrameFlatteningPreferenceKey] != WebKitFrameFlatteningDisabled;
2195 - (void)setFrameFlatteningEnabled:(BOOL)flattening
2197 WebKitFrameFlattening value = flattening ? WebKitFrameFlatteningFullyEnabled : WebKitFrameFlatteningDisabled;
2198 [self _setUnsignedIntValue:value forKey:WebKitFrameFlatteningPreferenceKey];
2201 - (WebKitFrameFlattening)frameFlattening
2203 return static_cast<WebKitFrameFlattening>([self _unsignedIntValueForKey:WebKitFrameFlatteningPreferenceKey]);
2206 - (void)setFrameFlattening:(WebKitFrameFlattening)flattening
2208 [self _setUnsignedIntValue:flattening forKey:WebKitFrameFlatteningPreferenceKey];
2211 - (BOOL)asyncFrameScrollingEnabled
2213 return [self _boolValueForKey:WebKitAsyncFrameScrollingEnabledPreferenceKey];
2216 - (void)setAsyncFrameScrollingEnabled:(BOOL)enabled
2218 [self _setBoolValue:enabled forKey:WebKitAsyncFrameScrollingEnabledPreferenceKey];
2221 - (BOOL)isSpatialNavigationEnabled
2223 return [self _boolValueForKey:WebKitSpatialNavigationEnabledPreferenceKey];
2226 - (void)setSpatialNavigationEnabled:(BOOL)flag
2228 [self _setBoolValue:flag forKey:WebKitSpatialNavigationEnabledPreferenceKey];
2231 - (BOOL)paginateDuringLayoutEnabled
2233 return [self _boolValueForKey:WebKitPaginateDuringLayoutEnabledPreferenceKey];
2236 - (void)setPaginateDuringLayoutEnabled:(BOOL)flag
2238 [self _setBoolValue:flag forKey:WebKitPaginateDuringLayoutEnabledPreferenceKey];
2241 - (BOOL)hyperlinkAuditingEnabled
2243 return [self _boolValueForKey:WebKitHyperlinkAuditingEnabledPreferenceKey];
2246 - (void)setHyperlinkAuditingEnabled:(BOOL)flag
2248 [self _setBoolValue:flag forKey:WebKitHyperlinkAuditingEnabledPreferenceKey];
2251 - (BOOL)usePreHTML5ParserQuirks
2253 return [self _boolValueForKey:WebKitUsePreHTML5ParserQuirksKey];
2256 - (void)setUsePreHTML5ParserQuirks:(BOOL)flag
2258 [self _setBoolValue:flag forKey:WebKitUsePreHTML5ParserQuirksKey];
2261 - (void)didRemoveFromWebView
2263 ASSERT(_private->numWebViews);
2264 if (--_private->numWebViews == 0)
2265 [[NSNotificationCenter defaultCenter]
2266 postNotificationName:WebPreferencesRemovedNotification
2271 - (void)willAddToWebView
2273 ++_private->numWebViews;
2276 - (void)_setPreferenceForTestWithValue:(NSString *)value forKey:(NSString *)key
2278 [self _setStringValue:value forKey:key];
2281 - (void)setFullScreenEnabled:(BOOL)flag
2283 [self _setBoolValue:flag forKey:WebKitFullScreenEnabledPreferenceKey];
2286 - (BOOL)fullScreenEnabled
2288 return [self _boolValueForKey:WebKitFullScreenEnabledPreferenceKey];
2291 - (void)setAsynchronousSpellCheckingEnabled:(BOOL)flag
2293 [self _setBoolValue:flag forKey:WebKitAsynchronousSpellCheckingEnabledPreferenceKey];
2296 - (BOOL)asynchronousSpellCheckingEnabled
2298 return [self _boolValueForKey:WebKitAsynchronousSpellCheckingEnabledPreferenceKey];
2301 + (void)setWebKitLinkTimeVersion:(int)version
2303 setWebKitLinkTimeVersion(version);
2306 - (void)setLoadsSiteIconsIgnoringImageLoadingPreference: (BOOL)flag
2308 [self _setBoolValue: flag forKey: WebKitLoadSiteIconsKey];
2311 - (BOOL)loadsSiteIconsIgnoringImageLoadingPreference
2313 return [self _boolValueForKey: WebKitLoadSiteIconsKey];
2316 - (void)setAVFoundationEnabled:(BOOL)flag
2318 [self _setBoolValue:flag forKey:WebKitAVFoundationEnabledKey];
2321 - (BOOL)isAVFoundationEnabled
2323 return [self _boolValueForKey:WebKitAVFoundationEnabledKey];
2326 - (void)setAVFoundationNSURLSessionEnabled:(BOOL)flag
2328 [self _setBoolValue:flag forKey:WebKitAVFoundationNSURLSessionEnabledKey];
2331 - (BOOL)isAVFoundationNSURLSessionEnabled
2333 return [self _boolValueForKey:WebKitAVFoundationNSURLSessionEnabledKey];
2336 - (void)setVideoPluginProxyEnabled:(BOOL)flag
2338 // No-op, left for SPI compatibility.
2341 - (BOOL)isVideoPluginProxyEnabled
2346 - (void)setHixie76WebSocketProtocolEnabled:(BOOL)flag
2350 - (BOOL)isHixie76WebSocketProtocolEnabled
2355 - (BOOL)isInheritURIQueryComponentEnabled
2357 return [self _boolValueForKey: WebKitEnableInheritURIQueryComponentPreferenceKey];
2360 - (void)setEnableInheritURIQueryComponent:(BOOL)flag
2362 [self _setBoolValue:flag forKey: WebKitEnableInheritURIQueryComponentPreferenceKey];
2365 #if PLATFORM(IOS_FAMILY)
2366 - (BOOL)mediaPlaybackAllowsAirPlay
2368 return [self _boolValueForKey:WebKitAllowsAirPlayForMediaPlaybackPreferenceKey];
2371 - (void)setMediaPlaybackAllowsAirPlay:(BOOL)flag
2373 [self _setBoolValue:flag forKey:WebKitAllowsAirPlayForMediaPlaybackPreferenceKey];
2376 - (unsigned)audioSessionCategoryOverride
2378 return [self _unsignedIntValueForKey:WebKitAudioSessionCategoryOverride];
2381 - (void)setAudioSessionCategoryOverride:(unsigned)override
2383 if (override > AudioSession::AudioProcessing) {
2384 // Clients are passing us OSTypes values from AudioToolbox/AudioSession.h,
2385 // which need to be translated into AudioSession::CategoryType:
2387 case WebKitAudioSessionCategoryAmbientSound:
2388 override = AudioSession::AmbientSound;
2390 case WebKitAudioSessionCategorySoloAmbientSound:
2391 override = AudioSession::SoloAmbientSound;
2393 case WebKitAudioSessionCategoryMediaPlayback:
2394 override = AudioSession::MediaPlayback;
2396 case WebKitAudioSessionCategoryRecordAudio:
2397 override = AudioSession::RecordAudio;
2399 case WebKitAudioSessionCategoryPlayAndRecord:
2400 override = AudioSession::PlayAndRecord;
2402 case WebKitAudioSessionCategoryAudioProcessing:
2403 override = AudioSession::AudioProcessing;
2406 override = AudioSession::None;
2411 [self _setUnsignedIntValue:override forKey:WebKitAudioSessionCategoryOverride];
2414 - (BOOL)avKitEnabled
2416 return [self _boolValueForKey:WebKitAVKitEnabled];
2419 - (void)setAVKitEnabled:(bool)flag
2422 [self _setBoolValue:flag forKey:WebKitAVKitEnabled];
2426 - (BOOL)networkDataUsageTrackingEnabled
2428 return [self _boolValueForKey:WebKitNetworkDataUsageTrackingEnabledPreferenceKey];
2431 - (void)setNetworkDataUsageTrackingEnabled:(bool)trackingEnabled
2433 [self _setBoolValue:trackingEnabled forKey:WebKitNetworkDataUsageTrackingEnabledPreferenceKey];
2436 - (NSString *)networkInterfaceName
2438 return [self _stringValueForKey:WebKitNetworkInterfaceNamePreferenceKey];
2441 - (void)setNetworkInterfaceName:(NSString *)name
2443 [self _setStringValue:name forKey:WebKitNetworkInterfaceNamePreferenceKey];
2445 #endif // PLATFORM(IOS_FAMILY)
2447 // Deprecated. Use -videoPlaybackRequiresUserGesture and -audioPlaybackRequiresUserGesture instead.
2448 - (BOOL)mediaPlaybackRequiresUserGesture
2450 return [self _boolValueForKey:WebKitRequiresUserGestureForMediaPlaybackPreferenceKey];
2453 // Deprecated. Use -setVideoPlaybackRequiresUserGesture and -setAudioPlaybackRequiresUserGesture instead.
2454 - (void)setMediaPlaybackRequiresUserGesture:(BOOL)flag
2456 [self _setBoolValue:flag forKey:WebKitRequiresUserGestureForMediaPlaybackPreferenceKey];
2459 - (BOOL)videoPlaybackRequiresUserGesture
2461 return [self _boolValueForKey:WebKitRequiresUserGestureForVideoPlaybackPreferenceKey];
2464 - (void)setVideoPlaybackRequiresUserGesture:(BOOL)flag
2466 [self _setBoolValue:flag forKey:WebKitRequiresUserGestureForVideoPlaybackPreferenceKey];
2469 - (BOOL)audioPlaybackRequiresUserGesture
2471 return [self _boolValueForKey:WebKitRequiresUserGestureForAudioPlaybackPreferenceKey];
2474 - (void)setAudioPlaybackRequiresUserGesture:(BOOL)flag
2476 [self _setBoolValue:flag forKey:WebKitRequiresUserGestureForAudioPlaybackPreferenceKey];
2479 - (BOOL)overrideUserGestureRequirementForMainContent
2481 return [self _boolValueForKey:WebKitMainContentUserGestureOverrideEnabledPreferenceKey];
2484 - (void)setOverrideUserGestureRequirementForMainContent:(BOOL)flag
2486 [self _setBoolValue:flag forKey:WebKitMainContentUserGestureOverrideEnabledPreferenceKey];
2489 - (BOOL)mediaPlaybackAllowsInline
2491 return [self _boolValueForKey:WebKitAllowsInlineMediaPlaybackPreferenceKey];
2494 - (void)setMediaPlaybackAllowsInline:(BOOL)flag
2496 [self _setBoolValue:flag forKey:WebKitAllowsInlineMediaPlaybackPreferenceKey];
2499 - (BOOL)inlineMediaPlaybackRequiresPlaysInlineAttribute
2501 return [self _boolValueForKey:WebKitInlineMediaPlaybackRequiresPlaysInlineAttributeKey];
2504 - (void)setInlineMediaPlaybackRequiresPlaysInlineAttribute:(BOOL)flag
2506 [self _setBoolValue:flag forKey:WebKitInlineMediaPlaybackRequiresPlaysInlineAttributeKey];
2509 - (BOOL)invisibleAutoplayNotPermitted
2511 return [self _boolValueForKey:WebKitInvisibleAutoplayNotPermittedKey];
2514 - (void)setInvisibleAutoplayNotPermitted:(BOOL)flag
2516 [self _setBoolValue:flag forKey:WebKitInvisibleAutoplayNotPermittedKey];
2519 - (BOOL)mediaControlsScaleWithPageZoom
2521 return [self _boolValueForKey:WebKitMediaControlsScaleWithPageZoomPreferenceKey];
2524 - (void)setMediaControlsScaleWithPageZoom:(BOOL)flag
2526 [self _setBoolValue:flag forKey:WebKitMediaControlsScaleWithPageZoomPreferenceKey];
2529 - (BOOL)allowsAlternateFullscreen
2531 return [self allowsPictureInPictureMediaPlayback];
2534 - (void)setAllowsAlternateFullscreen:(BOOL)flag
2536 [self setAllowsPictureInPictureMediaPlayback:flag];
2539 - (BOOL)allowsPictureInPictureMediaPlayback
2541 return [self _boolValueForKey:WebKitAllowsPictureInPictureMediaPlaybackPreferenceKey];
2544 - (void)setAllowsPictureInPictureMediaPlayback:(BOOL)flag
2546 [self _setBoolValue:flag forKey:WebKitAllowsPictureInPictureMediaPlaybackPreferenceKey];
2549 - (BOOL)mockScrollbarsEnabled
2551 return [self _boolValueForKey:WebKitMockScrollbarsEnabledPreferenceKey];
2554 - (void)setMockScrollbarsEnabled:(BOOL)flag
2556 [self _setBoolValue:flag forKey:WebKitMockScrollbarsEnabledPreferenceKey];
2559 - (NSString *)pictographFontFamily
2561 return [self _stringValueForKey: WebKitPictographFontPreferenceKey];
2564 - (void)setPictographFontFamily:(NSString *)family
2566 [self _setStringValue: family forKey: WebKitPictographFontPreferenceKey];
2569 - (BOOL)pageCacheSupportsPlugins
2571 return [self _boolValueForKey:WebKitPageCacheSupportsPluginsPreferenceKey];
2574 - (void)setPageCacheSupportsPlugins:(BOOL)flag
2576 [self _setBoolValue:flag forKey:WebKitPageCacheSupportsPluginsPreferenceKey];
2580 #if PLATFORM(IOS_FAMILY)
2581 - (void)_invalidateCachedPreferences
2583 dispatch_barrier_sync(_private->readWriteQueue, ^{
2584 if (_private->values)
2585 _private->values = adoptNS([[NSMutableDictionary alloc] init]);
2588 [self _updatePrivateBrowsingStateTo:[self privateBrowsingEnabled]];
2590 // Tell any live WebViews to refresh their preferences
2591 [self _postPreferencesChangedNotification];
2594 - (void)_synchronizeWebStoragePolicyWithCookiePolicy
2596 // FIXME: This should be done in clients, WebKit shouldn't be making such policy decisions.
2598 NSHTTPCookieAcceptPolicy cookieAcceptPolicy = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookieAcceptPolicy];
2599 WebStorageBlockingPolicy storageBlockingPolicy;
2600 switch (static_cast<unsigned>(cookieAcceptPolicy)) {
2601 case NSHTTPCookieAcceptPolicyAlways:
2602 storageBlockingPolicy = WebAllowAllStorage;
2604 case NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
2605 case NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain:
2606 storageBlockingPolicy = WebBlockThirdPartyStorage;
2608 case NSHTTPCookieAcceptPolicyNever:
2609 storageBlockingPolicy = WebBlockAllStorage;
2612 ASSERT_NOT_REACHED();
2613 storageBlockingPolicy = WebBlockAllStorage;
2617 [self setStorageBlockingPolicy:storageBlockingPolicy];
2621 - (void)setBackspaceKeyNavigationEnabled:(BOOL)flag
2623 [self _setBoolValue:flag forKey:WebKitBackspaceKeyNavigationEnabledKey];
2626 - (BOOL)backspaceKeyNavigationEnabled
2628 return [self _boolValueForKey:WebKitBackspaceKeyNavigationEnabledKey];
2631 - (void)setWantsBalancedSetDefersLoadingBehavior:(BOOL)flag
2633 [self _setBoolValue:flag forKey:WebKitWantsBalancedSetDefersLoadingBehaviorKey];
2636 - (BOOL)wantsBalancedSetDefersLoadingBehavior
2638 return [self _boolValueForKey:WebKitWantsBalancedSetDefersLoadingBehaviorKey];
2641 - (void)setShouldDisplaySubtitles:(BOOL)flag
2643 [self _setBoolValue:flag forKey:WebKitShouldDisplaySubtitlesPreferenceKey];
2646 - (BOOL)shouldDisplaySubtitles
2648 return [self _boolValueForKey:WebKitShouldDisplaySubtitlesPreferenceKey];
2651 - (void)setShouldDisplayCaptions:(BOOL)flag
2653 [self _setBoolValue:flag forKey:WebKitShouldDisplayCaptionsPreferenceKey];
2656 - (BOOL)shouldDisplayCaptions
2658 return [self _boolValueForKey:WebKitShouldDisplayCaptionsPreferenceKey];
2661 - (void)setShouldDisplayTextDescriptions:(BOOL)flag
2663 [self _setBoolValue:flag forKey:WebKitShouldDisplayTextDescriptionsPreferenceKey];
2666 - (BOOL)shouldDisplayTextDescriptions
2668 return [self _boolValueForKey:WebKitShouldDisplayTextDescriptionsPreferenceKey];
2671 - (void)setNotificationsEnabled:(BOOL)flag
2673 [self _setBoolValue:flag forKey:WebKitNotificationsEnabledKey];
2676 - (BOOL)notificationsEnabled
2678 return [self _boolValueForKey:WebKitNotificationsEnabledKey];
2681 - (void)setShouldRespectImageOrientation:(BOOL)flag
2683 [self _setBoolValue:flag forKey:WebKitShouldRespectImageOrientationKey];
2686 - (BOOL)shouldRespectImageOrientation
2688 return [self _boolValueForKey:WebKitShouldRespectImageOrientationKey];
2691 - (BOOL)requestAnimationFrameEnabled
2693 return [self _boolValueForKey:WebKitRequestAnimationFrameEnabledPreferenceKey];
2696 - (void)setRequestAnimationFrameEnabled:(BOOL)enabled
2698 [self _setBoolValue:enabled forKey:WebKitRequestAnimationFrameEnabledPreferenceKey];
2701 - (void)setIncrementalRenderingSuppressionTimeoutInSeconds:(NSTimeInterval)timeout
2703 [self _setFloatValue:timeout forKey:WebKitIncrementalRenderingSuppressionTimeoutInSecondsKey];
2706 - (NSTimeInterval)incrementalRenderingSuppressionTimeoutInSeconds
2708 return [self _floatValueForKey:WebKitIncrementalRenderingSuppressionTimeoutInSecondsKey];
2711 - (BOOL)diagnosticLoggingEnabled
2713 return [self _boolValueForKey:WebKitDiagnosticLoggingEnabledKey];
2716 - (void)setDiagnosticLoggingEnabled:(BOOL)enabled
2718 [self _setBoolValue:enabled forKey:WebKitDiagnosticLoggingEnabledKey];
2721 - (void)setStorageBlockingPolicy:(WebStorageBlockingPolicy)storageBlockingPolicy
2723 #if PLATFORM(IOS_FAMILY)
2724 // We don't want to write the setting out, so we just reset the default instead of storing the new setting.
2725 // FIXME: This code removes any defaults previously registered by client process, which is not appropriate for this method to do.
2726 NSDictionary *dict = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:storageBlockingPolicy] forKey:WebKitStorageBlockingPolicyKey];
2727 [[NSUserDefaults standardUserDefaults] registerDefaults:dict];
2729 [self _setIntegerValue:storageBlockingPolicy forKey:WebKitStorageBlockingPolicyKey];
2733 - (WebStorageBlockingPolicy)storageBlockingPolicy
2735 return static_cast<WebStorageBlockingPolicy>([self _integerValueForKey:WebKitStorageBlockingPolicyKey]);
2738 - (BOOL)plugInSnapshottingEnabled
2740 return [self _boolValueForKey:WebKitPlugInSnapshottingEnabledPreferenceKey];
2743 - (void)setPlugInSnapshottingEnabled:(BOOL)enabled
2745 [self _setBoolValue:enabled forKey:WebKitPlugInSnapshottingEnabledPreferenceKey];
2748 - (BOOL)hiddenPageDOMTimerThrottlingEnabled
2750 return [self _boolValueForKey:WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey];
2753 - (void)setHiddenPageDOMTimerThrottlingEnabled:(BOOL)enabled
2755 [self _setBoolValue:enabled forKey:WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey];
2758 - (BOOL)hiddenPageCSSAnimationSuspensionEnabled
2760 return [self _boolValueForKey:WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey];
2763 - (void)setHiddenPageCSSAnimationSuspensionEnabled:(BOOL)enabled
2765 [self _setBoolValue:enabled forKey:WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey];
2768 - (BOOL)lowPowerVideoAudioBufferSizeEnabled
2770 return [self _boolValueForKey:WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey];
2773 - (void)setLowPowerVideoAudioBufferSizeEnabled:(BOOL)enabled
2775 [self _setBoolValue:enabled forKey:WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey];
2778 - (BOOL)useLegacyTextAlignPositionedElementBehavior
2780 return [self _boolValueForKey:WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey];
2783 - (void)setUseLegacyTextAlignPositionedElementBehavior:(BOOL)enabled
2785 [self _setBoolValue:enabled forKey:WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey];
2788 - (BOOL)mediaSourceEnabled
2790 return [self _boolValueForKey:WebKitMediaSourceEnabledPreferenceKey];
2793 - (void)setMediaSourceEnabled:(BOOL)enabled
2795 [self _setBoolValue:enabled forKey:WebKitMediaSourceEnabledPreferenceKey];
2798 - (BOOL)sourceBufferChangeTypeEnabled
2800 return [self _boolValueForKey:WebKitSourceBufferChangeTypeEnabledPreferenceKey];
2803 - (void)setSourceBufferChangeTypeEnabled:(BOOL)enabled
2805 [self _setBoolValue:enabled forKey:WebKitSourceBufferChangeTypeEnabledPreferenceKey];
2808 - (BOOL)imageControlsEnabled
2810 return [self _boolValueForKey:WebKitImageControlsEnabledPreferenceKey];
2813 - (void)setImageControlsEnabled:(BOOL)enabled
2815 [self _setBoolValue:enabled forKey:WebKitImageControlsEnabledPreferenceKey];
2818 - (BOOL)serviceControlsEnabled
2820 return [self _boolValueForKey:WebKitServiceControlsEnabledPreferenceKey];
2823 - (void)setServiceControlsEnabled:(BOOL)enabled
2825 [self _setBoolValue:enabled forKey:WebKitServiceControlsEnabledPreferenceKey];
2828 - (BOOL)gamepadsEnabled
2830 return [self _boolValueForKey:WebKitGamepadsEnabledPreferenceKey];
2833 - (void)setGamepadsEnabled:(BOOL)flag
2835 [self _setBoolValue:flag forKey:WebKitGamepadsEnabledPreferenceKey];
2838 - (BOOL)shouldConvertPositionStyleOnCopy
2840 return [self _boolValueForKey:WebKitShouldConvertPositionStyleOnCopyPreferenceKey];
2843 - (void)setShouldConvertPositionStyleOnCopy:(BOOL)enabled
2845 [self _setBoolValue:enabled forKey:WebKitShouldConvertPositionStyleOnCopyPreferenceKey];
2848 - (NSString *)mediaKeysStorageDirectory
2850 return [[self _stringValueForKey:WebKitMediaKeysStorageDirectoryKey] stringByStandardizingPath];
2853 - (void)setMediaKeysStorageDirectory:(NSString *)directory
2855 [self _setStringValue:directory forKey:WebKitMediaKeysStorageDirectoryKey];
2858 - (BOOL)mediaDevicesEnabled
2860 return [self _boolValueForKey:WebKitMediaDevicesEnabledPreferenceKey];
2863 - (void)setMediaDevicesEnabled:(BOOL)flag
2865 [self _setBoolValue:flag forKey:WebKitMediaDevicesEnabledPreferenceKey];
2868 - (BOOL)mediaStreamEnabled
2870 return [self _boolValueForKey:WebKitMediaStreamEnabledPreferenceKey];
2873 - (void)setMediaStreamEnabled:(BOOL)flag
2875 [self _setBoolValue:flag forKey:WebKitMediaStreamEnabledPreferenceKey];
2878 - (BOOL)peerConnectionEnabled
2880 return [self _boolValueForKey:WebKitPeerConnectionEnabledPreferenceKey];
2883 - (void)setPeerConnectionEnabled:(BOOL)flag
2885 [self _setBoolValue:flag forKey:WebKitPeerConnectionEnabledPreferenceKey];
2888 - (BOOL)linkPreloadEnabled
2890 return [self _boolValueForKey:WebKitLinkPreloadEnabledPreferenceKey];
2893 - (void)setLinkPreloadEnabled:(BOOL)flag
2895 [self _setBoolValue:flag forKey:WebKitLinkPreloadEnabledPreferenceKey];
2898 - (BOOL)mediaPreloadingEnabled
2900 return [self _boolValueForKey:WebKitMediaPreloadingEnabledPreferenceKey];
2903 - (void)setMediaPreloadingEnabled:(BOOL)flag
2905 [self _setBoolValue:flag forKey:WebKitMediaPreloadingEnabledPreferenceKey];
2908 - (void)setMetaRefreshEnabled:(BOOL)enabled
2910 [self setHTTPEquivEnabled:enabled];
2913 - (BOOL)metaRefreshEnabled
2915 return [self httpEquivEnabled];
2918 - (void)setHTTPEquivEnabled:(BOOL)enabled
2920 [self _setBoolValue:enabled forKey:WebKitHTTPEquivEnabledPreferenceKey];
2923 - (BOOL)httpEquivEnabled
2925 return [self _boolValueForKey:WebKitHTTPEquivEnabledPreferenceKey];
2928 - (BOOL)javaScriptMarkupEnabled
2930 return [self _boolValueForKey:WebKitJavaScriptMarkupEnabledPreferenceKey];
2933 - (void)setJavaScriptMarkupEnabled:(BOOL)flag
2935 [self _setBoolValue:flag forKey:WebKitJavaScriptMarkupEnabledPreferenceKey];
2938 - (BOOL)mediaDataLoadsAutomatically
2940 return [self _boolValueForKey:WebKitMediaDataLoadsAutomaticallyPreferenceKey];
2943 - (void)setMediaDataLoadsAutomatically:(BOOL)flag
2945 [self _setBoolValue:flag forKey:WebKitMediaDataLoadsAutomaticallyPreferenceKey];
2948 - (BOOL)attachmentElementEnabled
2950 return [self _boolValueForKey:WebKitAttachmentElementEnabledPreferenceKey];
2953 - (void)setAttachmentElementEnabled:(BOOL)flag
2955 [self _setBoolValue:flag forKey:WebKitAttachmentElementEnabledPreferenceKey];
2958 - (BOOL)allowsInlineMediaPlaybackAfterFullscreen
2960 return [self _boolValueForKey:WebKitAllowsInlineMediaPlaybackAfterFullscreenPreferenceKey];
2963 - (void)setAllowsInlineMediaPlaybackAfterFullscreen:(BOOL)flag
2965 [self _setBoolValue:flag forKey:WebKitAllowsInlineMediaPlaybackAfterFullscreenPreferenceKey];
2968 - (BOOL)mockCaptureDevicesEnabled
2970 return [self _boolValueForKey:WebKitMockCaptureDevicesEnabledPreferenceKey];
2973 - (void)setMockCaptureDevicesEnabled:(BOOL)flag
2975 [self _setBoolValue:flag forKey:WebKitMockCaptureDevicesEnabledPreferenceKey];
2978 - (BOOL)mockCaptureDevicesPromptEnabled
2980 return [self _boolValueForKey:WebKitMockCaptureDevicesPromptEnabledPreferenceKey];
2983 - (void)setMockCaptureDevicesPromptEnabled:(BOOL)flag
2985 [self _setBoolValue:flag forKey:WebKitMockCaptureDevicesPromptEnabledPreferenceKey];
2988 - (BOOL)enumeratingAllNetworkInterfacesEnabled
2990 return [self _boolValueForKey:WebKitEnumeratingAllNetworkInterfacesEnabledPreferenceKey];
2993 - (void)setEnumeratingAllNetworkInterfacesEnabled:(BOOL)flag
2995 [self _setBoolValue:flag forKey:WebKitEnumeratingAllNetworkInterfacesEnabledPreferenceKey];
2998 - (BOOL)iceCandidateFilteringEnabled
3000 return [self _boolValueForKey:WebKitICECandidateFilteringEnabledPreferenceKey];
3003 - (void)setIceCandidateFilteringEnabled:(BOOL)flag
3005 [self _setBoolValue:flag forKey:WebKitICECandidateFilteringEnabledPreferenceKey];
3008 - (BOOL)mediaCaptureRequiresSecureConnection
3010 return [self _boolValueForKey:WebKitMediaCaptureRequiresSecureConnectionPreferenceKey];
3013 - (void)setMediaCaptureRequiresSecureConnection:(BOOL)flag
3015 [self _setBoolValue:flag forKey:WebKitMediaCaptureRequiresSecureConnectionPreferenceKey];
3018 - (BOOL)shadowDOMEnabled
3020 return [self _boolValueForKey:WebKitShadowDOMEnabledPreferenceKey];
3023 - (void)setShadowDOMEnabled:(BOOL)flag
3025 [self _setBoolValue:flag forKey:WebKitShadowDOMEnabledPreferenceKey];
3028 - (BOOL)customElementsEnabled
3030 return [self _boolValueForKey:WebKitCustomElementsEnabledPreferenceKey];
3033 - (void)setCustomElementsEnabled:(BOOL)flag
3035 [self _setBoolValue:flag forKey:WebKitCustomElementsEnabledPreferenceKey];
3038 - (BOOL)dataTransferItemsEnabled
3040 return [self _boolValueForKey:WebKitDataTransferItemsEnabledPreferenceKey];
3043 - (void)setDataTransferItemsEnabled:(BOOL)flag
3045 [self _setBoolValue:flag forKey:WebKitDataTransferItemsEnabledPreferenceKey];
3048 - (BOOL)customPasteboardDataEnabled
3050 return [self _boolValueForKey:WebKitCustomPasteboardDataEnabledPreferenceKey];
3053 - (void)setCustomPasteboardDataEnabled:(BOOL)flag
3055 [self _setBoolValue:flag forKey:WebKitCustomPasteboardDataEnabledPreferenceKey];
3058 - (BOOL)dialogElementEnabled
3060 return [self _boolValueForKey:WebKitDialogElementEnabledPreferenceKey];
3063 - (void)setDialogElementEnabled:(BOOL)flag
3065 [self _setBoolValue:flag forKey:WebKitDialogElementEnabledPreferenceKey];
3068 - (BOOL)keygenElementEnabled
3070 return [self _boolValueForKey:WebKitKeygenElementEnabledPreferenceKey];
3073 - (void)setKeygenElementEnabled:(BOOL)flag
3075 [self _setBoolValue:flag forKey:WebKitKeygenElementEnabledPreferenceKey];
3078 - (BOOL)cacheAPIEnabled
3080 return [self _boolValueForKey:WebKitCacheAPIEnabledPreferenceKey];
3083 - (void)setCacheAPIEnabled:(BOOL)flag
3085 [self _setBoolValue:flag forKey:WebKitCacheAPIEnabledPreferenceKey];
3088 - (BOOL)fetchAPIEnabled
3090 return [self _boolValueForKey:WebKitFetchAPIEnabledPreferenceKey];
3093 - (void)setFetchAPIEnabled:(BOOL)flag
3095 [self _setBoolValue:flag forKey:WebKitFetchAPIEnabledPreferenceKey];
3098 - (BOOL)readableByteStreamAPIEnabled
3100 return [self _boolValueForKey:WebKitReadableByteStreamAPIEnabledPreferenceKey];
3103 - (void)setReadableByteStreamAPIEnabled:(BOOL)flag
3105 [self _setBoolValue:flag forKey:WebKitReadableByteStreamAPIEnabledPreferenceKey];
3108 - (BOOL)writableStreamAPIEnabled
3110 return [self _boolValueForKey:WebKitWritableStreamAPIEnabledPreferenceKey];
3113 - (void)setWritableStreamAPIEnabled:(BOOL)flag
3115 [self _setBoolValue:flag forKey:WebKitWritableStreamAPIEnabledPreferenceKey];
3118 - (BOOL)downloadAttributeEnabled
3120 return [self _boolValueForKey:WebKitDownloadAttributeEnabledPreferenceKey];
3123 - (void)setDownloadAttributeEnabled:(BOOL)flag
3125 [self _setBoolValue:flag forKey:WebKitDownloadAttributeEnabledPreferenceKey];
3128 - (void)setDirectoryUploadEnabled:(BOOL)flag
3130 [self _setBoolValue:flag forKey:WebKitDirectoryUploadEnabledPreferenceKey];
3133 - (BOOL)directoryUploadEnabled
3135 return [self _boolValueForKey:WebKitDirectoryUploadEnabledPreferenceKey];
3138 - (BOOL)visualViewportAPIEnabled
3140 return [self _boolValueForKey:WebKitVisualViewportAPIEnabledPreferenceKey];
3143 - (void)setVisualViewportAPIEnabled:(BOOL)flag
3145 [self _setBoolValue:flag forKey:WebKitVisualViewportAPIEnabledPreferenceKey];
3148 - (BOOL)CSSOMViewScrollingAPIEnabled
3150 return [self _boolValueForKey:WebKitCSSOMViewScrollingAPIEnabledPreferenceKey];
3153 - (void)setCSSOMViewScrollingAPIEnabled:(BOOL)flag
3155 [self _setBoolValue:flag forKey:WebKitCSSOMViewScrollingAPIEnabledPreferenceKey];
3158 - (BOOL)webAnimationsEnabled
3160 return [self _boolValueForKey:WebKitWebAnimationsEnabledPreferenceKey];
3163 - (void)setWebAnimationsEnabled:(BOOL)flag
3165 [self _setBoolValue:flag forKey:WebKitWebAnimationsEnabledPreferenceKey];
3168 - (BOOL)pointerEventsEnabled
3170 return [self _boolValueForKey:WebKitPointerEventsEnabledPreferenceKey];
3173 - (void)setPointerEventsEnabled:(BOOL)flag
3175 [self _setBoolValue:flag forKey:WebKitPointerEventsEnabledPreferenceKey];
3178 - (BOOL)syntheticEditingCommandsEnabled
3180 return [self _boolValueForKey:WebKitPointerEventsEnabledPreferenceKey];
3183 - (void)setSyntheticEditingCommandsEnabled:(BOOL)flag
3185 [self _setBoolValue:flag forKey:WebKitPointerEventsEnabledPreferenceKey];
3188 - (BOOL)fetchAPIKeepAliveEnabled
3190 return [self _boolValueForKey:WebKitFetchAPIEnabledPreferenceKey];
3193 - (void)setFetchAPIKeepAliveEnabled:(BOOL)flag
3195 [self _setBoolValue:flag forKey:WebKitFetchAPIEnabledPreferenceKey];
3198 - (BOOL)modernMediaControlsEnabled
3200 return [self _boolValueForKey:WebKitModernMediaControlsEnabledPreferenceKey];
3203 - (void)setModernMediaControlsEnabled:(BOOL)flag
3205 [self _setBoolValue:flag forKey:WebKitModernMediaControlsEnabledPreferenceKey];
3208 - (BOOL)webAnimationsCSSIntegrationEnabled
3210 return [self _boolValueForKey:WebKitWebAnimationsCSSIntegrationEnabledPreferenceKey];
3213 - (void)setWebAnimationsCSSIntegrationEnabled:(BOOL)flag
3215 [self _setBoolValue:flag forKey:WebKitWebAnimationsCSSIntegrationEnabledPreferenceKey];
3218 - (BOOL)intersectionObserverEnabled
3220 return [self _boolValueForKey:WebKitIntersectionObserverEnabledPreferenceKey];
3223 - (void)setIntersectionObserverEnabled:(BOOL)flag
3225 [self _setBoolValue:flag forKey:WebKitIntersectionObserverEnabledPreferenceKey];
3228 - (BOOL)menuItemElementEnabled
3230 return [self _boolValueForKey:WebKitMenuItemElementEnabledPreferenceKey];
3233 - (void)setMenuItemElementEnabled:(BOOL)flag
3235 [self _setBoolValue:flag forKey:WebKitMenuItemElementEnabledPreferenceKey];
3238 - (BOOL)displayContentsEnabled
3240 return [self _boolValueForKey:WebKitDisplayContentsEnabledPreferenceKey];
3243 - (void)setDisplayContentsEnabled:(BOOL)flag
3245 [self _setBoolValue:flag forKey:WebKitDisplayContentsEnabledPreferenceKey];
3248 - (BOOL)userTimingEnabled
3250 return [self _boolValueForKey:WebKitUserTimingEnabledPreferenceKey];
3253 - (void)setUserTimingEnabled:(BOOL)flag
3255 [self _setBoolValue:flag forKey:WebKitUserTimingEnabledPreferenceKey];
3258 - (BOOL)resourceTimingEnabled
3260 return [self _boolValueForKey:WebKitResourceTimingEnabledPreferenceKey];
3263 - (void)setResourceTimingEnabled:(BOOL)flag
3265 [self _setBoolValue:flag forKey:WebKitResourceTimingEnabledPreferenceKey];
3268 - (BOOL)mediaUserGestureInheritsFromDocument
3270 return [self _boolValueForKey:WebKitMediaUserGestureInheritsFromDocument];
3273 - (void)setMediaUserGestureInheritsFromDocument:(BOOL)flag
3275 [self _setBoolValue:flag forKey:WebKitMediaUserGestureInheritsFromDocument];
3278 #if PLATFORM(IOS_FAMILY)
3279 - (BOOL)quickLookDocumentSavingEnabled
3281 return [self _boolValueForKey:WebKitQuickLookDocumentSavingPreferenceKey];
3284 - (void)setQuickLookDocumentSavingEnabled:(BOOL)flag
3286 [self _setBoolValue:flag forKey:WebKitQuickLookDocumentSavingPreferenceKey];
3290 - (NSString *)mediaContentTypesRequiringHardwareSupport
3292 return [self _stringValueForKey:WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey];
3295 - (void)setMediaContentTypesRequiringHardwareSupport:(NSString *)value
3297 [self _setStringValue:value forKey:WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey];
3300 - (BOOL)isSecureContextAttributeEnabled
3302 return [self _boolValueForKey:WebKitIsSecureContextAttributeEnabledPreferenceKey];
3305 - (void)setIsSecureContextAttributeEnabled:(BOOL)flag
3307 [self _setBoolValue:flag forKey:WebKitIsSecureContextAttributeEnabledPreferenceKey];
3310 - (BOOL)legacyEncryptedMediaAPIEnabled
3312 return [self _boolValueForKey:WebKitLegacyEncryptedMediaAPIEnabledKey];
3315 - (void)setLegacyEncryptedMediaAPIEnabled:(BOOL)flag
3317 [self _setBoolValue:flag forKey:WebKitLegacyEncryptedMediaAPIEnabledKey];
3320 - (BOOL)encryptedMediaAPIEnabled
3322 return [self _boolValueForKey:WebKitEncryptedMediaAPIEnabledKey];
3325 - (void)setEncryptedMediaAPIEnabled:(BOOL)flag
3327 [self _setBoolValue:flag forKey:WebKitEncryptedMediaAPIEnabledKey];
3330 - (BOOL)viewportFitEnabled
3332 return [self _boolValueForKey:WebKitViewportFitEnabledPreferenceKey];
3335 - (void)setViewportFitEnabled:(BOOL)flag
3337 [self _setBoolValue:flag forKey:WebKitViewportFitEnabledPreferenceKey];
3340 - (BOOL)constantPropertiesEnabled
3342 return [self _boolValueForKey:WebKitConstantPropertiesEnabledPreferenceKey];
3345 - (void)setConstantPropertiesEnabled:(BOOL)flag
3347 [self _setBoolValue:flag forKey:WebKitConstantPropertiesEnabledPreferenceKey];
3350 - (BOOL)colorFilterEnabled
3352 return [self _boolValueForKey:WebKitColorFilterEnabledPreferenceKey];
3355 - (void)setColorFilterEnabled:(BOOL)flag
3357 [self _setBoolValue:flag forKey:WebKitColorFilterEnabledPreferenceKey];
3360 - (BOOL)punchOutWhiteBackgroundsInDarkMode
3362 return [self _boolValueForKey:WebKitPunchOutWhiteBackgroundsInDarkModePreferenceKey];
3365 - (void)setPunchOutWhiteBackgroundsInDarkMode:(BOOL)flag
3367 [self _setBoolValue:flag forKey:WebKitPunchOutWhiteBackgroundsInDarkModePreferenceKey];
3370 - (BOOL)allowMediaContentTypesRequiringHardwareSupportAsFallback
3372 return [self _boolValueForKey:WebKitAllowMediaContentTypesRequiringHardwareSupportAsFallbackKey];
3375 - (void)setAllowMediaContentTypesRequiringHardwareSupportAsFallback:(BOOL)flag
3377 [self _setBoolValue:flag forKey:WebKitAllowMediaContentTypesRequiringHardwareSupportAsFallbackKey];
3380 - (BOOL)inspectorAdditionsEnabled
3382 return [self _boolValueForKey:WebKitInspectorAdditionsEnabledPreferenceKey];
3385 - (void)setInspectorAdditionsEnabled:(BOOL)flag
3387 [self _setBoolValue:flag forKey:WebKitInspectorAdditionsEnabledPreferenceKey];
3390 - (BOOL)accessibilityObjectModelEnabled
3392 return [self _boolValueForKey:WebKitAccessibilityObjectModelEnabledPreferenceKey];
3395 - (void)setAccessibilityObjectModelEnabled:(BOOL)flag
3397 [self _setBoolValue:flag forKey:WebKitAccessibilityObjectModelEnabledPreferenceKey];
3400 - (BOOL)ariaReflectionEnabled
3402 return [self _boolValueForKey:WebKitAriaReflectionEnabledPreferenceKey];
3405 - (void)setAriaReflectionEnabled:(BOOL)flag
3407 [self _setBoolValue:flag forKey:WebKitAriaReflectionEnabledPreferenceKey];
3410 - (BOOL)mediaCapabilitiesEnabled
3412 return [self _boolValueForKey:WebKitMediaCapabilitiesEnabledPreferenceKey];
3415 - (void)setMediaCapabilitiesEnabled:(BOOL)flag
3417 [self _setBoolValue:flag forKey:WebKitMediaCapabilitiesEnabledPreferenceKey];
3420 - (BOOL)mediaRecorderEnabled
3422 return [self _boolValueForKey:WebKitMediaRecorderEnabledPreferenceKey];
3425 - (void)setMediaRecorderEnabled:(BOOL)flag
3427 [self _setBoolValue:flag forKey:WebKitMediaRecorderEnabledPreferenceKey];
3430 - (BOOL)serverTimingEnabled
3432 return [self _boolValueForKey:WebKitServerTimingEnabledPreferenceKey];
3435 - (void)setServerTimingEnabled:(BOOL)flag
3437 [self _setBoolValue:flag forKey:WebKitServerTimingEnabledPreferenceKey];
3440 - (BOOL)selectionAcrossShadowBoundariesEnabled
3442 return [self _boolValueForKey:WebKitSelectionAcrossShadowBoundariesEnabledPreferenceKey];
3445 - (void)setSelectionAcrossShadowBoundariesEnabled:(BOOL)flag
3447 [self _setBoolValue:flag forKey:WebKitSelectionAcrossShadowBoundariesEnabledPreferenceKey];
3450 - (BOOL)cssLogicalEnabled
3452 return [self _boolValueForKey:WebKitCSSLogicalEnabledPreferenceKey];
3455 - (void)setCSSLogicalEnabled:(BOOL)flag
3457 [self _setBoolValue:flag forKey:WebKitCSSLogicalEnabledPreferenceKey];
3460 - (BOOL)adClickAttributionEnabled
3462 return [self _boolValueForKey:WebKitAdClickAttributionEnabledPreferenceKey];
3465 - (void)setAdClickAttributionEnabled:(BOOL)flag
3467 [self _setBoolValue:flag forKey:WebKitAdClickAttributionEnabledPreferenceKey];
3470 - (BOOL)referrerPolicyAttributeEnabled
3472 return [self _boolValueForKey:WebKitReferrerPolicyAttributeEnabledPreferenceKey];
3475 - (void)setReferrerPolicyAttributeEnabled:(BOOL)flag
3477 [self _setBoolValue:flag forKey:WebKitReferrerPolicyAttributeEnabledPreferenceKey];
3480 - (BOOL)resizeObserverEnabled
3482 return [self _boolValueForKey:WebKitResizeObserverEnabledPreferenceKey];
3485 - (void)setResizeObserverEnabled:(BOOL)flag
3487 [self _setBoolValue:flag forKey:WebKitResizeObserverEnabledPreferenceKey];
3490 - (BOOL)coreMathMLEnabled
3492 return [self _boolValueForKey:WebKitCoreMathMLEnabledPreferenceKey];
3495 - (void)setCoreMathMLEnabled:(BOOL)flag
3497 [self _setBoolValue:flag forKey:WebKitCoreMathMLEnabledPreferenceKey];
3500 - (BOOL)linkPreloadResponsiveImagesEnabled
3502 return [self _boolValueForKey:WebKitLinkPreloadResponsiveImagesEnabledPreferenceKey];
3505 - (void)setLinkPreloadResponsiveImagesEnabled:(BOOL)flag
3507 [self _setBoolValue:flag forKey:WebKitLinkPreloadResponsiveImagesEnabledPreferenceKey];
3512 @implementation WebPreferences (WebInternal)
3514 + (NSString *)_IBCreatorID
3516 return classIBCreatorID;
3519 + (NSString *)_concatenateKeyWithIBCreatorID:(NSString *)key
3521 NSString *IBCreatorID = [WebPreferences _IBCreatorID];
3524 return [IBCreatorID stringByAppendingString:key];