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