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