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