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