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 "WebApplicationCache.h"
34 #import "WebFrameNetworkingContext.h"
35 #import "WebKitLogging.h"
36 #import "WebKitNSStringExtras.h"
37 #import "WebKitVersionChecks.h"
38 #import "WebNSDictionaryExtras.h"
39 #import "WebNSURLExtras.h"
40 #import <JavaScriptCore/InitializeThreading.h>
41 #import <WebCore/ApplicationCacheStorage.h>
42 #import <WebCore/AudioSession.h>
43 #import <WebCore/DeprecatedGlobalSettings.h>
44 #import <WebCore/NetworkStorageSession.h>
45 #import <WebCore/RuntimeApplicationChecks.h>
46 #import <WebCore/Settings.h>
47 #import <WebCore/TextEncodingRegistry.h>
48 #import <pal/spi/cf/CFNetworkSPI.h>
49 #import <wtf/MainThread.h>
50 #import <wtf/RetainPtr.h>
51 #import <wtf/RunLoop.h>
53 using namespace WebCore;
55 #if HAVE(AUDIO_TOOLBOX_AUDIO_SESSION)
56 #import <AudioToolbox/AudioSession.h>
60 #import <WebCore/Device.h>
61 #import <WebCore/GraphicsContext.h>
62 #import <WebCore/WebCoreThreadMessage.h>
65 NSString *WebPreferencesChangedNotification = @"WebPreferencesChangedNotification";
66 NSString *WebPreferencesRemovedNotification = @"WebPreferencesRemovedNotification";
67 NSString *WebPreferencesChangedInternalNotification = @"WebPreferencesChangedInternalNotification";
68 NSString *WebPreferencesCacheModelChangedInternalNotification = @"WebPreferencesCacheModelChangedInternalNotification";
70 #define KEY(x) (_private->identifier ? [_private->identifier.get() stringByAppendingString:(x)] : (x))
72 enum { WebPreferencesVersion = 1 };
74 static WebPreferences *_standardPreferences;
75 static NSMutableDictionary *webPreferencesInstances;
77 static unsigned webPreferencesInstanceCountWithPrivateBrowsingEnabled;
79 template<unsigned size> static bool contains(const char* const (&array)[size], const char* item)
83 for (auto* string : array) {
84 if (equalIgnoringASCIICase(string, item))
90 static WebCacheModel cacheModelForMainBundle(void)
93 // Apps that probably need the small setting
94 static const char* const documentViewerIDs[] = {
95 "Microsoft/com.microsoft.Messenger",
97 "com.alientechnology.Proteus",
100 "com.barebones.bbedit",
101 "com.barebones.textwrangler",
102 "com.barebones.yojimbo",
103 "com.equinux.iSale4",
104 "com.growl.growlframework",
105 "com.intrarts.PandoraMan",
106 "com.karelia.Sandvox",
107 "com.macromates.textmate",
108 "com.realmacsoftware.rapidweaverpro",
109 "com.red-sweater.marsedit",
110 "com.yahoo.messenger3",
111 "de.codingmonkeys.SubEthaEdit",
117 // Apps that probably need the medium setting
118 static const char* const documentBrowserIDs[] = {
119 "com.apple.Dictionary",
121 "com.apple.dashboard.client",
122 "com.apple.helpviewer",
123 "com.culturedcode.xyle",
124 "com.macrabbit.CSSEdit",
126 "com.ranchero.NetNewsWire",
127 "com.thinkmac.NewsLife",
128 "org.xlife.NewsFire",
129 "uk.co.opencommunity.vienna2",
132 // Apps that probably need the large setting
133 static const char* const primaryWebBrowserIDs[] = {
134 "com.app4mac.KidsBrowser"
135 "com.app4mac.wKiosk",
136 "com.freeverse.bumpercar",
137 "com.omnigroup.OmniWeb5",
138 "com.sunrisebrowser.Sunrise",
139 "net.hmdt-web.Shiira",
142 const char* bundleID = [[[NSBundle mainBundle] bundleIdentifier] UTF8String];
143 if (contains(documentViewerIDs, bundleID))
144 return WebCacheModelDocumentViewer;
145 if (contains(documentBrowserIDs, bundleID))
146 return WebCacheModelDocumentBrowser;
147 if (contains(primaryWebBrowserIDs, bundleID))
148 return WebCacheModelPrimaryWebBrowser;
150 bool isLinkedAgainstWebKit = WebKitLinkedOnOrAfter(0);
151 if (!isLinkedAgainstWebKit)
152 return WebCacheModelDocumentViewer; // Apps that don't link against WebKit probably aren't meant to be browsers.
155 bool isLegacyApp = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_CACHE_MODEL_API);
157 bool isLegacyApp = false;
160 return WebCacheModelDocumentBrowser; // To avoid regressions in apps that depended on old WebKit's large cache.
162 return WebCacheModelDocumentViewer; // To save memory.
166 @interface WebPreferences ()
167 - (void)_postCacheModelChangedNotification;
170 @interface WebPreferences (WebInternal)
171 + (NSString *)_concatenateKeyWithIBCreatorID:(NSString *)key;
172 + (NSString *)_IBCreatorID;
175 struct WebPreferencesPrivate
178 WebPreferencesPrivate()
179 : inPrivateBrowsing(NO)
181 , automaticallyDetectsCacheModel(NO)
184 , readWriteQueue(dispatch_queue_create("com.apple.WebPreferences.ReadWriteQueue", DISPATCH_QUEUE_CONCURRENT))
190 ~WebPreferencesPrivate()
192 dispatch_release(readWriteQueue);
196 RetainPtr<NSMutableDictionary> values;
197 BOOL inPrivateBrowsing;
198 RetainPtr<NSString> identifier;
200 BOOL automaticallyDetectsCacheModel;
201 unsigned numWebViews;
203 dispatch_queue_t readWriteQueue;
207 @interface WebPreferences (WebForwardDeclarations)
208 // This pseudo-category is needed so these methods can be used from within other category implementations
209 // without being in the public header file.
210 - (BOOL)_boolValueForKey:(NSString *)key;
211 - (void)_setBoolValue:(BOOL)value forKey:(NSString *)key;
212 - (int)_integerValueForKey:(NSString *)key;
213 - (void)_setIntegerValue:(int)value forKey:(NSString *)key;
214 - (float)_floatValueForKey:(NSString *)key;
215 - (void)_setFloatValue:(float)value forKey:(NSString *)key;
216 - (void)_setLongLongValue:(long long)value forKey:(NSString *)key;
217 - (long long)_longLongValueForKey:(NSString *)key;
218 - (void)_setUnsignedLongLongValue:(unsigned long long)value forKey:(NSString *)key;
219 - (unsigned long long)_unsignedLongLongValueForKey:(NSString *)key;
223 @interface WebPreferences ()
224 - (id)initWithIdentifier:(NSString *)anIdentifier sendChangeNotification:(BOOL)sendChangeNotification;
228 @implementation WebPreferences
232 // Create fake identifier
233 static int instanceCount = 1;
234 NSString *fakeIdentifier;
236 // At least ensure that identifier hasn't been already used.
237 fakeIdentifier = [NSString stringWithFormat:@"WebPreferences%d", instanceCount++];
238 while ([[self class] _getInstanceForIdentifier:fakeIdentifier]){
239 fakeIdentifier = [NSString stringWithFormat:@"WebPreferences%d", instanceCount++];
242 return [self initWithIdentifier:fakeIdentifier];
246 - (id)initWithIdentifier:(NSString *)anIdentifier
248 return [self initWithIdentifier:anIdentifier sendChangeNotification:YES];
253 - (instancetype)initWithIdentifier:(NSString *)anIdentifier sendChangeNotification:(BOOL)sendChangeNotification
255 - (instancetype)initWithIdentifier:(NSString *)anIdentifier
258 WebPreferences *instance = [[self class] _getInstanceForIdentifier:anIdentifier];
261 return [instance retain];
268 _private = new WebPreferencesPrivate;
269 _private->values = adoptNS([[NSMutableDictionary alloc] init]);
270 _private->identifier = adoptNS([anIdentifier copy]);
271 _private->automaticallyDetectsCacheModel = YES;
273 [[self class] _setInstance:self forIdentifier:_private->identifier.get()];
275 [self _updatePrivateBrowsingStateTo:[self privateBrowsingEnabled]];
278 if (sendChangeNotification) {
279 [self _postPreferencesChangedNotification];
280 [self _postCacheModelChangedNotification];
283 [self _postPreferencesChangedNotification];
284 [self _postCacheModelChangedNotification];
290 - (instancetype)initWithCoder:(NSCoder *)decoder
296 _private = new WebPreferencesPrivate;
297 _private->automaticallyDetectsCacheModel = YES;
302 if ([decoder allowsKeyedCoding]) {
303 identifier = [decoder decodeObjectForKey:@"Identifier"];
304 values = [decoder decodeObjectForKey:@"Values"];
307 [decoder decodeValueOfObjCType:@encode(int) at:&version];
309 identifier = [decoder decodeObject];
310 values = [decoder decodeObject];
314 if ([identifier isKindOfClass:[NSString class]])
315 _private->identifier = adoptNS([identifier copy]);
316 if ([values isKindOfClass:[NSDictionary class]])
317 _private->values = adoptNS([values mutableCopy]); // ensure dictionary is mutable
319 LOG(Encoding, "Identifier = %@, Values = %@\n", _private->identifier.get(), _private->values.get());
325 // If we load a nib multiple times, or have instances in multiple
326 // nibs with the same name, the first guy up wins.
327 WebPreferences *instance = [[self class] _getInstanceForIdentifier:_private->identifier.get()];
330 self = [instance retain];
332 [[self class] _setInstance:self forIdentifier:_private->identifier.get()];
333 [self _updatePrivateBrowsingStateTo:[self privateBrowsingEnabled]];
339 - (void)encodeWithCoder:(NSCoder *)encoder
341 if ([encoder allowsKeyedCoding]){
342 [encoder encodeObject:_private->identifier.get() forKey:@"Identifier"];
344 dispatch_sync(_private->readWriteQueue, ^{
346 [encoder encodeObject:_private->values.get() forKey:@"Values"];
347 LOG (Encoding, "Identifier = %@, Values = %@\n", _private->identifier.get(), _private->values.get());
353 int version = WebPreferencesVersion;
354 [encoder encodeValueOfObjCType:@encode(int) at:&version];
355 [encoder encodeObject:_private->identifier.get()];
357 dispatch_sync(_private->readWriteQueue, ^{
359 [encoder encodeObject:_private->values.get()];
366 + (WebPreferences *)standardPreferences
369 if (_standardPreferences == nil) {
370 _standardPreferences = [[WebPreferences alloc] initWithIdentifier:nil];
371 [_standardPreferences setAutosaves:YES];
374 // FIXME: This check is necessary to avoid recursion (see <rdar://problem/9564337>), but it also makes _standardPreferences construction not thread safe.
375 if (_standardPreferences)
376 return _standardPreferences;
378 static dispatch_once_t pred;
379 dispatch_once(&pred, ^{
380 _standardPreferences = [[WebPreferences alloc] initWithIdentifier:nil sendChangeNotification:NO];
381 [_standardPreferences _postPreferencesChangedNotification];
382 [_standardPreferences setAutosaves:YES];
386 return _standardPreferences;
389 // if we ever have more than one WebPreferences object, this would move to init
393 JSC::initializeThreading();
394 WTF::initializeMainThreadToProcessMainThread();
395 RunLoop::initializeMainRunLoop();
396 bool attachmentElementEnabled = MacApplication::isAppleMail();
398 bool allowsInlineMediaPlayback = WebCore::deviceClass() == MGDeviceClassiPad;
399 bool allowsInlineMediaPlaybackAfterFullscreen = WebCore::deviceClass() != MGDeviceClassiPad;
400 bool requiresPlaysInlineAttribute = !allowsInlineMediaPlayback;
401 bool attachmentElementEnabled = IOSApplication::isMobileMail();
404 NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
405 @"Times", WebKitStandardFontPreferenceKey,
406 @"Courier", WebKitFixedFontPreferenceKey,
407 @"Times", WebKitSerifFontPreferenceKey,
408 @"Helvetica", WebKitSansSerifFontPreferenceKey,
410 @"Apple Chancery", WebKitCursiveFontPreferenceKey,
412 @"Snell Roundhand", WebKitCursiveFontPreferenceKey,
414 @"Papyrus", WebKitFantasyFontPreferenceKey,
416 @"AppleColorEmoji", WebKitPictographFontPreferenceKey,
418 @"Apple Color Emoji", WebKitPictographFontPreferenceKey,
420 @"0", WebKitMinimumFontSizePreferenceKey,
421 @"9", WebKitMinimumLogicalFontSizePreferenceKey,
422 @"16", WebKitDefaultFontSizePreferenceKey,
423 @"13", WebKitDefaultFixedFontSizePreferenceKey,
424 @"ISO-8859-1", WebKitDefaultTextEncodingNamePreferenceKey,
425 [NSNumber numberWithBool:NO], WebKitUsesEncodingDetectorPreferenceKey,
426 [NSNumber numberWithBool:NO], WebKitUserStyleSheetEnabledPreferenceKey,
427 @"", WebKitUserStyleSheetLocationPreferenceKey,
429 [NSNumber numberWithBool:NO], WebKitShouldPrintBackgroundsPreferenceKey,
430 [NSNumber numberWithBool:NO], WebKitTextAreasAreResizablePreferenceKey,
432 [NSNumber numberWithBool:NO], WebKitShrinksStandaloneImagesToFitPreferenceKey,
434 [NSNumber numberWithBool:YES], WebKitJavaEnabledPreferenceKey,
436 [NSNumber numberWithBool:YES], WebKitJavaScriptEnabledPreferenceKey,
437 [NSNumber numberWithBool:YES], WebKitJavaScriptMarkupEnabledPreferenceKey,
438 [NSNumber numberWithBool:YES], WebKitWebSecurityEnabledPreferenceKey,
439 [NSNumber numberWithBool:YES], WebKitAllowUniversalAccessFromFileURLsPreferenceKey,
440 [NSNumber numberWithBool:YES], WebKitAllowFileAccessFromFileURLsPreferenceKey,
442 [NSNumber numberWithBool:NO], WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey,
444 [NSNumber numberWithBool:YES], WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey,
446 [NSNumber numberWithBool:YES], WebKitPluginsEnabledPreferenceKey,
447 [NSNumber numberWithBool:YES], WebKitDatabasesEnabledPreferenceKey,
448 [NSNumber numberWithBool:YES], WebKitHTTPEquivEnabledPreferenceKey,
451 [NSNumber numberWithBool:NO], WebKitStorageTrackerEnabledPreferenceKey,
453 [NSNumber numberWithBool:YES], WebKitLocalStorageEnabledPreferenceKey,
454 [NSNumber numberWithBool:NO], WebKitExperimentalNotificationsEnabledPreferenceKey,
455 [NSNumber numberWithBool:YES], WebKitAllowAnimatedImagesPreferenceKey,
456 [NSNumber numberWithBool:YES], WebKitAllowAnimatedImageLoopingPreferenceKey,
457 [NSNumber numberWithBool:YES], WebKitDisplayImagesKey,
458 [NSNumber numberWithBool:NO], WebKitLoadSiteIconsKey,
459 @"1800", WebKitBackForwardCacheExpirationIntervalKey,
461 [NSNumber numberWithBool:NO], WebKitTabToLinksPreferenceKey,
463 [NSNumber numberWithBool:NO], WebKitPrivateBrowsingEnabledPreferenceKey,
465 [NSNumber numberWithBool:NO], WebKitRespectStandardStyleKeyEquivalentsPreferenceKey,
466 [NSNumber numberWithBool:NO], WebKitShowsURLsInToolTipsPreferenceKey,
467 [NSNumber numberWithBool:NO], WebKitShowsToolTipOverTruncatedTextPreferenceKey,
468 @"1", WebKitPDFDisplayModePreferenceKey,
469 @"0", WebKitPDFScaleFactorPreferenceKey,
471 @"0", WebKitUseSiteSpecificSpoofingPreferenceKey,
472 [NSNumber numberWithInt:WebKitEditableLinkDefaultBehavior], WebKitEditableLinkBehaviorPreferenceKey,
474 [NSNumber numberWithInt:WebTextDirectionSubmenuAutomaticallyIncluded],
475 WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey,
476 [NSNumber numberWithBool:NO], WebKitDOMPasteAllowedPreferenceKey,
478 [NSNumber numberWithBool:YES], WebKitUsesPageCachePreferenceKey,
479 [NSNumber numberWithInt:cacheModelForMainBundle()], WebKitCacheModelPreferenceKey,
480 [NSNumber numberWithBool:YES], WebKitPageCacheSupportsPluginsPreferenceKey,
481 [NSNumber numberWithBool:NO], WebKitDeveloperExtrasEnabledPreferenceKey,
482 [NSNumber numberWithUnsignedInt:0], WebKitJavaScriptRuntimeFlagsPreferenceKey,
483 [NSNumber numberWithBool:YES], WebKitAuthorAndUserStylesEnabledPreferenceKey,
484 [NSNumber numberWithBool:YES], WebKitDOMTimersThrottlingEnabledPreferenceKey,
485 [NSNumber numberWithBool:NO], WebKitWebArchiveDebugModeEnabledPreferenceKey,
486 [NSNumber numberWithBool:NO], WebKitLocalFileContentSniffingEnabledPreferenceKey,
487 [NSNumber numberWithBool:NO], WebKitOfflineWebApplicationCacheEnabledPreferenceKey,
488 [NSNumber numberWithBool:YES], WebKitZoomsTextOnlyPreferenceKey,
489 [NSNumber numberWithBool:NO], WebKitJavaScriptCanAccessClipboardPreferenceKey,
490 [NSNumber numberWithBool:YES], WebKitXSSAuditorEnabledPreferenceKey,
491 [NSNumber numberWithBool:YES], WebKitAcceleratedCompositingEnabledPreferenceKey,
493 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
494 #define DEFAULT_SUBPIXEL_ANTIALIASED_LAYER_TEXT_ENABLED YES
496 #define DEFAULT_SUBPIXEL_ANTIALIASED_LAYER_TEXT_ENABLED NO
498 [NSNumber numberWithBool:DEFAULT_SUBPIXEL_ANTIALIASED_LAYER_TEXT_ENABLED], WebKitSubpixelAntialiasedLayerTextEnabledPreferenceKey,
500 [NSNumber numberWithBool:NO], WebKitDisplayListDrawingEnabledPreferenceKey,
501 #if PLATFORM(IOS) && !PLATFORM(IOS_SIMULATOR)
502 [NSNumber numberWithBool:YES], WebKitAcceleratedDrawingEnabledPreferenceKey,
503 [NSNumber numberWithBool:YES], WebKitCanvasUsesAcceleratedDrawingPreferenceKey,
505 [NSNumber numberWithBool:NO], WebKitAcceleratedDrawingEnabledPreferenceKey,
506 [NSNumber numberWithBool:NO], WebKitCanvasUsesAcceleratedDrawingPreferenceKey,
508 [NSNumber numberWithBool:NO], WebKitShowDebugBordersPreferenceKey,
509 [NSNumber numberWithBool:YES], WebKitSimpleLineLayoutEnabledPreferenceKey,
510 [NSNumber numberWithBool:NO], WebKitSimpleLineLayoutDebugBordersEnabledPreferenceKey,
511 [NSNumber numberWithBool:NO], WebKitShowRepaintCounterPreferenceKey,
512 [NSNumber numberWithBool:YES], WebKitWebGLEnabledPreferenceKey,
513 [NSNumber numberWithBool:NO], WebKitForceSoftwareWebGLRenderingPreferenceKey,
514 [NSNumber numberWithBool:YES], WebKitForceWebGLUsesLowPowerPreferenceKey,
515 [NSNumber numberWithBool:NO], WebKitAccelerated2dCanvasEnabledPreferenceKey,
516 [NSNumber numberWithBool:NO], WebKitSubpixelCSSOMElementMetricsEnabledPreferenceKey,
517 [NSNumber numberWithBool:NO], WebKitResourceLoadStatisticsEnabledPreferenceKey,
518 [NSNumber numberWithBool:YES], WebKitLargeImageAsyncDecodingEnabledPreferenceKey,
519 [NSNumber numberWithBool:YES], WebKitAnimatedImageAsyncDecodingEnabledPreferenceKey,
521 [NSNumber numberWithUnsignedInt:static_cast<uint32_t>(FrameFlattening::FullyEnabled)], WebKitFrameFlatteningPreferenceKey,
523 [NSNumber numberWithUnsignedInt:static_cast<uint32_t>(FrameFlattening::Disabled)], WebKitFrameFlatteningPreferenceKey,
525 [NSNumber numberWithBool:NO], WebKitAsyncFrameScrollingEnabledPreferenceKey,
526 [NSNumber numberWithBool:NO], WebKitSpatialNavigationEnabledPreferenceKey,
527 [NSNumber numberWithBool:NO], WebKitDNSPrefetchingEnabledPreferenceKey,
528 [NSNumber numberWithBool:NO], WebKitFullScreenEnabledPreferenceKey,
529 [NSNumber numberWithBool:NO], WebKitAsynchronousSpellCheckingEnabledPreferenceKey,
530 [NSNumber numberWithBool:YES], WebKitHyperlinkAuditingEnabledPreferenceKey,
531 [NSNumber numberWithBool:NO], WebKitUsePreHTML5ParserQuirksKey,
532 [NSNumber numberWithBool:YES], WebKitAVFoundationEnabledKey,
533 [NSNumber numberWithBool:YES], WebKitAVFoundationNSURLSessionEnabledKey,
534 [NSNumber numberWithBool:NO], WebKitSuppressesIncrementalRenderingKey,
535 [NSNumber numberWithBool:attachmentElementEnabled], WebKitAttachmentElementEnabledPreferenceKey,
537 [NSNumber numberWithBool:YES], WebKitAllowsInlineMediaPlaybackPreferenceKey,
538 [NSNumber numberWithBool:NO], WebKitAllowsInlineMediaPlaybackAfterFullscreenPreferenceKey,
539 [NSNumber numberWithBool:NO], WebKitInlineMediaPlaybackRequiresPlaysInlineAttributeKey,
540 [NSNumber numberWithBool:YES], WebKitMediaControlsScaleWithPageZoomPreferenceKey,
541 [NSNumber numberWithBool:NO], WebKitWebAudioEnabledPreferenceKey,
542 [NSNumber numberWithBool:YES], WebKitBackspaceKeyNavigationEnabledKey,
543 [NSNumber numberWithBool:NO], WebKitShouldDisplaySubtitlesPreferenceKey,
544 [NSNumber numberWithBool:NO], WebKitShouldDisplayCaptionsPreferenceKey,
545 [NSNumber numberWithBool:NO], WebKitShouldDisplayTextDescriptionsPreferenceKey,
546 [NSNumber numberWithBool:YES], WebKitNotificationsEnabledKey,
547 [NSNumber numberWithBool:NO], WebKitShouldRespectImageOrientationKey,
548 [NSNumber numberWithBool:YES], WebKitMediaDataLoadsAutomaticallyPreferenceKey,
550 [NSNumber numberWithBool:allowsInlineMediaPlayback], WebKitAllowsInlineMediaPlaybackPreferenceKey,
551 [NSNumber numberWithBool:allowsInlineMediaPlaybackAfterFullscreen], WebKitAllowsInlineMediaPlaybackAfterFullscreenPreferenceKey,
552 [NSNumber numberWithBool:requiresPlaysInlineAttribute], WebKitInlineMediaPlaybackRequiresPlaysInlineAttributeKey,
553 [NSNumber numberWithBool:NO], WebKitMediaControlsScaleWithPageZoomPreferenceKey,
554 [NSNumber numberWithUnsignedInt:AudioSession::None], WebKitAudioSessionCategoryOverride,
555 [NSNumber numberWithBool:NO], WebKitMediaDataLoadsAutomaticallyPreferenceKey,
557 [NSNumber numberWithBool:YES], WebKitAVKitEnabled,
559 [NSNumber numberWithBool:YES], WebKitRequiresUserGestureForMediaPlaybackPreferenceKey,
560 [NSNumber numberWithBool:NO], WebKitRequiresUserGestureForVideoPlaybackPreferenceKey,
561 [NSNumber numberWithBool:NO], WebKitRequiresUserGestureForAudioPlaybackPreferenceKey,
562 [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
564 // Per-Origin Quota on iOS is 25MB. When the quota is reached for a particular origin
565 // the quota for that origin can be increased. See also webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:totalSpaceNeeded in WebUI/WebUIDelegate.m.
566 [NSNumber numberWithLongLong:(25 * 1024 * 1024)], WebKitApplicationCacheDefaultOriginQuota,
568 // Enable WebAudio by default in all iOS UIWebViews
569 [NSNumber numberWithBool:YES], WebKitWebAudioEnabledPreferenceKey,
571 [NSNumber numberWithBool:YES], WebKitShouldRespectImageOrientationKey,
572 #endif // PLATFORM(IOS)
573 #if ENABLE(WIRELESS_TARGET_PLAYBACK)
574 [NSNumber numberWithBool:YES], WebKitAllowsAirPlayForMediaPlaybackPreferenceKey,
576 [NSNumber numberWithBool:YES], WebKitAllowsPictureInPictureMediaPlaybackPreferenceKey,
577 [NSNumber numberWithBool:YES], WebKitRequestAnimationFrameEnabledPreferenceKey,
578 [NSNumber numberWithBool:NO], WebKitWantsBalancedSetDefersLoadingBehaviorKey,
579 [NSNumber numberWithBool:NO], WebKitDiagnosticLoggingEnabledKey,
580 [NSNumber numberWithInt:WebAllowAllStorage], WebKitStorageBlockingPolicyKey,
581 [NSNumber numberWithBool:NO], WebKitPlugInSnapshottingEnabledPreferenceKey,
584 [NSNumber numberWithBool:NO], WebKitTelephoneParsingEnabledPreferenceKey,
585 [NSNumber numberWithInt:-1], WebKitLayoutIntervalPreferenceKey,
586 [NSNumber numberWithFloat:-1.0f], WebKitMaxParseDurationPreferenceKey,
587 [NSNumber numberWithBool:NO], WebKitAllowMultiElementImplicitFormSubmissionPreferenceKey,
588 [NSNumber numberWithBool:NO], WebKitAlwaysRequestGeolocationPermissionPreferenceKey,
589 [NSNumber numberWithInt:InterpolationLow], WebKitInterpolationQualityPreferenceKey,
590 [NSNumber numberWithBool:YES], WebKitPasswordEchoEnabledPreferenceKey,
591 [NSNumber numberWithFloat:2.0f], WebKitPasswordEchoDurationPreferenceKey,
592 [NSNumber numberWithBool:NO], WebKitNetworkDataUsageTrackingEnabledPreferenceKey,
593 @"", WebKitNetworkInterfaceNamePreferenceKey,
595 #if ENABLE(TEXT_AUTOSIZING)
596 [NSNumber numberWithFloat:Settings::defaultMinimumZoomFontSize()], WebKitMinimumZoomFontSizePreferenceKey,
597 [NSNumber numberWithBool:Settings::defaultTextAutosizingEnabled()], WebKitTextAutosizingEnabledPreferenceKey,
599 [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
600 [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota,
601 [NSNumber numberWithBool:NO], WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey,
602 [NSNumber numberWithBool:NO], WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey,
603 [NSNumber numberWithBool:NO], WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey,
605 [NSNumber numberWithBool:NO], WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey,
606 #if ENABLE(MEDIA_SOURCE)
607 [NSNumber numberWithBool:YES], WebKitMediaSourceEnabledPreferenceKey,
608 @YES, WebKitSourceBufferChangeTypeEnabledPreferenceKey,
610 #if ENABLE(SERVICE_CONTROLS)
611 [NSNumber numberWithBool:NO], WebKitImageControlsEnabledPreferenceKey,
612 [NSNumber numberWithBool:NO], WebKitServiceControlsEnabledPreferenceKey,
614 [NSNumber numberWithBool:NO], WebKitEnableInheritURIQueryComponentPreferenceKey,
615 #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
616 @"~/Library/WebKit/MediaKeys", WebKitMediaKeysStorageDirectoryKey,
618 #if ENABLE(MEDIA_STREAM)
619 [NSNumber numberWithBool:NO], WebKitMockCaptureDevicesEnabledPreferenceKey,
620 [NSNumber numberWithBool:YES], WebKitMockCaptureDevicesPromptEnabledPreferenceKey,
621 [NSNumber numberWithBool:YES], WebKitMediaCaptureRequiresSecureConnectionPreferenceKey,
623 [NSNumber numberWithBool:YES], WebKitShadowDOMEnabledPreferenceKey,
624 [NSNumber numberWithBool:YES], WebKitCustomElementsEnabledPreferenceKey,
625 [NSNumber numberWithBool:YES], WebKitDataTransferItemsEnabledPreferenceKey,
626 [NSNumber numberWithBool:NO], WebKitCustomPasteboardDataEnabledPreferenceKey,
627 [NSNumber numberWithBool:YES], WebKitModernMediaControlsEnabledPreferenceKey,
628 [NSNumber numberWithBool:NO], WebKitWebAnimationsCSSIntegrationEnabledPreferenceKey,
631 [NSNumber numberWithBool:NO], WebKitWebGL2EnabledPreferenceKey,
634 [NSNumber numberWithBool:NO], WebKitWebGPUEnabledPreferenceKey,
636 [NSNumber numberWithBool:NO], WebKitCacheAPIEnabledPreferenceKey,
637 [NSNumber numberWithBool:NO], WebKitCrossOriginWindowPolicySupportEnabledPreferenceKey,
638 [NSNumber numberWithBool:YES], WebKitFetchAPIEnabledPreferenceKey,
640 #if ENABLE(STREAMS_API)
641 [NSNumber numberWithBool:NO], WebKitReadableByteStreamAPIEnabledPreferenceKey,
642 [NSNumber numberWithBool:NO], WebKitWritableStreamAPIEnabledPreferenceKey,
644 #if ENABLE(DOWNLOAD_ATTRIBUTE)
645 [NSNumber numberWithBool:NO], WebKitDownloadAttributeEnabledPreferenceKey,
647 [NSNumber numberWithBool:NO], WebKitDirectoryUploadEnabledPreferenceKey,
648 [NSNumber numberWithBool:NO], WebKitWebAnimationsEnabledPreferenceKey,
651 [NSNumber numberWithBool:NO], WebKitVisualViewportEnabledPreferenceKey,
653 [NSNumber numberWithBool:YES], WebKitVisualViewportEnabledPreferenceKey,
655 [NSNumber numberWithBool:NO], WebKitVisualViewportAPIEnabledPreferenceKey,
657 [NSNumber numberWithBool:NO], WebKitCSSOMViewScrollingAPIEnabledPreferenceKey,
658 [NSNumber numberWithBool:YES], WebKitNeedsStorageAccessFromFileURLsQuirkKey,
659 [NSNumber numberWithBool:NO], WebKitAllowCrossOriginSubresourcesToAskForCredentialsKey,
660 #if ENABLE(MEDIA_STREAM)
661 [NSNumber numberWithBool:NO], WebKitMediaDevicesEnabledPreferenceKey,
662 [NSNumber numberWithBool:YES], WebKitMediaStreamEnabledPreferenceKey,
665 [NSNumber numberWithBool:YES], WebKitPeerConnectionEnabledPreferenceKey,
667 #if ENABLE(INTERSECTION_OBSERVER)
668 @NO, WebKitIntersectionObserverEnabledPreferenceKey,
670 @YES, WebKitDisplayContentsEnabledPreferenceKey,
671 @NO, WebKitUserTimingEnabledPreferenceKey,
672 @NO, WebKitResourceTimingEnabledPreferenceKey,
673 @NO, WebKitWebAuthenticationEnabledPreferenceKey,
674 @NO, WebKitMediaUserGestureInheritsFromDocument,
675 @NO, WebKitIsSecureContextAttributeEnabledPreferenceKey,
676 @YES, WebKitLegacyEncryptedMediaAPIEnabledKey,
677 @NO, WebKitEncryptedMediaAPIEnabledKey,
678 @YES, WebKitViewportFitEnabledPreferenceKey,
679 @YES, WebKitConstantPropertiesEnabledPreferenceKey,
680 @NO, WebKitColorFilterEnabledPreferenceKey,
681 @NO, WebKitPunchOutWhiteBackgroundsInDarkModePreferenceKey,
682 @YES, WebKitAllowMediaContentTypesRequiringHardwareSupportAsFallbackKey,
683 @NO, WebKitInspectorAdditionsEnabledPreferenceKey,
684 (NSString *)Settings::defaultMediaContentTypesRequiringHardwareSupport(), WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey,
685 @NO, WebKitAccessibilityObjectModelEnabledPreferenceKey,
686 @YES, WebKitAriaReflectionEnabledPreferenceKey,
687 @NO, WebKitMediaCapabilitiesEnabledPreferenceKey,
688 @NO, WebKitFetchAPIKeepAliveEnabledPreferenceKey,
689 @NO, WebKitServerTimingEnabledPreferenceKey,
693 // This value shouldn't ever change, which is assumed in the initialization of WebKitPDFDisplayModePreferenceKey above
694 ASSERT(kPDFDisplaySinglePageContinuous == 1);
696 [[NSUserDefaults standardUserDefaults] registerDefaults:dict];
701 [self _updatePrivateBrowsingStateTo:NO];
707 - (NSString *)identifier
709 return _private->identifier.get();
712 - (id)_valueForKey:(NSString *)key
714 NSString *_key = KEY(key);
717 dispatch_sync(_private->readWriteQueue, ^{
718 o = [_private->values.get() objectForKey:_key];
721 id o = [_private->values.get() objectForKey:_key];
725 o = [[NSUserDefaults standardUserDefaults] objectForKey:_key];
726 if (!o && key != _key)
727 o = [[NSUserDefaults standardUserDefaults] objectForKey:key];
731 - (NSString *)_stringValueForKey:(NSString *)key
733 id s = [self _valueForKey:key];
734 return [s isKindOfClass:[NSString class]] ? (NSString *)s : nil;
737 - (void)_setStringValue:(NSString *)value forKey:(NSString *)key
739 if ([[self _stringValueForKey:key] isEqualToString:value])
741 NSString *_key = KEY(key);
743 dispatch_barrier_sync(_private->readWriteQueue, ^{
745 [_private->values.get() setObject:value forKey:_key];
749 if (_private->autosaves)
750 [[NSUserDefaults standardUserDefaults] setObject:value forKey:_key];
751 [self _postPreferencesChangedNotification];
754 - (int)_integerValueForKey:(NSString *)key
756 id o = [self _valueForKey:key];
757 return [o respondsToSelector:@selector(intValue)] ? [o intValue] : 0;
760 - (void)_setIntegerValue:(int)value forKey:(NSString *)key
762 if ([self _integerValueForKey:key] == value)
764 NSString *_key = KEY(key);
766 dispatch_barrier_sync(_private->readWriteQueue, ^{
768 [_private->values.get() setObject:@(value) forKey:_key];
772 if (_private->autosaves)
773 [[NSUserDefaults standardUserDefaults] setInteger:value forKey:_key];
774 [self _postPreferencesChangedNotification];
777 - (unsigned int)_unsignedIntValueForKey:(NSString *)key
779 id o = [self _valueForKey:key];
780 return [o respondsToSelector:@selector(unsignedIntValue)] ? [o unsignedIntValue] : 0;
783 - (void)_setUnsignedIntValue:(unsigned int)value forKey:(NSString *)key
785 if ([self _unsignedIntValueForKey:key] == value)
787 NSString *_key = KEY(key);
789 dispatch_barrier_sync(_private->readWriteQueue, ^{
791 [_private->values.get() setObject:@(value) forKey:_key];
795 if (_private->autosaves)
796 [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithUnsignedInt:value] forKey:_key];
797 [self _postPreferencesChangedNotification];
800 - (float)_floatValueForKey:(NSString *)key
802 id o = [self _valueForKey:key];
803 return [o respondsToSelector:@selector(floatValue)] ? [o floatValue] : 0.0f;
806 - (void)_setFloatValue:(float)value forKey:(NSString *)key
808 if ([self _floatValueForKey:key] == value)
810 NSString *_key = KEY(key);
812 dispatch_barrier_sync(_private->readWriteQueue, ^{
814 [_private->values.get() setObject:@(value) forKey:_key];
818 if (_private->autosaves)
819 [[NSUserDefaults standardUserDefaults] setFloat:value forKey:_key];
820 [self _postPreferencesChangedNotification];
823 - (BOOL)_boolValueForKey:(NSString *)key
825 return [self _integerValueForKey:key] != 0;
828 - (void)_setBoolValue:(BOOL)value forKey:(NSString *)key
830 if ([self _boolValueForKey:key] == value)
832 NSString *_key = KEY(key);
834 dispatch_barrier_sync(_private->readWriteQueue, ^{
836 [_private->values.get() setObject:@(value) forKey:_key];
840 if (_private->autosaves)
841 [[NSUserDefaults standardUserDefaults] setBool:value forKey:_key];
842 [self _postPreferencesChangedNotification];
845 - (long long)_longLongValueForKey:(NSString *)key
847 id o = [self _valueForKey:key];
848 return [o respondsToSelector:@selector(longLongValue)] ? [o longLongValue] : 0;
851 - (void)_setLongLongValue:(long long)value forKey:(NSString *)key
853 if ([self _longLongValueForKey:key] == value)
855 NSString *_key = KEY(key);
857 dispatch_barrier_sync(_private->readWriteQueue, ^{
859 [_private->values.get() setObject:@(value) forKey:_key];
863 if (_private->autosaves)
864 [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithLongLong:value] forKey:_key];
865 [self _postPreferencesChangedNotification];
868 - (unsigned long long)_unsignedLongLongValueForKey:(NSString *)key
870 id o = [self _valueForKey:key];
871 return [o respondsToSelector:@selector(unsignedLongLongValue)] ? [o unsignedLongLongValue] : 0;
874 - (void)_setUnsignedLongLongValue:(unsigned long long)value forKey:(NSString *)key
876 if ([self _unsignedLongLongValueForKey:key] == value)
878 NSString *_key = KEY(key);
880 dispatch_barrier_sync(_private->readWriteQueue, ^{
882 [_private->values.get() setObject:@(value) forKey:_key];
886 if (_private->autosaves)
887 [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithUnsignedLongLong:value] forKey:_key];
888 [self _postPreferencesChangedNotification];
891 - (NSString *)standardFontFamily
893 return [self _stringValueForKey: WebKitStandardFontPreferenceKey];
896 - (void)setStandardFontFamily:(NSString *)family
898 [self _setStringValue: family forKey: WebKitStandardFontPreferenceKey];
901 - (NSString *)fixedFontFamily
903 return [self _stringValueForKey: WebKitFixedFontPreferenceKey];
906 - (void)setFixedFontFamily:(NSString *)family
908 [self _setStringValue: family forKey: WebKitFixedFontPreferenceKey];
911 - (NSString *)serifFontFamily
913 return [self _stringValueForKey: WebKitSerifFontPreferenceKey];
916 - (void)setSerifFontFamily:(NSString *)family
918 [self _setStringValue: family forKey: WebKitSerifFontPreferenceKey];
921 - (NSString *)sansSerifFontFamily
923 return [self _stringValueForKey: WebKitSansSerifFontPreferenceKey];
926 - (void)setSansSerifFontFamily:(NSString *)family
928 [self _setStringValue: family forKey: WebKitSansSerifFontPreferenceKey];
931 - (NSString *)cursiveFontFamily
933 return [self _stringValueForKey: WebKitCursiveFontPreferenceKey];
936 - (void)setCursiveFontFamily:(NSString *)family
938 [self _setStringValue: family forKey: WebKitCursiveFontPreferenceKey];
941 - (NSString *)fantasyFontFamily
943 return [self _stringValueForKey: WebKitFantasyFontPreferenceKey];
946 - (void)setFantasyFontFamily:(NSString *)family
948 [self _setStringValue: family forKey: WebKitFantasyFontPreferenceKey];
951 - (int)defaultFontSize
953 return [self _integerValueForKey: WebKitDefaultFontSizePreferenceKey];
956 - (void)setDefaultFontSize:(int)size
958 [self _setIntegerValue: size forKey: WebKitDefaultFontSizePreferenceKey];
961 - (int)defaultFixedFontSize
963 return [self _integerValueForKey: WebKitDefaultFixedFontSizePreferenceKey];
966 - (void)setDefaultFixedFontSize:(int)size
968 [self _setIntegerValue: size forKey: WebKitDefaultFixedFontSizePreferenceKey];
971 - (int)minimumFontSize
973 return [self _integerValueForKey: WebKitMinimumFontSizePreferenceKey];
976 - (void)setMinimumFontSize:(int)size
978 [self _setIntegerValue: size forKey: WebKitMinimumFontSizePreferenceKey];
981 - (int)minimumLogicalFontSize
983 return [self _integerValueForKey: WebKitMinimumLogicalFontSizePreferenceKey];
986 - (void)setMinimumLogicalFontSize:(int)size
988 [self _setIntegerValue: size forKey: WebKitMinimumLogicalFontSizePreferenceKey];
991 - (NSString *)defaultTextEncodingName
993 return [self _stringValueForKey: WebKitDefaultTextEncodingNamePreferenceKey];
996 - (void)setDefaultTextEncodingName:(NSString *)encoding
998 [self _setStringValue: encoding forKey: WebKitDefaultTextEncodingNamePreferenceKey];
1002 - (BOOL)userStyleSheetEnabled
1004 return [self _boolValueForKey: WebKitUserStyleSheetEnabledPreferenceKey];
1007 - (void)setUserStyleSheetEnabled:(BOOL)flag
1009 [self _setBoolValue: flag forKey: WebKitUserStyleSheetEnabledPreferenceKey];
1012 - (NSURL *)userStyleSheetLocation
1014 NSString *locationString = [self _stringValueForKey: WebKitUserStyleSheetLocationPreferenceKey];
1016 if ([locationString _webkit_looksLikeAbsoluteURL]) {
1017 return [NSURL _web_URLWithDataAsString:locationString];
1019 locationString = [locationString stringByExpandingTildeInPath];
1020 return [NSURL fileURLWithPath:locationString isDirectory:NO];
1024 - (void)setUserStyleSheetLocation:(NSURL *)URL
1026 NSString *locationString;
1028 if ([URL isFileURL]) {
1029 locationString = [[URL path] _web_stringByAbbreviatingWithTildeInPath];
1031 locationString = [URL _web_originalDataAsString];
1034 if (!locationString)
1035 locationString = @"";
1037 [self _setStringValue:locationString forKey: WebKitUserStyleSheetLocationPreferenceKey];
1041 // These methods have had their implementations removed on iOS since it
1042 // is wrong to have such a setting stored in preferences that, when read,
1043 // is applied to all WebViews in a iOS process. Such a design might work
1044 // OK for an application like Safari on Mac OS X, where the only WebViews
1045 // in use display web content in a straightforward manner. However, it is
1046 // wrong for iOS, where WebViews are used for various purposes, like
1047 // text editing, text rendering, and displaying web content.
1049 // I have changed the user style sheet mechanism to be a per-WebView
1050 // setting, rather than a per-process preference. This seems to give the
1051 // behavior we want for iOS.
1053 - (BOOL)userStyleSheetEnabled
1058 - (void)setUserStyleSheetEnabled:(BOOL)flag
1063 - (NSURL *)userStyleSheetLocation
1068 - (void)setUserStyleSheetLocation:(NSURL *)URL
1072 #endif // PLATFORM(IOS)
1075 - (BOOL)shouldPrintBackgrounds
1077 return [self _boolValueForKey: WebKitShouldPrintBackgroundsPreferenceKey];
1080 - (void)setShouldPrintBackgrounds:(BOOL)flag
1082 [self _setBoolValue: flag forKey: WebKitShouldPrintBackgroundsPreferenceKey];
1086 - (BOOL)isJavaEnabled
1088 return [self _boolValueForKey: WebKitJavaEnabledPreferenceKey];
1091 - (void)setJavaEnabled:(BOOL)flag
1093 [self _setBoolValue: flag forKey: WebKitJavaEnabledPreferenceKey];
1096 - (BOOL)isJavaScriptEnabled
1098 return [self _boolValueForKey: WebKitJavaScriptEnabledPreferenceKey];
1101 - (void)setJavaScriptEnabled:(BOOL)flag
1103 [self _setBoolValue: flag forKey: WebKitJavaScriptEnabledPreferenceKey];
1106 - (BOOL)javaScriptCanOpenWindowsAutomatically
1108 return [self _boolValueForKey: WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey];
1111 - (void)setJavaScriptCanOpenWindowsAutomatically:(BOOL)flag
1113 [self _setBoolValue: flag forKey: WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey];
1116 - (BOOL)arePlugInsEnabled
1118 return [self _boolValueForKey: WebKitPluginsEnabledPreferenceKey];
1121 - (void)setPlugInsEnabled:(BOOL)flag
1123 [self _setBoolValue: flag forKey: WebKitPluginsEnabledPreferenceKey];
1126 - (BOOL)allowsAnimatedImages
1128 return [self _boolValueForKey: WebKitAllowAnimatedImagesPreferenceKey];
1131 - (void)setAllowsAnimatedImages:(BOOL)flag
1133 [self _setBoolValue: flag forKey: WebKitAllowAnimatedImagesPreferenceKey];
1136 - (BOOL)allowsAnimatedImageLooping
1138 return [self _boolValueForKey: WebKitAllowAnimatedImageLoopingPreferenceKey];
1141 - (void)setAllowsAnimatedImageLooping: (BOOL)flag
1143 [self _setBoolValue: flag forKey: WebKitAllowAnimatedImageLoopingPreferenceKey];
1146 - (void)setLoadsImagesAutomatically: (BOOL)flag
1148 [self _setBoolValue: flag forKey: WebKitDisplayImagesKey];
1151 - (BOOL)loadsImagesAutomatically
1153 return [self _boolValueForKey: WebKitDisplayImagesKey];
1156 - (void)setAutosaves:(BOOL)flag
1158 _private->autosaves = flag;
1163 return _private->autosaves;
1167 - (void)setTabsToLinks:(BOOL)flag
1169 [self _setBoolValue: flag forKey: WebKitTabToLinksPreferenceKey];
1174 return [self _boolValueForKey:WebKitTabToLinksPreferenceKey];
1178 - (void)setPrivateBrowsingEnabled:(BOOL)enabled
1180 [self _updatePrivateBrowsingStateTo:enabled];
1181 [self _setBoolValue:enabled forKey:WebKitPrivateBrowsingEnabledPreferenceKey];
1184 - (BOOL)privateBrowsingEnabled
1186 // Changes to private browsing defaults do not have effect on existing WebPreferences, and must be done through -setPrivateBrowsingEnabled.
1187 // This is needed to accurately track private browsing sessions in the process.
1188 return _private->inPrivateBrowsing;
1191 - (void)_updatePrivateBrowsingStateTo:(BOOL)enabled
1198 if (enabled == _private->inPrivateBrowsing)
1200 if (enabled > _private->inPrivateBrowsing) {
1201 WebFrameNetworkingContext::ensurePrivateBrowsingSession();
1202 ++webPreferencesInstanceCountWithPrivateBrowsingEnabled;
1204 ASSERT(webPreferencesInstanceCountWithPrivateBrowsingEnabled);
1205 --webPreferencesInstanceCountWithPrivateBrowsingEnabled;
1206 if (!webPreferencesInstanceCountWithPrivateBrowsingEnabled)
1207 WebFrameNetworkingContext::destroyPrivateBrowsingSession();
1209 _private->inPrivateBrowsing = enabled;
1212 - (void)setUsesPageCache:(BOOL)usesPageCache
1214 [self _setBoolValue:usesPageCache forKey:WebKitUsesPageCachePreferenceKey];
1217 - (BOOL)usesPageCache
1219 return [self _boolValueForKey:WebKitUsesPageCachePreferenceKey];
1222 - (void)_postCacheModelChangedNotification
1225 if (!pthread_main_np()) {
1226 [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO];
1231 [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesCacheModelChangedInternalNotification object:self userInfo:nil];
1234 - (void)setCacheModel:(WebCacheModel)cacheModel
1236 [self _setIntegerValue:cacheModel forKey:WebKitCacheModelPreferenceKey];
1237 [self setAutomaticallyDetectsCacheModel:NO];
1238 [self _postCacheModelChangedNotification];
1241 - (WebCacheModel)cacheModel
1243 return (WebCacheModel)[self _integerValueForKey:WebKitCacheModelPreferenceKey];
1247 - (void)setSuppressesIncrementalRendering:(BOOL)suppressesIncrementalRendering
1249 [self _setBoolValue:suppressesIncrementalRendering forKey:WebKitSuppressesIncrementalRenderingKey];
1252 - (BOOL)suppressesIncrementalRendering
1254 return [self _boolValueForKey:WebKitSuppressesIncrementalRenderingKey];
1257 - (BOOL)allowsAirPlayForMediaPlayback
1259 #if ENABLE(WIRELESS_TARGET_PLAYBACK)
1260 return [self _boolValueForKey:WebKitAllowsAirPlayForMediaPlaybackPreferenceKey];
1266 - (void)setAllowsAirPlayForMediaPlayback:(BOOL)flag
1268 #if ENABLE(WIRELESS_TARGET_PLAYBACK)
1269 [self _setBoolValue:flag forKey:WebKitAllowsAirPlayForMediaPlaybackPreferenceKey];
1275 @implementation WebPreferences (WebPrivate)
1277 - (BOOL)isDNSPrefetchingEnabled
1279 return [self _boolValueForKey:WebKitDNSPrefetchingEnabledPreferenceKey];
1282 - (void)setDNSPrefetchingEnabled:(BOOL)flag
1284 [self _setBoolValue:flag forKey:WebKitDNSPrefetchingEnabledPreferenceKey];
1287 - (BOOL)developerExtrasEnabled
1289 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1290 if ([defaults boolForKey:@"DisableWebKitDeveloperExtras"])
1293 if ([defaults boolForKey:@"WebKitDeveloperExtras"] || [defaults boolForKey:@"IncludeDebugMenu"])
1295 return [self _boolValueForKey:WebKitDeveloperExtrasEnabledPreferenceKey];
1297 return YES; // always enable in debug builds
1301 - (WebKitJavaScriptRuntimeFlags)javaScriptRuntimeFlags
1303 return static_cast<WebKitJavaScriptRuntimeFlags>([self _unsignedIntValueForKey:WebKitJavaScriptRuntimeFlagsPreferenceKey]);
1306 - (void)setJavaScriptRuntimeFlags:(WebKitJavaScriptRuntimeFlags)flags
1308 [self _setUnsignedIntValue:flags forKey:WebKitJavaScriptRuntimeFlagsPreferenceKey];
1311 - (void)setDeveloperExtrasEnabled:(BOOL)flag
1313 [self _setBoolValue:flag forKey:WebKitDeveloperExtrasEnabledPreferenceKey];
1316 - (BOOL)authorAndUserStylesEnabled
1318 return [self _boolValueForKey:WebKitAuthorAndUserStylesEnabledPreferenceKey];
1321 - (void)setAuthorAndUserStylesEnabled:(BOOL)flag
1323 [self _setBoolValue:flag forKey:WebKitAuthorAndUserStylesEnabledPreferenceKey];
1326 // FIXME: applicationChromeMode is no longer needed by ToT, but is still used in Safari 8.
1327 - (BOOL)applicationChromeModeEnabled
1332 - (void)setApplicationChromeModeEnabled:(BOOL)flag
1336 - (BOOL)domTimersThrottlingEnabled
1338 return [self _boolValueForKey:WebKitDOMTimersThrottlingEnabledPreferenceKey];
1341 - (void)setDOMTimersThrottlingEnabled:(BOOL)flag
1343 [self _setBoolValue:flag forKey:WebKitDOMTimersThrottlingEnabledPreferenceKey];
1346 - (BOOL)webArchiveDebugModeEnabled
1348 return [self _boolValueForKey:WebKitWebArchiveDebugModeEnabledPreferenceKey];
1351 - (void)setWebArchiveDebugModeEnabled:(BOOL)flag
1353 [self _setBoolValue:flag forKey:WebKitWebArchiveDebugModeEnabledPreferenceKey];
1356 - (BOOL)localFileContentSniffingEnabled
1358 return [self _boolValueForKey:WebKitLocalFileContentSniffingEnabledPreferenceKey];
1361 - (void)setLocalFileContentSniffingEnabled:(BOOL)flag
1363 [self _setBoolValue:flag forKey:WebKitLocalFileContentSniffingEnabledPreferenceKey];
1366 - (BOOL)offlineWebApplicationCacheEnabled
1368 return [self _boolValueForKey:WebKitOfflineWebApplicationCacheEnabledPreferenceKey];
1371 - (void)setOfflineWebApplicationCacheEnabled:(BOOL)flag
1373 [self _setBoolValue:flag forKey:WebKitOfflineWebApplicationCacheEnabledPreferenceKey];
1376 - (BOOL)zoomsTextOnly
1378 return [self _boolValueForKey:WebKitZoomsTextOnlyPreferenceKey];
1381 - (void)setZoomsTextOnly:(BOOL)flag
1383 [self _setBoolValue:flag forKey:WebKitZoomsTextOnlyPreferenceKey];
1386 - (BOOL)javaScriptCanAccessClipboard
1388 return [self _boolValueForKey:WebKitJavaScriptCanAccessClipboardPreferenceKey];
1391 - (void)setJavaScriptCanAccessClipboard:(BOOL)flag
1393 [self _setBoolValue:flag forKey:WebKitJavaScriptCanAccessClipboardPreferenceKey];
1396 - (BOOL)isXSSAuditorEnabled
1398 return [self _boolValueForKey:WebKitXSSAuditorEnabledPreferenceKey];
1401 - (void)setXSSAuditorEnabled:(BOOL)flag
1403 [self _setBoolValue:flag forKey:WebKitXSSAuditorEnabledPreferenceKey];
1407 - (BOOL)respectStandardStyleKeyEquivalents
1409 return [self _boolValueForKey:WebKitRespectStandardStyleKeyEquivalentsPreferenceKey];
1412 - (void)setRespectStandardStyleKeyEquivalents:(BOOL)flag
1414 [self _setBoolValue:flag forKey:WebKitRespectStandardStyleKeyEquivalentsPreferenceKey];
1417 - (BOOL)showsURLsInToolTips
1419 return [self _boolValueForKey:WebKitShowsURLsInToolTipsPreferenceKey];
1422 - (void)setShowsURLsInToolTips:(BOOL)flag
1424 [self _setBoolValue:flag forKey:WebKitShowsURLsInToolTipsPreferenceKey];
1427 - (BOOL)showsToolTipOverTruncatedText
1429 return [self _boolValueForKey:WebKitShowsToolTipOverTruncatedTextPreferenceKey];
1432 - (void)setShowsToolTipOverTruncatedText:(BOOL)flag
1434 [self _setBoolValue:flag forKey:WebKitShowsToolTipOverTruncatedTextPreferenceKey];
1437 - (BOOL)textAreasAreResizable
1439 return [self _boolValueForKey: WebKitTextAreasAreResizablePreferenceKey];
1442 - (void)setTextAreasAreResizable:(BOOL)flag
1444 [self _setBoolValue: flag forKey: WebKitTextAreasAreResizablePreferenceKey];
1446 #endif // !PLATFORM(IOS)
1448 - (BOOL)shrinksStandaloneImagesToFit
1450 return [self _boolValueForKey:WebKitShrinksStandaloneImagesToFitPreferenceKey];
1453 - (void)setShrinksStandaloneImagesToFit:(BOOL)flag
1455 [self _setBoolValue:flag forKey:WebKitShrinksStandaloneImagesToFitPreferenceKey];
1458 - (BOOL)automaticallyDetectsCacheModel
1460 return _private->automaticallyDetectsCacheModel;
1463 - (void)setAutomaticallyDetectsCacheModel:(BOOL)automaticallyDetectsCacheModel
1465 _private->automaticallyDetectsCacheModel = automaticallyDetectsCacheModel;
1468 - (BOOL)usesEncodingDetector
1470 return [self _boolValueForKey: WebKitUsesEncodingDetectorPreferenceKey];
1473 - (void)setUsesEncodingDetector:(BOOL)flag
1475 [self _setBoolValue: flag forKey: WebKitUsesEncodingDetectorPreferenceKey];
1478 - (BOOL)isWebSecurityEnabled
1480 return [self _boolValueForKey: WebKitWebSecurityEnabledPreferenceKey];
1483 - (void)setWebSecurityEnabled:(BOOL)flag
1485 [self _setBoolValue: flag forKey: WebKitWebSecurityEnabledPreferenceKey];
1488 - (BOOL)allowUniversalAccessFromFileURLs
1490 return [self _boolValueForKey: WebKitAllowUniversalAccessFromFileURLsPreferenceKey];
1493 - (void)setAllowUniversalAccessFromFileURLs:(BOOL)flag
1495 [self _setBoolValue: flag forKey: WebKitAllowUniversalAccessFromFileURLsPreferenceKey];
1498 - (BOOL)allowFileAccessFromFileURLs
1500 return [self _boolValueForKey: WebKitAllowFileAccessFromFileURLsPreferenceKey];
1503 - (void)setAllowFileAccessFromFileURLs:(BOOL)flag
1505 [self _setBoolValue: flag forKey: WebKitAllowFileAccessFromFileURLsPreferenceKey];
1508 - (BOOL)allowCrossOriginSubresourcesToAskForCredentials
1510 return [self _boolValueForKey:WebKitAllowCrossOriginSubresourcesToAskForCredentialsKey];
1513 - (void)setAllowCrossOriginSubresourcesToAskForCredentials:(BOOL)flag
1515 [self _setBoolValue:flag forKey:WebKitAllowCrossOriginSubresourcesToAskForCredentialsKey];
1518 - (BOOL)needsStorageAccessFromFileURLsQuirk
1520 return [self _boolValueForKey: WebKitNeedsStorageAccessFromFileURLsQuirkKey];
1523 -(void)setNeedsStorageAccessFromFileURLsQuirk:(BOOL)flag
1525 [self _setBoolValue: flag forKey: WebKitNeedsStorageAccessFromFileURLsQuirkKey];
1528 - (NSTimeInterval)_backForwardCacheExpirationInterval
1530 return (NSTimeInterval)[self _floatValueForKey:WebKitBackForwardCacheExpirationIntervalKey];
1536 return [self _boolValueForKey:WebKitStandalonePreferenceKey];
1539 - (void)_setStandalone:(BOOL)flag
1541 [self _setBoolValue:flag forKey:WebKitStandalonePreferenceKey];
1544 - (void)_setTelephoneNumberParsingEnabled:(BOOL)flag
1546 [self _setBoolValue:flag forKey:WebKitTelephoneParsingEnabledPreferenceKey];
1549 - (BOOL)_telephoneNumberParsingEnabled
1551 return [self _boolValueForKey:WebKitTelephoneParsingEnabledPreferenceKey];
1555 #if ENABLE(TEXT_AUTOSIZING)
1556 - (void)_setMinimumZoomFontSize:(float)size
1558 [self _setFloatValue:size forKey:WebKitMinimumZoomFontSizePreferenceKey];
1561 - (float)_minimumZoomFontSize
1563 return [self _floatValueForKey:WebKitMinimumZoomFontSizePreferenceKey];
1566 - (void)_setTextAutosizingEnabled:(BOOL)enabled
1568 [self _setBoolValue:enabled forKey:WebKitTextAutosizingEnabledPreferenceKey];
1571 - (BOOL)_textAutosizingEnabled
1573 return [self _boolValueForKey:WebKitTextAutosizingEnabledPreferenceKey];
1578 - (void)_setLayoutInterval:(int)l
1580 [self _setIntegerValue:l forKey:WebKitLayoutIntervalPreferenceKey];
1583 - (int)_layoutInterval
1585 return [self _integerValueForKey:WebKitLayoutIntervalPreferenceKey];
1588 - (void)_setMaxParseDuration:(float)d
1590 [self _setFloatValue:d forKey:WebKitMaxParseDurationPreferenceKey];
1593 - (float)_maxParseDuration
1595 return [self _floatValueForKey:WebKitMaxParseDurationPreferenceKey];
1598 - (void)_setAllowMultiElementImplicitFormSubmission:(BOOL)flag
1600 [self _setBoolValue:flag forKey:WebKitAllowMultiElementImplicitFormSubmissionPreferenceKey];
1603 - (BOOL)_allowMultiElementImplicitFormSubmission
1605 return [self _boolValueForKey:WebKitAllowMultiElementImplicitFormSubmissionPreferenceKey];
1608 - (void)_setAlwaysRequestGeolocationPermission:(BOOL)flag
1610 [self _setBoolValue:flag forKey:WebKitAlwaysRequestGeolocationPermissionPreferenceKey];
1613 - (BOOL)_alwaysRequestGeolocationPermission
1615 return [self _boolValueForKey:WebKitAlwaysRequestGeolocationPermissionPreferenceKey];
1618 - (void)_setAlwaysUseAcceleratedOverflowScroll:(BOOL)flag
1620 [self _setBoolValue:flag forKey:WebKitAlwaysUseAcceleratedOverflowScrollPreferenceKey];
1623 - (BOOL)_alwaysUseAcceleratedOverflowScroll
1625 return [self _boolValueForKey:WebKitAlwaysUseAcceleratedOverflowScrollPreferenceKey];
1628 - (void)_setInterpolationQuality:(int)quality
1630 [self _setIntegerValue:quality forKey:WebKitInterpolationQualityPreferenceKey];
1633 - (int)_interpolationQuality
1635 return [self _integerValueForKey:WebKitInterpolationQualityPreferenceKey];
1638 - (BOOL)_allowPasswordEcho
1640 return [self _boolValueForKey:WebKitPasswordEchoEnabledPreferenceKey];
1643 - (float)_passwordEchoDuration
1645 return [self _floatValueForKey:WebKitPasswordEchoDurationPreferenceKey];
1648 #endif // PLATFORM(IOS)
1651 - (float)PDFScaleFactor
1653 return [self _floatValueForKey:WebKitPDFScaleFactorPreferenceKey];
1656 - (void)setPDFScaleFactor:(float)factor
1658 [self _setFloatValue:factor forKey:WebKitPDFScaleFactorPreferenceKey];
1662 - (int64_t)applicationCacheTotalQuota
1664 return [self _longLongValueForKey:WebKitApplicationCacheTotalQuota];
1667 - (void)setApplicationCacheTotalQuota:(int64_t)quota
1669 [self _setLongLongValue:quota forKey:WebKitApplicationCacheTotalQuota];
1671 // Application Cache Preferences are stored on the global cache storage manager, not in Settings.
1672 [WebApplicationCache setMaximumSize:quota];
1675 - (int64_t)applicationCacheDefaultOriginQuota
1677 return [self _longLongValueForKey:WebKitApplicationCacheDefaultOriginQuota];
1680 - (void)setApplicationCacheDefaultOriginQuota:(int64_t)quota
1682 [self _setLongLongValue:quota forKey:WebKitApplicationCacheDefaultOriginQuota];
1686 - (PDFDisplayMode)PDFDisplayMode
1688 PDFDisplayMode value = static_cast<PDFDisplayMode>([self _integerValueForKey:WebKitPDFDisplayModePreferenceKey]);
1689 if (value != kPDFDisplaySinglePage && value != kPDFDisplaySinglePageContinuous && value != kPDFDisplayTwoUp && value != kPDFDisplayTwoUpContinuous) {
1690 // protect against new modes from future versions of OS X stored in defaults
1691 value = kPDFDisplaySinglePageContinuous;
1696 - (void)setPDFDisplayMode:(PDFDisplayMode)mode
1698 [self _setIntegerValue:mode forKey:WebKitPDFDisplayModePreferenceKey];
1702 - (WebKitEditableLinkBehavior)editableLinkBehavior
1704 WebKitEditableLinkBehavior value = static_cast<WebKitEditableLinkBehavior> ([self _integerValueForKey:WebKitEditableLinkBehaviorPreferenceKey]);
1705 if (value != WebKitEditableLinkDefaultBehavior &&
1706 value != WebKitEditableLinkAlwaysLive &&
1707 value != WebKitEditableLinkNeverLive &&
1708 value != WebKitEditableLinkOnlyLiveWithShiftKey &&
1709 value != WebKitEditableLinkLiveWhenNotFocused) {
1710 // ensure that a valid result is returned
1711 value = WebKitEditableLinkDefaultBehavior;
1717 - (void)setEditableLinkBehavior:(WebKitEditableLinkBehavior)behavior
1719 [self _setIntegerValue:behavior forKey:WebKitEditableLinkBehaviorPreferenceKey];
1722 - (WebTextDirectionSubmenuInclusionBehavior)textDirectionSubmenuInclusionBehavior
1724 WebTextDirectionSubmenuInclusionBehavior value = static_cast<WebTextDirectionSubmenuInclusionBehavior>([self _integerValueForKey:WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey]);
1725 if (value != WebTextDirectionSubmenuNeverIncluded &&
1726 value != WebTextDirectionSubmenuAutomaticallyIncluded &&
1727 value != WebTextDirectionSubmenuAlwaysIncluded) {
1728 // Ensure that a valid result is returned.
1729 value = WebTextDirectionSubmenuNeverIncluded;
1734 - (void)setTextDirectionSubmenuInclusionBehavior:(WebTextDirectionSubmenuInclusionBehavior)behavior
1736 [self _setIntegerValue:behavior forKey:WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey];
1739 - (BOOL)_useSiteSpecificSpoofing
1741 return [self _boolValueForKey:WebKitUseSiteSpecificSpoofingPreferenceKey];
1744 - (void)_setUseSiteSpecificSpoofing:(BOOL)newValue
1746 [self _setBoolValue:newValue forKey:WebKitUseSiteSpecificSpoofingPreferenceKey];
1749 - (BOOL)databasesEnabled
1751 return [self _boolValueForKey:WebKitDatabasesEnabledPreferenceKey];
1754 - (void)setDatabasesEnabled:(BOOL)databasesEnabled
1756 [self _setBoolValue:databasesEnabled forKey:WebKitDatabasesEnabledPreferenceKey];
1760 - (BOOL)storageTrackerEnabled
1762 return [self _boolValueForKey:WebKitStorageTrackerEnabledPreferenceKey];
1765 - (void)setStorageTrackerEnabled:(BOOL)storageTrackerEnabled
1767 [self _setBoolValue:storageTrackerEnabled forKey:WebKitStorageTrackerEnabledPreferenceKey];
1771 - (BOOL)localStorageEnabled
1773 return [self _boolValueForKey:WebKitLocalStorageEnabledPreferenceKey];
1776 - (void)setLocalStorageEnabled:(BOOL)localStorageEnabled
1778 [self _setBoolValue:localStorageEnabled forKey:WebKitLocalStorageEnabledPreferenceKey];
1781 - (BOOL)experimentalNotificationsEnabled
1783 return [self _boolValueForKey:WebKitExperimentalNotificationsEnabledPreferenceKey];
1786 - (void)setExperimentalNotificationsEnabled:(BOOL)experimentalNotificationsEnabled
1788 [self _setBoolValue:experimentalNotificationsEnabled forKey:WebKitExperimentalNotificationsEnabledPreferenceKey];
1791 + (WebPreferences *)_getInstanceForIdentifier:(NSString *)ident
1793 LOG(Encoding, "requesting for %@\n", ident);
1796 return _standardPreferences;
1798 WebPreferences *instance = [webPreferencesInstances objectForKey:[self _concatenateKeyWithIBCreatorID:ident]];
1803 + (void)_setInstance:(WebPreferences *)instance forIdentifier:(NSString *)ident
1805 if (!webPreferencesInstances)
1806 webPreferencesInstances = [[NSMutableDictionary alloc] init];
1808 [webPreferencesInstances setObject:instance forKey:[self _concatenateKeyWithIBCreatorID:ident]];
1809 LOG(Encoding, "recording %p for %@\n", instance, [self _concatenateKeyWithIBCreatorID:ident]);
1813 + (void)_checkLastReferenceForIdentifier:(id)identifier
1815 // FIXME: This won't work at all under garbage collection because retainCount returns a constant.
1816 // We may need to change WebPreferences API so there's an explicit way to end the lifetime of one.
1817 WebPreferences *instance = [webPreferencesInstances objectForKey:identifier];
1818 if ([instance retainCount] == 1)
1819 [webPreferencesInstances removeObjectForKey:identifier];
1822 + (void)_removeReferenceForIdentifier:(NSString *)ident
1825 [self performSelector:@selector(_checkLastReferenceForIdentifier:) withObject:[self _concatenateKeyWithIBCreatorID:ident] afterDelay:0.1];
1828 - (void)_postPreferencesChangedNotification
1831 if (!pthread_main_np()) {
1832 [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO];
1837 [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedInternalNotification object:self userInfo:nil];
1838 [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedNotification object:self userInfo:nil];
1841 - (void)_postPreferencesChangedAPINotification
1843 if (!pthread_main_np()) {
1844 [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO];
1848 [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedNotification object:self userInfo:nil];
1851 + (CFStringEncoding)_systemCFStringEncoding
1853 return webDefaultCFStringEncoding();
1856 + (void)_setInitialDefaultTextEncodingToSystemEncoding
1858 [[NSUserDefaults standardUserDefaults] registerDefaults:
1859 [NSDictionary dictionaryWithObject:defaultTextEncodingNameForSystemLanguage() forKey:WebKitDefaultTextEncodingNamePreferenceKey]];
1862 static NSString *classIBCreatorID = nil;
1864 + (void)_setIBCreatorID:(NSString *)string
1866 NSString *old = classIBCreatorID;
1867 classIBCreatorID = [string copy];
1871 + (void)_switchNetworkLoaderToNewTestingSession
1876 NetworkStorageSession::switchToNewTestingSession();
1879 + (void)_clearNetworkLoaderSession
1881 NetworkStorageSession::defaultStorageSession().deleteAllCookies();
1884 + (void)_setCurrentNetworkLoaderSessionCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy
1886 RetainPtr<CFHTTPCookieStorageRef> cookieStorage = NetworkStorageSession::defaultStorageSession().cookieStorage();
1887 ASSERT(cookieStorage); // Will fail when NetworkStorageSession::switchToNewTestingSession() was not called beforehand.
1888 CFHTTPCookieStorageSetCookieAcceptPolicy(cookieStorage.get(), policy);
1891 - (BOOL)isDOMPasteAllowed
1893 return [self _boolValueForKey:WebKitDOMPasteAllowedPreferenceKey];
1896 - (void)setDOMPasteAllowed:(BOOL)DOMPasteAllowed
1898 [self _setBoolValue:DOMPasteAllowed forKey:WebKitDOMPasteAllowedPreferenceKey];
1901 - (NSString *)_localStorageDatabasePath
1903 return [[self _stringValueForKey:WebKitLocalStorageDatabasePathPreferenceKey] stringByStandardizingPath];
1906 - (void)_setLocalStorageDatabasePath:(NSString *)path
1908 [self _setStringValue:[path stringByStandardizingPath] forKey:WebKitLocalStorageDatabasePathPreferenceKey];
1911 - (NSString *)_ftpDirectoryTemplatePath
1913 return [[self _stringValueForKey:WebKitFTPDirectoryTemplatePath] stringByStandardizingPath];
1916 - (void)_setFTPDirectoryTemplatePath:(NSString *)path
1918 [self _setStringValue:[path stringByStandardizingPath] forKey:WebKitFTPDirectoryTemplatePath];
1921 - (BOOL)_forceFTPDirectoryListings
1923 return [self _boolValueForKey:WebKitForceFTPDirectoryListings];
1926 - (void)_setForceFTPDirectoryListings:(BOOL)force
1928 [self _setBoolValue:force forKey:WebKitForceFTPDirectoryListings];
1931 - (BOOL)acceleratedDrawingEnabled
1933 return [self _boolValueForKey:WebKitAcceleratedDrawingEnabledPreferenceKey];
1936 - (void)setAcceleratedDrawingEnabled:(BOOL)enabled
1938 [self _setBoolValue:enabled forKey:WebKitAcceleratedDrawingEnabledPreferenceKey];
1941 - (BOOL)displayListDrawingEnabled
1943 return [self _boolValueForKey:WebKitDisplayListDrawingEnabledPreferenceKey];
1946 - (void)setDisplayListDrawingEnabled:(BOOL)enabled
1948 [self _setBoolValue:enabled forKey:WebKitDisplayListDrawingEnabledPreferenceKey];
1951 - (BOOL)resourceLoadStatisticsEnabled
1953 return [self _boolValueForKey:WebKitResourceLoadStatisticsEnabledPreferenceKey];
1956 - (void)setResourceLoadStatisticsEnabled:(BOOL)enabled
1958 [self _setBoolValue:enabled forKey:WebKitResourceLoadStatisticsEnabledPreferenceKey];
1961 - (BOOL)largeImageAsyncDecodingEnabled
1963 return [self _boolValueForKey:WebKitLargeImageAsyncDecodingEnabledPreferenceKey];
1966 - (void)setLargeImageAsyncDecodingEnabled:(BOOL)enabled
1968 [self _setBoolValue:enabled forKey:WebKitLargeImageAsyncDecodingEnabledPreferenceKey];
1971 - (BOOL)animatedImageAsyncDecodingEnabled
1973 return [self _boolValueForKey:WebKitAnimatedImageAsyncDecodingEnabledPreferenceKey];
1976 - (void)setAnimatedImageAsyncDecodingEnabled:(BOOL)enabled
1978 [self _setBoolValue:enabled forKey:WebKitAnimatedImageAsyncDecodingEnabledPreferenceKey];
1981 - (BOOL)canvasUsesAcceleratedDrawing
1983 return [self _boolValueForKey:WebKitCanvasUsesAcceleratedDrawingPreferenceKey];
1986 - (void)setCanvasUsesAcceleratedDrawing:(BOOL)enabled
1988 [self _setBoolValue:enabled forKey:WebKitCanvasUsesAcceleratedDrawingPreferenceKey];
1991 - (BOOL)acceleratedCompositingEnabled
1993 return [self _boolValueForKey:WebKitAcceleratedCompositingEnabledPreferenceKey];
1996 - (void)setAcceleratedCompositingEnabled:(BOOL)enabled
1998 [self _setBoolValue:enabled forKey:WebKitAcceleratedCompositingEnabledPreferenceKey];
2001 - (BOOL)showDebugBorders
2003 return [self _boolValueForKey:WebKitShowDebugBordersPreferenceKey];
2006 - (void)setShowDebugBorders:(BOOL)enabled
2008 [self _setBoolValue:enabled forKey:WebKitShowDebugBordersPreferenceKey];
2011 - (BOOL)subpixelAntialiasedLayerTextEnabled
2013 return [self _boolValueForKey:WebKitSubpixelAntialiasedLayerTextEnabledPreferenceKey];
2016 - (void)setSubpixelAntialiasedLayerTextEnabled:(BOOL)enabled
2018 [self _setBoolValue:enabled forKey:WebKitSubpixelAntialiasedLayerTextEnabledPreferenceKey];
2021 - (BOOL)simpleLineLayoutEnabled
2023 return [self _boolValueForKey:WebKitSimpleLineLayoutEnabledPreferenceKey];
2026 - (void)setSimpleLineLayoutEnabled:(BOOL)enabled
2028 [self _setBoolValue:enabled forKey:WebKitSimpleLineLayoutEnabledPreferenceKey];
2031 - (BOOL)simpleLineLayoutDebugBordersEnabled
2033 return [self _boolValueForKey:WebKitSimpleLineLayoutDebugBordersEnabledPreferenceKey];
2036 - (void)setSimpleLineLayoutDebugBordersEnabled:(BOOL)enabled
2038 [self _setBoolValue:enabled forKey:WebKitSimpleLineLayoutDebugBordersEnabledPreferenceKey];
2041 - (BOOL)showRepaintCounter
2043 return [self _boolValueForKey:WebKitShowRepaintCounterPreferenceKey];
2046 - (void)setShowRepaintCounter:(BOOL)enabled
2048 [self _setBoolValue:enabled forKey:WebKitShowRepaintCounterPreferenceKey];
2051 - (BOOL)webAudioEnabled
2053 return [self _boolValueForKey:WebKitWebAudioEnabledPreferenceKey];
2056 - (void)setWebAudioEnabled:(BOOL)enabled
2058 [self _setBoolValue:enabled forKey:WebKitWebAudioEnabledPreferenceKey];
2061 - (BOOL)subpixelCSSOMElementMetricsEnabled
2063 return [self _boolValueForKey:WebKitSubpixelCSSOMElementMetricsEnabledPreferenceKey];
2066 - (void)setSubpixelCSSOMElementMetricsEnabled:(BOOL)enabled
2068 [self _setBoolValue:enabled forKey:WebKitSubpixelCSSOMElementMetricsEnabledPreferenceKey];
2071 - (BOOL)webGLEnabled
2073 return [self _boolValueForKey:WebKitWebGLEnabledPreferenceKey];
2076 - (void)setWebGLEnabled:(BOOL)enabled
2078 [self _setBoolValue:enabled forKey:WebKitWebGLEnabledPreferenceKey];
2081 - (BOOL)webGL2Enabled
2083 return [self _boolValueForKey:WebKitWebGL2EnabledPreferenceKey];
2086 - (void)setWebGL2Enabled:(BOOL)enabled
2088 [self _setBoolValue:enabled forKey:WebKitWebGL2EnabledPreferenceKey];
2091 - (BOOL)forceSoftwareWebGLRendering
2093 return [self _boolValueForKey:WebKitForceSoftwareWebGLRenderingPreferenceKey];
2096 - (void)setForceSoftwareWebGLRendering:(BOOL)forced
2098 [self _setBoolValue:forced forKey:WebKitForceSoftwareWebGLRenderingPreferenceKey];
2101 - (BOOL)forceLowPowerGPUForWebGL
2103 return [self _boolValueForKey:WebKitForceWebGLUsesLowPowerPreferenceKey];
2106 - (void)setForceWebGLUsesLowPower:(BOOL)forceLowPower
2108 [self _setBoolValue:forceLowPower forKey:WebKitForceWebGLUsesLowPowerPreferenceKey];
2111 - (BOOL)webGPUEnabled
2113 return [self _boolValueForKey:WebKitWebGPUEnabledPreferenceKey];
2116 - (void)setWebGPUEnabled:(BOOL)enabled
2118 [self _setBoolValue:enabled forKey:WebKitWebGPUEnabledPreferenceKey];
2121 - (BOOL)accelerated2dCanvasEnabled
2123 return [self _boolValueForKey:WebKitAccelerated2dCanvasEnabledPreferenceKey];
2126 - (void)setAccelerated2dCanvasEnabled:(BOOL)enabled
2128 [self _setBoolValue:enabled forKey:WebKitAccelerated2dCanvasEnabledPreferenceKey];
2131 - (void)setDiskImageCacheEnabled:(BOOL)enabled
2133 // Staging. Can be removed once there are no more callers.
2136 - (BOOL)isFrameFlatteningEnabled
2138 return [self _unsignedIntValueForKey:WebKitFrameFlatteningPreferenceKey] != WebKitFrameFlatteningDisabled;
2141 - (void)setFrameFlatteningEnabled:(BOOL)flattening
2143 WebKitFrameFlattening value = flattening ? WebKitFrameFlatteningFullyEnabled : WebKitFrameFlatteningDisabled;
2144 [self _setUnsignedIntValue:value forKey:WebKitFrameFlatteningPreferenceKey];
2147 - (WebKitFrameFlattening)frameFlattening
2149 return static_cast<WebKitFrameFlattening>([self _unsignedIntValueForKey:WebKitFrameFlatteningPreferenceKey]);
2152 - (void)setFrameFlattening:(WebKitFrameFlattening)flattening
2154 [self _setUnsignedIntValue:flattening forKey:WebKitFrameFlatteningPreferenceKey];
2157 - (BOOL)asyncFrameScrollingEnabled
2159 return [self _boolValueForKey:WebKitAsyncFrameScrollingEnabledPreferenceKey];
2162 - (void)setAsyncFrameScrollingEnabled:(BOOL)enabled
2164 [self _setBoolValue:enabled forKey:WebKitAsyncFrameScrollingEnabledPreferenceKey];
2167 - (BOOL)isSpatialNavigationEnabled
2169 return [self _boolValueForKey:WebKitSpatialNavigationEnabledPreferenceKey];
2172 - (void)setSpatialNavigationEnabled:(BOOL)flag
2174 [self _setBoolValue:flag forKey:WebKitSpatialNavigationEnabledPreferenceKey];
2177 - (BOOL)paginateDuringLayoutEnabled
2179 return [self _boolValueForKey:WebKitPaginateDuringLayoutEnabledPreferenceKey];
2182 - (void)setPaginateDuringLayoutEnabled:(BOOL)flag
2184 [self _setBoolValue:flag forKey:WebKitPaginateDuringLayoutEnabledPreferenceKey];
2187 - (BOOL)hyperlinkAuditingEnabled
2189 return [self _boolValueForKey:WebKitHyperlinkAuditingEnabledPreferenceKey];
2192 - (void)setHyperlinkAuditingEnabled:(BOOL)flag
2194 [self _setBoolValue:flag forKey:WebKitHyperlinkAuditingEnabledPreferenceKey];
2197 - (BOOL)usePreHTML5ParserQuirks
2199 return [self _boolValueForKey:WebKitUsePreHTML5ParserQuirksKey];
2202 - (void)setUsePreHTML5ParserQuirks:(BOOL)flag
2204 [self _setBoolValue:flag forKey:WebKitUsePreHTML5ParserQuirksKey];
2207 - (void)didRemoveFromWebView
2209 ASSERT(_private->numWebViews);
2210 if (--_private->numWebViews == 0)
2211 [[NSNotificationCenter defaultCenter]
2212 postNotificationName:WebPreferencesRemovedNotification
2217 - (void)willAddToWebView
2219 ++_private->numWebViews;
2222 - (void)_setPreferenceForTestWithValue:(NSString *)value forKey:(NSString *)key
2224 [self _setStringValue:value forKey:key];
2227 - (void)setFullScreenEnabled:(BOOL)flag
2229 [self _setBoolValue:flag forKey:WebKitFullScreenEnabledPreferenceKey];
2232 - (BOOL)fullScreenEnabled
2234 return [self _boolValueForKey:WebKitFullScreenEnabledPreferenceKey];
2237 - (void)setAsynchronousSpellCheckingEnabled:(BOOL)flag
2239 [self _setBoolValue:flag forKey:WebKitAsynchronousSpellCheckingEnabledPreferenceKey];
2242 - (BOOL)asynchronousSpellCheckingEnabled
2244 return [self _boolValueForKey:WebKitAsynchronousSpellCheckingEnabledPreferenceKey];
2247 + (void)setWebKitLinkTimeVersion:(int)version
2249 setWebKitLinkTimeVersion(version);
2252 - (void)setLoadsSiteIconsIgnoringImageLoadingPreference: (BOOL)flag
2254 [self _setBoolValue: flag forKey: WebKitLoadSiteIconsKey];
2257 - (BOOL)loadsSiteIconsIgnoringImageLoadingPreference
2259 return [self _boolValueForKey: WebKitLoadSiteIconsKey];
2262 - (void)setAVFoundationEnabled:(BOOL)flag
2264 [self _setBoolValue:flag forKey:WebKitAVFoundationEnabledKey];
2267 - (BOOL)isAVFoundationEnabled
2269 return [self _boolValueForKey:WebKitAVFoundationEnabledKey];
2272 - (void)setAVFoundationNSURLSessionEnabled:(BOOL)flag
2274 [self _setBoolValue:flag forKey:WebKitAVFoundationNSURLSessionEnabledKey];
2277 - (BOOL)isAVFoundationNSURLSessionEnabled
2279 return [self _boolValueForKey:WebKitAVFoundationNSURLSessionEnabledKey];
2282 - (void)setVideoPluginProxyEnabled:(BOOL)flag
2284 // No-op, left for SPI compatibility.
2287 - (BOOL)isVideoPluginProxyEnabled
2292 - (void)setHixie76WebSocketProtocolEnabled:(BOOL)flag
2296 - (BOOL)isHixie76WebSocketProtocolEnabled
2301 - (BOOL)isInheritURIQueryComponentEnabled
2303 return [self _boolValueForKey: WebKitEnableInheritURIQueryComponentPreferenceKey];
2306 - (void)setEnableInheritURIQueryComponent:(BOOL)flag
2308 [self _setBoolValue:flag forKey: WebKitEnableInheritURIQueryComponentPreferenceKey];
2312 - (BOOL)mediaPlaybackAllowsAirPlay
2314 return [self _boolValueForKey:WebKitAllowsAirPlayForMediaPlaybackPreferenceKey];
2317 - (void)setMediaPlaybackAllowsAirPlay:(BOOL)flag
2319 [self _setBoolValue:flag forKey:WebKitAllowsAirPlayForMediaPlaybackPreferenceKey];
2322 - (unsigned)audioSessionCategoryOverride
2324 return [self _unsignedIntValueForKey:WebKitAudioSessionCategoryOverride];
2327 - (void)setAudioSessionCategoryOverride:(unsigned)override
2329 #if HAVE(AUDIO_TOOLBOX_AUDIO_SESSION)
2330 if (override > AudioSession::AudioProcessing) {
2331 // Clients are passing us OSTypes values from AudioToolbox/AudioSession.h,
2332 // which need to be translated into AudioSession::CategoryType:
2334 case kAudioSessionCategory_AmbientSound:
2335 override = AudioSession::AmbientSound;
2337 case kAudioSessionCategory_SoloAmbientSound:
2338 override = AudioSession::SoloAmbientSound;
2340 case kAudioSessionCategory_MediaPlayback:
2341 override = AudioSession::MediaPlayback;
2343 case kAudioSessionCategory_RecordAudio:
2344 override = AudioSession::RecordAudio;
2346 case kAudioSessionCategory_PlayAndRecord:
2347 override = AudioSession::PlayAndRecord;
2349 case kAudioSessionCategory_AudioProcessing:
2350 override = AudioSession::AudioProcessing;
2353 override = AudioSession::None;
2359 [self _setUnsignedIntValue:override forKey:WebKitAudioSessionCategoryOverride];
2362 - (BOOL)avKitEnabled
2364 return [self _boolValueForKey:WebKitAVKitEnabled];
2367 - (void)setAVKitEnabled:(bool)flag
2370 [self _setBoolValue:flag forKey:WebKitAVKitEnabled];
2374 - (BOOL)networkDataUsageTrackingEnabled
2376 return [self _boolValueForKey:WebKitNetworkDataUsageTrackingEnabledPreferenceKey];
2379 - (void)setNetworkDataUsageTrackingEnabled:(bool)trackingEnabled
2381 [self _setBoolValue:trackingEnabled forKey:WebKitNetworkDataUsageTrackingEnabledPreferenceKey];
2384 - (NSString *)networkInterfaceName
2386 return [self _stringValueForKey:WebKitNetworkInterfaceNamePreferenceKey];
2389 - (void)setNetworkInterfaceName:(NSString *)name
2391 [self _setStringValue:name forKey:WebKitNetworkInterfaceNamePreferenceKey];
2393 #endif // PLATFORM(IOS)
2395 // Deprecated. Use -videoPlaybackRequiresUserGesture and -audioPlaybackRequiresUserGesture instead.
2396 - (BOOL)mediaPlaybackRequiresUserGesture
2398 return [self _boolValueForKey:WebKitRequiresUserGestureForMediaPlaybackPreferenceKey];
2401 // Deprecated. Use -setVideoPlaybackRequiresUserGesture and -setAudioPlaybackRequiresUserGesture instead.
2402 - (void)setMediaPlaybackRequiresUserGesture:(BOOL)flag
2404 [self _setBoolValue:flag forKey:WebKitRequiresUserGestureForMediaPlaybackPreferenceKey];
2407 - (BOOL)videoPlaybackRequiresUserGesture
2409 return [self _boolValueForKey:WebKitRequiresUserGestureForVideoPlaybackPreferenceKey];
2412 - (void)setVideoPlaybackRequiresUserGesture:(BOOL)flag
2414 [self _setBoolValue:flag forKey:WebKitRequiresUserGestureForVideoPlaybackPreferenceKey];
2417 - (BOOL)audioPlaybackRequiresUserGesture
2419 return [self _boolValueForKey:WebKitRequiresUserGestureForAudioPlaybackPreferenceKey];
2422 - (void)setAudioPlaybackRequiresUserGesture:(BOOL)flag
2424 [self _setBoolValue:flag forKey:WebKitRequiresUserGestureForAudioPlaybackPreferenceKey];
2427 - (BOOL)overrideUserGestureRequirementForMainContent
2429 return [self _boolValueForKey:WebKitMainContentUserGestureOverrideEnabledPreferenceKey];
2432 - (void)setOverrideUserGestureRequirementForMainContent:(BOOL)flag
2434 [self _setBoolValue:flag forKey:WebKitMainContentUserGestureOverrideEnabledPreferenceKey];
2437 - (BOOL)mediaPlaybackAllowsInline
2439 return [self _boolValueForKey:WebKitAllowsInlineMediaPlaybackPreferenceKey];
2442 - (void)setMediaPlaybackAllowsInline:(BOOL)flag
2444 [self _setBoolValue:flag forKey:WebKitAllowsInlineMediaPlaybackPreferenceKey];
2447 - (BOOL)inlineMediaPlaybackRequiresPlaysInlineAttribute
2449 return [self _boolValueForKey:WebKitInlineMediaPlaybackRequiresPlaysInlineAttributeKey];
2452 - (void)setInlineMediaPlaybackRequiresPlaysInlineAttribute:(BOOL)flag
2454 [self _setBoolValue:flag forKey:WebKitInlineMediaPlaybackRequiresPlaysInlineAttributeKey];
2457 - (BOOL)invisibleAutoplayNotPermitted
2459 return [self _boolValueForKey:WebKitInvisibleAutoplayNotPermittedKey];
2462 - (void)setInvisibleAutoplayNotPermitted:(BOOL)flag
2464 [self _setBoolValue:flag forKey:WebKitInvisibleAutoplayNotPermittedKey];
2467 - (BOOL)mediaControlsScaleWithPageZoom
2469 return [self _boolValueForKey:WebKitMediaControlsScaleWithPageZoomPreferenceKey];
2472 - (void)setMediaControlsScaleWithPageZoom:(BOOL)flag
2474 [self _setBoolValue:flag forKey:WebKitMediaControlsScaleWithPageZoomPreferenceKey];
2477 - (BOOL)allowsAlternateFullscreen
2479 return [self allowsPictureInPictureMediaPlayback];
2482 - (void)setAllowsAlternateFullscreen:(BOOL)flag
2484 [self setAllowsPictureInPictureMediaPlayback:flag];
2487 - (BOOL)allowsPictureInPictureMediaPlayback
2489 return [self _boolValueForKey:WebKitAllowsPictureInPictureMediaPlaybackPreferenceKey];
2492 - (void)setAllowsPictureInPictureMediaPlayback:(BOOL)flag
2494 [self _setBoolValue:flag forKey:WebKitAllowsPictureInPictureMediaPlaybackPreferenceKey];
2497 - (BOOL)mockScrollbarsEnabled
2499 return [self _boolValueForKey:WebKitMockScrollbarsEnabledPreferenceKey];
2502 - (void)setMockScrollbarsEnabled:(BOOL)flag
2504 [self _setBoolValue:flag forKey:WebKitMockScrollbarsEnabledPreferenceKey];
2507 - (NSString *)pictographFontFamily
2509 return [self _stringValueForKey: WebKitPictographFontPreferenceKey];
2512 - (void)setPictographFontFamily:(NSString *)family
2514 [self _setStringValue: family forKey: WebKitPictographFontPreferenceKey];
2517 - (BOOL)pageCacheSupportsPlugins
2519 return [self _boolValueForKey:WebKitPageCacheSupportsPluginsPreferenceKey];
2522 - (void)setPageCacheSupportsPlugins:(BOOL)flag
2524 [self _setBoolValue:flag forKey:WebKitPageCacheSupportsPluginsPreferenceKey];
2529 - (void)_invalidateCachedPreferences
2531 dispatch_barrier_sync(_private->readWriteQueue, ^{
2532 if (_private->values)
2533 _private->values = adoptNS([[NSMutableDictionary alloc] init]);
2536 [self _updatePrivateBrowsingStateTo:[self privateBrowsingEnabled]];
2538 // Tell any live WebViews to refresh their preferences
2539 [self _postPreferencesChangedNotification];
2542 - (void)_synchronizeWebStoragePolicyWithCookiePolicy
2544 // FIXME: This should be done in clients, WebKit shouldn't be making such policy decisions.
2546 NSHTTPCookieAcceptPolicy cookieAcceptPolicy = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookieAcceptPolicy];
2547 WebStorageBlockingPolicy storageBlockingPolicy;
2548 switch (static_cast<unsigned>(cookieAcceptPolicy)) {
2549 case NSHTTPCookieAcceptPolicyAlways:
2550 storageBlockingPolicy = WebAllowAllStorage;
2552 case NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
2553 case NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain:
2554 storageBlockingPolicy = WebBlockThirdPartyStorage;
2556 case NSHTTPCookieAcceptPolicyNever:
2557 storageBlockingPolicy = WebBlockAllStorage;
2560 ASSERT_NOT_REACHED();
2561 storageBlockingPolicy = WebBlockAllStorage;
2565 [self setStorageBlockingPolicy:storageBlockingPolicy];
2569 - (void)setBackspaceKeyNavigationEnabled:(BOOL)flag
2571 [self _setBoolValue:flag forKey:WebKitBackspaceKeyNavigationEnabledKey];
2574 - (BOOL)backspaceKeyNavigationEnabled
2576 return [self _boolValueForKey:WebKitBackspaceKeyNavigationEnabledKey];
2579 - (void)setWantsBalancedSetDefersLoadingBehavior:(BOOL)flag
2581 [self _setBoolValue:flag forKey:WebKitWantsBalancedSetDefersLoadingBehaviorKey];
2584 - (BOOL)wantsBalancedSetDefersLoadingBehavior
2586 return [self _boolValueForKey:WebKitWantsBalancedSetDefersLoadingBehaviorKey];
2589 - (void)setShouldDisplaySubtitles:(BOOL)flag
2591 [self _setBoolValue:flag forKey:WebKitShouldDisplaySubtitlesPreferenceKey];
2594 - (BOOL)shouldDisplaySubtitles
2596 return [self _boolValueForKey:WebKitShouldDisplaySubtitlesPreferenceKey];
2599 - (void)setShouldDisplayCaptions:(BOOL)flag
2601 [self _setBoolValue:flag forKey:WebKitShouldDisplayCaptionsPreferenceKey];
2604 - (BOOL)shouldDisplayCaptions
2606 return [self _boolValueForKey:WebKitShouldDisplayCaptionsPreferenceKey];
2609 - (void)setShouldDisplayTextDescriptions:(BOOL)flag
2611 [self _setBoolValue:flag forKey:WebKitShouldDisplayTextDescriptionsPreferenceKey];
2614 - (BOOL)shouldDisplayTextDescriptions
2616 return [self _boolValueForKey:WebKitShouldDisplayTextDescriptionsPreferenceKey];
2619 - (void)setNotificationsEnabled:(BOOL)flag
2621 [self _setBoolValue:flag forKey:WebKitNotificationsEnabledKey];
2624 - (BOOL)notificationsEnabled
2626 return [self _boolValueForKey:WebKitNotificationsEnabledKey];
2629 - (void)setShouldRespectImageOrientation:(BOOL)flag
2631 [self _setBoolValue:flag forKey:WebKitShouldRespectImageOrientationKey];
2634 - (BOOL)shouldRespectImageOrientation
2636 return [self _boolValueForKey:WebKitShouldRespectImageOrientationKey];
2639 - (BOOL)requestAnimationFrameEnabled
2641 return [self _boolValueForKey:WebKitRequestAnimationFrameEnabledPreferenceKey];
2644 - (void)setRequestAnimationFrameEnabled:(BOOL)enabled
2646 [self _setBoolValue:enabled forKey:WebKitRequestAnimationFrameEnabledPreferenceKey];
2649 - (void)setIncrementalRenderingSuppressionTimeoutInSeconds:(NSTimeInterval)timeout
2651 [self _setFloatValue:timeout forKey:WebKitIncrementalRenderingSuppressionTimeoutInSecondsKey];
2654 - (NSTimeInterval)incrementalRenderingSuppressionTimeoutInSeconds
2656 return [self _floatValueForKey:WebKitIncrementalRenderingSuppressionTimeoutInSecondsKey];
2659 - (BOOL)diagnosticLoggingEnabled
2661 return [self _boolValueForKey:WebKitDiagnosticLoggingEnabledKey];
2664 - (void)setDiagnosticLoggingEnabled:(BOOL)enabled
2666 [self _setBoolValue:enabled forKey:WebKitDiagnosticLoggingEnabledKey];
2669 - (void)setStorageBlockingPolicy:(WebStorageBlockingPolicy)storageBlockingPolicy
2672 // We don't want to write the setting out, so we just reset the default instead of storing the new setting.
2673 // FIXME: This code removes any defaults previously registered by client process, which is not appropriate for this method to do.
2674 NSDictionary *dict = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:storageBlockingPolicy] forKey:WebKitStorageBlockingPolicyKey];
2675 [[NSUserDefaults standardUserDefaults] registerDefaults:dict];
2677 [self _setIntegerValue:storageBlockingPolicy forKey:WebKitStorageBlockingPolicyKey];
2681 - (WebStorageBlockingPolicy)storageBlockingPolicy
2683 return static_cast<WebStorageBlockingPolicy>([self _integerValueForKey:WebKitStorageBlockingPolicyKey]);
2686 - (BOOL)plugInSnapshottingEnabled
2688 return [self _boolValueForKey:WebKitPlugInSnapshottingEnabledPreferenceKey];
2691 - (void)setPlugInSnapshottingEnabled:(BOOL)enabled
2693 [self _setBoolValue:enabled forKey:WebKitPlugInSnapshottingEnabledPreferenceKey];
2696 - (BOOL)hiddenPageDOMTimerThrottlingEnabled
2698 return [self _boolValueForKey:WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey];
2701 - (void)setHiddenPageDOMTimerThrottlingEnabled:(BOOL)enabled
2703 [self _setBoolValue:enabled forKey:WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey];
2706 - (BOOL)hiddenPageCSSAnimationSuspensionEnabled
2708 return [self _boolValueForKey:WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey];
2711 - (void)setHiddenPageCSSAnimationSuspensionEnabled:(BOOL)enabled
2713 [self _setBoolValue:enabled forKey:WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey];
2716 - (BOOL)lowPowerVideoAudioBufferSizeEnabled
2718 return [self _boolValueForKey:WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey];
2721 - (void)setLowPowerVideoAudioBufferSizeEnabled:(BOOL)enabled
2723 [self _setBoolValue:enabled forKey:WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey];
2726 - (BOOL)useLegacyTextAlignPositionedElementBehavior
2728 return [self _boolValueForKey:WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey];
2731 - (void)setUseLegacyTextAlignPositionedElementBehavior:(BOOL)enabled
2733 [self _setBoolValue:enabled forKey:WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey];
2736 - (BOOL)mediaSourceEnabled
2738 return [self _boolValueForKey:WebKitMediaSourceEnabledPreferenceKey];
2741 - (void)setMediaSourceEnabled:(BOOL)enabled
2743 [self _setBoolValue:enabled forKey:WebKitMediaSourceEnabledPreferenceKey];
2746 - (BOOL)sourceBufferChangeTypeEnabled
2748 return [self _boolValueForKey:WebKitSourceBufferChangeTypeEnabledPreferenceKey];
2751 - (void)setSourceBufferChangeTypeEnabled:(BOOL)enabled
2753 [self _setBoolValue:enabled forKey:WebKitSourceBufferChangeTypeEnabledPreferenceKey];
2756 - (BOOL)imageControlsEnabled
2758 return [self _boolValueForKey:WebKitImageControlsEnabledPreferenceKey];
2761 - (void)setImageControlsEnabled:(BOOL)enabled
2763 [self _setBoolValue:enabled forKey:WebKitImageControlsEnabledPreferenceKey];
2766 - (BOOL)serviceControlsEnabled
2768 return [self _boolValueForKey:WebKitServiceControlsEnabledPreferenceKey];
2771 - (void)setServiceControlsEnabled:(BOOL)enabled
2773 [self _setBoolValue:enabled forKey:WebKitServiceControlsEnabledPreferenceKey];
2776 - (BOOL)gamepadsEnabled
2778 return [self _boolValueForKey:WebKitGamepadsEnabledPreferenceKey];
2781 - (void)setGamepadsEnabled:(BOOL)flag
2783 [self _setBoolValue:flag forKey:WebKitGamepadsEnabledPreferenceKey];
2786 - (BOOL)shouldConvertPositionStyleOnCopy
2788 return [self _boolValueForKey:WebKitShouldConvertPositionStyleOnCopyPreferenceKey];
2791 - (void)setShouldConvertPositionStyleOnCopy:(BOOL)enabled
2793 [self _setBoolValue:enabled forKey:WebKitShouldConvertPositionStyleOnCopyPreferenceKey];
2796 - (NSString *)mediaKeysStorageDirectory
2798 return [[self _stringValueForKey:WebKitMediaKeysStorageDirectoryKey] stringByStandardizingPath];
2801 - (void)setMediaKeysStorageDirectory:(NSString *)directory
2803 [self _setStringValue:directory forKey:WebKitMediaKeysStorageDirectoryKey];
2806 - (BOOL)mediaDevicesEnabled
2808 return [self _boolValueForKey:WebKitMediaDevicesEnabledPreferenceKey];
2811 - (void)setMediaDevicesEnabled:(BOOL)flag
2813 [self _setBoolValue:flag forKey:WebKitMediaDevicesEnabledPreferenceKey];
2816 - (BOOL)mediaStreamEnabled
2818 return [self _boolValueForKey:WebKitMediaStreamEnabledPreferenceKey];
2821 - (void)setMediaStreamEnabled:(BOOL)flag
2823 [self _setBoolValue:flag forKey:WebKitMediaStreamEnabledPreferenceKey];
2826 - (BOOL)peerConnectionEnabled
2828 return [self _boolValueForKey:WebKitPeerConnectionEnabledPreferenceKey];
2831 - (void)setPeerConnectionEnabled:(BOOL)flag
2833 [self _setBoolValue:flag forKey:WebKitPeerConnectionEnabledPreferenceKey];
2836 - (BOOL)linkPreloadEnabled
2838 return [self _boolValueForKey:WebKitLinkPreloadEnabledPreferenceKey];
2841 - (void)setLinkPreloadEnabled:(BOOL)flag
2843 [self _setBoolValue:flag forKey:WebKitLinkPreloadEnabledPreferenceKey];
2846 - (BOOL)mediaPreloadingEnabled
2848 return [self _boolValueForKey:WebKitMediaPreloadingEnabledPreferenceKey];
2851 - (void)setMediaPreloadingEnabled:(BOOL)flag
2853 [self _setBoolValue:flag forKey:WebKitMediaPreloadingEnabledPreferenceKey];
2856 - (void)setMetaRefreshEnabled:(BOOL)enabled
2858 [self setHTTPEquivEnabled:enabled];
2861 - (BOOL)metaRefreshEnabled
2863 return [self httpEquivEnabled];
2866 - (void)setHTTPEquivEnabled:(BOOL)enabled
2868 [self _setBoolValue:enabled forKey:WebKitHTTPEquivEnabledPreferenceKey];
2871 - (BOOL)httpEquivEnabled
2873 return [self _boolValueForKey:WebKitHTTPEquivEnabledPreferenceKey];
2876 - (BOOL)javaScriptMarkupEnabled
2878 return [self _boolValueForKey:WebKitJavaScriptMarkupEnabledPreferenceKey];
2881 - (void)setJavaScriptMarkupEnabled:(BOOL)flag
2883 [self _setBoolValue:flag forKey:WebKitJavaScriptMarkupEnabledPreferenceKey];
2886 - (BOOL)mediaDataLoadsAutomatically
2888 return [self _boolValueForKey:WebKitMediaDataLoadsAutomaticallyPreferenceKey];
2891 - (void)setMediaDataLoadsAutomatically:(BOOL)flag
2893 [self _setBoolValue:flag forKey:WebKitMediaDataLoadsAutomaticallyPreferenceKey];
2896 - (BOOL)attachmentElementEnabled
2898 return [self _boolValueForKey:WebKitAttachmentElementEnabledPreferenceKey];
2901 - (void)setAttachmentElementEnabled:(BOOL)flag
2903 [self _setBoolValue:flag forKey:WebKitAttachmentElementEnabledPreferenceKey];
2906 - (BOOL)allowsInlineMediaPlaybackAfterFullscreen
2908 return [self _boolValueForKey:WebKitAllowsInlineMediaPlaybackAfterFullscreenPreferenceKey];
2911 - (void)setAllowsInlineMediaPlaybackAfterFullscreen:(BOOL)flag
2913 [self _setBoolValue:flag forKey:WebKitAllowsInlineMediaPlaybackAfterFullscreenPreferenceKey];
2916 - (BOOL)mockCaptureDevicesEnabled
2918 return [self _boolValueForKey:WebKitMockCaptureDevicesEnabledPreferenceKey];
2921 - (void)setMockCaptureDevicesEnabled:(BOOL)flag
2923 [self _setBoolValue:flag forKey:WebKitMockCaptureDevicesEnabledPreferenceKey];
2926 - (BOOL)mockCaptureDevicesPromptEnabled
2928 return [self _boolValueForKey:WebKitMockCaptureDevicesPromptEnabledPreferenceKey];
2931 - (void)setMockCaptureDevicesPromptEnabled:(BOOL)flag
2933 [self _setBoolValue:flag forKey:WebKitMockCaptureDevicesPromptEnabledPreferenceKey];
2936 - (BOOL)enumeratingAllNetworkInterfacesEnabled
2938 return [self _boolValueForKey:WebKitEnumeratingAllNetworkInterfacesEnabledPreferenceKey];
2941 - (void)setEnumeratingAllNetworkInterfacesEnabled:(BOOL)flag
2943 [self _setBoolValue:flag forKey:WebKitEnumeratingAllNetworkInterfacesEnabledPreferenceKey];
2946 - (BOOL)iceCandidateFilteringEnabled
2948 return [self _boolValueForKey:WebKitICECandidateFilteringEnabledPreferenceKey];
2951 - (void)setIceCandidateFilteringEnabled:(BOOL)flag
2953 [self _setBoolValue:flag forKey:WebKitICECandidateFilteringEnabledPreferenceKey];
2956 - (BOOL)mediaCaptureRequiresSecureConnection
2958 return [self _boolValueForKey:WebKitMediaCaptureRequiresSecureConnectionPreferenceKey];
2961 - (void)setMediaCaptureRequiresSecureConnection:(BOOL)flag
2963 [self _setBoolValue:flag forKey:WebKitMediaCaptureRequiresSecureConnectionPreferenceKey];
2966 - (BOOL)shadowDOMEnabled
2968 return [self _boolValueForKey:WebKitShadowDOMEnabledPreferenceKey];
2971 - (void)setShadowDOMEnabled:(BOOL)flag
2973 [self _setBoolValue:flag forKey:WebKitShadowDOMEnabledPreferenceKey];
2976 - (BOOL)customElementsEnabled
2978 return [self _boolValueForKey:WebKitCustomElementsEnabledPreferenceKey];
2981 - (void)setCustomElementsEnabled:(BOOL)flag
2983 [self _setBoolValue:flag forKey:WebKitCustomElementsEnabledPreferenceKey];
2986 - (BOOL)dataTransferItemsEnabled
2988 return [self _boolValueForKey:WebKitDataTransferItemsEnabledPreferenceKey];
2991 - (void)setDataTransferItemsEnabled:(BOOL)flag
2993 [self _setBoolValue:flag forKey:WebKitDataTransferItemsEnabledPreferenceKey];
2996 - (BOOL)customPasteboardDataEnabled
2998 return [self _boolValueForKey:WebKitCustomPasteboardDataEnabledPreferenceKey];
3001 - (void)setCustomPasteboardDataEnabled:(BOOL)flag
3003 [self _setBoolValue:flag forKey:WebKitCustomPasteboardDataEnabledPreferenceKey];
3006 - (BOOL)cacheAPIEnabled
3008 return [self _boolValueForKey:WebKitCacheAPIEnabledPreferenceKey];
3011 - (void)setCacheAPIEnabled:(BOOL)flag
3013 [self _setBoolValue:flag forKey:WebKitCacheAPIEnabledPreferenceKey];
3016 - (BOOL)crossOriginWindowPolicySupportEnabled
3018 return [self _boolValueForKey:WebKitCrossOriginWindowPolicySupportEnabledPreferenceKey];
3021 - (void)setCrossOriginWindowPolicySupportEnabled:(BOOL)flag
3023 [self _setBoolValue:flag forKey:WebKitCrossOriginWindowPolicySupportEnabledPreferenceKey];
3026 - (BOOL)fetchAPIEnabled
3028 return [self _boolValueForKey:WebKitFetchAPIEnabledPreferenceKey];
3031 - (void)setFetchAPIEnabled:(BOOL)flag
3033 [self _setBoolValue:flag forKey:WebKitFetchAPIEnabledPreferenceKey];
3036 - (BOOL)readableByteStreamAPIEnabled
3038 return [self _boolValueForKey:WebKitReadableByteStreamAPIEnabledPreferenceKey];
3041 - (void)setReadableByteStreamAPIEnabled:(BOOL)flag
3043 [self _setBoolValue:flag forKey:WebKitReadableByteStreamAPIEnabledPreferenceKey];
3046 - (BOOL)writableStreamAPIEnabled
3048 return [self _boolValueForKey:WebKitWritableStreamAPIEnabledPreferenceKey];
3051 - (void)setWritableStreamAPIEnabled:(BOOL)flag
3053 [self _setBoolValue:flag forKey:WebKitWritableStreamAPIEnabledPreferenceKey];
3056 - (BOOL)downloadAttributeEnabled
3058 return [self _boolValueForKey:WebKitDownloadAttributeEnabledPreferenceKey];
3061 - (void)setDownloadAttributeEnabled:(BOOL)flag
3063 [self _setBoolValue:flag forKey:WebKitDownloadAttributeEnabledPreferenceKey];
3066 - (void)setDirectoryUploadEnabled:(BOOL)flag
3068 [self _setBoolValue:flag forKey:WebKitDirectoryUploadEnabledPreferenceKey];
3071 - (BOOL)directoryUploadEnabled
3073 return [self _boolValueForKey:WebKitDirectoryUploadEnabledPreferenceKey];
3076 - (BOOL)visualViewportEnabled
3078 return [self _boolValueForKey:WebKitVisualViewportEnabledPreferenceKey];
3081 - (void)setVisualViewportEnabled:(BOOL)flag
3083 [self _setBoolValue:flag forKey:WebKitVisualViewportEnabledPreferenceKey];
3086 - (BOOL)visualViewportAPIEnabled
3088 return [self _boolValueForKey:WebKitVisualViewportAPIEnabledPreferenceKey];
3091 - (void)setVisualViewportAPIEnabled:(BOOL)flag
3093 [self _setBoolValue:flag forKey:WebKitVisualViewportAPIEnabledPreferenceKey];
3096 - (BOOL)CSSOMViewScrollingAPIEnabled
3098 return [self _boolValueForKey:WebKitCSSOMViewScrollingAPIEnabledPreferenceKey];
3101 - (void)setCSSOMViewScrollingAPIEnabled:(BOOL)flag
3103 [self _setBoolValue:flag forKey:WebKitCSSOMViewScrollingAPIEnabledPreferenceKey];
3106 - (BOOL)webAnimationsEnabled
3108 return [self _boolValueForKey:WebKitWebAnimationsEnabledPreferenceKey];
3111 - (void)setWebAnimationsEnabled:(BOOL)flag
3113 [self _setBoolValue:flag forKey:WebKitWebAnimationsEnabledPreferenceKey];
3116 - (BOOL)fetchAPIKeepAliveEnabled
3118 return [self _boolValueForKey:WebKitFetchAPIEnabledPreferenceKey];
3121 - (void)setFetchAPIKeepAliveEnabled:(BOOL)flag
3123 [self _setBoolValue:flag forKey:WebKitFetchAPIEnabledPreferenceKey];
3126 - (BOOL)modernMediaControlsEnabled
3128 return [self _boolValueForKey:WebKitModernMediaControlsEnabledPreferenceKey];
3131 - (void)setModernMediaControlsEnabled:(BOOL)flag
3133 [self _setBoolValue:flag forKey:WebKitModernMediaControlsEnabledPreferenceKey];
3136 - (BOOL)webAnimationsCSSIntegrationEnabled
3138 return [self _boolValueForKey:WebKitWebAnimationsCSSIntegrationEnabledPreferenceKey];
3141 - (void)setWebAnimationsCSSIntegrationEnabled:(BOOL)flag
3143 [self _setBoolValue:flag forKey:WebKitWebAnimationsCSSIntegrationEnabledPreferenceKey];
3146 - (BOOL)intersectionObserverEnabled
3148 return [self _boolValueForKey:WebKitIntersectionObserverEnabledPreferenceKey];
3151 - (void)setIntersectionObserverEnabled:(BOOL)flag
3153 [self _setBoolValue:flag forKey:WebKitIntersectionObserverEnabledPreferenceKey];
3156 - (BOOL)menuItemElementEnabled
3158 return [self _boolValueForKey:WebKitMenuItemElementEnabledPreferenceKey];
3161 - (void)setMenuItemElementEnabled:(BOOL)flag
3163 [self _setBoolValue:flag forKey:WebKitMenuItemElementEnabledPreferenceKey];
3166 - (BOOL)displayContentsEnabled
3168 return [self _boolValueForKey:WebKitDisplayContentsEnabledPreferenceKey];
3171 - (void)setDisplayContentsEnabled:(BOOL)flag
3173 [self _setBoolValue:flag forKey:WebKitDisplayContentsEnabledPreferenceKey];
3176 - (BOOL)userTimingEnabled
3178 return [self _boolValueForKey:WebKitUserTimingEnabledPreferenceKey];
3181 - (void)setUserTimingEnabled:(BOOL)flag
3183 [self _setBoolValue:flag forKey:WebKitUserTimingEnabledPreferenceKey];
3186 - (BOOL)resourceTimingEnabled
3188 return [self _boolValueForKey:WebKitResourceTimingEnabledPreferenceKey];
3191 - (void)setResourceTimingEnabled:(BOOL)flag
3193 [self _setBoolValue:flag forKey:WebKitResourceTimingEnabledPreferenceKey];
3196 - (BOOL)webAuthenticationEnabled
3198 return [self _boolValueForKey:WebKitWebAuthenticationEnabledPreferenceKey];
3201 - (void)setWebAuthenticationEnabled:(BOOL)flag
3203 [self _setBoolValue:flag forKey:WebKitWebAuthenticationEnabledPreferenceKey];
3206 - (BOOL)mediaUserGestureInheritsFromDocument
3208 return [self _boolValueForKey:WebKitMediaUserGestureInheritsFromDocument];
3211 - (void)setMediaUserGestureInheritsFromDocument:(BOOL)flag
3213 [self _setBoolValue:flag forKey:WebKitMediaUserGestureInheritsFromDocument];
3217 - (BOOL)quickLookDocumentSavingEnabled
3219 return [self _boolValueForKey:WebKitQuickLookDocumentSavingPreferenceKey];
3222 - (void)setQuickLookDocumentSavingEnabled:(BOOL)flag
3224 [self _setBoolValue:flag forKey:WebKitQuickLookDocumentSavingPreferenceKey];
3228 - (NSString *)mediaContentTypesRequiringHardwareSupport
3230 return [self _stringValueForKey:WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey];
3233 - (void)setMediaContentTypesRequiringHardwareSupport:(NSString *)value
3235 [self _setStringValue:value forKey:WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey];
3238 - (BOOL)isSecureContextAttributeEnabled
3240 return [self _boolValueForKey:WebKitIsSecureContextAttributeEnabledPreferenceKey];
3243 - (void)setIsSecureContextAttributeEnabled:(BOOL)flag
3245 [self _setBoolValue:flag forKey:WebKitIsSecureContextAttributeEnabledPreferenceKey];
3248 - (BOOL)legacyEncryptedMediaAPIEnabled
3250 return [self _boolValueForKey:WebKitLegacyEncryptedMediaAPIEnabledKey];
3253 - (void)setLegacyEncryptedMediaAPIEnabled:(BOOL)flag
3255 [self _setBoolValue:flag forKey:WebKitLegacyEncryptedMediaAPIEnabledKey];
3258 - (BOOL)encryptedMediaAPIEnabled
3260 return [self _boolValueForKey:WebKitEncryptedMediaAPIEnabledKey];
3263 - (void)setEncryptedMediaAPIEnabled:(BOOL)flag
3265 [self _setBoolValue:flag forKey:WebKitEncryptedMediaAPIEnabledKey];
3268 - (BOOL)viewportFitEnabled
3270 return [self _boolValueForKey:WebKitViewportFitEnabledPreferenceKey];
3273 - (void)setViewportFitEnabled:(BOOL)flag
3275 [self _setBoolValue:flag forKey:WebKitViewportFitEnabledPreferenceKey];
3278 - (BOOL)constantPropertiesEnabled
3280 return [self _boolValueForKey:WebKitConstantPropertiesEnabledPreferenceKey];
3283 - (void)setConstantPropertiesEnabled:(BOOL)flag
3285 [self _setBoolValue:flag forKey:WebKitConstantPropertiesEnabledPreferenceKey];
3288 - (BOOL)colorFilterEnabled
3290 return [self _boolValueForKey:WebKitColorFilterEnabledPreferenceKey];
3293 - (void)setColorFilterEnabled:(BOOL)flag
3295 [self _setBoolValue:flag forKey:WebKitColorFilterEnabledPreferenceKey];
3298 - (BOOL)punchOutWhiteBackgroundsInDarkMode
3300 return [self _boolValueForKey:WebKitPunchOutWhiteBackgroundsInDarkModePreferenceKey];
3303 - (void)setPunchOutWhiteBackgroundsInDarkMode:(BOOL)flag
3305 [self _setBoolValue:flag forKey:WebKitPunchOutWhiteBackgroundsInDarkModePreferenceKey];
3308 - (BOOL)allowMediaContentTypesRequiringHardwareSupportAsFallback
3310 return [self _boolValueForKey:WebKitAllowMediaContentTypesRequiringHardwareSupportAsFallbackKey];
3313 - (void)setAllowMediaContentTypesRequiringHardwareSupportAsFallback:(BOOL)flag
3315 [self _setBoolValue:flag forKey:WebKitAllowMediaContentTypesRequiringHardwareSupportAsFallbackKey];
3318 - (BOOL)inspectorAdditionsEnabled
3320 return [self _boolValueForKey:WebKitInspectorAdditionsEnabledPreferenceKey];
3323 - (void)setInspectorAdditionsEnabled:(BOOL)flag
3325 [self _setBoolValue:flag forKey:WebKitInspectorAdditionsEnabledPreferenceKey];
3328 - (BOOL)accessibilityObjectModelEnabled
3330 return [self _boolValueForKey:WebKitAccessibilityObjectModelEnabledPreferenceKey];
3333 - (void)setAccessibilityObjectModelEnabled:(BOOL)flag
3335 [self _setBoolValue:flag forKey:WebKitAccessibilityObjectModelEnabledPreferenceKey];
3338 - (BOOL)ariaReflectionEnabled
3340 return [self _boolValueForKey:WebKitAriaReflectionEnabledPreferenceKey];
3343 - (void)setAriaReflectionEnabled:(BOOL)flag
3345 [self _setBoolValue:flag forKey:WebKitAriaReflectionEnabledPreferenceKey];
3348 - (BOOL)mediaCapabilitiesEnabled
3350 return [self _boolValueForKey:WebKitMediaCapabilitiesEnabledPreferenceKey];
3353 - (void)setMediaCapabilitiesEnabled:(BOOL)flag
3355 [self _setBoolValue:flag forKey:WebKitMediaCapabilitiesEnabledPreferenceKey];
3358 - (BOOL)serverTimingEnabled
3360 return [self _boolValueForKey:WebKitServerTimingEnabledPreferenceKey];
3363 - (void)setServerTimingEnabled:(BOOL)flag
3365 [self _setBoolValue:flag forKey:WebKitServerTimingEnabledPreferenceKey];
3370 @implementation WebPreferences (WebInternal)
3372 + (NSString *)_IBCreatorID
3374 return classIBCreatorID;
3377 + (NSString *)_concatenateKeyWithIBCreatorID:(NSString *)key
3379 NSString *IBCreatorID = [WebPreferences _IBCreatorID];
3382 return [IBCreatorID stringByAppendingString:key];