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