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