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