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