ba7aec6aa1e631286761af7c3af101f4f59d8ace
[WebKit-https.git] / Source / WebKitLegacy / mac / WebView / WebPreferences.mm
1 /*
2  * Copyright (C) 2005-2017 Apple Inc. All rights reserved.
3  *           (C) 2006 Graham Dennis (graham.dennis@gmail.com)
4  *
5  * Redistribution and use in source and binary forms, with or without
6  * modification, are permitted provided that the following conditions
7  * are met:
8  *
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. 
17  *
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.
28  */
29
30 #import "WebPreferencesPrivate.h"
31 #import "WebPreferenceKeysPrivate.h"
32
33 #import "NetworkStorageSessionMap.h"
34 #import "WebApplicationCache.h"
35 #import "WebFrameNetworkingContext.h"
36 #import "WebKitLogging.h"
37 #import "WebKitNSStringExtras.h"
38 #import "WebKitVersionChecks.h"
39 #import "WebNSDictionaryExtras.h"
40 #import "WebNSURLExtras.h"
41 #import <JavaScriptCore/InitializeThreading.h>
42 #import <WebCore/ApplicationCacheStorage.h>
43 #import <WebCore/AudioSession.h>
44 #import <WebCore/DeprecatedGlobalSettings.h>
45 #import <WebCore/NetworkStorageSession.h>
46 #import <WebCore/RuntimeApplicationChecks.h>
47 #import <WebCore/Settings.h>
48 #import <WebCore/TextEncodingRegistry.h>
49 #import <pal/spi/cf/CFNetworkSPI.h>
50 #import <wtf/MainThread.h>
51 #import <wtf/RetainPtr.h>
52 #import <wtf/RunLoop.h>
53
54 using namespace WebCore;
55
56 #if HAVE(AUDIO_TOOLBOX_AUDIO_SESSION)
57 #import <AudioToolbox/AudioSession.h>
58 #endif
59
60 #if PLATFORM(IOS_FAMILY)
61 #import <WebCore/Device.h>
62 #import <WebCore/GraphicsContext.h>
63 #import <WebCore/WebCoreThreadMessage.h>
64 #endif
65
66 NSString *WebPreferencesChangedNotification = @"WebPreferencesChangedNotification";
67 NSString *WebPreferencesRemovedNotification = @"WebPreferencesRemovedNotification";
68 NSString *WebPreferencesChangedInternalNotification = @"WebPreferencesChangedInternalNotification";
69 NSString *WebPreferencesCacheModelChangedInternalNotification = @"WebPreferencesCacheModelChangedInternalNotification";
70
71 #define KEY(x) (_private->identifier ? [_private->identifier.get() stringByAppendingString:(x)] : (x))
72
73 enum { WebPreferencesVersion = 1 };
74
75 static WebPreferences *_standardPreferences;
76 static NSMutableDictionary *webPreferencesInstances;
77
78 static unsigned webPreferencesInstanceCountWithPrivateBrowsingEnabled;
79
80 template<unsigned size> static bool contains(const char* const (&array)[size], const char* item)
81 {
82     if (!item)
83         return false;
84     for (auto* string : array) {
85         if (equalIgnoringASCIICase(string, item))
86             return true;
87     }
88     return false;
89 }
90
91 static WebCacheModel cacheModelForMainBundle(void)
92 {
93     @autoreleasepool {
94         // Apps that probably need the small setting
95         static const char* const documentViewerIDs[] = {
96             "Microsoft/com.microsoft.Messenger",
97             "com.adiumX.adiumX", 
98             "com.alientechnology.Proteus",
99             "com.apple.Dashcode",
100             "com.apple.iChat", 
101             "com.barebones.bbedit",
102             "com.barebones.textwrangler",
103             "com.barebones.yojimbo",
104             "com.equinux.iSale4",
105             "com.growl.growlframework",
106             "com.intrarts.PandoraMan",
107             "com.karelia.Sandvox",
108             "com.macromates.textmate",
109             "com.realmacsoftware.rapidweaverpro",
110             "com.red-sweater.marsedit",
111             "com.yahoo.messenger3",
112             "de.codingmonkeys.SubEthaEdit",
113             "fi.karppinen.Pyro",
114             "info.colloquy", 
115             "kungfoo.tv.ecto",
116         };
117
118         // Apps that probably need the medium setting
119         static const char* const documentBrowserIDs[] = {
120             "com.apple.Dictionary",
121             "com.apple.Xcode",
122             "com.apple.dashboard.client", 
123             "com.apple.helpviewer",
124             "com.culturedcode.xyle",
125             "com.macrabbit.CSSEdit",
126             "com.panic.Coda",
127             "com.ranchero.NetNewsWire",
128             "com.thinkmac.NewsLife",
129             "org.xlife.NewsFire",
130             "uk.co.opencommunity.vienna2",
131         };
132
133         // Apps that probably need the large setting
134         static const char* const primaryWebBrowserIDs[] = {
135             "com.app4mac.KidsBrowser"
136             "com.app4mac.wKiosk",
137             "com.freeverse.bumpercar",
138             "com.omnigroup.OmniWeb5",
139             "com.sunrisebrowser.Sunrise",
140             "net.hmdt-web.Shiira",
141         };
142
143         const char* bundleID = [[[NSBundle mainBundle] bundleIdentifier] UTF8String];
144         if (contains(documentViewerIDs, bundleID))
145             return WebCacheModelDocumentViewer;
146         if (contains(documentBrowserIDs, bundleID))
147             return WebCacheModelDocumentBrowser;
148         if (contains(primaryWebBrowserIDs, bundleID))
149             return WebCacheModelPrimaryWebBrowser;
150
151         bool isLinkedAgainstWebKit = WebKitLinkedOnOrAfter(0);
152         if (!isLinkedAgainstWebKit)
153             return WebCacheModelDocumentViewer; // Apps that don't link against WebKit probably aren't meant to be browsers.
154
155 #if !PLATFORM(IOS_FAMILY)
156         bool isLegacyApp = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_CACHE_MODEL_API);
157 #else
158         bool isLegacyApp = false;
159 #endif
160         if (isLegacyApp)
161             return WebCacheModelDocumentBrowser; // To avoid regressions in apps that depended on old WebKit's large cache.
162
163         return WebCacheModelDocumentViewer; // To save memory.
164     }
165 }
166
167 @interface WebPreferences ()
168 - (void)_postCacheModelChangedNotification;
169 @end
170
171 @interface WebPreferences (WebInternal)
172 + (NSString *)_concatenateKeyWithIBCreatorID:(NSString *)key;
173 + (NSString *)_IBCreatorID;
174 @end
175
176 struct WebPreferencesPrivate
177 {
178 public:
179     WebPreferencesPrivate()
180     : inPrivateBrowsing(NO)
181     , autosaves(NO)
182     , automaticallyDetectsCacheModel(NO)
183     , numWebViews(0)
184 #if PLATFORM(IOS_FAMILY)
185     , readWriteQueue(dispatch_queue_create("com.apple.WebPreferences.ReadWriteQueue", DISPATCH_QUEUE_CONCURRENT))
186 #endif
187     {
188     }
189
190 #if PLATFORM(IOS_FAMILY)
191     ~WebPreferencesPrivate()
192     {
193         dispatch_release(readWriteQueue);
194     }
195 #endif
196
197     RetainPtr<NSMutableDictionary> values;
198     BOOL inPrivateBrowsing;
199     RetainPtr<NSString> identifier;
200     BOOL autosaves;
201     BOOL automaticallyDetectsCacheModel;
202     unsigned numWebViews;
203 #if PLATFORM(IOS_FAMILY)
204     dispatch_queue_t readWriteQueue;
205 #endif
206 };
207
208 @interface WebPreferences (WebForwardDeclarations)
209 // This pseudo-category is needed so these methods can be used from within other category implementations
210 // without being in the public header file.
211 - (BOOL)_boolValueForKey:(NSString *)key;
212 - (void)_setBoolValue:(BOOL)value forKey:(NSString *)key;
213 - (int)_integerValueForKey:(NSString *)key;
214 - (void)_setIntegerValue:(int)value forKey:(NSString *)key;
215 - (float)_floatValueForKey:(NSString *)key;
216 - (void)_setFloatValue:(float)value forKey:(NSString *)key;
217 - (void)_setLongLongValue:(long long)value forKey:(NSString *)key;
218 - (long long)_longLongValueForKey:(NSString *)key;
219 - (void)_setUnsignedLongLongValue:(unsigned long long)value forKey:(NSString *)key;
220 - (unsigned long long)_unsignedLongLongValueForKey:(NSString *)key;
221 @end
222
223 #if PLATFORM(IOS_FAMILY)
224 @interface WebPreferences ()
225 - (id)initWithIdentifier:(NSString *)anIdentifier sendChangeNotification:(BOOL)sendChangeNotification;
226 @end
227 #endif
228
229 @implementation WebPreferences
230
231 - (instancetype)init
232 {
233     // Create fake identifier
234     static int instanceCount = 1;
235     NSString *fakeIdentifier;
236     
237     // At least ensure that identifier hasn't been already used.  
238     fakeIdentifier = [NSString stringWithFormat:@"WebPreferences%d", instanceCount++];
239     while ([[self class] _getInstanceForIdentifier:fakeIdentifier]){
240         fakeIdentifier = [NSString stringWithFormat:@"WebPreferences%d", instanceCount++];
241     }
242     
243     return [self initWithIdentifier:fakeIdentifier];
244 }
245
246 #if PLATFORM(IOS_FAMILY)
247 - (id)initWithIdentifier:(NSString *)anIdentifier
248 {
249     return [self initWithIdentifier:anIdentifier sendChangeNotification:YES];
250 }
251 #endif
252
253 #if PLATFORM(IOS_FAMILY)
254 - (instancetype)initWithIdentifier:(NSString *)anIdentifier sendChangeNotification:(BOOL)sendChangeNotification
255 #else
256 - (instancetype)initWithIdentifier:(NSString *)anIdentifier
257 #endif
258 {
259     WebPreferences *instance = [[self class] _getInstanceForIdentifier:anIdentifier];
260     if (instance) {
261         [self release];
262         return [instance retain];
263     }
264
265     self = [super init];
266     if (!self)
267         return nil;
268
269     _private = new WebPreferencesPrivate;
270     _private->values = adoptNS([[NSMutableDictionary alloc] init]);
271     _private->identifier = adoptNS([anIdentifier copy]);
272     _private->automaticallyDetectsCacheModel = YES;
273
274     [[self class] _setInstance:self forIdentifier:_private->identifier.get()];
275
276     [self _updatePrivateBrowsingStateTo:[self privateBrowsingEnabled]];
277
278 #if PLATFORM(IOS_FAMILY)
279     if (sendChangeNotification) {
280         [self _postPreferencesChangedNotification];
281         [self _postCacheModelChangedNotification];
282     }
283 #else
284     [self _postPreferencesChangedNotification];
285     [self _postCacheModelChangedNotification];
286 #endif
287
288     return self;
289 }
290
291 - (instancetype)initWithCoder:(NSCoder *)decoder
292 {
293     self = [super init];
294     if (!self)
295         return nil;
296
297     _private = new WebPreferencesPrivate;
298     _private->automaticallyDetectsCacheModel = YES;
299
300     @try {
301         id identifier = nil;
302         id values = nil;
303         if ([decoder allowsKeyedCoding]) {
304             identifier = [decoder decodeObjectForKey:@"Identifier"];
305             values = [decoder decodeObjectForKey:@"Values"];
306         } else {
307             int version;
308             [decoder decodeValueOfObjCType:@encode(int) at:&version];
309             if (version == 1) {
310                 identifier = [decoder decodeObject];
311                 values = [decoder decodeObject];
312             }
313         }
314
315         if ([identifier isKindOfClass:[NSString class]])
316             _private->identifier = adoptNS([identifier copy]);
317         if ([values isKindOfClass:[NSDictionary class]])
318             _private->values = adoptNS([values mutableCopy]); // ensure dictionary is mutable
319
320         LOG(Encoding, "Identifier = %@, Values = %@\n", _private->identifier.get(), _private->values.get());
321     } @catch(id) {
322         [self release];
323         return nil;
324     }
325
326     // If we load a nib multiple times, or have instances in multiple
327     // nibs with the same name, the first guy up wins.
328     WebPreferences *instance = [[self class] _getInstanceForIdentifier:_private->identifier.get()];
329     if (instance) {
330         [self release];
331         self = [instance retain];
332     } else {
333         [[self class] _setInstance:self forIdentifier:_private->identifier.get()];
334         [self _updatePrivateBrowsingStateTo:[self privateBrowsingEnabled]];
335     }
336
337     return self;
338 }
339
340 - (void)encodeWithCoder:(NSCoder *)encoder
341 {
342     if ([encoder allowsKeyedCoding]){
343         [encoder encodeObject:_private->identifier.get() forKey:@"Identifier"];
344 #if PLATFORM(IOS_FAMILY)
345         dispatch_sync(_private->readWriteQueue, ^{
346 #endif
347         [encoder encodeObject:_private->values.get() forKey:@"Values"];
348         LOG (Encoding, "Identifier = %@, Values = %@\n", _private->identifier.get(), _private->values.get());
349 #if PLATFORM(IOS_FAMILY)
350         });
351 #endif
352     }
353     else {
354         int version = WebPreferencesVersion;
355         [encoder encodeValueOfObjCType:@encode(int) at:&version];
356         [encoder encodeObject:_private->identifier.get()];
357 #if PLATFORM(IOS_FAMILY)
358         dispatch_sync(_private->readWriteQueue, ^{
359 #endif
360         [encoder encodeObject:_private->values.get()];
361 #if PLATFORM(IOS_FAMILY)
362         });
363 #endif
364     }
365 }
366
367 + (WebPreferences *)standardPreferences
368 {
369 #if !PLATFORM(IOS_FAMILY)
370     if (_standardPreferences == nil) {
371         _standardPreferences = [[WebPreferences alloc] initWithIdentifier:nil];
372         [_standardPreferences setAutosaves:YES];
373     }
374 #else
375     // FIXME: This check is necessary to avoid recursion (see <rdar://problem/9564337>), but it also makes _standardPreferences construction not thread safe.
376     if (_standardPreferences)
377         return _standardPreferences;
378
379     static dispatch_once_t pred;
380     dispatch_once(&pred, ^{
381         _standardPreferences = [[WebPreferences alloc] initWithIdentifier:nil sendChangeNotification:NO];
382         [_standardPreferences _postPreferencesChangedNotification];
383         [_standardPreferences setAutosaves:YES];
384     });
385 #endif
386
387     return _standardPreferences;
388 }
389
390 // if we ever have more than one WebPreferences object, this would move to init
391 + (void)initialize
392 {
393 #if !PLATFORM(IOS_FAMILY)
394     JSC::initializeThreading();
395     WTF::initializeMainThreadToProcessMainThread();
396     RunLoop::initializeMainRunLoop();
397     bool attachmentElementEnabled = MacApplication::isAppleMail();
398 #else
399     bool allowsInlineMediaPlayback = WebCore::deviceClass() == MGDeviceClassiPad;
400     bool allowsInlineMediaPlaybackAfterFullscreen = WebCore::deviceClass() != MGDeviceClassiPad;
401     bool requiresPlaysInlineAttribute = !allowsInlineMediaPlayback;
402     bool attachmentElementEnabled = IOSApplication::isMobileMail();
403 #endif
404
405     NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
406         @"Times",                       WebKitStandardFontPreferenceKey,
407         @"Courier",                     WebKitFixedFontPreferenceKey,
408         @"Times",                       WebKitSerifFontPreferenceKey,
409         @"Helvetica",                   WebKitSansSerifFontPreferenceKey,
410 #if !PLATFORM(IOS_FAMILY)
411         @"Apple Chancery",              WebKitCursiveFontPreferenceKey,
412 #else
413         @"Snell Roundhand",             WebKitCursiveFontPreferenceKey,
414 #endif
415         @"Papyrus",                     WebKitFantasyFontPreferenceKey,
416 #if PLATFORM(IOS_FAMILY)
417         @"AppleColorEmoji",             WebKitPictographFontPreferenceKey,
418 #else
419         @"Apple Color Emoji",           WebKitPictographFontPreferenceKey,
420 #endif
421         @"0",                           WebKitMinimumFontSizePreferenceKey,
422         @"9",                           WebKitMinimumLogicalFontSizePreferenceKey, 
423         @"16",                          WebKitDefaultFontSizePreferenceKey,
424         @"13",                          WebKitDefaultFixedFontSizePreferenceKey,
425         @"ISO-8859-1",                  WebKitDefaultTextEncodingNamePreferenceKey,
426         [NSNumber numberWithBool:NO],   WebKitUsesEncodingDetectorPreferenceKey,
427         [NSNumber numberWithBool:NO],   WebKitUserStyleSheetEnabledPreferenceKey,
428         @"",                            WebKitUserStyleSheetLocationPreferenceKey,
429 #if !PLATFORM(IOS_FAMILY)
430         [NSNumber numberWithBool:NO],   WebKitShouldPrintBackgroundsPreferenceKey,
431         [NSNumber numberWithBool:NO],   WebKitTextAreasAreResizablePreferenceKey,
432 #endif
433         [NSNumber numberWithBool:NO],   WebKitShrinksStandaloneImagesToFitPreferenceKey,
434 #if !PLATFORM(IOS_FAMILY)
435         [NSNumber numberWithBool:YES],  WebKitJavaEnabledPreferenceKey,
436 #endif
437         [NSNumber numberWithBool:YES],  WebKitJavaScriptEnabledPreferenceKey,
438         [NSNumber numberWithBool:YES],  WebKitJavaScriptMarkupEnabledPreferenceKey,
439         [NSNumber numberWithBool:YES],  WebKitWebSecurityEnabledPreferenceKey,
440         [NSNumber numberWithBool:YES],  WebKitAllowUniversalAccessFromFileURLsPreferenceKey,
441         [NSNumber numberWithBool:YES],  WebKitAllowFileAccessFromFileURLsPreferenceKey,
442 #if PLATFORM(IOS_FAMILY)
443         [NSNumber numberWithBool:NO],   WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey,
444 #else
445         [NSNumber numberWithBool:YES],  WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey,
446 #endif
447         [NSNumber numberWithBool:YES],  WebKitPluginsEnabledPreferenceKey,
448         [NSNumber numberWithBool:YES],  WebKitDatabasesEnabledPreferenceKey,
449         [NSNumber numberWithBool:YES],  WebKitHTTPEquivEnabledPreferenceKey,
450
451 #if PLATFORM(IOS_FAMILY)
452         [NSNumber numberWithBool:NO],   WebKitStorageTrackerEnabledPreferenceKey,
453 #endif
454         [NSNumber numberWithBool:YES],  WebKitLocalStorageEnabledPreferenceKey,
455         [NSNumber numberWithBool:NO],   WebKitExperimentalNotificationsEnabledPreferenceKey,
456         [NSNumber numberWithBool:YES],  WebKitAllowAnimatedImagesPreferenceKey,
457         [NSNumber numberWithBool:YES],  WebKitAllowAnimatedImageLoopingPreferenceKey,
458         [NSNumber numberWithBool:YES],  WebKitDisplayImagesKey,
459         [NSNumber numberWithBool:NO],   WebKitLoadSiteIconsKey,
460         @"1800",                        WebKitBackForwardCacheExpirationIntervalKey,
461 #if !PLATFORM(IOS_FAMILY)
462         [NSNumber numberWithBool:NO],   WebKitTabToLinksPreferenceKey,
463 #endif
464         [NSNumber numberWithBool:NO],   WebKitPrivateBrowsingEnabledPreferenceKey,
465 #if !PLATFORM(IOS_FAMILY)
466         [NSNumber numberWithBool:NO],   WebKitRespectStandardStyleKeyEquivalentsPreferenceKey,
467         [NSNumber numberWithBool:NO],   WebKitShowsURLsInToolTipsPreferenceKey,
468         [NSNumber numberWithBool:NO],   WebKitShowsToolTipOverTruncatedTextPreferenceKey,
469         @"1",                           WebKitPDFDisplayModePreferenceKey,
470         @"0",                           WebKitPDFScaleFactorPreferenceKey,
471 #endif
472         @"0",                           WebKitUseSiteSpecificSpoofingPreferenceKey,
473         [NSNumber numberWithInt:WebKitEditableLinkDefaultBehavior], WebKitEditableLinkBehaviorPreferenceKey,
474 #if !PLATFORM(IOS_FAMILY)
475         [NSNumber numberWithInt:WebTextDirectionSubmenuAutomaticallyIncluded],
476                                         WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey,
477         [NSNumber numberWithBool:NO],   WebKitDOMPasteAllowedPreferenceKey,
478 #endif
479         [NSNumber numberWithBool:YES],  WebKitUsesPageCachePreferenceKey,
480         [NSNumber numberWithInt:cacheModelForMainBundle()], WebKitCacheModelPreferenceKey,
481         [NSNumber numberWithBool:YES],  WebKitPageCacheSupportsPluginsPreferenceKey,
482         [NSNumber numberWithBool:NO],   WebKitDeveloperExtrasEnabledPreferenceKey,
483         [NSNumber numberWithUnsignedInt:0], WebKitJavaScriptRuntimeFlagsPreferenceKey,
484         [NSNumber numberWithBool:YES],  WebKitAuthorAndUserStylesEnabledPreferenceKey,
485         [NSNumber numberWithBool:YES],  WebKitDOMTimersThrottlingEnabledPreferenceKey,
486         [NSNumber numberWithBool:NO],   WebKitWebArchiveDebugModeEnabledPreferenceKey,
487         [NSNumber numberWithBool:NO],   WebKitLocalFileContentSniffingEnabledPreferenceKey,
488         [NSNumber numberWithBool:NO],   WebKitOfflineWebApplicationCacheEnabledPreferenceKey,
489         [NSNumber numberWithBool:YES],  WebKitZoomsTextOnlyPreferenceKey,
490         [NSNumber numberWithBool:NO],   WebKitJavaScriptCanAccessClipboardPreferenceKey,
491         [NSNumber numberWithBool:YES],  WebKitXSSAuditorEnabledPreferenceKey,
492         [NSNumber numberWithBool:YES],  WebKitAcceleratedCompositingEnabledPreferenceKey,
493
494 #if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
495 #define DEFAULT_SUBPIXEL_ANTIALIASED_LAYER_TEXT_ENABLED YES
496 #else
497 #define DEFAULT_SUBPIXEL_ANTIALIASED_LAYER_TEXT_ENABLED NO
498 #endif
499         [NSNumber numberWithBool:DEFAULT_SUBPIXEL_ANTIALIASED_LAYER_TEXT_ENABLED], WebKitSubpixelAntialiasedLayerTextEnabledPreferenceKey,
500
501         [NSNumber numberWithBool:NO],   WebKitDisplayListDrawingEnabledPreferenceKey,
502 #if PLATFORM(IOS_FAMILY) && !PLATFORM(IOS_FAMILY_SIMULATOR)
503         [NSNumber numberWithBool:YES],  WebKitAcceleratedDrawingEnabledPreferenceKey,
504         [NSNumber numberWithBool:YES],  WebKitCanvasUsesAcceleratedDrawingPreferenceKey,
505 #else
506         [NSNumber numberWithBool:NO],  WebKitAcceleratedDrawingEnabledPreferenceKey,
507         [NSNumber numberWithBool:NO],  WebKitCanvasUsesAcceleratedDrawingPreferenceKey,
508 #endif
509         [NSNumber numberWithBool:NO],   WebKitShowDebugBordersPreferenceKey,
510         [NSNumber numberWithBool:YES],  WebKitSimpleLineLayoutEnabledPreferenceKey,
511         [NSNumber numberWithBool:NO],   WebKitSimpleLineLayoutDebugBordersEnabledPreferenceKey,
512         [NSNumber numberWithBool:NO],   WebKitShowRepaintCounterPreferenceKey,
513         [NSNumber numberWithBool:YES],  WebKitWebGLEnabledPreferenceKey,
514         [NSNumber numberWithBool:NO],  WebKitForceSoftwareWebGLRenderingPreferenceKey,
515         [NSNumber numberWithBool:YES],   WebKitForceWebGLUsesLowPowerPreferenceKey,
516         [NSNumber numberWithBool:NO],   WebKitAccelerated2dCanvasEnabledPreferenceKey,
517         [NSNumber numberWithBool:NO],  WebKitSubpixelCSSOMElementMetricsEnabledPreferenceKey,
518         [NSNumber numberWithBool:NO],  WebKitResourceLoadStatisticsEnabledPreferenceKey,
519         [NSNumber numberWithBool:YES],  WebKitLargeImageAsyncDecodingEnabledPreferenceKey,
520         [NSNumber numberWithBool:YES],  WebKitAnimatedImageAsyncDecodingEnabledPreferenceKey,
521 #if PLATFORM(IOS_FAMILY)
522         [NSNumber numberWithUnsignedInt:static_cast<uint32_t>(FrameFlattening::FullyEnabled)], WebKitFrameFlatteningPreferenceKey,
523 #else
524         [NSNumber numberWithUnsignedInt:static_cast<uint32_t>(FrameFlattening::Disabled)], WebKitFrameFlatteningPreferenceKey,
525 #endif
526         [NSNumber numberWithBool:NO], WebKitAsyncFrameScrollingEnabledPreferenceKey,
527         [NSNumber numberWithBool:NO],   WebKitSpatialNavigationEnabledPreferenceKey,
528         [NSNumber numberWithBool:NO],  WebKitDNSPrefetchingEnabledPreferenceKey,
529         [NSNumber numberWithBool:NO],   WebKitFullScreenEnabledPreferenceKey,
530         [NSNumber numberWithBool:NO],   WebKitAsynchronousSpellCheckingEnabledPreferenceKey,
531         [NSNumber numberWithBool:YES],  WebKitHyperlinkAuditingEnabledPreferenceKey,
532         [NSNumber numberWithBool:NO],   WebKitUsePreHTML5ParserQuirksKey,
533         [NSNumber numberWithBool:YES],  WebKitAVFoundationEnabledKey,
534         [NSNumber numberWithBool:YES],  WebKitAVFoundationNSURLSessionEnabledKey,
535         [NSNumber numberWithBool:NO],   WebKitSuppressesIncrementalRenderingKey,
536         [NSNumber numberWithBool:attachmentElementEnabled], WebKitAttachmentElementEnabledPreferenceKey,
537 #if !PLATFORM(IOS_FAMILY)
538         [NSNumber numberWithBool:YES],  WebKitAllowsInlineMediaPlaybackPreferenceKey,
539         [NSNumber numberWithBool:NO],   WebKitAllowsInlineMediaPlaybackAfterFullscreenPreferenceKey,
540         [NSNumber numberWithBool:NO],   WebKitInlineMediaPlaybackRequiresPlaysInlineAttributeKey,
541         [NSNumber numberWithBool:YES],  WebKitMediaControlsScaleWithPageZoomPreferenceKey,
542         [NSNumber numberWithBool:NO],   WebKitWebAudioEnabledPreferenceKey,
543         [NSNumber numberWithBool:YES],  WebKitBackspaceKeyNavigationEnabledKey,
544         [NSNumber numberWithBool:NO],   WebKitShouldDisplaySubtitlesPreferenceKey,
545         [NSNumber numberWithBool:NO],   WebKitShouldDisplayCaptionsPreferenceKey,
546         [NSNumber numberWithBool:NO],   WebKitShouldDisplayTextDescriptionsPreferenceKey,
547         [NSNumber numberWithBool:YES],  WebKitNotificationsEnabledKey,
548         [NSNumber numberWithBool:NO],   WebKitShouldRespectImageOrientationKey,
549         [NSNumber numberWithBool:YES],  WebKitMediaDataLoadsAutomaticallyPreferenceKey,
550 #else
551         [NSNumber numberWithBool:allowsInlineMediaPlayback],   WebKitAllowsInlineMediaPlaybackPreferenceKey,
552         [NSNumber numberWithBool:allowsInlineMediaPlaybackAfterFullscreen],   WebKitAllowsInlineMediaPlaybackAfterFullscreenPreferenceKey,
553         [NSNumber numberWithBool:requiresPlaysInlineAttribute], WebKitInlineMediaPlaybackRequiresPlaysInlineAttributeKey,
554         [NSNumber numberWithBool:NO],   WebKitMediaControlsScaleWithPageZoomPreferenceKey,
555         [NSNumber numberWithUnsignedInt:AudioSession::None],  WebKitAudioSessionCategoryOverride,
556         [NSNumber numberWithBool:NO],   WebKitMediaDataLoadsAutomaticallyPreferenceKey,
557 #if HAVE(AVKIT)
558         [NSNumber numberWithBool:YES],  WebKitAVKitEnabled,
559 #endif
560         [NSNumber numberWithBool:YES],  WebKitRequiresUserGestureForMediaPlaybackPreferenceKey,
561         [NSNumber numberWithBool:NO],   WebKitRequiresUserGestureForVideoPlaybackPreferenceKey,
562         [NSNumber numberWithBool:NO],   WebKitRequiresUserGestureForAudioPlaybackPreferenceKey,
563         [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
564
565         // Per-Origin Quota on iOS is 25MB. When the quota is reached for a particular origin
566         // the quota for that origin can be increased. See also webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:totalSpaceNeeded in WebUI/WebUIDelegate.m.
567         [NSNumber numberWithLongLong:(25 * 1024 * 1024)], WebKitApplicationCacheDefaultOriginQuota,
568
569         // Enable WebAudio by default in all iOS UIWebViews
570         [NSNumber numberWithBool:YES],   WebKitWebAudioEnabledPreferenceKey,
571
572         [NSNumber numberWithBool:YES],   WebKitShouldRespectImageOrientationKey,
573 #endif // PLATFORM(IOS_FAMILY)
574 #if ENABLE(WIRELESS_TARGET_PLAYBACK)
575         [NSNumber numberWithBool:YES],  WebKitAllowsAirPlayForMediaPlaybackPreferenceKey,
576 #endif
577         [NSNumber numberWithBool:YES],  WebKitAllowsPictureInPictureMediaPlaybackPreferenceKey,
578         [NSNumber numberWithBool:YES],  WebKitRequestAnimationFrameEnabledPreferenceKey,
579         [NSNumber numberWithBool:NO],   WebKitWantsBalancedSetDefersLoadingBehaviorKey,
580         [NSNumber numberWithBool:NO],   WebKitDiagnosticLoggingEnabledKey,
581         [NSNumber numberWithInt:WebAllowAllStorage], WebKitStorageBlockingPolicyKey,
582         [NSNumber numberWithBool:NO],   WebKitPlugInSnapshottingEnabledPreferenceKey,
583
584 #if PLATFORM(IOS_FAMILY)
585         [NSNumber numberWithBool:YES],  WebKitContentChangeObserverEnabledPreferenceKey,
586         [NSNumber numberWithBool:NO],   WebKitTelephoneParsingEnabledPreferenceKey,
587         [NSNumber numberWithInt:-1],      WebKitLayoutIntervalPreferenceKey,
588         [NSNumber numberWithFloat:-1.0f], WebKitMaxParseDurationPreferenceKey,
589         [NSNumber numberWithBool:NO],     WebKitAllowMultiElementImplicitFormSubmissionPreferenceKey,
590         [NSNumber numberWithBool:NO],     WebKitAlwaysRequestGeolocationPermissionPreferenceKey,
591         [NSNumber numberWithInt:InterpolationLow], WebKitInterpolationQualityPreferenceKey,
592         [NSNumber numberWithBool:YES],    WebKitPasswordEchoEnabledPreferenceKey,
593         [NSNumber numberWithFloat:2.0f],  WebKitPasswordEchoDurationPreferenceKey,
594         [NSNumber numberWithBool:NO],     WebKitNetworkDataUsageTrackingEnabledPreferenceKey,
595         @"",                              WebKitNetworkInterfaceNamePreferenceKey,
596 #endif
597 #if ENABLE(TEXT_AUTOSIZING)
598         [NSNumber numberWithFloat:Settings::defaultMinimumZoomFontSize()], WebKitMinimumZoomFontSizePreferenceKey,
599         [NSNumber numberWithBool:Settings::defaultTextAutosizingEnabled()], WebKitTextAutosizingEnabledPreferenceKey,
600 #endif
601         [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
602         [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota,
603         [NSNumber numberWithBool:NO], WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey,
604         [NSNumber numberWithBool:NO], WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey,
605         [NSNumber numberWithBool:NO], WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey,
606         
607         [NSNumber numberWithBool:NO], WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey,
608 #if ENABLE(MEDIA_SOURCE)
609         [NSNumber numberWithBool:YES], WebKitMediaSourceEnabledPreferenceKey,
610         @YES, WebKitSourceBufferChangeTypeEnabledPreferenceKey,
611 #endif
612 #if ENABLE(SERVICE_CONTROLS)
613         [NSNumber numberWithBool:NO], WebKitImageControlsEnabledPreferenceKey,
614         [NSNumber numberWithBool:NO], WebKitServiceControlsEnabledPreferenceKey,
615 #endif
616         [NSNumber numberWithBool:NO], WebKitEnableInheritURIQueryComponentPreferenceKey,
617 #if ENABLE(LEGACY_ENCRYPTED_MEDIA)
618         @"~/Library/WebKit/MediaKeys", WebKitMediaKeysStorageDirectoryKey,
619 #endif
620 #if ENABLE(MEDIA_STREAM)
621         [NSNumber numberWithBool:NO], WebKitMockCaptureDevicesEnabledPreferenceKey,
622         [NSNumber numberWithBool:YES], WebKitMockCaptureDevicesPromptEnabledPreferenceKey,
623         [NSNumber numberWithBool:YES], WebKitMediaCaptureRequiresSecureConnectionPreferenceKey,
624 #endif
625         [NSNumber numberWithBool:YES], WebKitShadowDOMEnabledPreferenceKey,
626         [NSNumber numberWithBool:YES], WebKitCustomElementsEnabledPreferenceKey,
627         [NSNumber numberWithBool:YES], WebKitDataTransferItemsEnabledPreferenceKey,
628         [NSNumber numberWithBool:NO], WebKitCustomPasteboardDataEnabledPreferenceKey,
629         [NSNumber numberWithBool:YES], WebKitModernMediaControlsEnabledPreferenceKey,
630         [NSNumber numberWithBool:NO], WebKitWebAnimationsCSSIntegrationEnabledPreferenceKey,
631
632 #if ENABLE(WEBGL2)
633         [NSNumber numberWithBool:NO], WebKitWebGL2EnabledPreferenceKey,
634 #endif
635 #if ENABLE(WEBGPU)
636         [NSNumber numberWithBool:NO], WebKitWebGPUEnabledPreferenceKey,
637 #endif
638         [NSNumber numberWithBool:NO], WebKitCacheAPIEnabledPreferenceKey,
639         [NSNumber numberWithBool:YES], WebKitFetchAPIEnabledPreferenceKey,
640
641 #if ENABLE(STREAMS_API)
642         [NSNumber numberWithBool:NO], WebKitReadableByteStreamAPIEnabledPreferenceKey,
643         [NSNumber numberWithBool:NO], WebKitWritableStreamAPIEnabledPreferenceKey,
644 #endif
645 #if ENABLE(DOWNLOAD_ATTRIBUTE)
646         [NSNumber numberWithBool:NO], WebKitDownloadAttributeEnabledPreferenceKey,
647 #endif
648         [NSNumber numberWithBool:NO], WebKitDirectoryUploadEnabledPreferenceKey,
649         [NSNumber numberWithBool:YES], WebKitWebAnimationsEnabledPreferenceKey,
650         [NSNumber numberWithBool:YES], WebKitPointerEventsEnabledPreferenceKey,
651
652 #if PLATFORM(IOS_FAMILY)
653         @NO, WebKitVisualViewportAPIEnabledPreferenceKey,
654 #else
655         @YES, WebKitVisualViewportAPIEnabledPreferenceKey,
656 #endif
657
658         [NSNumber numberWithBool:NO], WebKitCSSOMViewScrollingAPIEnabledPreferenceKey,
659         [NSNumber numberWithBool:YES], WebKitNeedsStorageAccessFromFileURLsQuirkKey,
660         [NSNumber numberWithBool:NO], WebKitAllowCrossOriginSubresourcesToAskForCredentialsKey,
661 #if ENABLE(MEDIA_STREAM)
662         [NSNumber numberWithBool:NO], WebKitMediaDevicesEnabledPreferenceKey,
663         [NSNumber numberWithBool:YES], WebKitMediaStreamEnabledPreferenceKey,
664         [NSNumber numberWithBool:YES], WebKitMediaRecorderEnabledPreferenceKey,
665 #endif
666 #if ENABLE(WEB_RTC)
667         [NSNumber numberWithBool:YES], WebKitPeerConnectionEnabledPreferenceKey,
668 #endif
669         [NSNumber numberWithBool:YES], WebKitSelectionAcrossShadowBoundariesEnabledPreferenceKey,
670         [NSNumber numberWithBool:NO], WebKitCSSLogicalEnabledPreferenceKey,
671         [NSNumber numberWithBool:NO], WebKitAdClickAttributionEnabledPreferenceKey,
672 #if ENABLE(INTERSECTION_OBSERVER)
673         @NO, WebKitIntersectionObserverEnabledPreferenceKey,
674 #endif
675         @YES, WebKitDisplayContentsEnabledPreferenceKey,
676         @NO, WebKitUserTimingEnabledPreferenceKey,
677         @NO, WebKitResourceTimingEnabledPreferenceKey,
678         @NO, WebKitMediaUserGestureInheritsFromDocument,
679         @NO, WebKitIsSecureContextAttributeEnabledPreferenceKey,
680         @YES, WebKitLegacyEncryptedMediaAPIEnabledKey,
681         @NO, WebKitEncryptedMediaAPIEnabledKey,
682         @YES, WebKitViewportFitEnabledPreferenceKey,
683         @YES, WebKitConstantPropertiesEnabledPreferenceKey,
684         @NO, WebKitColorFilterEnabledPreferenceKey,
685         @NO, WebKitPunchOutWhiteBackgroundsInDarkModePreferenceKey,
686         @YES, WebKitAllowMediaContentTypesRequiringHardwareSupportAsFallbackKey,
687         @NO, WebKitInspectorAdditionsEnabledPreferenceKey,
688         (NSString *)Settings::defaultMediaContentTypesRequiringHardwareSupport(), WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey,
689         @NO, WebKitAccessibilityObjectModelEnabledPreferenceKey,
690         @YES, WebKitAriaReflectionEnabledPreferenceKey,
691         @NO, WebKitMediaCapabilitiesEnabledPreferenceKey,
692         @NO, WebKitFetchAPIKeepAliveEnabledPreferenceKey,
693         @NO, WebKitServerTimingEnabledPreferenceKey,
694         @NO, WebKitReferrerPolicyAttributeEnabledPreferenceKey,
695 #if ENABLE(RESIZE_OBSERVER)
696         @NO, WebKitResizeObserverEnabledPreferenceKey,
697 #endif
698         nil];
699
700 #if !PLATFORM(IOS_FAMILY)
701     // This value shouldn't ever change, which is assumed in the initialization of WebKitPDFDisplayModePreferenceKey above
702     ASSERT(kPDFDisplaySinglePageContinuous == 1);
703 #endif
704     [[NSUserDefaults standardUserDefaults] registerDefaults:dict];
705 }
706
707 - (void)dealloc
708 {
709     [self _updatePrivateBrowsingStateTo:NO];
710
711     delete _private;
712     [super dealloc];
713 }
714
715 - (NSString *)identifier
716 {
717     return _private->identifier.get();
718 }
719
720 - (id)_valueForKey:(NSString *)key
721 {
722     NSString *_key = KEY(key);
723 #if PLATFORM(IOS_FAMILY)
724     __block id o = nil;
725     dispatch_sync(_private->readWriteQueue, ^{
726         o = [_private->values.get() objectForKey:_key];
727     });
728 #else
729     id o = [_private->values.get() objectForKey:_key];
730 #endif
731     if (o)
732         return o;
733     o = [[NSUserDefaults standardUserDefaults] objectForKey:_key];
734     if (!o && key != _key)
735         o = [[NSUserDefaults standardUserDefaults] objectForKey:key];
736     return o;
737 }
738
739 - (NSString *)_stringValueForKey:(NSString *)key
740 {
741     id s = [self _valueForKey:key];
742     return [s isKindOfClass:[NSString class]] ? (NSString *)s : nil;
743 }
744
745 - (void)_setStringValue:(NSString *)value forKey:(NSString *)key
746 {
747     if ([[self _stringValueForKey:key] isEqualToString:value])
748         return;
749     NSString *_key = KEY(key);
750 #if PLATFORM(IOS_FAMILY)
751     dispatch_barrier_sync(_private->readWriteQueue, ^{
752 #endif
753     [_private->values.get() setObject:value forKey:_key];
754 #if PLATFORM(IOS_FAMILY)
755     });
756 #endif
757     if (_private->autosaves)
758         [[NSUserDefaults standardUserDefaults] setObject:value forKey:_key];
759     [self _postPreferencesChangedNotification];
760 }
761
762 - (NSArray<NSString *> *)_stringArrayValueForKey:(NSString *)key
763 {
764     id value = [self _valueForKey:key];
765     if (![value isKindOfClass:[NSArray class]])
766         return nil;
767
768     NSArray *array = (NSArray *)value;
769     for (id object in array) {
770         if (![object isKindOfClass:[NSString class]])
771             return nil;
772     }
773
774     return (NSArray<NSString *> *)array;
775 }
776
777 - (void)_setStringArrayValueForKey:(NSArray<NSString *> *)value forKey:(NSString *)key
778 {
779     NSString *_key = KEY(key);
780 #if PLATFORM(IOS_FAMILY)
781     dispatch_barrier_sync(_private->readWriteQueue, ^{
782 #endif
783         [_private->values.get() setObject:value forKey:_key];
784 #if PLATFORM(IOS_FAMILY)
785     });
786 #endif
787     if (_private->autosaves)
788         [[NSUserDefaults standardUserDefaults] setObject:value forKey:_key];
789     [self _postPreferencesChangedNotification];
790 }
791
792 - (int)_integerValueForKey:(NSString *)key
793 {
794     id o = [self _valueForKey:key];
795     return [o respondsToSelector:@selector(intValue)] ? [o intValue] : 0;
796 }
797
798 - (void)_setIntegerValue:(int)value forKey:(NSString *)key
799 {
800     if ([self _integerValueForKey:key] == value)
801         return;
802     NSString *_key = KEY(key);
803 #if PLATFORM(IOS_FAMILY)
804     dispatch_barrier_sync(_private->readWriteQueue, ^{
805 #endif
806     [_private->values.get() setObject:@(value) forKey:_key];
807 #if PLATFORM(IOS_FAMILY)
808     });
809 #endif
810     if (_private->autosaves)
811         [[NSUserDefaults standardUserDefaults] setInteger:value forKey:_key];
812     [self _postPreferencesChangedNotification];
813 }
814
815 - (unsigned int)_unsignedIntValueForKey:(NSString *)key
816 {
817     id o = [self _valueForKey:key];
818     return [o respondsToSelector:@selector(unsignedIntValue)] ? [o unsignedIntValue] : 0;
819 }
820
821 - (void)_setUnsignedIntValue:(unsigned int)value forKey:(NSString *)key
822 {
823     if ([self _unsignedIntValueForKey:key] == value)
824         return;
825     NSString *_key = KEY(key);
826 #if PLATFORM(IOS_FAMILY)
827     dispatch_barrier_sync(_private->readWriteQueue, ^{
828 #endif
829     [_private->values.get() setObject:@(value) forKey:_key];
830 #if PLATFORM(IOS_FAMILY)
831     });
832 #endif
833     if (_private->autosaves)
834         [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithUnsignedInt:value] forKey:_key];
835     [self _postPreferencesChangedNotification];
836 }
837
838 - (float)_floatValueForKey:(NSString *)key
839 {
840     id o = [self _valueForKey:key];
841     return [o respondsToSelector:@selector(floatValue)] ? [o floatValue] : 0.0f;
842 }
843
844 - (void)_setFloatValue:(float)value forKey:(NSString *)key
845 {
846     if ([self _floatValueForKey:key] == value)
847         return;
848     NSString *_key = KEY(key);
849 #if PLATFORM(IOS_FAMILY)
850     dispatch_barrier_sync(_private->readWriteQueue, ^{
851 #endif
852     [_private->values.get() setObject:@(value) forKey:_key];
853 #if PLATFORM(IOS_FAMILY)
854     });
855 #endif
856     if (_private->autosaves)
857         [[NSUserDefaults standardUserDefaults] setFloat:value forKey:_key];
858     [self _postPreferencesChangedNotification];
859 }
860
861 - (BOOL)_boolValueForKey:(NSString *)key
862 {
863     return [self _integerValueForKey:key] != 0;
864 }
865
866 - (void)_setBoolValue:(BOOL)value forKey:(NSString *)key
867 {
868     if ([self _boolValueForKey:key] == value)
869         return;
870     NSString *_key = KEY(key);
871 #if PLATFORM(IOS_FAMILY)
872     dispatch_barrier_sync(_private->readWriteQueue, ^{
873 #endif
874     [_private->values.get() setObject:@(value) forKey:_key];
875 #if PLATFORM(IOS_FAMILY)
876     });
877 #endif
878     if (_private->autosaves)
879         [[NSUserDefaults standardUserDefaults] setBool:value forKey:_key];
880     [self _postPreferencesChangedNotification];
881 }
882
883 - (long long)_longLongValueForKey:(NSString *)key
884 {
885     id o = [self _valueForKey:key];
886     return [o respondsToSelector:@selector(longLongValue)] ? [o longLongValue] : 0;
887 }
888
889 - (void)_setLongLongValue:(long long)value forKey:(NSString *)key
890 {
891     if ([self _longLongValueForKey:key] == value)
892         return;
893     NSString *_key = KEY(key);
894 #if PLATFORM(IOS_FAMILY)
895     dispatch_barrier_sync(_private->readWriteQueue, ^{
896 #endif
897     [_private->values.get() setObject:@(value) forKey:_key];
898 #if PLATFORM(IOS_FAMILY)
899     });
900 #endif
901     if (_private->autosaves)
902         [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithLongLong:value] forKey:_key];
903     [self _postPreferencesChangedNotification];
904 }
905
906 - (unsigned long long)_unsignedLongLongValueForKey:(NSString *)key
907 {
908     id o = [self _valueForKey:key];
909     return [o respondsToSelector:@selector(unsignedLongLongValue)] ? [o unsignedLongLongValue] : 0;
910 }
911
912 - (void)_setUnsignedLongLongValue:(unsigned long long)value forKey:(NSString *)key
913 {
914     if ([self _unsignedLongLongValueForKey:key] == value)
915         return;
916     NSString *_key = KEY(key);
917 #if PLATFORM(IOS_FAMILY)
918     dispatch_barrier_sync(_private->readWriteQueue, ^{
919 #endif
920     [_private->values.get() setObject:@(value) forKey:_key];
921 #if PLATFORM(IOS_FAMILY)
922     });
923 #endif
924     if (_private->autosaves)
925         [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithUnsignedLongLong:value] forKey:_key];
926     [self _postPreferencesChangedNotification];
927 }
928
929 - (NSString *)standardFontFamily
930 {
931     return [self _stringValueForKey: WebKitStandardFontPreferenceKey];
932 }
933
934 - (void)setStandardFontFamily:(NSString *)family
935 {
936     [self _setStringValue: family forKey: WebKitStandardFontPreferenceKey];
937 }
938
939 - (NSString *)fixedFontFamily
940 {
941     return [self _stringValueForKey: WebKitFixedFontPreferenceKey];
942 }
943
944 - (void)setFixedFontFamily:(NSString *)family
945 {
946     [self _setStringValue: family forKey: WebKitFixedFontPreferenceKey];
947 }
948
949 - (NSString *)serifFontFamily
950 {
951     return [self _stringValueForKey: WebKitSerifFontPreferenceKey];
952 }
953
954 - (void)setSerifFontFamily:(NSString *)family 
955 {
956     [self _setStringValue: family forKey: WebKitSerifFontPreferenceKey];
957 }
958
959 - (NSString *)sansSerifFontFamily
960 {
961     return [self _stringValueForKey: WebKitSansSerifFontPreferenceKey];
962 }
963
964 - (void)setSansSerifFontFamily:(NSString *)family
965 {
966     [self _setStringValue: family forKey: WebKitSansSerifFontPreferenceKey];
967 }
968
969 - (NSString *)cursiveFontFamily
970 {
971     return [self _stringValueForKey: WebKitCursiveFontPreferenceKey];
972 }
973
974 - (void)setCursiveFontFamily:(NSString *)family
975 {
976     [self _setStringValue: family forKey: WebKitCursiveFontPreferenceKey];
977 }
978
979 - (NSString *)fantasyFontFamily
980 {
981     return [self _stringValueForKey: WebKitFantasyFontPreferenceKey];
982 }
983
984 - (void)setFantasyFontFamily:(NSString *)family
985 {
986     [self _setStringValue: family forKey: WebKitFantasyFontPreferenceKey];
987 }
988
989 - (int)defaultFontSize
990 {
991     return [self _integerValueForKey: WebKitDefaultFontSizePreferenceKey];
992 }
993
994 - (void)setDefaultFontSize:(int)size
995 {
996     [self _setIntegerValue: size forKey: WebKitDefaultFontSizePreferenceKey];
997 }
998
999 - (int)defaultFixedFontSize
1000 {
1001     return [self _integerValueForKey: WebKitDefaultFixedFontSizePreferenceKey];
1002 }
1003
1004 - (void)setDefaultFixedFontSize:(int)size
1005 {
1006     [self _setIntegerValue: size forKey: WebKitDefaultFixedFontSizePreferenceKey];
1007 }
1008
1009 - (int)minimumFontSize
1010 {
1011     return [self _integerValueForKey: WebKitMinimumFontSizePreferenceKey];
1012 }
1013
1014 - (void)setMinimumFontSize:(int)size
1015 {
1016     [self _setIntegerValue: size forKey: WebKitMinimumFontSizePreferenceKey];
1017 }
1018
1019 - (int)minimumLogicalFontSize
1020 {
1021   return [self _integerValueForKey: WebKitMinimumLogicalFontSizePreferenceKey];
1022 }
1023
1024 - (void)setMinimumLogicalFontSize:(int)size
1025 {
1026   [self _setIntegerValue: size forKey: WebKitMinimumLogicalFontSizePreferenceKey];
1027 }
1028
1029 - (NSString *)defaultTextEncodingName
1030 {
1031     return [self _stringValueForKey: WebKitDefaultTextEncodingNamePreferenceKey];
1032 }
1033
1034 - (void)setDefaultTextEncodingName:(NSString *)encoding
1035 {
1036     [self _setStringValue: encoding forKey: WebKitDefaultTextEncodingNamePreferenceKey];
1037 }
1038
1039 #if !PLATFORM(IOS_FAMILY)
1040 - (BOOL)userStyleSheetEnabled
1041 {
1042     return [self _boolValueForKey: WebKitUserStyleSheetEnabledPreferenceKey];
1043 }
1044
1045 - (void)setUserStyleSheetEnabled:(BOOL)flag
1046 {
1047     [self _setBoolValue: flag forKey: WebKitUserStyleSheetEnabledPreferenceKey];
1048 }
1049
1050 - (NSURL *)userStyleSheetLocation
1051 {
1052     NSString *locationString = [self _stringValueForKey: WebKitUserStyleSheetLocationPreferenceKey];
1053     
1054     if ([locationString _webkit_looksLikeAbsoluteURL]) {
1055         return [NSURL _web_URLWithDataAsString:locationString];
1056     } else {
1057         locationString = [locationString stringByExpandingTildeInPath];
1058         return [NSURL fileURLWithPath:locationString isDirectory:NO];
1059     }
1060 }
1061
1062 - (void)setUserStyleSheetLocation:(NSURL *)URL
1063 {
1064     NSString *locationString;
1065     
1066     if ([URL isFileURL]) {
1067         locationString = [[URL path] _web_stringByAbbreviatingWithTildeInPath];
1068     } else {
1069         locationString = [URL _web_originalDataAsString];
1070     }
1071
1072     if (!locationString)
1073         locationString = @"";
1074
1075     [self _setStringValue:locationString forKey: WebKitUserStyleSheetLocationPreferenceKey];
1076 }
1077 #else
1078
1079 // These methods have had their implementations removed on iOS since it
1080 // is wrong to have such a setting stored in preferences that, when read,
1081 // is applied to all WebViews in a iOS process. Such a design might work
1082 // OK for an application like Safari on Mac OS X, where the only WebViews
1083 // in use display web content in a straightforward manner. However, it is
1084 // wrong for iOS, where WebViews are used for various purposes, like
1085 // text editing, text rendering, and displaying web content.
1086 // 
1087 // I have changed the user style sheet mechanism to be a per-WebView
1088 // setting, rather than a per-process preference. This seems to give the
1089 // behavior we want for iOS.
1090
1091 - (BOOL)userStyleSheetEnabled
1092 {
1093     return NO;
1094 }
1095
1096 - (void)setUserStyleSheetEnabled:(BOOL)flag
1097 {
1098     // no-op
1099 }
1100
1101 - (NSURL *)userStyleSheetLocation
1102 {
1103     return nil;
1104 }
1105
1106 - (void)setUserStyleSheetLocation:(NSURL *)URL
1107 {
1108     // no-op
1109 }
1110 #endif // PLATFORM(IOS_FAMILY)
1111
1112 #if !PLATFORM(IOS_FAMILY)
1113 - (BOOL)shouldPrintBackgrounds
1114 {
1115     return [self _boolValueForKey: WebKitShouldPrintBackgroundsPreferenceKey];
1116 }
1117
1118 - (void)setShouldPrintBackgrounds:(BOOL)flag
1119 {
1120     [self _setBoolValue: flag forKey: WebKitShouldPrintBackgroundsPreferenceKey];
1121 }
1122 #endif
1123
1124 - (BOOL)isJavaEnabled
1125 {
1126     return [self _boolValueForKey: WebKitJavaEnabledPreferenceKey];
1127 }
1128
1129 - (void)setJavaEnabled:(BOOL)flag
1130 {
1131     [self _setBoolValue: flag forKey: WebKitJavaEnabledPreferenceKey];
1132 }
1133
1134 - (BOOL)isJavaScriptEnabled
1135 {
1136     return [self _boolValueForKey: WebKitJavaScriptEnabledPreferenceKey];
1137 }
1138
1139 - (void)setJavaScriptEnabled:(BOOL)flag
1140 {
1141     [self _setBoolValue: flag forKey: WebKitJavaScriptEnabledPreferenceKey];
1142 }
1143
1144 - (BOOL)javaScriptCanOpenWindowsAutomatically
1145 {
1146     return [self _boolValueForKey: WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey];
1147 }
1148
1149 - (void)setJavaScriptCanOpenWindowsAutomatically:(BOOL)flag
1150 {
1151     [self _setBoolValue: flag forKey: WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey];
1152 }
1153
1154 - (BOOL)arePlugInsEnabled
1155 {
1156     return [self _boolValueForKey: WebKitPluginsEnabledPreferenceKey];
1157 }
1158
1159 - (void)setPlugInsEnabled:(BOOL)flag
1160 {
1161     [self _setBoolValue: flag forKey: WebKitPluginsEnabledPreferenceKey];
1162 }
1163
1164 - (BOOL)allowsAnimatedImages
1165 {
1166     return [self _boolValueForKey: WebKitAllowAnimatedImagesPreferenceKey];
1167 }
1168
1169 - (void)setAllowsAnimatedImages:(BOOL)flag
1170 {
1171     [self _setBoolValue: flag forKey: WebKitAllowAnimatedImagesPreferenceKey];
1172 }
1173
1174 - (BOOL)allowsAnimatedImageLooping
1175 {
1176     return [self _boolValueForKey: WebKitAllowAnimatedImageLoopingPreferenceKey];
1177 }
1178
1179 - (void)setAllowsAnimatedImageLooping: (BOOL)flag
1180 {
1181     [self _setBoolValue: flag forKey: WebKitAllowAnimatedImageLoopingPreferenceKey];
1182 }
1183
1184 - (void)setLoadsImagesAutomatically: (BOOL)flag
1185 {
1186     [self _setBoolValue: flag forKey: WebKitDisplayImagesKey];
1187 }
1188
1189 - (BOOL)loadsImagesAutomatically
1190 {
1191     return [self _boolValueForKey: WebKitDisplayImagesKey];
1192 }
1193
1194 - (void)setAdditionalSupportedImageTypes:(NSArray<NSString*> *)imageTypes
1195 {
1196     [self _setStringArrayValueForKey:imageTypes forKey:WebKitAdditionalSupportedImageTypesKey];
1197 }
1198
1199 - (NSArray<NSString *> *)additionalSupportedImageTypes
1200 {
1201     return [self _stringArrayValueForKey:WebKitAdditionalSupportedImageTypesKey];
1202 }
1203
1204 - (void)setAutosaves:(BOOL)flag
1205 {
1206     _private->autosaves = flag;
1207 }
1208
1209 - (BOOL)autosaves
1210 {
1211     return _private->autosaves;
1212 }
1213
1214 #if !PLATFORM(IOS_FAMILY)
1215 - (void)setTabsToLinks:(BOOL)flag
1216 {
1217     [self _setBoolValue: flag forKey: WebKitTabToLinksPreferenceKey];
1218 }
1219
1220 - (BOOL)tabsToLinks
1221 {
1222     return [self _boolValueForKey:WebKitTabToLinksPreferenceKey];
1223 }
1224 #endif
1225
1226 - (void)setPrivateBrowsingEnabled:(BOOL)enabled
1227 {
1228     [self _updatePrivateBrowsingStateTo:enabled];
1229     [self _setBoolValue:enabled forKey:WebKitPrivateBrowsingEnabledPreferenceKey];
1230 }
1231
1232 - (BOOL)privateBrowsingEnabled
1233 {
1234     // Changes to private browsing defaults do not have effect on existing WebPreferences, and must be done through -setPrivateBrowsingEnabled.
1235     // This is needed to accurately track private browsing sessions in the process.
1236     return _private->inPrivateBrowsing;
1237 }
1238
1239 - (void)_updatePrivateBrowsingStateTo:(BOOL)enabled
1240 {
1241     if (!_private) {
1242         ASSERT(!enabled);
1243         return;
1244     }
1245
1246     if (enabled == _private->inPrivateBrowsing)
1247         return;
1248     if (enabled > _private->inPrivateBrowsing) {
1249         WebFrameNetworkingContext::ensurePrivateBrowsingSession();
1250         ++webPreferencesInstanceCountWithPrivateBrowsingEnabled;
1251     } else {
1252         ASSERT(webPreferencesInstanceCountWithPrivateBrowsingEnabled);
1253         --webPreferencesInstanceCountWithPrivateBrowsingEnabled;
1254         if (!webPreferencesInstanceCountWithPrivateBrowsingEnabled)
1255             WebFrameNetworkingContext::destroyPrivateBrowsingSession();
1256     }
1257     _private->inPrivateBrowsing = enabled;
1258 }
1259
1260 - (void)setUsesPageCache:(BOOL)usesPageCache
1261 {
1262     [self _setBoolValue:usesPageCache forKey:WebKitUsesPageCachePreferenceKey];
1263 }
1264
1265 - (BOOL)usesPageCache
1266 {
1267     return [self _boolValueForKey:WebKitUsesPageCachePreferenceKey];
1268 }
1269
1270 - (void)_postCacheModelChangedNotification
1271 {
1272 #if !PLATFORM(IOS_FAMILY)
1273     if (!pthread_main_np()) {
1274         [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO];
1275         return;
1276     }
1277 #endif
1278
1279     [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesCacheModelChangedInternalNotification object:self userInfo:nil];
1280 }
1281
1282 - (void)setCacheModel:(WebCacheModel)cacheModel
1283 {
1284     [self _setIntegerValue:cacheModel forKey:WebKitCacheModelPreferenceKey];
1285     [self setAutomaticallyDetectsCacheModel:NO];
1286     [self _postCacheModelChangedNotification];
1287 }
1288
1289 - (WebCacheModel)cacheModel
1290 {
1291     return (WebCacheModel)[self _integerValueForKey:WebKitCacheModelPreferenceKey];
1292 }
1293
1294
1295 - (void)setSuppressesIncrementalRendering:(BOOL)suppressesIncrementalRendering
1296 {
1297     [self _setBoolValue:suppressesIncrementalRendering forKey:WebKitSuppressesIncrementalRenderingKey];
1298 }
1299
1300 - (BOOL)suppressesIncrementalRendering
1301 {
1302     return [self _boolValueForKey:WebKitSuppressesIncrementalRenderingKey];
1303 }
1304
1305 - (BOOL)allowsAirPlayForMediaPlayback
1306 {
1307 #if ENABLE(WIRELESS_TARGET_PLAYBACK)
1308     return [self _boolValueForKey:WebKitAllowsAirPlayForMediaPlaybackPreferenceKey];
1309 #else
1310     return false;
1311 #endif
1312 }
1313
1314 - (void)setAllowsAirPlayForMediaPlayback:(BOOL)flag
1315 {
1316 #if ENABLE(WIRELESS_TARGET_PLAYBACK)
1317     [self _setBoolValue:flag forKey:WebKitAllowsAirPlayForMediaPlaybackPreferenceKey];
1318 #endif
1319 }
1320
1321 @end
1322
1323 @implementation WebPreferences (WebPrivate)
1324
1325 - (BOOL)isDNSPrefetchingEnabled
1326 {
1327     return [self _boolValueForKey:WebKitDNSPrefetchingEnabledPreferenceKey];
1328 }
1329
1330 - (void)setDNSPrefetchingEnabled:(BOOL)flag
1331 {
1332     [self _setBoolValue:flag forKey:WebKitDNSPrefetchingEnabledPreferenceKey];
1333 }
1334
1335 - (BOOL)developerExtrasEnabled
1336 {
1337     NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1338     if ([defaults boolForKey:@"DisableWebKitDeveloperExtras"])
1339         return NO;
1340 #ifdef NDEBUG
1341     if ([defaults boolForKey:@"WebKitDeveloperExtras"] || [defaults boolForKey:@"IncludeDebugMenu"])
1342         return YES;
1343     return [self _boolValueForKey:WebKitDeveloperExtrasEnabledPreferenceKey];
1344 #else
1345     return YES; // always enable in debug builds
1346 #endif
1347 }
1348
1349 - (WebKitJavaScriptRuntimeFlags)javaScriptRuntimeFlags
1350 {
1351     return static_cast<WebKitJavaScriptRuntimeFlags>([self _unsignedIntValueForKey:WebKitJavaScriptRuntimeFlagsPreferenceKey]);
1352 }
1353
1354 - (void)setJavaScriptRuntimeFlags:(WebKitJavaScriptRuntimeFlags)flags
1355 {
1356     [self _setUnsignedIntValue:flags forKey:WebKitJavaScriptRuntimeFlagsPreferenceKey];
1357 }
1358
1359 - (void)setDeveloperExtrasEnabled:(BOOL)flag
1360 {
1361     [self _setBoolValue:flag forKey:WebKitDeveloperExtrasEnabledPreferenceKey];
1362 }
1363
1364 - (BOOL)authorAndUserStylesEnabled
1365 {
1366     return [self _boolValueForKey:WebKitAuthorAndUserStylesEnabledPreferenceKey];
1367 }
1368
1369 - (void)setAuthorAndUserStylesEnabled:(BOOL)flag
1370 {
1371     [self _setBoolValue:flag forKey:WebKitAuthorAndUserStylesEnabledPreferenceKey];
1372 }
1373
1374 // FIXME: applicationChromeMode is no longer needed by ToT, but is still used in Safari 8.
1375 - (BOOL)applicationChromeModeEnabled
1376 {
1377     return NO;
1378 }
1379
1380 - (void)setApplicationChromeModeEnabled:(BOOL)flag
1381 {
1382 }
1383
1384 - (BOOL)domTimersThrottlingEnabled
1385 {
1386     return [self _boolValueForKey:WebKitDOMTimersThrottlingEnabledPreferenceKey];
1387 }
1388
1389 - (void)setDOMTimersThrottlingEnabled:(BOOL)flag
1390 {
1391     [self _setBoolValue:flag forKey:WebKitDOMTimersThrottlingEnabledPreferenceKey];
1392 }
1393
1394 - (BOOL)webArchiveDebugModeEnabled
1395 {
1396     return [self _boolValueForKey:WebKitWebArchiveDebugModeEnabledPreferenceKey];
1397 }
1398
1399 - (void)setWebArchiveDebugModeEnabled:(BOOL)flag
1400 {
1401     [self _setBoolValue:flag forKey:WebKitWebArchiveDebugModeEnabledPreferenceKey];
1402 }
1403
1404 - (BOOL)localFileContentSniffingEnabled
1405 {
1406     return [self _boolValueForKey:WebKitLocalFileContentSniffingEnabledPreferenceKey];
1407 }
1408
1409 - (void)setLocalFileContentSniffingEnabled:(BOOL)flag
1410 {
1411     [self _setBoolValue:flag forKey:WebKitLocalFileContentSniffingEnabledPreferenceKey];
1412 }
1413
1414 - (BOOL)offlineWebApplicationCacheEnabled
1415 {
1416     return [self _boolValueForKey:WebKitOfflineWebApplicationCacheEnabledPreferenceKey];
1417 }
1418
1419 - (void)setOfflineWebApplicationCacheEnabled:(BOOL)flag
1420 {
1421     [self _setBoolValue:flag forKey:WebKitOfflineWebApplicationCacheEnabledPreferenceKey];
1422 }
1423
1424 - (BOOL)zoomsTextOnly
1425 {
1426     return [self _boolValueForKey:WebKitZoomsTextOnlyPreferenceKey];
1427 }
1428
1429 - (void)setZoomsTextOnly:(BOOL)flag
1430 {
1431     [self _setBoolValue:flag forKey:WebKitZoomsTextOnlyPreferenceKey];
1432 }
1433
1434 - (BOOL)javaScriptCanAccessClipboard
1435 {
1436     return [self _boolValueForKey:WebKitJavaScriptCanAccessClipboardPreferenceKey];
1437 }
1438
1439 - (void)setJavaScriptCanAccessClipboard:(BOOL)flag
1440 {
1441     [self _setBoolValue:flag forKey:WebKitJavaScriptCanAccessClipboardPreferenceKey];
1442 }
1443
1444 - (BOOL)isXSSAuditorEnabled
1445 {
1446     return [self _boolValueForKey:WebKitXSSAuditorEnabledPreferenceKey];
1447 }
1448
1449 - (void)setXSSAuditorEnabled:(BOOL)flag
1450 {
1451     [self _setBoolValue:flag forKey:WebKitXSSAuditorEnabledPreferenceKey];
1452 }
1453
1454 #if !PLATFORM(IOS_FAMILY)
1455 - (BOOL)respectStandardStyleKeyEquivalents
1456 {
1457     return [self _boolValueForKey:WebKitRespectStandardStyleKeyEquivalentsPreferenceKey];
1458 }
1459
1460 - (void)setRespectStandardStyleKeyEquivalents:(BOOL)flag
1461 {
1462     [self _setBoolValue:flag forKey:WebKitRespectStandardStyleKeyEquivalentsPreferenceKey];
1463 }
1464
1465 - (BOOL)showsURLsInToolTips
1466 {
1467     return [self _boolValueForKey:WebKitShowsURLsInToolTipsPreferenceKey];
1468 }
1469
1470 - (void)setShowsURLsInToolTips:(BOOL)flag
1471 {
1472     [self _setBoolValue:flag forKey:WebKitShowsURLsInToolTipsPreferenceKey];
1473 }
1474
1475 - (BOOL)showsToolTipOverTruncatedText
1476 {
1477     return [self _boolValueForKey:WebKitShowsToolTipOverTruncatedTextPreferenceKey];
1478 }
1479
1480 - (void)setShowsToolTipOverTruncatedText:(BOOL)flag
1481 {
1482     [self _setBoolValue:flag forKey:WebKitShowsToolTipOverTruncatedTextPreferenceKey];
1483 }
1484
1485 - (BOOL)textAreasAreResizable
1486 {
1487     return [self _boolValueForKey: WebKitTextAreasAreResizablePreferenceKey];
1488 }
1489
1490 - (void)setTextAreasAreResizable:(BOOL)flag
1491 {
1492     [self _setBoolValue: flag forKey: WebKitTextAreasAreResizablePreferenceKey];
1493 }
1494 #endif // !PLATFORM(IOS_FAMILY)
1495
1496 - (BOOL)shrinksStandaloneImagesToFit
1497 {
1498     return [self _boolValueForKey:WebKitShrinksStandaloneImagesToFitPreferenceKey];
1499 }
1500
1501 - (void)setShrinksStandaloneImagesToFit:(BOOL)flag
1502 {
1503     [self _setBoolValue:flag forKey:WebKitShrinksStandaloneImagesToFitPreferenceKey];
1504 }
1505
1506 - (BOOL)automaticallyDetectsCacheModel
1507 {
1508     return _private->automaticallyDetectsCacheModel;
1509 }
1510
1511 - (void)setAutomaticallyDetectsCacheModel:(BOOL)automaticallyDetectsCacheModel
1512 {
1513     _private->automaticallyDetectsCacheModel = automaticallyDetectsCacheModel;
1514 }
1515
1516 - (BOOL)usesEncodingDetector
1517 {
1518     return [self _boolValueForKey: WebKitUsesEncodingDetectorPreferenceKey];
1519 }
1520
1521 - (void)setUsesEncodingDetector:(BOOL)flag
1522 {
1523     [self _setBoolValue: flag forKey: WebKitUsesEncodingDetectorPreferenceKey];
1524 }
1525
1526 - (BOOL)isWebSecurityEnabled
1527 {
1528     return [self _boolValueForKey: WebKitWebSecurityEnabledPreferenceKey];
1529 }
1530
1531 - (void)setWebSecurityEnabled:(BOOL)flag
1532 {
1533     [self _setBoolValue: flag forKey: WebKitWebSecurityEnabledPreferenceKey];
1534 }
1535
1536 - (BOOL)allowUniversalAccessFromFileURLs
1537 {
1538     return [self _boolValueForKey: WebKitAllowUniversalAccessFromFileURLsPreferenceKey];
1539 }
1540
1541 - (void)setAllowUniversalAccessFromFileURLs:(BOOL)flag
1542 {
1543     [self _setBoolValue: flag forKey: WebKitAllowUniversalAccessFromFileURLsPreferenceKey];
1544 }
1545
1546 - (BOOL)allowFileAccessFromFileURLs
1547 {
1548     return [self _boolValueForKey: WebKitAllowFileAccessFromFileURLsPreferenceKey];
1549 }
1550
1551 - (void)setAllowFileAccessFromFileURLs:(BOOL)flag
1552 {
1553     [self _setBoolValue: flag forKey: WebKitAllowFileAccessFromFileURLsPreferenceKey];
1554 }
1555
1556 - (BOOL)allowCrossOriginSubresourcesToAskForCredentials
1557 {
1558     return [self _boolValueForKey:WebKitAllowCrossOriginSubresourcesToAskForCredentialsKey];
1559 }
1560
1561 - (void)setAllowCrossOriginSubresourcesToAskForCredentials:(BOOL)flag
1562 {
1563     [self _setBoolValue:flag forKey:WebKitAllowCrossOriginSubresourcesToAskForCredentialsKey];
1564 }
1565
1566 - (BOOL)needsStorageAccessFromFileURLsQuirk
1567 {
1568     return [self _boolValueForKey: WebKitNeedsStorageAccessFromFileURLsQuirkKey];
1569 }
1570
1571 -(void)setNeedsStorageAccessFromFileURLsQuirk:(BOOL)flag
1572 {
1573     [self _setBoolValue: flag forKey: WebKitNeedsStorageAccessFromFileURLsQuirkKey];
1574 }
1575
1576 - (NSTimeInterval)_backForwardCacheExpirationInterval
1577 {
1578     return (NSTimeInterval)[self _floatValueForKey:WebKitBackForwardCacheExpirationIntervalKey];
1579 }
1580
1581 #if PLATFORM(IOS_FAMILY)
1582 - (BOOL)_standalone
1583 {
1584     return [self _boolValueForKey:WebKitStandalonePreferenceKey];
1585 }
1586
1587 - (void)_setStandalone:(BOOL)flag
1588 {
1589     [self _setBoolValue:flag forKey:WebKitStandalonePreferenceKey];
1590 }
1591
1592 - (void)_setTelephoneNumberParsingEnabled:(BOOL)flag
1593 {
1594     [self _setBoolValue:flag forKey:WebKitTelephoneParsingEnabledPreferenceKey];
1595 }
1596
1597 - (BOOL)_telephoneNumberParsingEnabled
1598 {
1599     return [self _boolValueForKey:WebKitTelephoneParsingEnabledPreferenceKey];
1600 }
1601
1602 - (BOOL)contentChangeObserverEnabled
1603 {
1604     return [self _boolValueForKey:WebKitContentChangeObserverEnabledPreferenceKey];
1605 }
1606
1607 - (void)setContentChangeObserverEnabled:(BOOL)enabled
1608 {
1609     [self _setBoolValue:enabled forKey:WebKitContentChangeObserverEnabledPreferenceKey];
1610 }
1611 #endif
1612
1613 #if ENABLE(TEXT_AUTOSIZING)
1614 - (void)_setMinimumZoomFontSize:(float)size
1615 {
1616     [self _setFloatValue:size forKey:WebKitMinimumZoomFontSizePreferenceKey];
1617 }
1618
1619 - (float)_minimumZoomFontSize
1620 {
1621     return [self _floatValueForKey:WebKitMinimumZoomFontSizePreferenceKey];
1622 }
1623
1624 - (void)_setTextAutosizingEnabled:(BOOL)enabled
1625 {
1626     [self _setBoolValue:enabled forKey:WebKitTextAutosizingEnabledPreferenceKey];
1627 }
1628
1629 - (BOOL)_textAutosizingEnabled
1630 {
1631     return [self _boolValueForKey:WebKitTextAutosizingEnabledPreferenceKey];
1632 }
1633 #endif
1634
1635 #if PLATFORM(IOS_FAMILY)
1636 - (void)_setLayoutInterval:(int)l
1637 {
1638     [self _setIntegerValue:l forKey:WebKitLayoutIntervalPreferenceKey];
1639 }
1640
1641 - (int)_layoutInterval
1642 {
1643     return [self _integerValueForKey:WebKitLayoutIntervalPreferenceKey];
1644 }
1645
1646 - (void)_setMaxParseDuration:(float)d
1647 {
1648     [self _setFloatValue:d forKey:WebKitMaxParseDurationPreferenceKey];
1649 }
1650
1651 - (float)_maxParseDuration
1652 {
1653     return [self _floatValueForKey:WebKitMaxParseDurationPreferenceKey];
1654 }
1655
1656 - (void)_setAllowMultiElementImplicitFormSubmission:(BOOL)flag
1657 {
1658     [self _setBoolValue:flag forKey:WebKitAllowMultiElementImplicitFormSubmissionPreferenceKey];
1659 }
1660
1661 - (BOOL)_allowMultiElementImplicitFormSubmission
1662 {
1663     return [self _boolValueForKey:WebKitAllowMultiElementImplicitFormSubmissionPreferenceKey];
1664 }
1665
1666 - (void)_setAlwaysRequestGeolocationPermission:(BOOL)flag
1667 {
1668     [self _setBoolValue:flag forKey:WebKitAlwaysRequestGeolocationPermissionPreferenceKey];
1669 }
1670
1671 - (BOOL)_alwaysRequestGeolocationPermission
1672 {
1673     return [self _boolValueForKey:WebKitAlwaysRequestGeolocationPermissionPreferenceKey];
1674 }
1675
1676 - (void)_setAlwaysUseAcceleratedOverflowScroll:(BOOL)flag
1677 {
1678     [self _setBoolValue:flag forKey:WebKitAlwaysUseAcceleratedOverflowScrollPreferenceKey];
1679 }
1680
1681 - (BOOL)_alwaysUseAcceleratedOverflowScroll
1682 {
1683     return [self _boolValueForKey:WebKitAlwaysUseAcceleratedOverflowScrollPreferenceKey];
1684 }
1685
1686 - (void)_setInterpolationQuality:(int)quality
1687 {
1688     [self _setIntegerValue:quality forKey:WebKitInterpolationQualityPreferenceKey];
1689 }
1690
1691 - (int)_interpolationQuality
1692 {
1693     return [self _integerValueForKey:WebKitInterpolationQualityPreferenceKey];
1694 }
1695
1696 - (BOOL)_allowPasswordEcho
1697 {
1698     return [self _boolValueForKey:WebKitPasswordEchoEnabledPreferenceKey];
1699 }
1700
1701 - (float)_passwordEchoDuration
1702 {
1703     return [self _floatValueForKey:WebKitPasswordEchoDurationPreferenceKey];
1704 }
1705
1706 #endif // PLATFORM(IOS_FAMILY)
1707
1708 #if !PLATFORM(IOS_FAMILY)
1709 - (float)PDFScaleFactor
1710 {
1711     return [self _floatValueForKey:WebKitPDFScaleFactorPreferenceKey];
1712 }
1713
1714 - (void)setPDFScaleFactor:(float)factor
1715 {
1716     [self _setFloatValue:factor forKey:WebKitPDFScaleFactorPreferenceKey];
1717 }
1718 #endif
1719
1720 - (int64_t)applicationCacheTotalQuota
1721 {
1722     return [self _longLongValueForKey:WebKitApplicationCacheTotalQuota];
1723 }
1724
1725 - (void)setApplicationCacheTotalQuota:(int64_t)quota
1726 {
1727     [self _setLongLongValue:quota forKey:WebKitApplicationCacheTotalQuota];
1728
1729     // Application Cache Preferences are stored on the global cache storage manager, not in Settings.
1730     [WebApplicationCache setMaximumSize:quota];
1731 }
1732
1733 - (int64_t)applicationCacheDefaultOriginQuota
1734 {
1735     return [self _longLongValueForKey:WebKitApplicationCacheDefaultOriginQuota];
1736 }
1737
1738 - (void)setApplicationCacheDefaultOriginQuota:(int64_t)quota
1739 {
1740     [self _setLongLongValue:quota forKey:WebKitApplicationCacheDefaultOriginQuota];
1741 }
1742
1743 #if !PLATFORM(IOS_FAMILY)
1744 - (PDFDisplayMode)PDFDisplayMode
1745 {
1746     PDFDisplayMode value = static_cast<PDFDisplayMode>([self _integerValueForKey:WebKitPDFDisplayModePreferenceKey]);
1747     if (value != kPDFDisplaySinglePage && value != kPDFDisplaySinglePageContinuous && value != kPDFDisplayTwoUp && value != kPDFDisplayTwoUpContinuous) {
1748         // protect against new modes from future versions of OS X stored in defaults
1749         value = kPDFDisplaySinglePageContinuous;
1750     }
1751     return value;
1752 }
1753
1754 - (void)setPDFDisplayMode:(PDFDisplayMode)mode
1755 {
1756     [self _setIntegerValue:mode forKey:WebKitPDFDisplayModePreferenceKey];
1757 }
1758 #endif
1759
1760 - (WebKitEditableLinkBehavior)editableLinkBehavior
1761 {
1762     WebKitEditableLinkBehavior value = static_cast<WebKitEditableLinkBehavior> ([self _integerValueForKey:WebKitEditableLinkBehaviorPreferenceKey]);
1763     if (value != WebKitEditableLinkDefaultBehavior &&
1764         value != WebKitEditableLinkAlwaysLive &&
1765         value != WebKitEditableLinkNeverLive &&
1766         value != WebKitEditableLinkOnlyLiveWithShiftKey &&
1767         value != WebKitEditableLinkLiveWhenNotFocused) {
1768         // ensure that a valid result is returned
1769         value = WebKitEditableLinkDefaultBehavior;
1770     }
1771     
1772     return value;
1773 }
1774
1775 - (void)setEditableLinkBehavior:(WebKitEditableLinkBehavior)behavior
1776 {
1777     [self _setIntegerValue:behavior forKey:WebKitEditableLinkBehaviorPreferenceKey];
1778 }
1779
1780 - (WebTextDirectionSubmenuInclusionBehavior)textDirectionSubmenuInclusionBehavior
1781 {
1782     WebTextDirectionSubmenuInclusionBehavior value = static_cast<WebTextDirectionSubmenuInclusionBehavior>([self _integerValueForKey:WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey]);
1783     if (value != WebTextDirectionSubmenuNeverIncluded &&
1784         value != WebTextDirectionSubmenuAutomaticallyIncluded &&
1785         value != WebTextDirectionSubmenuAlwaysIncluded) {
1786         // Ensure that a valid result is returned.
1787         value = WebTextDirectionSubmenuNeverIncluded;
1788     }
1789     return value;
1790 }
1791
1792 - (void)setTextDirectionSubmenuInclusionBehavior:(WebTextDirectionSubmenuInclusionBehavior)behavior
1793 {
1794     [self _setIntegerValue:behavior forKey:WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey];
1795 }
1796
1797 - (BOOL)_useSiteSpecificSpoofing
1798 {
1799     return [self _boolValueForKey:WebKitUseSiteSpecificSpoofingPreferenceKey];
1800 }
1801
1802 - (void)_setUseSiteSpecificSpoofing:(BOOL)newValue
1803 {
1804     [self _setBoolValue:newValue forKey:WebKitUseSiteSpecificSpoofingPreferenceKey];
1805 }
1806
1807 - (BOOL)databasesEnabled
1808 {
1809     return [self _boolValueForKey:WebKitDatabasesEnabledPreferenceKey];
1810 }
1811
1812 - (void)setDatabasesEnabled:(BOOL)databasesEnabled
1813 {
1814     [self _setBoolValue:databasesEnabled forKey:WebKitDatabasesEnabledPreferenceKey];
1815 }
1816
1817 #if PLATFORM(IOS_FAMILY)
1818 - (BOOL)storageTrackerEnabled
1819 {
1820     return [self _boolValueForKey:WebKitStorageTrackerEnabledPreferenceKey];
1821 }
1822
1823 - (void)setStorageTrackerEnabled:(BOOL)storageTrackerEnabled
1824 {
1825     [self _setBoolValue:storageTrackerEnabled forKey:WebKitStorageTrackerEnabledPreferenceKey];
1826 }
1827 #endif
1828
1829 - (BOOL)localStorageEnabled
1830 {
1831     return [self _boolValueForKey:WebKitLocalStorageEnabledPreferenceKey];
1832 }
1833
1834 - (void)setLocalStorageEnabled:(BOOL)localStorageEnabled
1835 {
1836     [self _setBoolValue:localStorageEnabled forKey:WebKitLocalStorageEnabledPreferenceKey];
1837 }
1838
1839 - (BOOL)experimentalNotificationsEnabled
1840 {
1841     return [self _boolValueForKey:WebKitExperimentalNotificationsEnabledPreferenceKey];
1842 }
1843
1844 - (void)setExperimentalNotificationsEnabled:(BOOL)experimentalNotificationsEnabled
1845 {
1846     [self _setBoolValue:experimentalNotificationsEnabled forKey:WebKitExperimentalNotificationsEnabledPreferenceKey];
1847 }
1848
1849 + (WebPreferences *)_getInstanceForIdentifier:(NSString *)ident
1850 {
1851     LOG(Encoding, "requesting for %@\n", ident);
1852
1853     if (!ident)
1854         return _standardPreferences;
1855     
1856     WebPreferences *instance = [webPreferencesInstances objectForKey:[self _concatenateKeyWithIBCreatorID:ident]];
1857
1858     return instance;
1859 }
1860
1861 + (void)_setInstance:(WebPreferences *)instance forIdentifier:(NSString *)ident
1862 {
1863     if (!webPreferencesInstances)
1864         webPreferencesInstances = [[NSMutableDictionary alloc] init];
1865     if (ident) {
1866         [webPreferencesInstances setObject:instance forKey:[self _concatenateKeyWithIBCreatorID:ident]];
1867         LOG(Encoding, "recording %p for %@\n", instance, [self _concatenateKeyWithIBCreatorID:ident]);
1868     }
1869 }
1870
1871 + (void)_checkLastReferenceForIdentifier:(id)identifier
1872 {
1873     // FIXME: This won't work at all under garbage collection because retainCount returns a constant.
1874     // We may need to change WebPreferences API so there's an explicit way to end the lifetime of one.
1875     WebPreferences *instance = [webPreferencesInstances objectForKey:identifier];
1876     if ([instance retainCount] == 1)
1877         [webPreferencesInstances removeObjectForKey:identifier];
1878 }
1879
1880 + (void)_removeReferenceForIdentifier:(NSString *)ident
1881 {
1882     if (ident)
1883         [self performSelector:@selector(_checkLastReferenceForIdentifier:) withObject:[self _concatenateKeyWithIBCreatorID:ident] afterDelay:0.1];
1884 }
1885
1886 - (void)_postPreferencesChangedNotification
1887 {
1888 #if !PLATFORM(IOS_FAMILY)
1889     if (!pthread_main_np()) {
1890         [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO];
1891         return;
1892     }
1893 #endif
1894
1895     [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedInternalNotification object:self userInfo:nil];
1896     [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedNotification object:self userInfo:nil];
1897 }
1898
1899 - (void)_postPreferencesChangedAPINotification
1900 {
1901     if (!pthread_main_np()) {
1902         [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO];
1903         return;
1904     }
1905
1906     [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedNotification object:self userInfo:nil];
1907 }
1908
1909 + (CFStringEncoding)_systemCFStringEncoding
1910 {
1911     return webDefaultCFStringEncoding();
1912 }
1913
1914 + (void)_setInitialDefaultTextEncodingToSystemEncoding
1915 {
1916     [[NSUserDefaults standardUserDefaults] registerDefaults:
1917         [NSDictionary dictionaryWithObject:defaultTextEncodingNameForSystemLanguage() forKey:WebKitDefaultTextEncodingNamePreferenceKey]];
1918 }
1919
1920 static NSString *classIBCreatorID = nil;
1921
1922 + (void)_setIBCreatorID:(NSString *)string
1923 {
1924     NSString *old = classIBCreatorID;
1925     classIBCreatorID = [string copy];
1926     [old release];
1927 }
1928
1929 + (void)_switchNetworkLoaderToNewTestingSession
1930 {
1931 #if PLATFORM(IOS_FAMILY)
1932     WebThreadLock();
1933 #endif
1934     NetworkStorageSessionMap::switchToNewTestingSession();
1935 }
1936
1937 + (void)_clearNetworkLoaderSession
1938 {
1939     NetworkStorageSessionMap::defaultStorageSession().deleteAllCookies();
1940 }
1941
1942 + (void)_setCurrentNetworkLoaderSessionCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy
1943 {
1944     RetainPtr<CFHTTPCookieStorageRef> cookieStorage = NetworkStorageSessionMap::defaultStorageSession().cookieStorage();
1945     ASSERT(cookieStorage); // Will fail when NetworkStorageSessionMap::switchToNewTestingSession() was not called beforehand.
1946     CFHTTPCookieStorageSetCookieAcceptPolicy(cookieStorage.get(), policy);
1947 }
1948
1949 - (BOOL)isDOMPasteAllowed
1950 {
1951     return [self _boolValueForKey:WebKitDOMPasteAllowedPreferenceKey];
1952 }
1953
1954 - (void)setDOMPasteAllowed:(BOOL)DOMPasteAllowed
1955 {
1956     [self _setBoolValue:DOMPasteAllowed forKey:WebKitDOMPasteAllowedPreferenceKey];
1957 }
1958
1959 - (NSString *)_localStorageDatabasePath
1960 {
1961     return [[self _stringValueForKey:WebKitLocalStorageDatabasePathPreferenceKey] stringByStandardizingPath];
1962 }
1963
1964 - (void)_setLocalStorageDatabasePath:(NSString *)path
1965 {
1966     [self _setStringValue:[path stringByStandardizingPath] forKey:WebKitLocalStorageDatabasePathPreferenceKey];
1967 }
1968
1969 - (NSString *)_ftpDirectoryTemplatePath
1970 {
1971     return [[self _stringValueForKey:WebKitFTPDirectoryTemplatePath] stringByStandardizingPath];
1972 }
1973
1974 - (void)_setFTPDirectoryTemplatePath:(NSString *)path
1975 {
1976     [self _setStringValue:[path stringByStandardizingPath] forKey:WebKitFTPDirectoryTemplatePath];
1977 }
1978
1979 - (BOOL)_forceFTPDirectoryListings
1980 {
1981     return [self _boolValueForKey:WebKitForceFTPDirectoryListings];
1982 }
1983
1984 - (void)_setForceFTPDirectoryListings:(BOOL)force
1985 {
1986     [self _setBoolValue:force forKey:WebKitForceFTPDirectoryListings];
1987 }
1988
1989 - (BOOL)acceleratedDrawingEnabled
1990 {
1991     return [self _boolValueForKey:WebKitAcceleratedDrawingEnabledPreferenceKey];
1992 }
1993
1994 - (void)setAcceleratedDrawingEnabled:(BOOL)enabled
1995 {
1996     [self _setBoolValue:enabled forKey:WebKitAcceleratedDrawingEnabledPreferenceKey];
1997 }
1998
1999 - (BOOL)displayListDrawingEnabled
2000 {
2001     return [self _boolValueForKey:WebKitDisplayListDrawingEnabledPreferenceKey];
2002 }
2003
2004 - (void)setDisplayListDrawingEnabled:(BOOL)enabled
2005 {
2006     [self _setBoolValue:enabled forKey:WebKitDisplayListDrawingEnabledPreferenceKey];
2007 }
2008
2009 - (BOOL)resourceLoadStatisticsEnabled
2010 {
2011     return [self _boolValueForKey:WebKitResourceLoadStatisticsEnabledPreferenceKey];
2012 }
2013
2014 - (void)setResourceLoadStatisticsEnabled:(BOOL)enabled
2015 {
2016     [self _setBoolValue:enabled forKey:WebKitResourceLoadStatisticsEnabledPreferenceKey];
2017 }
2018
2019 - (BOOL)largeImageAsyncDecodingEnabled
2020 {
2021     return [self _boolValueForKey:WebKitLargeImageAsyncDecodingEnabledPreferenceKey];
2022 }
2023
2024 - (void)setLargeImageAsyncDecodingEnabled:(BOOL)enabled
2025 {
2026     [self _setBoolValue:enabled forKey:WebKitLargeImageAsyncDecodingEnabledPreferenceKey];
2027 }
2028
2029 - (BOOL)animatedImageAsyncDecodingEnabled
2030 {
2031     return [self _boolValueForKey:WebKitAnimatedImageAsyncDecodingEnabledPreferenceKey];
2032 }
2033
2034 - (void)setAnimatedImageAsyncDecodingEnabled:(BOOL)enabled
2035 {
2036     [self _setBoolValue:enabled forKey:WebKitAnimatedImageAsyncDecodingEnabledPreferenceKey];
2037 }
2038
2039 - (BOOL)canvasUsesAcceleratedDrawing
2040 {
2041     return [self _boolValueForKey:WebKitCanvasUsesAcceleratedDrawingPreferenceKey];
2042 }
2043
2044 - (void)setCanvasUsesAcceleratedDrawing:(BOOL)enabled
2045 {
2046     [self _setBoolValue:enabled forKey:WebKitCanvasUsesAcceleratedDrawingPreferenceKey];
2047 }
2048
2049 - (BOOL)acceleratedCompositingEnabled
2050 {
2051     return [self _boolValueForKey:WebKitAcceleratedCompositingEnabledPreferenceKey];
2052 }
2053
2054 - (void)setAcceleratedCompositingEnabled:(BOOL)enabled
2055 {
2056     [self _setBoolValue:enabled forKey:WebKitAcceleratedCompositingEnabledPreferenceKey];
2057 }
2058
2059 - (BOOL)showDebugBorders
2060 {
2061     return [self _boolValueForKey:WebKitShowDebugBordersPreferenceKey];
2062 }
2063
2064 - (void)setShowDebugBorders:(BOOL)enabled
2065 {
2066     [self _setBoolValue:enabled forKey:WebKitShowDebugBordersPreferenceKey];
2067 }
2068
2069 - (BOOL)subpixelAntialiasedLayerTextEnabled
2070 {
2071     return [self _boolValueForKey:WebKitSubpixelAntialiasedLayerTextEnabledPreferenceKey];
2072 }
2073
2074 - (void)setSubpixelAntialiasedLayerTextEnabled:(BOOL)enabled
2075 {
2076     [self _setBoolValue:enabled forKey:WebKitSubpixelAntialiasedLayerTextEnabledPreferenceKey];
2077 }
2078
2079 - (BOOL)simpleLineLayoutEnabled
2080 {
2081     return [self _boolValueForKey:WebKitSimpleLineLayoutEnabledPreferenceKey];
2082 }
2083
2084 - (void)setSimpleLineLayoutEnabled:(BOOL)enabled
2085 {
2086     [self _setBoolValue:enabled forKey:WebKitSimpleLineLayoutEnabledPreferenceKey];
2087 }
2088
2089 - (BOOL)simpleLineLayoutDebugBordersEnabled
2090 {
2091     return [self _boolValueForKey:WebKitSimpleLineLayoutDebugBordersEnabledPreferenceKey];
2092 }
2093
2094 - (void)setSimpleLineLayoutDebugBordersEnabled:(BOOL)enabled
2095 {
2096     [self _setBoolValue:enabled forKey:WebKitSimpleLineLayoutDebugBordersEnabledPreferenceKey];
2097 }
2098
2099 - (BOOL)showRepaintCounter
2100 {
2101     return [self _boolValueForKey:WebKitShowRepaintCounterPreferenceKey];
2102 }
2103
2104 - (void)setShowRepaintCounter:(BOOL)enabled
2105 {
2106     [self _setBoolValue:enabled forKey:WebKitShowRepaintCounterPreferenceKey];
2107 }
2108
2109 - (BOOL)webAudioEnabled
2110 {
2111     return [self _boolValueForKey:WebKitWebAudioEnabledPreferenceKey];
2112 }
2113
2114 - (void)setWebAudioEnabled:(BOOL)enabled
2115 {
2116     [self _setBoolValue:enabled forKey:WebKitWebAudioEnabledPreferenceKey];
2117 }
2118
2119 - (BOOL)subpixelCSSOMElementMetricsEnabled
2120 {
2121     return [self _boolValueForKey:WebKitSubpixelCSSOMElementMetricsEnabledPreferenceKey];
2122 }
2123
2124 - (void)setSubpixelCSSOMElementMetricsEnabled:(BOOL)enabled
2125 {
2126     [self _setBoolValue:enabled forKey:WebKitSubpixelCSSOMElementMetricsEnabledPreferenceKey];
2127 }
2128
2129 - (BOOL)webGLEnabled
2130 {
2131     return [self _boolValueForKey:WebKitWebGLEnabledPreferenceKey];
2132 }
2133
2134 - (void)setWebGLEnabled:(BOOL)enabled
2135 {
2136     [self _setBoolValue:enabled forKey:WebKitWebGLEnabledPreferenceKey];
2137 }
2138
2139 - (BOOL)webGL2Enabled
2140 {
2141     return [self _boolValueForKey:WebKitWebGL2EnabledPreferenceKey];
2142 }
2143
2144 - (void)setWebGL2Enabled:(BOOL)enabled
2145 {
2146     [self _setBoolValue:enabled forKey:WebKitWebGL2EnabledPreferenceKey];
2147 }
2148
2149 - (BOOL)forceSoftwareWebGLRendering
2150 {
2151     return [self _boolValueForKey:WebKitForceSoftwareWebGLRenderingPreferenceKey];
2152 }
2153
2154 - (void)setForceSoftwareWebGLRendering:(BOOL)forced
2155 {
2156     [self _setBoolValue:forced forKey:WebKitForceSoftwareWebGLRenderingPreferenceKey];
2157 }
2158
2159 - (BOOL)forceLowPowerGPUForWebGL
2160 {
2161     return [self _boolValueForKey:WebKitForceWebGLUsesLowPowerPreferenceKey];
2162 }
2163
2164 - (void)setForceWebGLUsesLowPower:(BOOL)forceLowPower
2165 {
2166     [self _setBoolValue:forceLowPower forKey:WebKitForceWebGLUsesLowPowerPreferenceKey];
2167 }
2168
2169 - (BOOL)webGPUEnabled
2170 {
2171     return [self _boolValueForKey:WebKitWebGPUEnabledPreferenceKey];
2172 }
2173
2174 - (void)setWebGPUEnabled:(BOOL)enabled
2175 {
2176     [self _setBoolValue:enabled forKey:WebKitWebGPUEnabledPreferenceKey];
2177 }
2178
2179 - (BOOL)accelerated2dCanvasEnabled
2180 {
2181     return [self _boolValueForKey:WebKitAccelerated2dCanvasEnabledPreferenceKey];
2182 }
2183
2184 - (void)setAccelerated2dCanvasEnabled:(BOOL)enabled
2185 {
2186     [self _setBoolValue:enabled forKey:WebKitAccelerated2dCanvasEnabledPreferenceKey];
2187 }
2188
2189 - (void)setDiskImageCacheEnabled:(BOOL)enabled
2190 {
2191     // Staging. Can be removed once there are no more callers.
2192 }
2193
2194 - (BOOL)isFrameFlatteningEnabled
2195 {
2196     return [self _unsignedIntValueForKey:WebKitFrameFlatteningPreferenceKey] != WebKitFrameFlatteningDisabled;
2197 }
2198
2199 - (void)setFrameFlatteningEnabled:(BOOL)flattening
2200 {
2201     WebKitFrameFlattening value = flattening ? WebKitFrameFlatteningFullyEnabled : WebKitFrameFlatteningDisabled;
2202     [self _setUnsignedIntValue:value forKey:WebKitFrameFlatteningPreferenceKey];
2203 }
2204
2205 - (WebKitFrameFlattening)frameFlattening
2206 {
2207     return static_cast<WebKitFrameFlattening>([self _unsignedIntValueForKey:WebKitFrameFlatteningPreferenceKey]);
2208 }
2209
2210 - (void)setFrameFlattening:(WebKitFrameFlattening)flattening
2211 {
2212     [self _setUnsignedIntValue:flattening forKey:WebKitFrameFlatteningPreferenceKey];
2213 }
2214
2215 - (BOOL)asyncFrameScrollingEnabled
2216 {
2217     return [self _boolValueForKey:WebKitAsyncFrameScrollingEnabledPreferenceKey];
2218 }
2219
2220 - (void)setAsyncFrameScrollingEnabled:(BOOL)enabled
2221 {
2222     [self _setBoolValue:enabled forKey:WebKitAsyncFrameScrollingEnabledPreferenceKey];
2223 }
2224
2225 - (BOOL)isSpatialNavigationEnabled
2226 {
2227     return [self _boolValueForKey:WebKitSpatialNavigationEnabledPreferenceKey];
2228 }
2229
2230 - (void)setSpatialNavigationEnabled:(BOOL)flag
2231 {
2232     [self _setBoolValue:flag forKey:WebKitSpatialNavigationEnabledPreferenceKey];
2233 }
2234
2235 - (BOOL)paginateDuringLayoutEnabled
2236 {
2237     return [self _boolValueForKey:WebKitPaginateDuringLayoutEnabledPreferenceKey];
2238 }
2239
2240 - (void)setPaginateDuringLayoutEnabled:(BOOL)flag
2241 {
2242     [self _setBoolValue:flag forKey:WebKitPaginateDuringLayoutEnabledPreferenceKey];
2243 }
2244
2245 - (BOOL)hyperlinkAuditingEnabled
2246 {
2247     return [self _boolValueForKey:WebKitHyperlinkAuditingEnabledPreferenceKey];
2248 }
2249
2250 - (void)setHyperlinkAuditingEnabled:(BOOL)flag
2251 {
2252     [self _setBoolValue:flag forKey:WebKitHyperlinkAuditingEnabledPreferenceKey];
2253 }
2254
2255 - (BOOL)usePreHTML5ParserQuirks
2256 {
2257     return [self _boolValueForKey:WebKitUsePreHTML5ParserQuirksKey];
2258 }
2259
2260 - (void)setUsePreHTML5ParserQuirks:(BOOL)flag
2261 {
2262     [self _setBoolValue:flag forKey:WebKitUsePreHTML5ParserQuirksKey];
2263 }
2264
2265 - (void)didRemoveFromWebView
2266 {
2267     ASSERT(_private->numWebViews);
2268     if (--_private->numWebViews == 0)
2269         [[NSNotificationCenter defaultCenter]
2270             postNotificationName:WebPreferencesRemovedNotification
2271                           object:self
2272                         userInfo:nil];
2273 }
2274
2275 - (void)willAddToWebView
2276 {
2277     ++_private->numWebViews;
2278 }
2279
2280 - (void)_setPreferenceForTestWithValue:(NSString *)value forKey:(NSString *)key
2281 {
2282     [self _setStringValue:value forKey:key];
2283 }
2284
2285 - (void)setFullScreenEnabled:(BOOL)flag
2286 {
2287     [self _setBoolValue:flag forKey:WebKitFullScreenEnabledPreferenceKey];
2288 }
2289
2290 - (BOOL)fullScreenEnabled
2291 {
2292     return [self _boolValueForKey:WebKitFullScreenEnabledPreferenceKey];
2293 }
2294
2295 - (void)setAsynchronousSpellCheckingEnabled:(BOOL)flag
2296 {
2297     [self _setBoolValue:flag forKey:WebKitAsynchronousSpellCheckingEnabledPreferenceKey];
2298 }
2299
2300 - (BOOL)asynchronousSpellCheckingEnabled
2301 {
2302     return [self _boolValueForKey:WebKitAsynchronousSpellCheckingEnabledPreferenceKey];
2303 }
2304
2305 + (void)setWebKitLinkTimeVersion:(int)version
2306 {
2307     setWebKitLinkTimeVersion(version);
2308 }
2309
2310 - (void)setLoadsSiteIconsIgnoringImageLoadingPreference: (BOOL)flag
2311 {
2312     [self _setBoolValue: flag forKey: WebKitLoadSiteIconsKey];
2313 }
2314
2315 - (BOOL)loadsSiteIconsIgnoringImageLoadingPreference
2316 {
2317     return [self _boolValueForKey: WebKitLoadSiteIconsKey];
2318 }
2319
2320 - (void)setAVFoundationEnabled:(BOOL)flag
2321 {
2322     [self _setBoolValue:flag forKey:WebKitAVFoundationEnabledKey];
2323 }
2324
2325 - (BOOL)isAVFoundationEnabled
2326 {
2327     return [self _boolValueForKey:WebKitAVFoundationEnabledKey];
2328 }
2329
2330 - (void)setAVFoundationNSURLSessionEnabled:(BOOL)flag
2331 {
2332     [self _setBoolValue:flag forKey:WebKitAVFoundationNSURLSessionEnabledKey];
2333 }
2334
2335 - (BOOL)isAVFoundationNSURLSessionEnabled
2336 {
2337     return [self _boolValueForKey:WebKitAVFoundationNSURLSessionEnabledKey];
2338 }
2339
2340 - (void)setVideoPluginProxyEnabled:(BOOL)flag
2341 {
2342     // No-op, left for SPI compatibility.
2343 }
2344
2345 - (BOOL)isVideoPluginProxyEnabled
2346 {
2347     return NO;
2348 }
2349
2350 - (void)setHixie76WebSocketProtocolEnabled:(BOOL)flag
2351 {
2352 }
2353
2354 - (BOOL)isHixie76WebSocketProtocolEnabled
2355 {
2356     return false;
2357 }
2358
2359 - (BOOL)isInheritURIQueryComponentEnabled
2360 {
2361     return [self _boolValueForKey: WebKitEnableInheritURIQueryComponentPreferenceKey];
2362 }
2363
2364 - (void)setEnableInheritURIQueryComponent:(BOOL)flag
2365 {
2366     [self _setBoolValue:flag forKey: WebKitEnableInheritURIQueryComponentPreferenceKey];
2367 }
2368
2369 #if PLATFORM(IOS_FAMILY)
2370 - (BOOL)mediaPlaybackAllowsAirPlay
2371 {
2372     return [self _boolValueForKey:WebKitAllowsAirPlayForMediaPlaybackPreferenceKey];
2373 }
2374
2375 - (void)setMediaPlaybackAllowsAirPlay:(BOOL)flag
2376 {
2377     [self _setBoolValue:flag forKey:WebKitAllowsAirPlayForMediaPlaybackPreferenceKey];
2378 }
2379
2380 - (unsigned)audioSessionCategoryOverride
2381 {
2382     return [self _unsignedIntValueForKey:WebKitAudioSessionCategoryOverride];
2383 }
2384
2385 - (void)setAudioSessionCategoryOverride:(unsigned)override
2386 {
2387 #if HAVE(AUDIO_TOOLBOX_AUDIO_SESSION)
2388     if (override > AudioSession::AudioProcessing) {
2389         // Clients are passing us OSTypes values from AudioToolbox/AudioSession.h,
2390         // which need to be translated into AudioSession::CategoryType:
2391         switch (override) {
2392         case kAudioSessionCategory_AmbientSound:
2393             override = AudioSession::AmbientSound;
2394             break;
2395         case kAudioSessionCategory_SoloAmbientSound:
2396             override = AudioSession::SoloAmbientSound;
2397             break;
2398         case kAudioSessionCategory_MediaPlayback:
2399             override = AudioSession::MediaPlayback;
2400             break;
2401         case kAudioSessionCategory_RecordAudio:
2402             override = AudioSession::RecordAudio;
2403             break;
2404         case kAudioSessionCategory_PlayAndRecord:
2405             override = AudioSession::PlayAndRecord;
2406             break;
2407         case kAudioSessionCategory_AudioProcessing:
2408             override = AudioSession::AudioProcessing;
2409             break;
2410         default:
2411             override = AudioSession::None;
2412             break;
2413         }
2414     }
2415 #endif
2416
2417     [self _setUnsignedIntValue:override forKey:WebKitAudioSessionCategoryOverride];
2418 }
2419
2420 - (BOOL)avKitEnabled
2421 {
2422     return [self _boolValueForKey:WebKitAVKitEnabled];
2423 }
2424
2425 - (void)setAVKitEnabled:(bool)flag
2426 {
2427 #if HAVE(AVKIT)
2428     [self _setBoolValue:flag forKey:WebKitAVKitEnabled];
2429 #endif
2430 }
2431
2432 - (BOOL)networkDataUsageTrackingEnabled
2433 {
2434     return [self _boolValueForKey:WebKitNetworkDataUsageTrackingEnabledPreferenceKey];
2435 }
2436
2437 - (void)setNetworkDataUsageTrackingEnabled:(bool)trackingEnabled
2438 {
2439     [self _setBoolValue:trackingEnabled forKey:WebKitNetworkDataUsageTrackingEnabledPreferenceKey];
2440 }
2441
2442 - (NSString *)networkInterfaceName
2443 {
2444     return [self _stringValueForKey:WebKitNetworkInterfaceNamePreferenceKey];
2445 }
2446
2447 - (void)setNetworkInterfaceName:(NSString *)name
2448 {
2449     [self _setStringValue:name forKey:WebKitNetworkInterfaceNamePreferenceKey];
2450 }
2451 #endif // PLATFORM(IOS_FAMILY)
2452
2453 // Deprecated. Use -videoPlaybackRequiresUserGesture and -audioPlaybackRequiresUserGesture instead.
2454 - (BOOL)mediaPlaybackRequiresUserGesture
2455 {
2456     return [self _boolValueForKey:WebKitRequiresUserGestureForMediaPlaybackPreferenceKey];
2457 }
2458
2459 // Deprecated. Use -setVideoPlaybackRequiresUserGesture and -setAudioPlaybackRequiresUserGesture instead.
2460 - (void)setMediaPlaybackRequiresUserGesture:(BOOL)flag
2461 {
2462     [self _setBoolValue:flag forKey:WebKitRequiresUserGestureForMediaPlaybackPreferenceKey];
2463 }
2464
2465 - (BOOL)videoPlaybackRequiresUserGesture
2466 {
2467     return [self _boolValueForKey:WebKitRequiresUserGestureForVideoPlaybackPreferenceKey];
2468 }
2469
2470 - (void)setVideoPlaybackRequiresUserGesture:(BOOL)flag
2471 {
2472     [self _setBoolValue:flag forKey:WebKitRequiresUserGestureForVideoPlaybackPreferenceKey];
2473 }
2474
2475 - (BOOL)audioPlaybackRequiresUserGesture
2476 {
2477     return [self _boolValueForKey:WebKitRequiresUserGestureForAudioPlaybackPreferenceKey];
2478 }
2479
2480 - (void)setAudioPlaybackRequiresUserGesture:(BOOL)flag
2481 {
2482     [self _setBoolValue:flag forKey:WebKitRequiresUserGestureForAudioPlaybackPreferenceKey];
2483 }
2484
2485 - (BOOL)overrideUserGestureRequirementForMainContent
2486 {
2487     return [self _boolValueForKey:WebKitMainContentUserGestureOverrideEnabledPreferenceKey];
2488 }
2489
2490 - (void)setOverrideUserGestureRequirementForMainContent:(BOOL)flag
2491 {
2492     [self _setBoolValue:flag forKey:WebKitMainContentUserGestureOverrideEnabledPreferenceKey];
2493 }
2494
2495 - (BOOL)mediaPlaybackAllowsInline
2496 {
2497     return [self _boolValueForKey:WebKitAllowsInlineMediaPlaybackPreferenceKey];
2498 }
2499
2500 - (void)setMediaPlaybackAllowsInline:(BOOL)flag
2501 {
2502     [self _setBoolValue:flag forKey:WebKitAllowsInlineMediaPlaybackPreferenceKey];
2503 }
2504
2505 - (BOOL)inlineMediaPlaybackRequiresPlaysInlineAttribute
2506 {
2507     return [self _boolValueForKey:WebKitInlineMediaPlaybackRequiresPlaysInlineAttributeKey];
2508 }
2509
2510 - (void)setInlineMediaPlaybackRequiresPlaysInlineAttribute:(BOOL)flag
2511 {
2512     [self _setBoolValue:flag forKey:WebKitInlineMediaPlaybackRequiresPlaysInlineAttributeKey];
2513 }
2514
2515 - (BOOL)invisibleAutoplayNotPermitted
2516 {
2517     return [self _boolValueForKey:WebKitInvisibleAutoplayNotPermittedKey];
2518 }
2519
2520 - (void)setInvisibleAutoplayNotPermitted:(BOOL)flag
2521 {
2522     [self _setBoolValue:flag forKey:WebKitInvisibleAutoplayNotPermittedKey];
2523 }
2524
2525 - (BOOL)mediaControlsScaleWithPageZoom
2526 {
2527     return [self _boolValueForKey:WebKitMediaControlsScaleWithPageZoomPreferenceKey];
2528 }
2529
2530 - (void)setMediaControlsScaleWithPageZoom:(BOOL)flag
2531 {
2532     [self _setBoolValue:flag forKey:WebKitMediaControlsScaleWithPageZoomPreferenceKey];
2533 }
2534
2535 - (BOOL)allowsAlternateFullscreen
2536 {
2537     return [self allowsPictureInPictureMediaPlayback];
2538 }
2539
2540 - (void)setAllowsAlternateFullscreen:(BOOL)flag
2541 {
2542     [self setAllowsPictureInPictureMediaPlayback:flag];
2543 }
2544
2545 - (BOOL)allowsPictureInPictureMediaPlayback
2546 {
2547     return [self _boolValueForKey:WebKitAllowsPictureInPictureMediaPlaybackPreferenceKey];
2548 }
2549
2550 - (void)setAllowsPictureInPictureMediaPlayback:(BOOL)flag
2551 {
2552     [self _setBoolValue:flag forKey:WebKitAllowsPictureInPictureMediaPlaybackPreferenceKey];
2553 }
2554
2555 - (BOOL)mockScrollbarsEnabled
2556 {
2557     return [self _boolValueForKey:WebKitMockScrollbarsEnabledPreferenceKey];
2558 }
2559
2560 - (void)setMockScrollbarsEnabled:(BOOL)flag
2561 {
2562     [self _setBoolValue:flag forKey:WebKitMockScrollbarsEnabledPreferenceKey];
2563 }
2564
2565 - (NSString *)pictographFontFamily
2566 {
2567     return [self _stringValueForKey: WebKitPictographFontPreferenceKey];
2568 }
2569
2570 - (void)setPictographFontFamily:(NSString *)family
2571 {
2572     [self _setStringValue: family forKey: WebKitPictographFontPreferenceKey];
2573 }
2574
2575 - (BOOL)pageCacheSupportsPlugins
2576 {
2577     return [self _boolValueForKey:WebKitPageCacheSupportsPluginsPreferenceKey];
2578 }
2579
2580 - (void)setPageCacheSupportsPlugins:(BOOL)flag
2581 {
2582     [self _setBoolValue:flag forKey:WebKitPageCacheSupportsPluginsPreferenceKey];
2583
2584 }
2585
2586 #if PLATFORM(IOS_FAMILY)
2587 - (void)_invalidateCachedPreferences
2588 {
2589     dispatch_barrier_sync(_private->readWriteQueue, ^{
2590         if (_private->values)
2591             _private->values = adoptNS([[NSMutableDictionary alloc] init]);
2592     });
2593
2594     [self _updatePrivateBrowsingStateTo:[self privateBrowsingEnabled]];
2595
2596     // Tell any live WebViews to refresh their preferences
2597     [self _postPreferencesChangedNotification];
2598 }
2599
2600 - (void)_synchronizeWebStoragePolicyWithCookiePolicy
2601 {
2602     // FIXME: This should be done in clients, WebKit shouldn't be making such policy decisions.
2603
2604     NSHTTPCookieAcceptPolicy cookieAcceptPolicy = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookieAcceptPolicy];
2605     WebStorageBlockingPolicy storageBlockingPolicy;
2606     switch (static_cast<unsigned>(cookieAcceptPolicy)) {
2607     case NSHTTPCookieAcceptPolicyAlways:
2608         storageBlockingPolicy = WebAllowAllStorage;
2609         break;
2610     case NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
2611     case NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain:
2612         storageBlockingPolicy = WebBlockThirdPartyStorage;
2613         break;
2614     case NSHTTPCookieAcceptPolicyNever:
2615         storageBlockingPolicy = WebBlockAllStorage;
2616         break;
2617     default:
2618         ASSERT_NOT_REACHED();
2619         storageBlockingPolicy = WebBlockAllStorage;
2620         break;
2621     }    
2622
2623     [self setStorageBlockingPolicy:storageBlockingPolicy];
2624 }
2625 #endif
2626
2627 - (void)setBackspaceKeyNavigationEnabled:(BOOL)flag
2628 {
2629     [self _setBoolValue:flag forKey:WebKitBackspaceKeyNavigationEnabledKey];
2630 }
2631
2632 - (BOOL)backspaceKeyNavigationEnabled
2633 {
2634     return [self _boolValueForKey:WebKitBackspaceKeyNavigationEnabledKey];
2635 }
2636
2637 - (void)setWantsBalancedSetDefersLoadingBehavior:(BOOL)flag
2638 {
2639     [self _setBoolValue:flag forKey:WebKitWantsBalancedSetDefersLoadingBehaviorKey];
2640 }
2641
2642 - (BOOL)wantsBalancedSetDefersLoadingBehavior
2643 {
2644     return [self _boolValueForKey:WebKitWantsBalancedSetDefersLoadingBehaviorKey];
2645 }
2646
2647 - (void)setShouldDisplaySubtitles:(BOOL)flag
2648 {
2649     [self _setBoolValue:flag forKey:WebKitShouldDisplaySubtitlesPreferenceKey];
2650 }
2651
2652 - (BOOL)shouldDisplaySubtitles
2653 {
2654     return [self _boolValueForKey:WebKitShouldDisplaySubtitlesPreferenceKey];
2655 }
2656
2657 - (void)setShouldDisplayCaptions:(BOOL)flag
2658 {
2659     [self _setBoolValue:flag forKey:WebKitShouldDisplayCaptionsPreferenceKey];
2660 }
2661
2662 - (BOOL)shouldDisplayCaptions
2663 {
2664     return [self _boolValueForKey:WebKitShouldDisplayCaptionsPreferenceKey];
2665 }
2666
2667 - (void)setShouldDisplayTextDescriptions:(BOOL)flag
2668 {
2669     [self _setBoolValue:flag forKey:WebKitShouldDisplayTextDescriptionsPreferenceKey];
2670 }
2671
2672 - (BOOL)shouldDisplayTextDescriptions
2673 {
2674     return [self _boolValueForKey:WebKitShouldDisplayTextDescriptionsPreferenceKey];
2675 }
2676
2677 - (void)setNotificationsEnabled:(BOOL)flag
2678 {
2679     [self _setBoolValue:flag forKey:WebKitNotificationsEnabledKey];
2680 }
2681
2682 - (BOOL)notificationsEnabled
2683 {
2684     return [self _boolValueForKey:WebKitNotificationsEnabledKey];
2685 }
2686
2687 - (void)setShouldRespectImageOrientation:(BOOL)flag
2688 {
2689     [self _setBoolValue:flag forKey:WebKitShouldRespectImageOrientationKey];
2690 }
2691
2692 - (BOOL)shouldRespectImageOrientation
2693 {
2694     return [self _boolValueForKey:WebKitShouldRespectImageOrientationKey];
2695 }
2696
2697 - (BOOL)requestAnimationFrameEnabled
2698 {
2699     return [self _boolValueForKey:WebKitRequestAnimationFrameEnabledPreferenceKey];
2700 }
2701
2702 - (void)setRequestAnimationFrameEnabled:(BOOL)enabled
2703 {
2704     [self _setBoolValue:enabled forKey:WebKitRequestAnimationFrameEnabledPreferenceKey];
2705 }
2706
2707 - (void)setIncrementalRenderingSuppressionTimeoutInSeconds:(NSTimeInterval)timeout
2708 {
2709     [self _setFloatValue:timeout forKey:WebKitIncrementalRenderingSuppressionTimeoutInSecondsKey];
2710 }
2711
2712 - (NSTimeInterval)incrementalRenderingSuppressionTimeoutInSeconds
2713 {
2714     return [self _floatValueForKey:WebKitIncrementalRenderingSuppressionTimeoutInSecondsKey];
2715 }
2716
2717 - (BOOL)diagnosticLoggingEnabled
2718 {
2719     return [self _boolValueForKey:WebKitDiagnosticLoggingEnabledKey];
2720 }
2721
2722 - (void)setDiagnosticLoggingEnabled:(BOOL)enabled
2723 {
2724     [self _setBoolValue:enabled forKey:WebKitDiagnosticLoggingEnabledKey];
2725 }
2726
2727 - (void)setStorageBlockingPolicy:(WebStorageBlockingPolicy)storageBlockingPolicy
2728 {
2729 #if PLATFORM(IOS_FAMILY)
2730     // We don't want to write the setting out, so we just reset the default instead of storing the new setting.
2731     // FIXME: This code removes any defaults previously registered by client process, which is not appropriate for this method to do.
2732     NSDictionary *dict = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:storageBlockingPolicy] forKey:WebKitStorageBlockingPolicyKey];
2733     [[NSUserDefaults standardUserDefaults] registerDefaults:dict];
2734 #else
2735     [self _setIntegerValue:storageBlockingPolicy forKey:WebKitStorageBlockingPolicyKey];
2736 #endif
2737 }
2738
2739 - (WebStorageBlockingPolicy)storageBlockingPolicy
2740 {
2741     return static_cast<WebStorageBlockingPolicy>([self _integerValueForKey:WebKitStorageBlockingPolicyKey]);
2742 }
2743
2744 - (BOOL)plugInSnapshottingEnabled
2745 {
2746     return [self _boolValueForKey:WebKitPlugInSnapshottingEnabledPreferenceKey];
2747 }
2748
2749 - (void)setPlugInSnapshottingEnabled:(BOOL)enabled
2750 {
2751     [self _setBoolValue:enabled forKey:WebKitPlugInSnapshottingEnabledPreferenceKey];
2752 }
2753
2754 - (BOOL)hiddenPageDOMTimerThrottlingEnabled
2755 {
2756     return [self _boolValueForKey:WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey];
2757 }
2758
2759 - (void)setHiddenPageDOMTimerThrottlingEnabled:(BOOL)enabled
2760 {
2761     [self _setBoolValue:enabled forKey:WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey];
2762 }
2763
2764 - (BOOL)hiddenPageCSSAnimationSuspensionEnabled
2765 {
2766     return [self _boolValueForKey:WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey];
2767 }
2768
2769 - (void)setHiddenPageCSSAnimationSuspensionEnabled:(BOOL)enabled
2770 {
2771     [self _setBoolValue:enabled forKey:WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey];
2772 }
2773
2774 - (BOOL)lowPowerVideoAudioBufferSizeEnabled
2775 {
2776     return [self _boolValueForKey:WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey];
2777 }
2778
2779 - (void)setLowPowerVideoAudioBufferSizeEnabled:(BOOL)enabled
2780 {
2781     [self _setBoolValue:enabled forKey:WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey];
2782 }
2783
2784 - (BOOL)useLegacyTextAlignPositionedElementBehavior
2785 {
2786     return [self _boolValueForKey:WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey];
2787 }
2788
2789 - (void)setUseLegacyTextAlignPositionedElementBehavior:(BOOL)enabled
2790 {
2791     [self _setBoolValue:enabled forKey:WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey];
2792 }
2793
2794 - (BOOL)mediaSourceEnabled
2795 {
2796     return [self _boolValueForKey:WebKitMediaSourceEnabledPreferenceKey];
2797 }
2798
2799 - (void)setMediaSourceEnabled:(BOOL)enabled
2800 {
2801     [self _setBoolValue:enabled forKey:WebKitMediaSourceEnabledPreferenceKey];
2802 }
2803
2804 - (BOOL)sourceBufferChangeTypeEnabled
2805 {
2806     return [self _boolValueForKey:WebKitSourceBufferChangeTypeEnabledPreferenceKey];
2807 }
2808
2809 - (void)setSourceBufferChangeTypeEnabled:(BOOL)enabled
2810 {
2811     [self _setBoolValue:enabled forKey:WebKitSourceBufferChangeTypeEnabledPreferenceKey];
2812 }
2813
2814 - (BOOL)imageControlsEnabled
2815 {
2816     return [self _boolValueForKey:WebKitImageControlsEnabledPreferenceKey];
2817 }
2818
2819 - (void)setImageControlsEnabled:(BOOL)enabled
2820 {
2821     [self _setBoolValue:enabled forKey:WebKitImageControlsEnabledPreferenceKey];
2822 }
2823
2824 - (BOOL)serviceControlsEnabled
2825 {
2826     return [self _boolValueForKey:WebKitServiceControlsEnabledPreferenceKey];
2827 }
2828
2829 - (void)setServiceControlsEnabled:(BOOL)enabled
2830 {
2831     [self _setBoolValue:enabled forKey:WebKitServiceControlsEnabledPreferenceKey];
2832 }
2833
2834 - (BOOL)gamepadsEnabled
2835 {
2836     return [self _boolValueForKey:WebKitGamepadsEnabledPreferenceKey];
2837 }
2838
2839 - (void)setGamepadsEnabled:(BOOL)flag
2840 {
2841     [self _setBoolValue:flag forKey:WebKitGamepadsEnabledPreferenceKey];
2842 }
2843
2844 - (BOOL)shouldConvertPositionStyleOnCopy
2845 {
2846     return [self _boolValueForKey:WebKitShouldConvertPositionStyleOnCopyPreferenceKey];
2847 }
2848
2849 - (void)setShouldConvertPositionStyleOnCopy:(BOOL)enabled
2850 {
2851     [self _setBoolValue:enabled forKey:WebKitShouldConvertPositionStyleOnCopyPreferenceKey];
2852 }
2853
2854 - (NSString *)mediaKeysStorageDirectory
2855 {
2856     return [[self _stringValueForKey:WebKitMediaKeysStorageDirectoryKey] stringByStandardizingPath];
2857 }
2858
2859 - (void)setMediaKeysStorageDirectory:(NSString *)directory
2860 {
2861     [self _setStringValue:directory forKey:WebKitMediaKeysStorageDirectoryKey];
2862 }
2863
2864 - (BOOL)mediaDevicesEnabled
2865 {
2866     return [self _boolValueForKey:WebKitMediaDevicesEnabledPreferenceKey];
2867 }
2868
2869 - (void)setMediaDevicesEnabled:(BOOL)flag
2870 {
2871     [self _setBoolValue:flag forKey:WebKitMediaDevicesEnabledPreferenceKey];
2872 }
2873
2874 - (BOOL)mediaStreamEnabled
2875 {
2876     return [self _boolValueForKey:WebKitMediaStreamEnabledPreferenceKey];
2877 }
2878
2879 - (void)setMediaStreamEnabled:(BOOL)flag
2880 {
2881     [self _setBoolValue:flag forKey:WebKitMediaStreamEnabledPreferenceKey];
2882 }
2883
2884 - (BOOL)peerConnectionEnabled
2885 {
2886     return [self _boolValueForKey:WebKitPeerConnectionEnabledPreferenceKey];
2887 }
2888
2889 - (void)setPeerConnectionEnabled:(BOOL)flag
2890 {
2891     [self _setBoolValue:flag forKey:WebKitPeerConnectionEnabledPreferenceKey];
2892 }
2893
2894 - (BOOL)linkPreloadEnabled
2895 {
2896     return [self _boolValueForKey:WebKitLinkPreloadEnabledPreferenceKey];
2897 }
2898
2899 - (void)setLinkPreloadEnabled:(BOOL)flag
2900 {
2901     [self _setBoolValue:flag forKey:WebKitLinkPreloadEnabledPreferenceKey];
2902 }
2903
2904 - (BOOL)mediaPreloadingEnabled
2905 {
2906     return [self _boolValueForKey:WebKitMediaPreloadingEnabledPreferenceKey];
2907 }
2908
2909 - (void)setMediaPreloadingEnabled:(BOOL)flag
2910 {
2911     [self _setBoolValue:flag forKey:WebKitMediaPreloadingEnabledPreferenceKey];
2912 }
2913
2914 - (void)setMetaRefreshEnabled:(BOOL)enabled
2915 {
2916     [self setHTTPEquivEnabled:enabled];
2917 }
2918
2919 - (BOOL)metaRefreshEnabled
2920 {
2921     return [self httpEquivEnabled];
2922 }
2923
2924 - (void)setHTTPEquivEnabled:(BOOL)enabled
2925 {
2926     [self _setBoolValue:enabled forKey:WebKitHTTPEquivEnabledPreferenceKey];
2927 }
2928
2929 - (BOOL)httpEquivEnabled
2930 {
2931     return [self _boolValueForKey:WebKitHTTPEquivEnabledPreferenceKey];
2932 }
2933
2934 - (BOOL)javaScriptMarkupEnabled
2935 {
2936     return [self _boolValueForKey:WebKitJavaScriptMarkupEnabledPreferenceKey];
2937 }
2938
2939 - (void)setJavaScriptMarkupEnabled:(BOOL)flag
2940 {
2941     [self _setBoolValue:flag forKey:WebKitJavaScriptMarkupEnabledPreferenceKey];
2942 }
2943
2944 - (BOOL)mediaDataLoadsAutomatically
2945 {
2946     return [self _boolValueForKey:WebKitMediaDataLoadsAutomaticallyPreferenceKey];
2947 }
2948
2949 - (void)setMediaDataLoadsAutomatically:(BOOL)flag
2950 {
2951     [self _setBoolValue:flag forKey:WebKitMediaDataLoadsAutomaticallyPreferenceKey];
2952 }
2953
2954 - (BOOL)attachmentElementEnabled
2955 {
2956     return [self _boolValueForKey:WebKitAttachmentElementEnabledPreferenceKey];
2957 }
2958
2959 - (void)setAttachmentElementEnabled:(BOOL)flag
2960 {
2961     [self _setBoolValue:flag forKey:WebKitAttachmentElementEnabledPreferenceKey];
2962 }
2963
2964 - (BOOL)allowsInlineMediaPlaybackAfterFullscreen
2965 {
2966     return [self _boolValueForKey:WebKitAllowsInlineMediaPlaybackAfterFullscreenPreferenceKey];
2967 }
2968
2969 - (void)setAllowsInlineMediaPlaybackAfterFullscreen:(BOOL)flag
2970 {
2971     [self _setBoolValue:flag forKey:WebKitAllowsInlineMediaPlaybackAfterFullscreenPreferenceKey];
2972 }
2973
2974 - (BOOL)mockCaptureDevicesEnabled
2975 {
2976     return [self _boolValueForKey:WebKitMockCaptureDevicesEnabledPreferenceKey];
2977 }
2978
2979 - (void)setMockCaptureDevicesEnabled:(BOOL)flag
2980 {
2981     [self _setBoolValue:flag forKey:WebKitMockCaptureDevicesEnabledPreferenceKey];
2982 }
2983
2984 - (BOOL)mockCaptureDevicesPromptEnabled
2985 {
2986     return [self _boolValueForKey:WebKitMockCaptureDevicesPromptEnabledPreferenceKey];
2987 }
2988
2989 - (void)setMockCaptureDevicesPromptEnabled:(BOOL)flag
2990 {
2991     [self _setBoolValue:flag forKey:WebKitMockCaptureDevicesPromptEnabledPreferenceKey];
2992 }
2993
2994 - (BOOL)enumeratingAllNetworkInterfacesEnabled
2995 {
2996     return [self _boolValueForKey:WebKitEnumeratingAllNetworkInterfacesEnabledPreferenceKey];
2997 }
2998
2999 - (void)setEnumeratingAllNetworkInterfacesEnabled:(BOOL)flag
3000 {
3001     [self _setBoolValue:flag forKey:WebKitEnumeratingAllNetworkInterfacesEnabledPreferenceKey];
3002 }
3003
3004 - (BOOL)iceCandidateFilteringEnabled
3005 {
3006     return [self _boolValueForKey:WebKitICECandidateFilteringEnabledPreferenceKey];
3007 }
3008
3009 - (void)setIceCandidateFilteringEnabled:(BOOL)flag
3010 {
3011     [self _setBoolValue:flag forKey:WebKitICECandidateFilteringEnabledPreferenceKey];
3012 }
3013
3014 - (BOOL)mediaCaptureRequiresSecureConnection
3015 {
3016     return [self _boolValueForKey:WebKitMediaCaptureRequiresSecureConnectionPreferenceKey];
3017 }
3018
3019 - (void)setMediaCaptureRequiresSecureConnection:(BOOL)flag
3020 {
3021     [self _setBoolValue:flag forKey:WebKitMediaCaptureRequiresSecureConnectionPreferenceKey];
3022 }
3023
3024 - (BOOL)shadowDOMEnabled
3025 {
3026     return [self _boolValueForKey:WebKitShadowDOMEnabledPreferenceKey];
3027 }
3028
3029 - (void)setShadowDOMEnabled:(BOOL)flag
3030 {
3031     [self _setBoolValue:flag forKey:WebKitShadowDOMEnabledPreferenceKey];
3032 }
3033
3034 - (BOOL)customElementsEnabled
3035 {
3036     return [self _boolValueForKey:WebKitCustomElementsEnabledPreferenceKey];
3037 }
3038
3039 - (void)setCustomElementsEnabled:(BOOL)flag
3040 {
3041     [self _setBoolValue:flag forKey:WebKitCustomElementsEnabledPreferenceKey];
3042 }
3043
3044 - (BOOL)dataTransferItemsEnabled
3045 {
3046     return [self _boolValueForKey:WebKitDataTransferItemsEnabledPreferenceKey];
3047 }
3048
3049 - (void)setDataTransferItemsEnabled:(BOOL)flag
3050 {
3051     [self _setBoolValue:flag forKey:WebKitDataTransferItemsEnabledPreferenceKey];
3052 }
3053
3054 - (BOOL)customPasteboardDataEnabled
3055 {
3056     return [self _boolValueForKey:WebKitCustomPasteboardDataEnabledPreferenceKey];
3057 }
3058
3059 - (void)setCustomPasteboardDataEnabled:(BOOL)flag
3060 {
3061     [self _setBoolValue:flag forKey:WebKitCustomPasteboardDataEnabledPreferenceKey];
3062 }
3063
3064 - (BOOL)cacheAPIEnabled
3065 {
3066     return [self _boolValueForKey:WebKitCacheAPIEnabledPreferenceKey];
3067 }
3068
3069 - (void)setCacheAPIEnabled:(BOOL)flag
3070 {
3071     [self _setBoolValue:flag forKey:WebKitCacheAPIEnabledPreferenceKey];
3072 }
3073
3074 - (BOOL)fetchAPIEnabled
3075 {
3076     return [self _boolValueForKey:WebKitFetchAPIEnabledPreferenceKey];
3077 }
3078
3079 - (void)setFetchAPIEnabled:(BOOL)flag
3080 {
3081     [self _setBoolValue:flag forKey:WebKitFetchAPIEnabledPreferenceKey];
3082 }
3083
3084 - (BOOL)readableByteStreamAPIEnabled
3085 {
3086     return [self _boolValueForKey:WebKitReadableByteStreamAPIEnabledPreferenceKey];
3087 }
3088
3089 - (void)setReadableByteStreamAPIEnabled:(BOOL)flag
3090 {
3091     [self _setBoolValue:flag forKey:WebKitReadableByteStreamAPIEnabledPreferenceKey];
3092 }
3093
3094 - (BOOL)writableStreamAPIEnabled
3095 {
3096     return [self _boolValueForKey:WebKitWritableStreamAPIEnabledPreferenceKey];
3097 }
3098
3099 - (void)setWritableStreamAPIEnabled:(BOOL)flag
3100 {
3101     [self _setBoolValue:flag forKey:WebKitWritableStreamAPIEnabledPreferenceKey];
3102 }
3103
3104 - (BOOL)downloadAttributeEnabled
3105 {
3106     return [self _boolValueForKey:WebKitDownloadAttributeEnabledPreferenceKey];
3107 }
3108
3109 - (void)setDownloadAttributeEnabled:(BOOL)flag
3110 {
3111     [self _setBoolValue:flag forKey:WebKitDownloadAttributeEnabledPreferenceKey];
3112 }
3113
3114 - (void)setDirectoryUploadEnabled:(BOOL)flag
3115 {
3116     [self _setBoolValue:flag forKey:WebKitDirectoryUploadEnabledPreferenceKey];
3117 }
3118
3119 - (BOOL)directoryUploadEnabled
3120 {
3121     return [self _boolValueForKey:WebKitDirectoryUploadEnabledPreferenceKey];
3122 }
3123
3124 - (BOOL)visualViewportAPIEnabled
3125 {
3126     return [self _boolValueForKey:WebKitVisualViewportAPIEnabledPreferenceKey];
3127 }
3128
3129 - (void)setVisualViewportAPIEnabled:(BOOL)flag
3130 {
3131     [self _setBoolValue:flag forKey:WebKitVisualViewportAPIEnabledPreferenceKey];
3132 }
3133
3134 - (BOOL)CSSOMViewScrollingAPIEnabled
3135 {
3136     return [self _boolValueForKey:WebKitCSSOMViewScrollingAPIEnabledPreferenceKey];
3137 }
3138
3139 - (void)setCSSOMViewScrollingAPIEnabled:(BOOL)flag
3140 {
3141     [self _setBoolValue:flag forKey:WebKitCSSOMViewScrollingAPIEnabledPreferenceKey];
3142 }
3143
3144 - (BOOL)webAnimationsEnabled
3145 {
3146     return [self _boolValueForKey:WebKitWebAnimationsEnabledPreferenceKey];
3147 }
3148
3149 - (void)setWebAnimationsEnabled:(BOOL)flag
3150 {
3151     [self _setBoolValue:flag forKey:WebKitWebAnimationsEnabledPreferenceKey];
3152 }
3153
3154 - (BOOL)pointerEventsEnabled
3155 {
3156     return [self _boolValueForKey:WebKitPointerEventsEnabledPreferenceKey];
3157 }
3158
3159 - (void)setPointerEventsEnabled:(BOOL)flag
3160 {
3161     [self _setBoolValue:flag forKey:WebKitPointerEventsEnabledPreferenceKey];
3162 }
3163
3164 - (BOOL)fetchAPIKeepAliveEnabled
3165 {
3166     return [self _boolValueForKey:WebKitFetchAPIEnabledPreferenceKey];
3167 }
3168
3169 - (void)setFetchAPIKeepAliveEnabled:(BOOL)flag
3170 {
3171     [self _setBoolValue:flag forKey:WebKitFetchAPIEnabledPreferenceKey];
3172 }
3173
3174 - (BOOL)modernMediaControlsEnabled
3175 {
3176     return [self _boolValueForKey:WebKitModernMediaControlsEnabledPreferenceKey];
3177 }
3178
3179 - (void)setModernMediaControlsEnabled:(BOOL)flag
3180 {
3181     [self _setBoolValue:flag forKey:WebKitModernMediaControlsEnabledPreferenceKey];
3182 }
3183
3184 - (BOOL)webAnimationsCSSIntegrationEnabled
3185 {
3186     return [self _boolValueForKey:WebKitWebAnimationsCSSIntegrationEnabledPreferenceKey];
3187 }
3188
3189 - (void)setWebAnimationsCSSIntegrationEnabled:(BOOL)flag
3190 {
3191     [self _setBoolValue:flag forKey:WebKitWebAnimationsCSSIntegrationEnabledPreferenceKey];
3192 }
3193
3194 - (BOOL)intersectionObserverEnabled
3195 {
3196     return [self _boolValueForKey:WebKitIntersectionObserverEnabledPreferenceKey];
3197 }
3198
3199 - (void)setIntersectionObserverEnabled:(BOOL)flag
3200 {
3201     [self _setBoolValue:flag forKey:WebKitIntersectionObserverEnabledPreferenceKey];
3202 }
3203
3204 - (BOOL)menuItemElementEnabled
3205 {
3206     return [self _boolValueForKey:WebKitMenuItemElementEnabledPreferenceKey];
3207 }
3208
3209 - (void)setMenuItemElementEnabled:(BOOL)flag
3210 {
3211     [self _setBoolValue:flag forKey:WebKitMenuItemElementEnabledPreferenceKey];
3212 }
3213
3214 - (BOOL)displayContentsEnabled
3215 {
3216     return [self _boolValueForKey:WebKitDisplayContentsEnabledPreferenceKey];
3217 }
3218
3219 - (void)setDisplayContentsEnabled:(BOOL)flag
3220 {
3221     [self _setBoolValue:flag forKey:WebKitDisplayContentsEnabledPreferenceKey];
3222 }
3223
3224 - (BOOL)userTimingEnabled
3225 {
3226     return [self _boolValueForKey:WebKitUserTimingEnabledPreferenceKey];
3227 }
3228
3229 - (void)setUserTimingEnabled:(BOOL)flag
3230 {
3231     [self _setBoolValue:flag forKey:WebKitUserTimingEnabledPreferenceKey];
3232 }
3233
3234 - (BOOL)resourceTimingEnabled
3235 {
3236     return [self _boolValueForKey:WebKitResourceTimingEnabledPreferenceKey];
3237 }
3238
3239 - (void)setResourceTimingEnabled:(BOOL)flag
3240 {
3241     [self _setBoolValue:flag forKey:WebKitResourceTimingEnabledPreferenceKey];
3242 }
3243
3244 - (BOOL)mediaUserGestureInheritsFromDocument
3245 {
3246     return [self _boolValueForKey:WebKitMediaUserGestureInheritsFromDocument];
3247 }
3248
3249 - (void)setMediaUserGestureInheritsFromDocument:(BOOL)flag
3250 {
3251     [self _setBoolValue:flag forKey:WebKitMediaUserGestureInheritsFromDocument];
3252 }
3253
3254 #if PLATFORM(IOS_FAMILY)
3255 - (BOOL)quickLookDocumentSavingEnabled
3256 {
3257     return [self _boolValueForKey:WebKitQuickLookDocumentSavingPreferenceKey];
3258 }
3259
3260 - (void)setQuickLookDocumentSavingEnabled:(BOOL)flag
3261 {
3262     [self _setBoolValue:flag forKey:WebKitQuickLookDocumentSavingPreferenceKey];
3263 }
3264 #endif
3265
3266 - (NSString *)mediaContentTypesRequiringHardwareSupport
3267 {
3268     return [self _stringValueForKey:WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey];
3269 }
3270
3271 - (void)setMediaContentTypesRequiringHardwareSupport:(NSString *)value
3272 {
3273     [self _setStringValue:value forKey:WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey];
3274 }
3275
3276 - (BOOL)isSecureContextAttributeEnabled
3277 {
3278     return [self _boolValueForKey:WebKitIsSecureContextAttributeEnabledPreferenceKey];
3279 }
3280
3281 - (void)setIsSecureContextAttributeEnabled:(BOOL)flag
3282 {
3283     [self _setBoolValue:flag forKey:WebKitIsSecureContextAttributeEnabledPreferenceKey];
3284 }
3285
3286 - (BOOL)legacyEncryptedMediaAPIEnabled
3287 {
3288     return [self _boolValueForKey:WebKitLegacyEncryptedMediaAPIEnabledKey];
3289 }
3290
3291 - (void)setLegacyEncryptedMediaAPIEnabled:(BOOL)flag
3292 {
3293     [self _setBoolValue:flag forKey:WebKitLegacyEncryptedMediaAPIEnabledKey];
3294 }
3295
3296 - (BOOL)encryptedMediaAPIEnabled
3297 {
3298     return [self _boolValueForKey:WebKitEncryptedMediaAPIEnabledKey];
3299 }
3300
3301 - (void)setEncryptedMediaAPIEnabled:(BOOL)flag
3302 {
3303     [self _setBoolValue:flag forKey:WebKitEncryptedMediaAPIEnabledKey];
3304 }
3305
3306 - (BOOL)viewportFitEnabled
3307 {
3308     return [self _boolValueForKey:WebKitViewportFitEnabledPreferenceKey];
3309 }
3310
3311 - (void)setViewportFitEnabled:(BOOL)flag
3312 {
3313     [self _setBoolValue:flag forKey:WebKitViewportFitEnabledPreferenceKey];
3314 }
3315
3316 - (BOOL)constantPropertiesEnabled
3317 {
3318     return [self _boolValueForKey:WebKitConstantPropertiesEnabledPreferenceKey];
3319 }
3320
3321 - (void)setConstantPropertiesEnabled:(BOOL)flag
3322 {
3323     [self _setBoolValue:flag forKey:WebKitConstantPropertiesEnabledPreferenceKey];
3324 }
3325
3326 - (BOOL)colorFilterEnabled
3327 {
3328     return [self _boolValueForKey:WebKitColorFilterEnabledPreferenceKey];
3329 }
3330
3331 - (void)setColorFilterEnabled:(BOOL)flag
3332 {
3333     [self _setBoolValue:flag forKey:WebKitColorFilterEnabledPreferenceKey];
3334 }
3335
3336 - (BOOL)punchOutWhiteBackgroundsInDarkMode
3337 {
3338     return [self _boolValueForKey:WebKitPunchOutWhiteBackgroundsInDarkModePreferenceKey];
3339 }
3340
3341 - (void)setPunchOutWhiteBackgroundsInDarkMode:(BOOL)flag
3342 {
3343     [self _setBoolValue:flag forKey:WebKitPunchOutWhiteBackgroundsInDarkModePreferenceKey];
3344 }
3345
3346 - (BOOL)allowMediaContentTypesRequiringHardwareSupportAsFallback
3347 {
3348     return [self _boolValueForKey:WebKitAllowMediaContentTypesRequiringHardwareSupportAsFallbackKey];
3349 }
3350
3351 - (void)setAllowMediaContentTypesRequiringHardwareSupportAsFallback:(BOOL)flag
3352 {
3353     [self _setBoolValue:flag forKey:WebKitAllowMediaContentTypesRequiringHardwareSupportAsFallbackKey];
3354 }
3355
3356 - (BOOL)inspectorAdditionsEnabled
3357 {
3358     return [self _boolValueForKey:WebKitInspectorAdditionsEnabledPreferenceKey];
3359 }
3360
3361 - (void)setInspectorAdditionsEnabled:(BOOL)flag
3362 {
3363     [self _setBoolValue:flag forKey:WebKitInspectorAdditionsEnabledPreferenceKey];
3364 }
3365
3366 - (BOOL)accessibilityObjectModelEnabled
3367 {
3368     return [self _boolValueForKey:WebKitAccessibilityObjectModelEnabledPreferenceKey];
3369 }
3370
3371 - (void)setAccessibilityObjectModelEnabled:(BOOL)flag
3372 {
3373     [self _setBoolValue:flag forKey:WebKitAccessibilityObjectModelEnabledPreferenceKey];
3374 }
3375
3376 - (BOOL)ariaReflectionEnabled
3377 {
3378     return [self _boolValueForKey:WebKitAriaReflectionEnabledPreferenceKey];
3379 }
3380
3381 - (void)setAriaReflectionEnabled:(BOOL)flag
3382 {
3383     [self _setBoolValue:flag forKey:WebKitAriaReflectionEnabledPreferenceKey];
3384 }
3385
3386 - (BOOL)mediaCapabilitiesEnabled
3387 {
3388     return [self _boolValueForKey:WebKitMediaCapabilitiesEnabledPreferenceKey];
3389 }
3390
3391 - (void)setMediaCapabilitiesEnabled:(BOOL)flag
3392 {
3393     [self _setBoolValue:flag forKey:WebKitMediaCapabilitiesEnabledPreferenceKey];
3394 }
3395
3396 - (BOOL)mediaRecorderEnabled
3397 {
3398     return [self _boolValueForKey:WebKitMediaRecorderEnabledPreferenceKey];
3399 }
3400
3401 - (void)setMediaRecorderEnabled:(BOOL)flag
3402 {
3403     [self _setBoolValue:flag forKey:WebKitMediaRecorderEnabledPreferenceKey];
3404 }
3405
3406 - (BOOL)serverTimingEnabled
3407 {
3408     return [self _boolValueForKey:WebKitServerTimingEnabledPreferenceKey];
3409 }
3410
3411 - (void)setServerTimingEnabled:(BOOL)flag
3412 {
3413     [self _setBoolValue:flag forKey:WebKitServerTimingEnabledPreferenceKey];
3414 }
3415
3416 - (BOOL)selectionAcrossShadowBoundariesEnabled
3417 {
3418     return [self _boolValueForKey:WebKitSelectionAcrossShadowBoundariesEnabledPreferenceKey];
3419 }
3420
3421 - (void)setSelectionAcrossShadowBoundariesEnabled:(BOOL)flag
3422 {
3423     [self _setBoolValue:flag forKey:WebKitSelectionAcrossShadowBoundariesEnabledPreferenceKey];
3424 }
3425
3426 - (BOOL)cssLogicalEnabled
3427 {
3428     return [self _boolValueForKey:WebKitCSSLogicalEnabledPreferenceKey];
3429 }
3430
3431 - (void)setCSSLogicalEnabled:(BOOL)flag
3432 {
3433     [self _setBoolValue:flag forKey:WebKitCSSLogicalEnabledPreferenceKey];
3434 }
3435
3436 - (BOOL)adClickAttributionEnabled
3437 {
3438     return [self _boolValueForKey:WebKitAdClickAttributionEnabledPreferenceKey];
3439 }
3440
3441 - (void)setAdClickAttributionEnabled:(BOOL)flag
3442 {
3443     [self _setBoolValue:flag forKey:WebKitAdClickAttributionEnabledPreferenceKey];
3444 }
3445
3446 - (BOOL)referrerPolicyAttributeEnabled
3447 {
3448     return [self _boolValueForKey:WebKitReferrerPolicyAttributeEnabledPreferenceKey];
3449 }
3450
3451 - (void)setReferrerPolicyAttributeEnabled:(BOOL)flag
3452 {
3453     [self _setBoolValue:flag forKey:WebKitReferrerPolicyAttributeEnabledPreferenceKey];
3454 }
3455
3456 - (BOOL)resizeObserverEnabled
3457 {
3458     return [self _boolValueForKey:WebKitResizeObserverEnabledPreferenceKey];
3459 }
3460
3461 - (void)setResizeObserverEnabled:(BOOL)flag
3462 {
3463     [self _setBoolValue:flag forKey:WebKitResizeObserverEnabledPreferenceKey];
3464 }
3465 @end
3466
3467 @implementation WebPreferences (WebInternal)
3468
3469 + (NSString *)_IBCreatorID
3470 {
3471     return classIBCreatorID;
3472 }
3473
3474 + (NSString *)_concatenateKeyWithIBCreatorID:(NSString *)key
3475 {
3476     NSString *IBCreatorID = [WebPreferences _IBCreatorID];
3477     if (!IBCreatorID)
3478         return key;
3479     return [IBCreatorID stringByAppendingString:key];
3480 }
3481
3482 @end