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