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