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