blob: 540de1d31bd1e64a23a7573e13c5b7005e8303fe [file] [log] [blame]
darin123ff8e2005-06-05 17:54:49 +00001/*
aestes@apple.comf000b5c2017-01-30 01:40:29 +00002 * Copyright (C) 2005-2017 Apple Inc. All rights reserved.
bdashfb3f9562006-10-04 02:31:10 +00003 * (C) 2006 Graham Dennis (graham.dennis@gmail.com)
darin123ff8e2005-06-05 17:54:49 +00004 *
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.
mjs@apple.com92047332014-03-15 04:08:27 +000014 * 3. Neither the name of Apple Inc. ("Apple") nor the names of
darin123ff8e2005-06-05 17:54:49 +000015 * 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 */
darinfbff5892002-09-10 15:52:06 +000029
ggaren2e941232007-05-26 00:28:27 +000030#import "WebPreferencesPrivate.h"
31#import "WebPreferenceKeysPrivate.h"
sullivan6b34b0c2002-03-21 19:38:37 +000032
achristensen@apple.comcc76ce82019-01-22 21:28:28 +000033#import "NetworkStorageSessionMap.h"
joepeck@webkit.org4112f8b2010-07-31 02:22:05 +000034#import "WebApplicationCache.h"
ap@apple.com9ffc45d2012-11-16 17:46:50 +000035#import "WebFrameNetworkingContext.h"
ggaren2e941232007-05-26 00:28:27 +000036#import "WebKitLogging.h"
37#import "WebKitNSStringExtras.h"
ggaren414ee7e2007-09-08 00:40:53 +000038#import "WebKitVersionChecks.h"
ggaren2e941232007-05-26 00:28:27 +000039#import "WebNSDictionaryExtras.h"
40#import "WebNSURLExtras.h"
don.olmstead@sony.com71f34a02018-02-07 05:20:34 +000041#import <JavaScriptCore/InitializeThreading.h>
joepeck@webkit.org4112f8b2010-07-31 02:22:05 +000042#import <WebCore/ApplicationCacheStorage.h>
simon.fraser@apple.comd0573e42014-01-14 01:27:57 +000043#import <WebCore/AudioSession.h>
commit-queue@webkit.orge5c3d722017-10-19 23:02:56 +000044#import <WebCore/DeprecatedGlobalSettings.h>
ap@apple.comf18b8092012-12-23 02:15:18 +000045#import <WebCore/NetworkStorageSession.h>
dino@apple.com07bc2602016-03-14 01:09:17 +000046#import <WebCore/RuntimeApplicationChecks.h>
jer.noble@apple.combc93e4d2015-04-23 22:43:38 +000047#import <WebCore/Settings.h>
ap@apple.com7ce55d22014-08-06 20:25:00 +000048#import <WebCore/TextEncodingRegistry.h>
commit-queue@webkit.orgaa0ac382017-08-04 00:20:37 +000049#import <pal/spi/cf/CFNetworkSPI.h>
weinig@apple.comfbfc08f2012-12-27 18:57:59 +000050#import <wtf/MainThread.h>
joepeck@webkit.org3c82fdf2012-07-15 23:01:11 +000051#import <wtf/RetainPtr.h>
commit-queue@webkit.org67033622014-03-27 22:49:16 +000052#import <wtf/RunLoop.h>
ap@apple.com5d809022011-08-30 18:57:08 +000053
54using namespace WebCore;
cblu72e4d302003-07-09 21:57:19 +000055
ap@apple.com1e8475922018-10-18 21:38:50 +000056#if PLATFORM(IOS_FAMILY)
aestes@apple.com0d5a0902015-11-02 20:29:38 +000057#import <WebCore/Device.h>
aestes@apple.coma43fba52013-12-31 23:46:34 +000058#import <WebCore/GraphicsContext.h>
aestes@apple.coma43fba52013-12-31 23:46:34 +000059#import <WebCore/WebCoreThreadMessage.h>
60#endif
61
rjw5fd5a7f2003-02-07 22:08:16 +000062NSString *WebPreferencesChangedNotification = @"WebPreferencesChangedNotification";
ggaren414ee7e2007-09-08 00:40:53 +000063NSString *WebPreferencesRemovedNotification = @"WebPreferencesRemovedNotification";
mjs@apple.com60484932011-04-08 19:33:04 +000064NSString *WebPreferencesChangedInternalNotification = @"WebPreferencesChangedInternalNotification";
benjamin@webkit.orgc5e20682012-07-14 23:31:03 +000065NSString *WebPreferencesCacheModelChangedInternalNotification = @"WebPreferencesCacheModelChangedInternalNotification";
rjw5fd5a7f2003-02-07 22:08:16 +000066
benjamin@webkit.org15fc1812012-07-15 20:24:03 +000067#define KEY(x) (_private->identifier ? [_private->identifier.get() stringByAppendingString:(x)] : (x))
rjw46467492003-05-22 03:52:50 +000068
69enum { WebPreferencesVersion = 1 };
70
ggaren414ee7e2007-09-08 00:40:53 +000071static WebPreferences *_standardPreferences;
72static NSMutableDictionary *webPreferencesInstances;
73
ap@apple.come3691aa2014-01-15 21:30:26 +000074static unsigned webPreferencesInstanceCountWithPrivateBrowsingEnabled;
75
darin@apple.combe91ed92017-12-07 04:06:53 +000076template<unsigned size> static bool contains(const char* const (&array)[size], const char* item)
ggaren414ee7e2007-09-08 00:40:53 +000077{
78 if (!item)
79 return false;
darin@apple.combe91ed92017-12-07 04:06:53 +000080 for (auto* string : array) {
81 if (equalIgnoringASCIICase(string, item))
ggaren414ee7e2007-09-08 00:40:53 +000082 return true;
darin@apple.combe91ed92017-12-07 04:06:53 +000083 }
ggaren414ee7e2007-09-08 00:40:53 +000084 return false;
85}
86
87static WebCacheModel cacheModelForMainBundle(void)
88{
aroben@webkit.org1d298a02013-10-13 04:05:49 +000089 @autoreleasepool {
90 // Apps that probably need the small setting
91 static const char* const documentViewerIDs[] = {
92 "Microsoft/com.microsoft.Messenger",
93 "com.adiumX.adiumX",
94 "com.alientechnology.Proteus",
95 "com.apple.Dashcode",
96 "com.apple.iChat",
97 "com.barebones.bbedit",
98 "com.barebones.textwrangler",
99 "com.barebones.yojimbo",
100 "com.equinux.iSale4",
101 "com.growl.growlframework",
102 "com.intrarts.PandoraMan",
103 "com.karelia.Sandvox",
104 "com.macromates.textmate",
105 "com.realmacsoftware.rapidweaverpro",
106 "com.red-sweater.marsedit",
107 "com.yahoo.messenger3",
108 "de.codingmonkeys.SubEthaEdit",
109 "fi.karppinen.Pyro",
110 "info.colloquy",
111 "kungfoo.tv.ecto",
112 };
ggaren414ee7e2007-09-08 00:40:53 +0000113
aroben@webkit.org1d298a02013-10-13 04:05:49 +0000114 // Apps that probably need the medium setting
115 static const char* const documentBrowserIDs[] = {
116 "com.apple.Dictionary",
117 "com.apple.Xcode",
aroben@webkit.org1d298a02013-10-13 04:05:49 +0000118 "com.apple.helpviewer",
119 "com.culturedcode.xyle",
120 "com.macrabbit.CSSEdit",
121 "com.panic.Coda",
122 "com.ranchero.NetNewsWire",
123 "com.thinkmac.NewsLife",
124 "org.xlife.NewsFire",
125 "uk.co.opencommunity.vienna2",
126 };
ggaren414ee7e2007-09-08 00:40:53 +0000127
aroben@webkit.org1d298a02013-10-13 04:05:49 +0000128 // Apps that probably need the large setting
129 static const char* const primaryWebBrowserIDs[] = {
130 "com.app4mac.KidsBrowser"
131 "com.app4mac.wKiosk",
132 "com.freeverse.bumpercar",
133 "com.omnigroup.OmniWeb5",
134 "com.sunrisebrowser.Sunrise",
135 "net.hmdt-web.Shiira",
136 };
ggaren414ee7e2007-09-08 00:40:53 +0000137
aroben@webkit.org1d298a02013-10-13 04:05:49 +0000138 const char* bundleID = [[[NSBundle mainBundle] bundleIdentifier] UTF8String];
darin@apple.combe91ed92017-12-07 04:06:53 +0000139 if (contains(documentViewerIDs, bundleID))
aroben@webkit.org1d298a02013-10-13 04:05:49 +0000140 return WebCacheModelDocumentViewer;
darin@apple.combe91ed92017-12-07 04:06:53 +0000141 if (contains(documentBrowserIDs, bundleID))
aroben@webkit.org1d298a02013-10-13 04:05:49 +0000142 return WebCacheModelDocumentBrowser;
darin@apple.combe91ed92017-12-07 04:06:53 +0000143 if (contains(primaryWebBrowserIDs, bundleID))
aroben@webkit.org1d298a02013-10-13 04:05:49 +0000144 return WebCacheModelPrimaryWebBrowser;
ggaren414ee7e2007-09-08 00:40:53 +0000145
aroben@webkit.org1d298a02013-10-13 04:05:49 +0000146 bool isLinkedAgainstWebKit = WebKitLinkedOnOrAfter(0);
147 if (!isLinkedAgainstWebKit)
148 return WebCacheModelDocumentViewer; // Apps that don't link against WebKit probably aren't meant to be browsers.
ggaren414ee7e2007-09-08 00:40:53 +0000149
ap@apple.com1e8475922018-10-18 21:38:50 +0000150#if !PLATFORM(IOS_FAMILY)
ggaren414ee7e2007-09-08 00:40:53 +0000151 bool isLegacyApp = !WebKitLinkedOnOrAfter(WEBKIT_FIRST_VERSION_WITH_CACHE_MODEL_API);
aestes@apple.coma43fba52013-12-31 23:46:34 +0000152#else
153 bool isLegacyApp = false;
154#endif
ggaren414ee7e2007-09-08 00:40:53 +0000155 if (isLegacyApp)
aroben@webkit.org1d298a02013-10-13 04:05:49 +0000156 return WebCacheModelDocumentBrowser; // To avoid regressions in apps that depended on old WebKit's large cache.
157
158 return WebCacheModelDocumentViewer; // To save memory.
ggaren414ee7e2007-09-08 00:40:53 +0000159 }
ggaren414ee7e2007-09-08 00:40:53 +0000160}
161
benjamin@webkit.orgc5e20682012-07-14 23:31:03 +0000162@interface WebPreferences ()
163- (void)_postCacheModelChangedNotification;
164@end
165
rjw2293d4a2003-07-29 01:23:26 +0000166@interface WebPreferences (WebInternal)
rjw3a8520a2003-08-28 23:17:07 +0000167+ (NSString *)_concatenateKeyWithIBCreatorID:(NSString *)key;
rjw2293d4a2003-07-29 01:23:26 +0000168+ (NSString *)_IBCreatorID;
169@end
170
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000171struct WebPreferencesPrivate
172{
173public:
174 WebPreferencesPrivate()
ap@apple.come3691aa2014-01-15 21:30:26 +0000175 : inPrivateBrowsing(NO)
176 , autosaves(NO)
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000177 , automaticallyDetectsCacheModel(NO)
178 , numWebViews(0)
ap@apple.com1e8475922018-10-18 21:38:50 +0000179#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000180 , readWriteQueue(dispatch_queue_create("com.apple.WebPreferences.ReadWriteQueue", DISPATCH_QUEUE_CONCURRENT))
181#endif
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000182 {
183 }
184
ap@apple.com1e8475922018-10-18 21:38:50 +0000185#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000186 ~WebPreferencesPrivate()
187 {
188 dispatch_release(readWriteQueue);
189 }
190#endif
191
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000192 RetainPtr<NSMutableDictionary> values;
ap@apple.come3691aa2014-01-15 21:30:26 +0000193 BOOL inPrivateBrowsing;
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000194 RetainPtr<NSString> identifier;
195 BOOL autosaves;
196 BOOL automaticallyDetectsCacheModel;
197 unsigned numWebViews;
ap@apple.com1e8475922018-10-18 21:38:50 +0000198#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000199 dispatch_queue_t readWriteQueue;
200#endif
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000201};
202
kdeckere398dcd62006-02-22 00:55:26 +0000203@interface WebPreferences (WebForwardDeclarations)
204// This pseudo-category is needed so these methods can be used from within other category implementations
205// without being in the public header file.
206- (BOOL)_boolValueForKey:(NSString *)key;
207- (void)_setBoolValue:(BOOL)value forKey:(NSString *)key;
208- (int)_integerValueForKey:(NSString *)key;
209- (void)_setIntegerValue:(int)value forKey:(NSString *)key;
210- (float)_floatValueForKey:(NSString *)key;
211- (void)_setFloatValue:(float)value forKey:(NSString *)key;
joepeck@webkit.org4112f8b2010-07-31 02:22:05 +0000212- (void)_setLongLongValue:(long long)value forKey:(NSString *)key;
213- (long long)_longLongValueForKey:(NSString *)key;
beidson@apple.com2dbe1212007-11-27 03:28:31 +0000214- (void)_setUnsignedLongLongValue:(unsigned long long)value forKey:(NSString *)key;
215- (unsigned long long)_unsignedLongLongValueForKey:(NSString *)key;
kdeckere398dcd62006-02-22 00:55:26 +0000216@end
217
ap@apple.com1e8475922018-10-18 21:38:50 +0000218#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000219@interface WebPreferences ()
220- (id)initWithIdentifier:(NSString *)anIdentifier sendChangeNotification:(BOOL)sendChangeNotification;
221@end
222#endif
223
darinf7e15ec2002-07-16 16:17:05 +0000224@implementation WebPreferences
sullivan6b34b0c2002-03-21 19:38:37 +0000225
mrowe@apple.com28611202013-12-11 09:27:32 +0000226- (instancetype)init
rjwbb6206f2003-04-16 02:18:48 +0000227{
rjw61fb9fd2003-10-03 23:24:02 +0000228 // Create fake identifier
229 static int instanceCount = 1;
230 NSString *fakeIdentifier;
231
232 // At least ensure that identifier hasn't been already used.
233 fakeIdentifier = [NSString stringWithFormat:@"WebPreferences%d", instanceCount++];
234 while ([[self class] _getInstanceForIdentifier:fakeIdentifier]){
235 fakeIdentifier = [NSString stringWithFormat:@"WebPreferences%d", instanceCount++];
236 }
237
238 return [self initWithIdentifier:fakeIdentifier];
rjw46467492003-05-22 03:52:50 +0000239}
240
ap@apple.com1e8475922018-10-18 21:38:50 +0000241#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000242- (id)initWithIdentifier:(NSString *)anIdentifier
243{
244 return [self initWithIdentifier:anIdentifier sendChangeNotification:YES];
245}
246#endif
247
ap@apple.com1e8475922018-10-18 21:38:50 +0000248#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000249- (instancetype)initWithIdentifier:(NSString *)anIdentifier sendChangeNotification:(BOOL)sendChangeNotification
250#else
mrowe@apple.com28611202013-12-11 09:27:32 +0000251- (instancetype)initWithIdentifier:(NSString *)anIdentifier
aestes@apple.coma43fba52013-12-31 23:46:34 +0000252#endif
rjw46467492003-05-22 03:52:50 +0000253{
rjw46467492003-05-22 03:52:50 +0000254 WebPreferences *instance = [[self class] _getInstanceForIdentifier:anIdentifier];
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000255 if (instance) {
rjw46467492003-05-22 03:52:50 +0000256 [self release];
rjw60281c02003-05-27 22:03:28 +0000257 return [instance retain];
rjw46467492003-05-22 03:52:50 +0000258 }
259
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000260 self = [super init];
261 if (!self)
262 return nil;
263
264 _private = new WebPreferencesPrivate;
darin@apple.com051fed92013-04-28 03:51:20 +0000265 _private->values = adoptNS([[NSMutableDictionary alloc] init]);
266 _private->identifier = adoptNS([anIdentifier copy]);
ggaren414ee7e2007-09-08 00:40:53 +0000267 _private->automaticallyDetectsCacheModel = YES;
268
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000269 [[self class] _setInstance:self forIdentifier:_private->identifier.get()];
rjw46467492003-05-22 03:52:50 +0000270
ap@apple.come3691aa2014-01-15 21:30:26 +0000271 [self _updatePrivateBrowsingStateTo:[self privateBrowsingEnabled]];
272
ap@apple.com1e8475922018-10-18 21:38:50 +0000273#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000274 if (sendChangeNotification) {
275 [self _postPreferencesChangedNotification];
276 [self _postCacheModelChangedNotification];
277 }
278#else
mjs@apple.com60484932011-04-08 19:33:04 +0000279 [self _postPreferencesChangedNotification];
benjamin@webkit.orgc5e20682012-07-14 23:31:03 +0000280 [self _postCacheModelChangedNotification];
aestes@apple.coma43fba52013-12-31 23:46:34 +0000281#endif
rjw46467492003-05-22 03:52:50 +0000282
rjwbb6206f2003-04-16 02:18:48 +0000283 return self;
284}
285
mrowe@apple.com28611202013-12-11 09:27:32 +0000286- (instancetype)initWithCoder:(NSCoder *)decoder
rjw46467492003-05-22 03:52:50 +0000287{
darin07eefe12007-09-14 20:42:32 +0000288 self = [super init];
289 if (!self)
290 return nil;
rjw46467492003-05-22 03:52:50 +0000291
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000292 _private = new WebPreferencesPrivate;
ggaren414ee7e2007-09-08 00:40:53 +0000293 _private->automaticallyDetectsCacheModel = YES;
darin07eefe12007-09-14 20:42:32 +0000294
295 @try {
296 id identifier = nil;
297 id values = nil;
298 if ([decoder allowsKeyedCoding]) {
299 identifier = [decoder decodeObjectForKey:@"Identifier"];
300 values = [decoder decodeObjectForKey:@"Values"];
301 } else {
302 int version;
303 [decoder decodeValueOfObjCType:@encode(int) at:&version];
304 if (version == 1) {
305 identifier = [decoder decodeObject];
306 values = [decoder decodeObject];
307 }
rjw46467492003-05-22 03:52:50 +0000308 }
darin07eefe12007-09-14 20:42:32 +0000309
310 if ([identifier isKindOfClass:[NSString class]])
darin@apple.com051fed92013-04-28 03:51:20 +0000311 _private->identifier = adoptNS([identifier copy]);
darin07eefe12007-09-14 20:42:32 +0000312 if ([values isKindOfClass:[NSDictionary class]])
darin@apple.com051fed92013-04-28 03:51:20 +0000313 _private->values = adoptNS([values mutableCopy]); // ensure dictionary is mutable
darin07eefe12007-09-14 20:42:32 +0000314
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000315 LOG(Encoding, "Identifier = %@, Values = %@\n", _private->identifier.get(), _private->values.get());
bdashfa58f632007-09-14 21:27:49 +0000316 } @catch(id) {
darin07eefe12007-09-14 20:42:32 +0000317 [self release];
318 return nil;
rjw46467492003-05-22 03:52:50 +0000319 }
darin07eefe12007-09-14 20:42:32 +0000320
rjwd39f8a92003-05-23 23:56:48 +0000321 // If we load a nib multiple times, or have instances in multiple
322 // nibs with the same name, the first guy up wins.
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000323 WebPreferences *instance = [[self class] _getInstanceForIdentifier:_private->identifier.get()];
darin07eefe12007-09-14 20:42:32 +0000324 if (instance) {
rjw41229092003-05-27 18:34:05 +0000325 [self release];
darin07eefe12007-09-14 20:42:32 +0000326 self = [instance retain];
327 } else {
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000328 [[self class] _setInstance:self forIdentifier:_private->identifier.get()];
ap@apple.come3691aa2014-01-15 21:30:26 +0000329 [self _updatePrivateBrowsingStateTo:[self privateBrowsingEnabled]];
rjwd39f8a92003-05-23 23:56:48 +0000330 }
rjwd39f8a92003-05-23 23:56:48 +0000331
darin07eefe12007-09-14 20:42:32 +0000332 return self;
rjw46467492003-05-22 03:52:50 +0000333}
334
335- (void)encodeWithCoder:(NSCoder *)encoder
336{
rjwd39f8a92003-05-23 23:56:48 +0000337 if ([encoder allowsKeyedCoding]){
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000338 [encoder encodeObject:_private->identifier.get() forKey:@"Identifier"];
ap@apple.com1e8475922018-10-18 21:38:50 +0000339#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000340 dispatch_sync(_private->readWriteQueue, ^{
341#endif
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000342 [encoder encodeObject:_private->values.get() forKey:@"Values"];
343 LOG (Encoding, "Identifier = %@, Values = %@\n", _private->identifier.get(), _private->values.get());
ap@apple.com1e8475922018-10-18 21:38:50 +0000344#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000345 });
346#endif
rjwd39f8a92003-05-23 23:56:48 +0000347 }
348 else {
349 int version = WebPreferencesVersion;
350 [encoder encodeValueOfObjCType:@encode(int) at:&version];
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000351 [encoder encodeObject:_private->identifier.get()];
ap@apple.com1e8475922018-10-18 21:38:50 +0000352#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000353 dispatch_sync(_private->readWriteQueue, ^{
354#endif
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000355 [encoder encodeObject:_private->values.get()];
ap@apple.com1e8475922018-10-18 21:38:50 +0000356#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000357 });
358#endif
rjwd39f8a92003-05-23 23:56:48 +0000359 }
rjw46467492003-05-22 03:52:50 +0000360}
361
darin2778da12003-03-05 00:56:40 +0000362+ (WebPreferences *)standardPreferences
sullivan6b34b0c2002-03-21 19:38:37 +0000363{
ap@apple.com1e8475922018-10-18 21:38:50 +0000364#if !PLATFORM(IOS_FAMILY)
darin2778da12003-03-05 00:56:40 +0000365 if (_standardPreferences == nil) {
rjw61fb9fd2003-10-03 23:24:02 +0000366 _standardPreferences = [[WebPreferences alloc] initWithIdentifier:nil];
rjw46467492003-05-22 03:52:50 +0000367 [_standardPreferences setAutosaves:YES];
darin2778da12003-03-05 00:56:40 +0000368 }
aestes@apple.coma43fba52013-12-31 23:46:34 +0000369#else
ap@apple.come3691aa2014-01-15 21:30:26 +0000370 // FIXME: This check is necessary to avoid recursion (see <rdar://problem/9564337>), but it also makes _standardPreferences construction not thread safe.
aestes@apple.coma43fba52013-12-31 23:46:34 +0000371 if (_standardPreferences)
372 return _standardPreferences;
373
374 static dispatch_once_t pred;
375 dispatch_once(&pred, ^{
376 _standardPreferences = [[WebPreferences alloc] initWithIdentifier:nil sendChangeNotification:NO];
377 [_standardPreferences _postPreferencesChangedNotification];
378 [_standardPreferences setAutosaves:YES];
379 });
380#endif
darin2778da12003-03-05 00:56:40 +0000381
382 return _standardPreferences;
383}
384
385// if we ever have more than one WebPreferences object, this would move to init
386+ (void)initialize
387{
ap@apple.com1e8475922018-10-18 21:38:50 +0000388#if !PLATFORM(IOS_FAMILY)
weinig@apple.comfbfc08f2012-12-27 18:57:59 +0000389 JSC::initializeThreading();
390 WTF::initializeMainThreadToProcessMainThread();
commit-queue@webkit.org67033622014-03-27 22:49:16 +0000391 RunLoop::initializeMainRunLoop();
dino@apple.com07bc2602016-03-14 01:09:17 +0000392 bool attachmentElementEnabled = MacApplication::isAppleMail();
jer.noble@apple.comfd286342015-08-28 18:51:42 +0000393#else
aestes@apple.com0d5a0902015-11-02 20:29:38 +0000394 bool allowsInlineMediaPlayback = WebCore::deviceClass() == MGDeviceClassiPad;
jer.noble@apple.com9fa59132016-05-19 21:59:12 +0000395 bool allowsInlineMediaPlaybackAfterFullscreen = WebCore::deviceClass() != MGDeviceClassiPad;
jer.noble@apple.comfd286342015-08-28 18:51:42 +0000396 bool requiresPlaysInlineAttribute = !allowsInlineMediaPlayback;
dino@apple.com07bc2602016-03-14 01:09:17 +0000397 bool attachmentElementEnabled = IOSApplication::isMobileMail();
aestes@apple.coma43fba52013-12-31 23:46:34 +0000398#endif
weinig@apple.comfbfc08f2012-12-27 18:57:59 +0000399
sullivan6b34b0c2002-03-21 19:38:37 +0000400 NSDictionary *dict = [NSDictionary dictionaryWithObjectsAndKeys:
gramps92119132003-04-29 02:09:53 +0000401 @"Times", WebKitStandardFontPreferenceKey,
darina9bdc3e2002-08-06 15:36:10 +0000402 @"Courier", WebKitFixedFontPreferenceKey,
gramps92119132003-04-29 02:09:53 +0000403 @"Times", WebKitSerifFontPreferenceKey,
404 @"Helvetica", WebKitSansSerifFontPreferenceKey,
ap@apple.com1e8475922018-10-18 21:38:50 +0000405#if !PLATFORM(IOS_FAMILY)
darin54a62802003-03-25 17:23:54 +0000406 @"Apple Chancery", WebKitCursiveFontPreferenceKey,
aestes@apple.coma43fba52013-12-31 23:46:34 +0000407#else
408 @"Snell Roundhand", WebKitCursiveFontPreferenceKey,
409#endif
darina9bdc3e2002-08-06 15:36:10 +0000410 @"Papyrus", WebKitFantasyFontPreferenceKey,
ap@apple.com1e8475922018-10-18 21:38:50 +0000411#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000412 @"AppleColorEmoji", WebKitPictographFontPreferenceKey,
413#else
mitz@apple.com676a2002011-07-26 20:23:50 +0000414 @"Apple Color Emoji", WebKitPictographFontPreferenceKey,
aestes@apple.coma43fba52013-12-31 23:46:34 +0000415#endif
hyatt@apple.com80958a72010-11-16 23:28:53 +0000416 @"0", WebKitMinimumFontSizePreferenceKey,
darin72541772005-03-10 19:29:57 +0000417 @"9", WebKitMinimumLogicalFontSizePreferenceKey,
gramps92119132003-04-29 02:09:53 +0000418 @"16", WebKitDefaultFontSizePreferenceKey,
419 @"13", WebKitDefaultFixedFontSizePreferenceKey,
cblue8cd5472003-09-09 21:28:26 +0000420 @"ISO-8859-1", WebKitDefaultTextEncodingNamePreferenceKey,
eric@webkit.orgb59b8a52009-03-27 00:01:58 +0000421 [NSNumber numberWithBool:NO], WebKitUsesEncodingDetectorPreferenceKey,
darinfbff5892002-09-10 15:52:06 +0000422 [NSNumber numberWithBool:NO], WebKitUserStyleSheetEnabledPreferenceKey,
gramps92119132003-04-29 02:09:53 +0000423 @"", WebKitUserStyleSheetLocationPreferenceKey,
ap@apple.com1e8475922018-10-18 21:38:50 +0000424#if !PLATFORM(IOS_FAMILY)
sullivan8dc1c0e2003-09-18 15:26:08 +0000425 [NSNumber numberWithBool:NO], WebKitShouldPrintBackgroundsPreferenceKey,
sullivan6b395972005-05-24 17:20:36 +0000426 [NSNumber numberWithBool:NO], WebKitTextAreasAreResizablePreferenceKey,
aestes@apple.coma43fba52013-12-31 23:46:34 +0000427#endif
andersca@apple.com5d1ba5e2007-11-29 22:10:11 +0000428 [NSNumber numberWithBool:NO], WebKitShrinksStandaloneImagesToFitPreferenceKey,
ap@apple.com1e8475922018-10-18 21:38:50 +0000429#if !PLATFORM(IOS_FAMILY)
rjw257f3ec2002-12-13 18:49:29 +0000430 [NSNumber numberWithBool:YES], WebKitJavaEnabledPreferenceKey,
aestes@apple.coma43fba52013-12-31 23:46:34 +0000431#endif
darinfbff5892002-09-10 15:52:06 +0000432 [NSNumber numberWithBool:YES], WebKitJavaScriptEnabledPreferenceKey,
weinig@apple.com21e76be2015-04-17 00:28:20 +0000433 [NSNumber numberWithBool:YES], WebKitJavaScriptMarkupEnabledPreferenceKey,
abarth@webkit.orgaf477982009-01-31 08:42:29 +0000434 [NSNumber numberWithBool:YES], WebKitWebSecurityEnabledPreferenceKey,
abarth@webkit.org0a502fb2009-08-23 04:43:32 +0000435 [NSNumber numberWithBool:YES], WebKitAllowUniversalAccessFromFileURLsPreferenceKey,
eric@webkit.orge85e2372010-02-17 07:32:30 +0000436 [NSNumber numberWithBool:YES], WebKitAllowFileAccessFromFileURLsPreferenceKey,
ap@apple.com1e8475922018-10-18 21:38:50 +0000437#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000438 [NSNumber numberWithBool:NO], WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey,
439#else
rjw257f3ec2002-12-13 18:49:29 +0000440 [NSNumber numberWithBool:YES], WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey,
aestes@apple.coma43fba52013-12-31 23:46:34 +0000441#endif
darinfbff5892002-09-10 15:52:06 +0000442 [NSNumber numberWithBool:YES], WebKitPluginsEnabledPreferenceKey,
mitz@apple.comc278ea22008-11-08 19:12:23 +0000443 [NSNumber numberWithBool:YES], WebKitDatabasesEnabledPreferenceKey,
beidson@apple.com855d88b2015-07-02 20:19:36 +0000444 [NSNumber numberWithBool:YES], WebKitHTTPEquivEnabledPreferenceKey,
445
ap@apple.com1e8475922018-10-18 21:38:50 +0000446#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000447 [NSNumber numberWithBool:NO], WebKitStorageTrackerEnabledPreferenceKey,
448#endif
mitz@apple.comc278ea22008-11-08 19:12:23 +0000449 [NSNumber numberWithBool:YES], WebKitLocalStorageEnabledPreferenceKey,
atwilson@chromium.org046e5022009-09-25 02:45:14 +0000450 [NSNumber numberWithBool:NO], WebKitExperimentalNotificationsEnabledPreferenceKey,
darinfbff5892002-09-10 15:52:06 +0000451 [NSNumber numberWithBool:YES], WebKitAllowAnimatedImagesPreferenceKey,
452 [NSNumber numberWithBool:YES], WebKitAllowAnimatedImageLoopingPreferenceKey,
gramps92119132003-04-29 02:09:53 +0000453 [NSNumber numberWithBool:YES], WebKitDisplayImagesKey,
alice.liu@apple.comdc9ed392011-04-12 20:22:22 +0000454 [NSNumber numberWithBool:NO], WebKitLoadSiteIconsKey,
rjw94db6432003-05-31 00:37:40 +0000455 @"1800", WebKitBackForwardCacheExpirationIntervalKey,
ap@apple.com1e8475922018-10-18 21:38:50 +0000456#if !PLATFORM(IOS_FAMILY)
kocienda995dbef2003-11-13 21:37:17 +0000457 [NSNumber numberWithBool:NO], WebKitTabToLinksPreferenceKey,
aestes@apple.coma43fba52013-12-31 23:46:34 +0000458#endif
sullivan834fc032004-04-14 20:39:56 +0000459 [NSNumber numberWithBool:NO], WebKitPrivateBrowsingEnabledPreferenceKey,
ap@apple.com1e8475922018-10-18 21:38:50 +0000460#if !PLATFORM(IOS_FAMILY)
sullivanfd93e2f2004-09-27 21:30:50 +0000461 [NSNumber numberWithBool:NO], WebKitRespectStandardStyleKeyEquivalentsPreferenceKey,
sullivand64529c2004-12-16 21:33:09 +0000462 [NSNumber numberWithBool:NO], WebKitShowsURLsInToolTipsPreferenceKey,
mitz@apple.com13ed5592011-08-13 06:25:30 +0000463 [NSNumber numberWithBool:NO], WebKitShowsToolTipOverTruncatedTextPreferenceKey,
sullivanf33213d2005-08-01 17:50:35 +0000464 @"1", WebKitPDFDisplayModePreferenceKey,
sullivan56d3d8e2006-03-29 21:41:11 +0000465 @"0", WebKitPDFScaleFactorPreferenceKey,
aestes@apple.coma43fba52013-12-31 23:46:34 +0000466#endif
sullivan079a7d42007-03-24 17:25:09 +0000467 @"0", WebKitUseSiteSpecificSpoofingPreferenceKey,
ggarenb6474732007-04-10 18:19:51 +0000468 [NSNumber numberWithInt:WebKitEditableLinkDefaultBehavior], WebKitEditableLinkBehaviorPreferenceKey,
ap@apple.com1e8475922018-10-18 21:38:50 +0000469#if !PLATFORM(IOS_FAMILY)
mitz@apple.com0b72c8d2008-11-26 05:24:20 +0000470 [NSNumber numberWithInt:WebTextDirectionSubmenuAutomaticallyIncluded],
mitz@apple.com0b72c8d2008-11-26 05:24:20 +0000471 WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey,
ggarenb6474732007-04-10 18:19:51 +0000472 [NSNumber numberWithBool:NO], WebKitDOMPasteAllowedPreferenceKey,
aestes@apple.coma43fba52013-12-31 23:46:34 +0000473#endif
ggaren2e941232007-05-26 00:28:27 +0000474 [NSNumber numberWithBool:YES], WebKitUsesPageCachePreferenceKey,
ggaren414ee7e2007-09-08 00:40:53 +0000475 [NSNumber numberWithInt:cacheModelForMainBundle()], WebKitCacheModelPreferenceKey,
benjamin@webkit.org8b6b67a2012-01-24 19:07:34 +0000476 [NSNumber numberWithBool:YES], WebKitPageCacheSupportsPluginsPreferenceKey,
beidson@apple.comaf2e0112008-04-15 00:40:33 +0000477 [NSNumber numberWithBool:NO], WebKitDeveloperExtrasEnabledPreferenceKey,
utatane.tea@gmail.com8d6f6ea2015-02-24 18:20:45 +0000478 [NSNumber numberWithUnsignedInt:0], WebKitJavaScriptRuntimeFlagsPreferenceKey,
timothy@apple.combf423a12007-11-27 17:15:19 +0000479 [NSNumber numberWithBool:YES], WebKitAuthorAndUserStylesEnabledPreferenceKey,
cdumez@apple.com9d3e4a72014-11-19 00:56:33 +0000480 [NSNumber numberWithBool:YES], WebKitDOMTimersThrottlingEnabledPreferenceKey,
beidson@apple.comaf2e0112008-04-15 00:40:33 +0000481 [NSNumber numberWithBool:NO], WebKitWebArchiveDebugModeEnabledPreferenceKey,
beidson@apple.comb16bd432009-07-02 00:38:02 +0000482 [NSNumber numberWithBool:NO], WebKitLocalFileContentSniffingEnabledPreferenceKey,
andersca@apple.comc3a561b2008-04-25 23:36:19 +0000483 [NSNumber numberWithBool:NO], WebKitOfflineWebApplicationCacheEnabledPreferenceKey,
sullivan@apple.com99a39322008-07-31 21:42:45 +0000484 [NSNumber numberWithBool:YES], WebKitZoomsTextOnlyPreferenceKey,
abarth@webkit.org616e41e2010-05-03 21:50:27 +0000485 [NSNumber numberWithBool:NO], WebKitJavaScriptCanAccessClipboardPreferenceKey,
abarth@webkit.orgb983b962009-07-11 01:21:45 +0000486 [NSNumber numberWithBool:YES], WebKitXSSAuditorEnabledPreferenceKey,
cmarrin@apple.com89072a02009-06-25 22:03:59 +0000487 [NSNumber numberWithBool:YES], WebKitAcceleratedCompositingEnabledPreferenceKey,
simon.fraser@apple.coma91c1342017-03-08 01:43:21 +0000488
489#if PLATFORM(MAC) && __MAC_OS_X_VERSION_MIN_REQUIRED >= 101300
490#define DEFAULT_SUBPIXEL_ANTIALIASED_LAYER_TEXT_ENABLED YES
491#else
492#define DEFAULT_SUBPIXEL_ANTIALIASED_LAYER_TEXT_ENABLED NO
493#endif
494 [NSNumber numberWithBool:DEFAULT_SUBPIXEL_ANTIALIASED_LAYER_TEXT_ENABLED], WebKitSubpixelAntialiasedLayerTextEnabledPreferenceKey,
495
simon.fraser@apple.com956c3252016-01-07 01:43:25 +0000496 [NSNumber numberWithBool:NO], WebKitDisplayListDrawingEnabledPreferenceKey,
ap@apple.com1e8475922018-10-18 21:38:50 +0000497#if PLATFORM(IOS_FAMILY) && !PLATFORM(IOS_FAMILY_SIMULATOR)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000498 [NSNumber numberWithBool:YES], WebKitAcceleratedDrawingEnabledPreferenceKey,
499 [NSNumber numberWithBool:YES], WebKitCanvasUsesAcceleratedDrawingPreferenceKey,
500#else
simon.fraser@apple.comd7638512011-02-17 04:54:24 +0000501 [NSNumber numberWithBool:NO], WebKitAcceleratedDrawingEnabledPreferenceKey,
mdelaney@apple.com036685c2011-04-19 23:15:56 +0000502 [NSNumber numberWithBool:NO], WebKitCanvasUsesAcceleratedDrawingPreferenceKey,
aestes@apple.coma43fba52013-12-31 23:46:34 +0000503#endif
andersca@apple.comc1ac9e42009-12-18 21:17:38 +0000504 [NSNumber numberWithBool:NO], WebKitShowDebugBordersPreferenceKey,
zalan@apple.comb7e6a662017-01-25 05:02:56 +0000505 [NSNumber numberWithBool:YES], WebKitSimpleLineLayoutEnabledPreferenceKey,
zalan@apple.comb1f545f2014-11-22 00:59:27 +0000506 [NSNumber numberWithBool:NO], WebKitSimpleLineLayoutDebugBordersEnabledPreferenceKey,
andersca@apple.comc1ac9e42009-12-18 21:17:38 +0000507 [NSNumber numberWithBool:NO], WebKitShowRepaintCounterPreferenceKey,
dino@apple.com2d7d8c02013-09-09 20:30:01 +0000508 [NSNumber numberWithBool:YES], WebKitWebGLEnabledPreferenceKey,
dino@apple.com997f7b12017-02-14 23:31:12 +0000509 [NSNumber numberWithBool:YES], WebKitForceWebGLUsesLowPowerPreferenceKey,
cmarrin@apple.com09fa67e2010-09-17 18:35:46 +0000510 [NSNumber numberWithBool:NO], WebKitAccelerated2dCanvasEnabledPreferenceKey,
zalan@apple.com51a5d6e2014-07-11 15:27:42 +0000511 [NSNumber numberWithBool:NO], WebKitSubpixelCSSOMElementMetricsEnabledPreferenceKey,
bfulgham@apple.comb0f69c92016-02-16 05:36:38 +0000512 [NSNumber numberWithBool:NO], WebKitResourceLoadStatisticsEnabledPreferenceKey,
commit-queue@webkit.orgd57dde42016-11-30 23:48:00 +0000513 [NSNumber numberWithBool:YES], WebKitLargeImageAsyncDecodingEnabledPreferenceKey,
514 [NSNumber numberWithBool:YES], WebKitAnimatedImageAsyncDecodingEnabledPreferenceKey,
ap@apple.com1e8475922018-10-18 21:38:50 +0000515#if PLATFORM(IOS_FAMILY)
weinig@apple.com2eb70cf2017-10-16 20:33:32 +0000516 [NSNumber numberWithUnsignedInt:static_cast<uint32_t>(FrameFlattening::FullyEnabled)], WebKitFrameFlatteningPreferenceKey,
aestes@apple.coma43fba52013-12-31 23:46:34 +0000517#else
weinig@apple.com2eb70cf2017-10-16 20:33:32 +0000518 [NSNumber numberWithUnsignedInt:static_cast<uint32_t>(FrameFlattening::Disabled)], WebKitFrameFlatteningPreferenceKey,
aestes@apple.coma43fba52013-12-31 23:46:34 +0000519#endif
fred.wang@free.fr24211532017-06-20 06:04:55 +0000520 [NSNumber numberWithBool:NO], WebKitAsyncFrameScrollingEnabledPreferenceKey,
tonikitoo@webkit.org3d484882010-10-10 14:23:49 +0000521 [NSNumber numberWithBool:NO], WebKitSpatialNavigationEnabledPreferenceKey,
ap@apple.com362c8a82010-12-14 18:35:50 +0000522 [NSNumber numberWithBool:NO], WebKitDNSPrefetchingEnabledPreferenceKey,
commit-queue@webkit.org85a95022011-04-21 23:24:50 +0000523 [NSNumber numberWithBool:NO], WebKitFullScreenEnabledPreferenceKey,
morrita@google.com7a18fee2010-12-13 06:06:19 +0000524 [NSNumber numberWithBool:NO], WebKitAsynchronousSpellCheckingEnabledPreferenceKey,
weinig@apple.com6a43c412010-12-03 23:25:55 +0000525 [NSNumber numberWithBool:YES], WebKitHyperlinkAuditingEnabledPreferenceKey,
aestes@apple.com7fb43f62010-09-20 23:01:12 +0000526 [NSNumber numberWithBool:NO], WebKitUsePreHTML5ParserQuirksKey,
jer.noble@apple.com93d40322011-04-22 17:51:00 +0000527 [NSNumber numberWithBool:YES], WebKitAVFoundationEnabledKey,
jer.noble@apple.com37d0e8b2016-03-10 16:28:52 +0000528 [NSNumber numberWithBool:YES], WebKitAVFoundationNSURLSessionEnabledKey,
aestes@apple.com9fb5eb332014-05-19 17:45:57 +0000529 [NSNumber numberWithBool:NO], WebKitSuppressesIncrementalRenderingKey,
dino@apple.com07bc2602016-03-14 01:09:17 +0000530 [NSNumber numberWithBool:attachmentElementEnabled], WebKitAttachmentElementEnabledPreferenceKey,
ap@apple.com1e8475922018-10-18 21:38:50 +0000531#if !PLATFORM(IOS_FAMILY)
jonlee@apple.com0c65d8b2015-05-23 01:57:43 +0000532 [NSNumber numberWithBool:YES], WebKitAllowsInlineMediaPlaybackPreferenceKey,
jer.noble@apple.com9fa59132016-05-19 21:59:12 +0000533 [NSNumber numberWithBool:NO], WebKitAllowsInlineMediaPlaybackAfterFullscreenPreferenceKey,
mmaxfield@apple.com9807e042016-07-26 23:36:52 +0000534 [NSNumber numberWithBool:NO], WebKitInlineMediaPlaybackRequiresPlaysInlineAttributeKey,
dino@apple.com5d4e6342015-06-29 20:53:59 +0000535 [NSNumber numberWithBool:YES], WebKitMediaControlsScaleWithPageZoomPreferenceKey,
jer.noble@apple.com866bf692011-09-21 23:06:42 +0000536 [NSNumber numberWithBool:NO], WebKitWebAudioEnabledPreferenceKey,
sullivan@apple.comc94bb9c2011-10-28 22:07:16 +0000537 [NSNumber numberWithBool:YES], WebKitBackspaceKeyNavigationEnabledKey,
eric.carlson@apple.com4eb26b52011-12-05 08:42:27 +0000538 [NSNumber numberWithBool:NO], WebKitShouldDisplaySubtitlesPreferenceKey,
539 [NSNumber numberWithBool:NO], WebKitShouldDisplayCaptionsPreferenceKey,
540 [NSNumber numberWithBool:NO], WebKitShouldDisplayTextDescriptionsPreferenceKey,
jonlee@apple.com793d5142012-02-22 00:00:59 +0000541 [NSNumber numberWithBool:YES], WebKitNotificationsEnabledKey,
timothy_horton@apple.com04ef44a2012-04-06 20:02:59 +0000542 [NSNumber numberWithBool:NO], WebKitShouldRespectImageOrientationKey,
jer.noble@apple.com8b34ebd2015-08-28 22:57:01 +0000543 [NSNumber numberWithBool:YES], WebKitMediaDataLoadsAutomaticallyPreferenceKey,
aestes@apple.coma43fba52013-12-31 23:46:34 +0000544#else
jer.noble@apple.comfd286342015-08-28 18:51:42 +0000545 [NSNumber numberWithBool:allowsInlineMediaPlayback], WebKitAllowsInlineMediaPlaybackPreferenceKey,
jer.noble@apple.com9fa59132016-05-19 21:59:12 +0000546 [NSNumber numberWithBool:allowsInlineMediaPlaybackAfterFullscreen], WebKitAllowsInlineMediaPlaybackAfterFullscreenPreferenceKey,
mmaxfield@apple.com9807e042016-07-26 23:36:52 +0000547 [NSNumber numberWithBool:requiresPlaysInlineAttribute], WebKitInlineMediaPlaybackRequiresPlaysInlineAttributeKey,
dino@apple.com5d4e6342015-06-29 20:53:59 +0000548 [NSNumber numberWithBool:NO], WebKitMediaControlsScaleWithPageZoomPreferenceKey,
aestes@apple.coma43fba52013-12-31 23:46:34 +0000549 [NSNumber numberWithUnsignedInt:AudioSession::None], WebKitAudioSessionCategoryOverride,
jer.noble@apple.com8b34ebd2015-08-28 22:57:01 +0000550 [NSNumber numberWithBool:NO], WebKitMediaDataLoadsAutomaticallyPreferenceKey,
aestes@apple.com18ea6992015-04-10 08:33:41 +0000551#if HAVE(AVKIT)
jer.noble@apple.comace38d982014-03-19 19:21:03 +0000552 [NSNumber numberWithBool:YES], WebKitAVKitEnabled,
aestes@apple.com18ea6992015-04-10 08:33:41 +0000553#endif
dbates@webkit.org54e32d52016-10-11 20:18:27 +0000554 [NSNumber numberWithBool:YES], WebKitRequiresUserGestureForMediaPlaybackPreferenceKey,
jer.noble@apple.com1b10c1f2016-03-16 00:45:32 +0000555 [NSNumber numberWithBool:NO], WebKitRequiresUserGestureForVideoPlaybackPreferenceKey,
556 [NSNumber numberWithBool:NO], WebKitRequiresUserGestureForAudioPlaybackPreferenceKey,
aestes@apple.coma43fba52013-12-31 23:46:34 +0000557 [NSNumber numberWithLongLong:WebCore::ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
558
559 // Per-Origin Quota on iOS is 25MB. When the quota is reached for a particular origin
560 // the quota for that origin can be increased. See also webView:exceededApplicationCacheOriginQuotaForSecurityOrigin:totalSpaceNeeded in WebUI/WebUIDelegate.m.
561 [NSNumber numberWithLongLong:(25 * 1024 * 1024)], WebKitApplicationCacheDefaultOriginQuota,
562
563 // Enable WebAudio by default in all iOS UIWebViews
564 [NSNumber numberWithBool:YES], WebKitWebAudioEnabledPreferenceKey,
565
566 [NSNumber numberWithBool:YES], WebKitShouldRespectImageOrientationKey,
ap@apple.com1e8475922018-10-18 21:38:50 +0000567#endif // PLATFORM(IOS_FAMILY)
jonlee@apple.comebeab742015-05-28 07:27:13 +0000568#if ENABLE(WIRELESS_TARGET_PLAYBACK)
569 [NSNumber numberWithBool:YES], WebKitAllowsAirPlayForMediaPlaybackPreferenceKey,
570#endif
jonlee@apple.com92313232015-06-18 23:42:22 +0000571 [NSNumber numberWithBool:YES], WebKitAllowsPictureInPictureMediaPlaybackPreferenceKey,
dino@apple.com2c7328e2012-05-05 21:38:17 +0000572 [NSNumber numberWithBool:YES], WebKitRequestAnimationFrameEnabledPreferenceKey,
jhoneycutt@apple.com5d98acc2012-05-03 01:39:16 +0000573 [NSNumber numberWithBool:NO], WebKitWantsBalancedSetDefersLoadingBehaviorKey,
jer.noble@apple.comc35303d2012-07-26 18:26:32 +0000574 [NSNumber numberWithBool:NO], WebKitDiagnosticLoggingEnabledKey,
jpfau@apple.com8219a2e2012-09-25 23:00:25 +0000575 [NSNumber numberWithInt:WebAllowAllStorage], WebKitStorageBlockingPolicyKey,
jonlee@apple.com3f4a62e2012-10-05 17:53:04 +0000576 [NSNumber numberWithBool:NO], WebKitPlugInSnapshottingEnabledPreferenceKey,
aestes@apple.coma43fba52013-12-31 23:46:34 +0000577
ap@apple.com1e8475922018-10-18 21:38:50 +0000578#if PLATFORM(IOS_FAMILY)
zalan@apple.com7de69d92019-03-08 00:36:42 +0000579 [NSNumber numberWithBool:YES], WebKitContentChangeObserverEnabledPreferenceKey,
aestes@apple.coma43fba52013-12-31 23:46:34 +0000580 [NSNumber numberWithBool:NO], WebKitTelephoneParsingEnabledPreferenceKey,
581 [NSNumber numberWithInt:-1], WebKitLayoutIntervalPreferenceKey,
582 [NSNumber numberWithFloat:-1.0f], WebKitMaxParseDurationPreferenceKey,
583 [NSNumber numberWithBool:NO], WebKitAllowMultiElementImplicitFormSubmissionPreferenceKey,
aestes@apple.coma43fba52013-12-31 23:46:34 +0000584 [NSNumber numberWithBool:NO], WebKitAlwaysRequestGeolocationPermissionPreferenceKey,
585 [NSNumber numberWithInt:InterpolationLow], WebKitInterpolationQualityPreferenceKey,
586 [NSNumber numberWithBool:YES], WebKitPasswordEchoEnabledPreferenceKey,
587 [NSNumber numberWithFloat:2.0f], WebKitPasswordEchoDurationPreferenceKey,
588 [NSNumber numberWithBool:NO], WebKitNetworkDataUsageTrackingEnabledPreferenceKey,
589 @"", WebKitNetworkInterfaceNamePreferenceKey,
590#endif
dbates@webkit.org102013c2016-09-26 21:51:25 +0000591#if ENABLE(TEXT_AUTOSIZING)
aestes@apple.com0d5a0902015-11-02 20:29:38 +0000592 [NSNumber numberWithFloat:Settings::defaultMinimumZoomFontSize()], WebKitMinimumZoomFontSizePreferenceKey,
simon.fraser@apple.com36676e52016-05-07 00:05:58 +0000593 [NSNumber numberWithBool:Settings::defaultTextAutosizingEnabled()], WebKitTextAutosizingEnabledPreferenceKey,
dbates@webkit.orgacb8f4f2013-09-11 02:39:05 +0000594#endif
ap@apple.com5d809022011-08-30 18:57:08 +0000595 [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheTotalQuota,
596 [NSNumber numberWithLongLong:ApplicationCacheStorage::noQuota()], WebKitApplicationCacheDefaultOriginQuota,
cmuppala@apple.coma756fa62013-03-23 02:15:36 +0000597 [NSNumber numberWithBool:NO], WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey,
598 [NSNumber numberWithBool:NO], WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey,
jer.noble@apple.comde0138e2013-07-01 18:40:27 +0000599 [NSNumber numberWithBool:NO], WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey,
hyatt@apple.coma5626692013-11-18 23:08:30 +0000600
601 [NSNumber numberWithBool:NO], WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey,
jer.noble@apple.com9c31d752013-12-07 00:56:24 +0000602#if ENABLE(MEDIA_SOURCE)
jonlee@apple.comcb954a52014-04-09 02:18:52 +0000603 [NSNumber numberWithBool:YES], WebKitMediaSourceEnabledPreferenceKey,
jer.noble@apple.com1a252332018-09-14 17:03:35 +0000604 @YES, WebKitSourceBufferChangeTypeEnabledPreferenceKey,
jer.noble@apple.com9c31d752013-12-07 00:56:24 +0000605#endif
beidson@apple.com83cca902014-04-25 00:53:01 +0000606#if ENABLE(SERVICE_CONTROLS)
beidson@apple.com42ee7a12014-02-21 00:39:35 +0000607 [NSNumber numberWithBool:NO], WebKitImageControlsEnabledPreferenceKey,
timothy_horton@apple.com09bd9852014-10-09 20:56:16 +0000608 [NSNumber numberWithBool:NO], WebKitServiceControlsEnabledPreferenceKey,
beidson@apple.com42ee7a12014-02-21 00:39:35 +0000609#endif
bfulgham@apple.coma6c7b142014-03-17 20:33:20 +0000610 [NSNumber numberWithBool:NO], WebKitEnableInheritURIQueryComponentPreferenceKey,
zandobersek@gmail.comcc158ec2016-10-05 16:02:35 +0000611#if ENABLE(LEGACY_ENCRYPTED_MEDIA)
jer.noble@apple.com6aa71d22014-10-31 00:18:21 +0000612 @"~/Library/WebKit/MediaKeys", WebKitMediaKeysStorageDirectoryKey,
613#endif
eric.carlson@apple.com59a4bdb2015-12-12 01:52:43 +0000614#if ENABLE(MEDIA_STREAM)
615 [NSNumber numberWithBool:NO], WebKitMockCaptureDevicesEnabledPreferenceKey,
commit-queue@webkit.org4de71602017-06-06 16:53:55 +0000616 [NSNumber numberWithBool:YES], WebKitMockCaptureDevicesPromptEnabledPreferenceKey,
eric.carlson@apple.com7ad2bbd2016-11-01 22:00:23 +0000617 [NSNumber numberWithBool:YES], WebKitMediaCaptureRequiresSecureConnectionPreferenceKey,
eric.carlson@apple.com59a4bdb2015-12-12 01:52:43 +0000618#endif
rniwa@webkit.org8c504b62016-03-10 04:43:14 +0000619 [NSNumber numberWithBool:YES], WebKitShadowDOMEnabledPreferenceKey,
rniwa@webkit.org7d8b0002016-11-01 23:16:49 +0000620 [NSNumber numberWithBool:YES], WebKitCustomElementsEnabledPreferenceKey,
rniwa@webkit.org81604e52017-09-22 01:51:19 +0000621 [NSNumber numberWithBool:YES], WebKitDataTransferItemsEnabledPreferenceKey,
rniwa@webkit.org450cd052018-01-22 06:41:05 +0000622 [NSNumber numberWithBool:NO], WebKitCustomPasteboardDataEnabledPreferenceKey,
commit-queue@webkit.orgd4f19662019-07-17 18:58:14 +0000623 [NSNumber numberWithBool:NO], WebKitDialogElementEnabledPreferenceKey,
graouts@webkit.org0d180e72017-01-20 12:17:50 +0000624 [NSNumber numberWithBool:YES], WebKitModernMediaControlsEnabledPreferenceKey,
graouts@webkit.orga9cf2e82018-10-25 19:17:04 +0000625 [NSNumber numberWithBool:NO], WebKitWebAnimationsCSSIntegrationEnabledPreferenceKey,
graouts@webkit.org9a1f7c02018-03-12 12:56:14 +0000626
commit-queue@webkit.orgd1adeef2016-04-05 11:22:17 +0000627#if ENABLE(WEBGL2)
628 [NSNumber numberWithBool:NO], WebKitWebGL2EnabledPreferenceKey,
629#endif
justin_fan@apple.comc21759c2018-10-16 04:57:47 +0000630#if ENABLE(WEBGPU)
631 [NSNumber numberWithBool:NO], WebKitWebGPUEnabledPreferenceKey,
632#endif
commit-queue@webkit.org37a1da42017-08-05 05:06:13 +0000633 [NSNumber numberWithBool:NO], WebKitCacheAPIEnabledPreferenceKey,
commit-queue@webkit.org4c8d5ec2016-08-22 09:53:47 +0000634 [NSNumber numberWithBool:YES], WebKitFetchAPIEnabledPreferenceKey,
commit-queue@webkit.org31dcef82017-08-03 23:54:36 +0000635
jlewis3@apple.comc9f6abb2017-08-04 18:28:23 +0000636#if ENABLE(STREAMS_API)
commit-queue@webkit.orgcf57fe22017-04-17 21:24:37 +0000637 [NSNumber numberWithBool:NO], WebKitReadableByteStreamAPIEnabledPreferenceKey,
638 [NSNumber numberWithBool:NO], WebKitWritableStreamAPIEnabledPreferenceKey,
jlewis3@apple.comc9f6abb2017-08-04 18:28:23 +0000639#endif
bfulgham@apple.comff4e25e2016-04-15 00:45:52 +0000640#if ENABLE(DOWNLOAD_ATTRIBUTE)
641 [NSNumber numberWithBool:NO], WebKitDownloadAttributeEnabledPreferenceKey,
642#endif
cdumez@apple.com04a3cca2017-08-25 02:05:54 +0000643 [NSNumber numberWithBool:NO], WebKitDirectoryUploadEnabledPreferenceKey,
graouts@webkit.org80535072018-09-27 09:49:52 +0000644 [NSNumber numberWithBool:YES], WebKitWebAnimationsEnabledPreferenceKey,
commit-queue@webkit.org18130782019-02-28 22:59:14 +0000645 [NSNumber numberWithBool:YES], WebKitPointerEventsEnabledPreferenceKey,
megan_gardner@apple.com31cdd982019-06-14 21:00:13 +0000646 [NSNumber numberWithBool:YES], WebKitSyntheticEditingCommandsEnabledPreferenceKey,
simon.fraser@apple.comb2f5fcf2016-12-06 19:39:32 +0000647
ap@apple.com1e8475922018-10-18 21:38:50 +0000648#if PLATFORM(IOS_FAMILY)
simon.fraser@apple.comaad6ee92019-02-22 07:04:03 +0000649 @NO, WebKitVisualViewportAPIEnabledPreferenceKey,
simon.fraser@apple.comb2f5fcf2016-12-06 19:39:32 +0000650#else
simon.fraser@apple.comaad6ee92019-02-22 07:04:03 +0000651 @YES, WebKitVisualViewportAPIEnabledPreferenceKey,
simon.fraser@apple.comb2f5fcf2016-12-06 19:39:32 +0000652#endif
653
commit-queue@webkit.org6b0ee982018-08-31 07:49:32 +0000654 [NSNumber numberWithBool:NO], WebKitCSSOMViewScrollingAPIEnabledPreferenceKey,
bfulgham@apple.comf2d5a2e2016-11-10 00:58:35 +0000655 [NSNumber numberWithBool:YES], WebKitNeedsStorageAccessFromFileURLsQuirkKey,
dbates@webkit.orgd94563d2018-02-14 22:27:52 +0000656 [NSNumber numberWithBool:NO], WebKitAllowCrossOriginSubresourcesToAskForCredentialsKey,
eric.carlson@apple.coma4923bc2016-12-10 02:46:31 +0000657#if ENABLE(MEDIA_STREAM)
commit-queue@webkit.org74391d02017-04-28 20:42:40 +0000658 [NSNumber numberWithBool:NO], WebKitMediaDevicesEnabledPreferenceKey,
659 [NSNumber numberWithBool:YES], WebKitMediaStreamEnabledPreferenceKey,
commit-queue@webkit.org4e7a4e72018-10-04 19:27:10 +0000660 [NSNumber numberWithBool:YES], WebKitMediaRecorderEnabledPreferenceKey,
eric.carlson@apple.coma4923bc2016-12-10 02:46:31 +0000661#endif
eric.carlson@apple.coma4923bc2016-12-10 02:46:31 +0000662#if ENABLE(WEB_RTC)
commit-queue@webkit.org74391d02017-04-28 20:42:40 +0000663 [NSNumber numberWithBool:YES], WebKitPeerConnectionEnabledPreferenceKey,
eric.carlson@apple.coma4923bc2016-12-10 02:46:31 +0000664#endif
rniwa@webkit.org44b24a32018-10-03 09:45:18 +0000665 [NSNumber numberWithBool:YES], WebKitSelectionAcrossShadowBoundariesEnabledPreferenceKey,
commit-queue@webkit.org7cef8172019-01-22 09:52:48 +0000666 [NSNumber numberWithBool:NO], WebKitCSSLogicalEnabledPreferenceKey,
wilander@apple.com04dcc7e2019-01-24 19:17:09 +0000667 [NSNumber numberWithBool:NO], WebKitAdClickAttributionEnabledPreferenceKey,
joepeck@webkit.org58cb1a72017-01-28 09:26:14 +0000668#if ENABLE(INTERSECTION_OBSERVER)
669 @NO, WebKitIntersectionObserverEnabledPreferenceKey,
670#endif
antti@apple.com4e5b50b2017-11-14 19:01:22 +0000671 @YES, WebKitDisplayContentsEnabledPreferenceKey,
joepeck@webkit.org58cb1a72017-01-28 09:26:14 +0000672 @NO, WebKitUserTimingEnabledPreferenceKey,
joepeck@webkit.org3f0a1982017-02-10 22:28:56 +0000673 @NO, WebKitResourceTimingEnabledPreferenceKey,
jer.noble@apple.com333940e2017-05-15 22:46:13 +0000674 @NO, WebKitMediaUserGestureInheritsFromDocument,
dbates@webkit.orgd3072e52017-06-13 20:21:00 +0000675 @NO, WebKitIsSecureContextAttributeEnabledPreferenceKey,
jer.noble@apple.com876bf002017-06-30 21:04:11 +0000676 @YES, WebKitLegacyEncryptedMediaAPIEnabledKey,
jer.noble@apple.come2f800d2017-11-14 20:29:05 +0000677 @NO, WebKitEncryptedMediaAPIEnabledKey,
timothy_horton@apple.com52ec9f72017-07-03 09:00:49 +0000678 @YES, WebKitViewportFitEnabledPreferenceKey,
679 @YES, WebKitConstantPropertiesEnabledPreferenceKey,
simon.fraser@apple.com4f41ba22018-04-27 00:10:48 +0000680 @NO, WebKitColorFilterEnabledPreferenceKey,
dino@apple.com79c90412018-07-16 23:34:42 +0000681 @NO, WebKitPunchOutWhiteBackgroundsInDarkModePreferenceKey,
jer.noble@apple.comf2b5ea32017-07-14 22:04:20 +0000682 @YES, WebKitAllowMediaContentTypesRequiringHardwareSupportAsFallbackKey,
drousso@apple.comed533c62017-08-07 23:55:36 +0000683 @NO, WebKitInspectorAdditionsEnabledPreferenceKey,
jer.noble@apple.comec63c3a2017-06-08 17:51:47 +0000684 (NSString *)Settings::defaultMediaContentTypesRequiringHardwareSupport(), WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey,
n_wang@apple.com5fe440a2017-11-15 07:56:04 +0000685 @NO, WebKitAccessibilityObjectModelEnabledPreferenceKey,
n_wang@apple.comd02736d2018-08-01 22:07:42 +0000686 @YES, WebKitAriaReflectionEnabledPreferenceKey,
jer.noble@apple.com3b52acc2017-12-21 18:28:21 +0000687 @NO, WebKitMediaCapabilitiesEnabledPreferenceKey,
commit-queue@webkit.orgecc55612018-01-17 21:06:48 +0000688 @NO, WebKitFetchAPIKeepAliveEnabledPreferenceKey,
commit-queue@webkit.org87d615c2018-05-11 18:33:43 +0000689 @NO, WebKitServerTimingEnabledPreferenceKey,
commit-queue@webkit.orgf59b72d2019-03-06 11:28:38 +0000690 @NO, WebKitReferrerPolicyAttributeEnabledPreferenceKey,
commit-queue@webkit.org30634002019-03-29 08:37:46 +0000691#if ENABLE(RESIZE_OBSERVER)
692 @NO, WebKitResizeObserverEnabledPreferenceKey,
693#endif
commit-queue@webkit.org0d74b3b2019-05-02 10:12:14 +0000694 @NO, WebKitCoreMathMLEnabledPreferenceKey,
commit-queue@webkit.orgcb884302019-06-03 20:49:53 +0000695 @NO, WebKitLinkPreloadResponsiveImagesEnabledPreferenceKey,
sullivan6b34b0c2002-03-21 19:38:37 +0000696 nil];
697
ap@apple.com1e8475922018-10-18 21:38:50 +0000698#if !PLATFORM(IOS_FAMILY)
sullivanf33213d2005-08-01 17:50:35 +0000699 // This value shouldn't ever change, which is assumed in the initialization of WebKitPDFDisplayModePreferenceKey above
700 ASSERT(kPDFDisplaySinglePageContinuous == 1);
aestes@apple.coma43fba52013-12-31 23:46:34 +0000701#endif
sullivan6b34b0c2002-03-21 19:38:37 +0000702 [[NSUserDefaults standardUserDefaults] registerDefaults:dict];
sullivan6b34b0c2002-03-21 19:38:37 +0000703}
704
rjwbb6206f2003-04-16 02:18:48 +0000705- (void)dealloc
706{
ap@apple.come3691aa2014-01-15 21:30:26 +0000707 [self _updatePrivateBrowsingStateTo:NO];
708
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000709 delete _private;
rjwbb6206f2003-04-16 02:18:48 +0000710 [super dealloc];
711}
712
rjw46467492003-05-22 03:52:50 +0000713- (NSString *)identifier
714{
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000715 return _private->identifier.get();
rjw46467492003-05-22 03:52:50 +0000716}
717
darin86e09922004-07-02 17:27:36 +0000718- (id)_valueForKey:(NSString *)key
rjw5fd5a7f2003-02-07 22:08:16 +0000719{
rjw46467492003-05-22 03:52:50 +0000720 NSString *_key = KEY(key);
ap@apple.com1e8475922018-10-18 21:38:50 +0000721#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000722 __block id o = nil;
723 dispatch_sync(_private->readWriteQueue, ^{
724 o = [_private->values.get() objectForKey:_key];
725 });
726#else
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000727 id o = [_private->values.get() objectForKey:_key];
aestes@apple.coma43fba52013-12-31 23:46:34 +0000728#endif
darin86e09922004-07-02 17:27:36 +0000729 if (o)
730 return o;
731 o = [[NSUserDefaults standardUserDefaults] objectForKey:_key];
732 if (!o && key != _key)
733 o = [[NSUserDefaults standardUserDefaults] objectForKey:key];
734 return o;
rjw5fd5a7f2003-02-07 22:08:16 +0000735}
736
darin86e09922004-07-02 17:27:36 +0000737- (NSString *)_stringValueForKey:(NSString *)key
738{
739 id s = [self _valueForKey:key];
740 return [s isKindOfClass:[NSString class]] ? (NSString *)s : nil;
741}
742
743- (void)_setStringValue:(NSString *)value forKey:(NSString *)key
rjw5fd5a7f2003-02-07 22:08:16 +0000744{
darin36981132005-06-05 20:57:29 +0000745 if ([[self _stringValueForKey:key] isEqualToString:value])
746 return;
rjw46467492003-05-22 03:52:50 +0000747 NSString *_key = KEY(key);
ap@apple.com1e8475922018-10-18 21:38:50 +0000748#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000749 dispatch_barrier_sync(_private->readWriteQueue, ^{
750#endif
benjamin@webkit.org15fc1812012-07-15 20:24:03 +0000751 [_private->values.get() setObject:value forKey:_key];
ap@apple.com1e8475922018-10-18 21:38:50 +0000752#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000753 });
754#endif
rjw46467492003-05-22 03:52:50 +0000755 if (_private->autosaves)
756 [[NSUserDefaults standardUserDefaults] setObject:value forKey:_key];
mjs@apple.com60484932011-04-08 19:33:04 +0000757 [self _postPreferencesChangedNotification];
rjw5fd5a7f2003-02-07 22:08:16 +0000758}
759
said@apple.com5c8ad7d2019-02-05 00:47:17 +0000760- (NSArray<NSString *> *)_stringArrayValueForKey:(NSString *)key
761{
762 id value = [self _valueForKey:key];
763 if (![value isKindOfClass:[NSArray class]])
764 return nil;
765
766 NSArray *array = (NSArray *)value;
767 for (id object in array) {
768 if (![object isKindOfClass:[NSString class]])
769 return nil;
770 }
771
772 return (NSArray<NSString *> *)array;
773}
774
775- (void)_setStringArrayValueForKey:(NSArray<NSString *> *)value forKey:(NSString *)key
776{
777 NSString *_key = KEY(key);
778#if PLATFORM(IOS_FAMILY)
779 dispatch_barrier_sync(_private->readWriteQueue, ^{
780#endif
781 [_private->values.get() setObject:value forKey:_key];
782#if PLATFORM(IOS_FAMILY)
783 });
784#endif
785 if (_private->autosaves)
786 [[NSUserDefaults standardUserDefaults] setObject:value forKey:_key];
787 [self _postPreferencesChangedNotification];
788}
789
kdeckere398dcd62006-02-22 00:55:26 +0000790- (int)_integerValueForKey:(NSString *)key
791{
792 id o = [self _valueForKey:key];
793 return [o respondsToSelector:@selector(intValue)] ? [o intValue] : 0;
794}
795
796- (void)_setIntegerValue:(int)value forKey:(NSString *)key
797{
798 if ([self _integerValueForKey:key] == value)
799 return;
800 NSString *_key = KEY(key);
ap@apple.com1e8475922018-10-18 21:38:50 +0000801#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000802 dispatch_barrier_sync(_private->readWriteQueue, ^{
803#endif
darin@apple.comec6dbae2018-08-08 02:39:12 +0000804 [_private->values.get() setObject:@(value) forKey:_key];
ap@apple.com1e8475922018-10-18 21:38:50 +0000805#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000806 });
807#endif
kdeckere398dcd62006-02-22 00:55:26 +0000808 if (_private->autosaves)
809 [[NSUserDefaults standardUserDefaults] setInteger:value forKey:_key];
mjs@apple.com60484932011-04-08 19:33:04 +0000810 [self _postPreferencesChangedNotification];
kdeckere398dcd62006-02-22 00:55:26 +0000811}
812
aestes@apple.coma43fba52013-12-31 23:46:34 +0000813- (unsigned int)_unsignedIntValueForKey:(NSString *)key
814{
815 id o = [self _valueForKey:key];
816 return [o respondsToSelector:@selector(unsignedIntValue)] ? [o unsignedIntValue] : 0;
817}
818
819- (void)_setUnsignedIntValue:(unsigned int)value forKey:(NSString *)key
darin@apple.com0fdefc32016-03-18 07:56:20 +0000820{
821 if ([self _unsignedIntValueForKey:key] == value)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000822 return;
823 NSString *_key = KEY(key);
ap@apple.com1e8475922018-10-18 21:38:50 +0000824#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000825 dispatch_barrier_sync(_private->readWriteQueue, ^{
utatane.tea@gmail.com8d6f6ea2015-02-24 18:20:45 +0000826#endif
darin@apple.comec6dbae2018-08-08 02:39:12 +0000827 [_private->values.get() setObject:@(value) forKey:_key];
ap@apple.com1e8475922018-10-18 21:38:50 +0000828#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000829 });
utatane.tea@gmail.com8d6f6ea2015-02-24 18:20:45 +0000830#endif
aestes@apple.coma43fba52013-12-31 23:46:34 +0000831 if (_private->autosaves)
832 [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithUnsignedInt:value] forKey:_key];
833 [self _postPreferencesChangedNotification];
834}
aestes@apple.coma43fba52013-12-31 23:46:34 +0000835
kdeckere398dcd62006-02-22 00:55:26 +0000836- (float)_floatValueForKey:(NSString *)key
837{
838 id o = [self _valueForKey:key];
weinig48bafd82006-08-04 18:57:40 +0000839 return [o respondsToSelector:@selector(floatValue)] ? [o floatValue] : 0.0f;
kdeckere398dcd62006-02-22 00:55:26 +0000840}
841
842- (void)_setFloatValue:(float)value forKey:(NSString *)key
843{
844 if ([self _floatValueForKey:key] == value)
845 return;
846 NSString *_key = KEY(key);
ap@apple.com1e8475922018-10-18 21:38:50 +0000847#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000848 dispatch_barrier_sync(_private->readWriteQueue, ^{
849#endif
darin@apple.comec6dbae2018-08-08 02:39:12 +0000850 [_private->values.get() setObject:@(value) forKey:_key];
ap@apple.com1e8475922018-10-18 21:38:50 +0000851#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000852 });
853#endif
kdeckere398dcd62006-02-22 00:55:26 +0000854 if (_private->autosaves)
855 [[NSUserDefaults standardUserDefaults] setFloat:value forKey:_key];
mjs@apple.com60484932011-04-08 19:33:04 +0000856 [self _postPreferencesChangedNotification];
kdeckere398dcd62006-02-22 00:55:26 +0000857}
858
859- (BOOL)_boolValueForKey:(NSString *)key
860{
861 return [self _integerValueForKey:key] != 0;
862}
863
864- (void)_setBoolValue:(BOOL)value forKey:(NSString *)key
865{
866 if ([self _boolValueForKey:key] == value)
867 return;
868 NSString *_key = KEY(key);
ap@apple.com1e8475922018-10-18 21:38:50 +0000869#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000870 dispatch_barrier_sync(_private->readWriteQueue, ^{
871#endif
darin@apple.comec6dbae2018-08-08 02:39:12 +0000872 [_private->values.get() setObject:@(value) forKey:_key];
ap@apple.com1e8475922018-10-18 21:38:50 +0000873#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000874 });
875#endif
kdeckere398dcd62006-02-22 00:55:26 +0000876 if (_private->autosaves)
877 [[NSUserDefaults standardUserDefaults] setBool:value forKey:_key];
mjs@apple.com60484932011-04-08 19:33:04 +0000878 [self _postPreferencesChangedNotification];
kdeckere398dcd62006-02-22 00:55:26 +0000879}
880
joepeck@webkit.org4112f8b2010-07-31 02:22:05 +0000881- (long long)_longLongValueForKey:(NSString *)key
882{
883 id o = [self _valueForKey:key];
884 return [o respondsToSelector:@selector(longLongValue)] ? [o longLongValue] : 0;
885}
886
887- (void)_setLongLongValue:(long long)value forKey:(NSString *)key
888{
889 if ([self _longLongValueForKey:key] == value)
890 return;
891 NSString *_key = KEY(key);
ap@apple.com1e8475922018-10-18 21:38:50 +0000892#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000893 dispatch_barrier_sync(_private->readWriteQueue, ^{
894#endif
darin@apple.comec6dbae2018-08-08 02:39:12 +0000895 [_private->values.get() setObject:@(value) forKey:_key];
ap@apple.com1e8475922018-10-18 21:38:50 +0000896#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000897 });
898#endif
joepeck@webkit.org4112f8b2010-07-31 02:22:05 +0000899 if (_private->autosaves)
900 [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithLongLong:value] forKey:_key];
mjs@apple.com60484932011-04-08 19:33:04 +0000901 [self _postPreferencesChangedNotification];
joepeck@webkit.org4112f8b2010-07-31 02:22:05 +0000902}
903
beidson@apple.com2dbe1212007-11-27 03:28:31 +0000904- (unsigned long long)_unsignedLongLongValueForKey:(NSString *)key
905{
906 id o = [self _valueForKey:key];
907 return [o respondsToSelector:@selector(unsignedLongLongValue)] ? [o unsignedLongLongValue] : 0;
908}
909
910- (void)_setUnsignedLongLongValue:(unsigned long long)value forKey:(NSString *)key
911{
912 if ([self _unsignedLongLongValueForKey:key] == value)
913 return;
914 NSString *_key = KEY(key);
ap@apple.com1e8475922018-10-18 21:38:50 +0000915#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000916 dispatch_barrier_sync(_private->readWriteQueue, ^{
917#endif
darin@apple.comec6dbae2018-08-08 02:39:12 +0000918 [_private->values.get() setObject:@(value) forKey:_key];
ap@apple.com1e8475922018-10-18 21:38:50 +0000919#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +0000920 });
921#endif
beidson@apple.com2dbe1212007-11-27 03:28:31 +0000922 if (_private->autosaves)
923 [[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithUnsignedLongLong:value] forKey:_key];
mjs@apple.com60484932011-04-08 19:33:04 +0000924 [self _postPreferencesChangedNotification];
beidson@apple.com2dbe1212007-11-27 03:28:31 +0000925}
926
sullivan6b34b0c2002-03-21 19:38:37 +0000927- (NSString *)standardFontFamily
928{
rjw5fd5a7f2003-02-07 22:08:16 +0000929 return [self _stringValueForKey: WebKitStandardFontPreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +0000930}
931
932- (void)setStandardFontFamily:(NSString *)family
933{
rjw5fd5a7f2003-02-07 22:08:16 +0000934 [self _setStringValue: family forKey: WebKitStandardFontPreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +0000935}
936
937- (NSString *)fixedFontFamily
938{
rjw5fd5a7f2003-02-07 22:08:16 +0000939 return [self _stringValueForKey: WebKitFixedFontPreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +0000940}
941
942- (void)setFixedFontFamily:(NSString *)family
943{
rjw5fd5a7f2003-02-07 22:08:16 +0000944 [self _setStringValue: family forKey: WebKitFixedFontPreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +0000945}
946
947- (NSString *)serifFontFamily
948{
rjw5fd5a7f2003-02-07 22:08:16 +0000949 return [self _stringValueForKey: WebKitSerifFontPreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +0000950}
951
rjw5fd5a7f2003-02-07 22:08:16 +0000952- (void)setSerifFontFamily:(NSString *)family
sullivan6b34b0c2002-03-21 19:38:37 +0000953{
rjw5fd5a7f2003-02-07 22:08:16 +0000954 [self _setStringValue: family forKey: WebKitSerifFontPreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +0000955}
956
957- (NSString *)sansSerifFontFamily
958{
rjw5fd5a7f2003-02-07 22:08:16 +0000959 return [self _stringValueForKey: WebKitSansSerifFontPreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +0000960}
961
962- (void)setSansSerifFontFamily:(NSString *)family
963{
rjw5fd5a7f2003-02-07 22:08:16 +0000964 [self _setStringValue: family forKey: WebKitSansSerifFontPreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +0000965}
966
967- (NSString *)cursiveFontFamily
968{
rjw5fd5a7f2003-02-07 22:08:16 +0000969 return [self _stringValueForKey: WebKitCursiveFontPreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +0000970}
971
972- (void)setCursiveFontFamily:(NSString *)family
973{
rjw5fd5a7f2003-02-07 22:08:16 +0000974 [self _setStringValue: family forKey: WebKitCursiveFontPreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +0000975}
976
977- (NSString *)fantasyFontFamily
978{
rjw5fd5a7f2003-02-07 22:08:16 +0000979 return [self _stringValueForKey: WebKitFantasyFontPreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +0000980}
981
982- (void)setFantasyFontFamily:(NSString *)family
983{
rjw5fd5a7f2003-02-07 22:08:16 +0000984 [self _setStringValue: family forKey: WebKitFantasyFontPreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +0000985}
986
darinf4829be2002-07-24 20:37:31 +0000987- (int)defaultFontSize
sullivan6b34b0c2002-03-21 19:38:37 +0000988{
rjw5fd5a7f2003-02-07 22:08:16 +0000989 return [self _integerValueForKey: WebKitDefaultFontSizePreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +0000990}
991
darinf4829be2002-07-24 20:37:31 +0000992- (void)setDefaultFontSize:(int)size
sullivan6b34b0c2002-03-21 19:38:37 +0000993{
cblu74efe762003-06-26 19:21:31 +0000994 [self _setIntegerValue: size forKey: WebKitDefaultFontSizePreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +0000995}
996
darinc6125442002-08-08 19:37:43 +0000997- (int)defaultFixedFontSize
sullivane281a772002-08-06 16:21:26 +0000998{
rjw5fd5a7f2003-02-07 22:08:16 +0000999 return [self _integerValueForKey: WebKitDefaultFixedFontSizePreferenceKey];
sullivane281a772002-08-06 16:21:26 +00001000}
1001
darinc6125442002-08-08 19:37:43 +00001002- (void)setDefaultFixedFontSize:(int)size
sullivane281a772002-08-06 16:21:26 +00001003{
cblu74efe762003-06-26 19:21:31 +00001004 [self _setIntegerValue: size forKey: WebKitDefaultFixedFontSizePreferenceKey];
sullivane281a772002-08-06 16:21:26 +00001005}
1006
sullivan6b34b0c2002-03-21 19:38:37 +00001007- (int)minimumFontSize
1008{
rjw5fd5a7f2003-02-07 22:08:16 +00001009 return [self _integerValueForKey: WebKitMinimumFontSizePreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +00001010}
1011
1012- (void)setMinimumFontSize:(int)size
1013{
cblu74efe762003-06-26 19:21:31 +00001014 [self _setIntegerValue: size forKey: WebKitMinimumFontSizePreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +00001015}
1016
hyattcd4bea62003-10-31 19:54:29 +00001017- (int)minimumLogicalFontSize
1018{
1019 return [self _integerValueForKey: WebKitMinimumLogicalFontSizePreferenceKey];
1020}
1021
1022- (void)setMinimumLogicalFontSize:(int)size
1023{
1024 [self _setIntegerValue: size forKey: WebKitMinimumLogicalFontSizePreferenceKey];
1025}
1026
darinbd1b4a22002-09-27 00:45:32 +00001027- (NSString *)defaultTextEncodingName
mjsc2ebb3f2002-08-08 10:22:13 +00001028{
rjw5fd5a7f2003-02-07 22:08:16 +00001029 return [self _stringValueForKey: WebKitDefaultTextEncodingNamePreferenceKey];
mjsc2ebb3f2002-08-08 10:22:13 +00001030}
1031
darinbd1b4a22002-09-27 00:45:32 +00001032- (void)setDefaultTextEncodingName:(NSString *)encoding
mjsc2ebb3f2002-08-08 10:22:13 +00001033{
rjw5fd5a7f2003-02-07 22:08:16 +00001034 [self _setStringValue: encoding forKey: WebKitDefaultTextEncodingNamePreferenceKey];
mjsc2ebb3f2002-08-08 10:22:13 +00001035}
sullivan6b34b0c2002-03-21 19:38:37 +00001036
ap@apple.com1e8475922018-10-18 21:38:50 +00001037#if !PLATFORM(IOS_FAMILY)
sullivan667d5032002-08-07 00:57:38 +00001038- (BOOL)userStyleSheetEnabled
1039{
rjw5fd5a7f2003-02-07 22:08:16 +00001040 return [self _boolValueForKey: WebKitUserStyleSheetEnabledPreferenceKey];
sullivan667d5032002-08-07 00:57:38 +00001041}
1042
1043- (void)setUserStyleSheetEnabled:(BOOL)flag
1044{
rjw5fd5a7f2003-02-07 22:08:16 +00001045 [self _setBoolValue: flag forKey: WebKitUserStyleSheetEnabledPreferenceKey];
sullivan667d5032002-08-07 00:57:38 +00001046}
1047
rjwe5770842003-03-26 03:37:15 +00001048- (NSURL *)userStyleSheetLocation
sullivan667d5032002-08-07 00:57:38 +00001049{
cblu72e4d302003-07-09 21:57:19 +00001050 NSString *locationString = [self _stringValueForKey: WebKitUserStyleSheetLocationPreferenceKey];
1051
mjs3dc6aba2005-06-02 22:09:33 +00001052 if ([locationString _webkit_looksLikeAbsoluteURL]) {
kociendac9dd8a12003-08-07 20:53:48 +00001053 return [NSURL _web_URLWithDataAsString:locationString];
cblu72e4d302003-07-09 21:57:19 +00001054 } else {
1055 locationString = [locationString stringByExpandingTildeInPath];
darin@apple.com7c780332018-06-22 15:03:54 +00001056 return [NSURL fileURLWithPath:locationString isDirectory:NO];
cblu72e4d302003-07-09 21:57:19 +00001057 }
sullivan667d5032002-08-07 00:57:38 +00001058}
1059
rjwe5770842003-03-26 03:37:15 +00001060- (void)setUserStyleSheetLocation:(NSURL *)URL
sullivan667d5032002-08-07 00:57:38 +00001061{
cblu72e4d302003-07-09 21:57:19 +00001062 NSString *locationString;
1063
1064 if ([URL isFileURL]) {
1065 locationString = [[URL path] _web_stringByAbbreviatingWithTildeInPath];
1066 } else {
kocienda197316f2003-08-14 16:48:03 +00001067 locationString = [URL _web_originalDataAsString];
cblu72e4d302003-07-09 21:57:19 +00001068 }
commit-queue@webkit.org328a5f32010-09-16 18:19:03 +00001069
1070 if (!locationString)
1071 locationString = @"";
1072
cblu72e4d302003-07-09 21:57:19 +00001073 [self _setStringValue:locationString forKey: WebKitUserStyleSheetLocationPreferenceKey];
sullivan667d5032002-08-07 00:57:38 +00001074}
aestes@apple.coma43fba52013-12-31 23:46:34 +00001075#else
sullivan667d5032002-08-07 00:57:38 +00001076
aestes@apple.coma43fba52013-12-31 23:46:34 +00001077// These methods have had their implementations removed on iOS since it
1078// is wrong to have such a setting stored in preferences that, when read,
1079// is applied to all WebViews in a iOS process. Such a design might work
1080// OK for an application like Safari on Mac OS X, where the only WebViews
1081// in use display web content in a straightforward manner. However, it is
1082// wrong for iOS, where WebViews are used for various purposes, like
1083// text editing, text rendering, and displaying web content.
1084//
1085// I have changed the user style sheet mechanism to be a per-WebView
1086// setting, rather than a per-process preference. This seems to give the
1087// behavior we want for iOS.
1088
1089- (BOOL)userStyleSheetEnabled
1090{
1091 return NO;
1092}
1093
1094- (void)setUserStyleSheetEnabled:(BOOL)flag
1095{
1096 // no-op
1097}
1098
1099- (NSURL *)userStyleSheetLocation
1100{
1101 return nil;
1102}
1103
1104- (void)setUserStyleSheetLocation:(NSURL *)URL
1105{
1106 // no-op
1107}
ap@apple.com1e8475922018-10-18 21:38:50 +00001108#endif // PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +00001109
ap@apple.com1e8475922018-10-18 21:38:50 +00001110#if !PLATFORM(IOS_FAMILY)
sullivan8dc1c0e2003-09-18 15:26:08 +00001111- (BOOL)shouldPrintBackgrounds
1112{
1113 return [self _boolValueForKey: WebKitShouldPrintBackgroundsPreferenceKey];
1114}
1115
1116- (void)setShouldPrintBackgrounds:(BOOL)flag
1117{
1118 [self _setBoolValue: flag forKey: WebKitShouldPrintBackgroundsPreferenceKey];
1119}
aestes@apple.coma43fba52013-12-31 23:46:34 +00001120#endif
sullivan8dc1c0e2003-09-18 15:26:08 +00001121
rjw8787c562003-03-27 03:05:55 +00001122- (BOOL)isJavaEnabled
sullivan6b34b0c2002-03-21 19:38:37 +00001123{
rjw5fd5a7f2003-02-07 22:08:16 +00001124 return [self _boolValueForKey: WebKitJavaEnabledPreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +00001125}
1126
rjwabbd1ad2003-04-03 23:39:44 +00001127- (void)setJavaEnabled:(BOOL)flag
sullivan6b34b0c2002-03-21 19:38:37 +00001128{
rjw5fd5a7f2003-02-07 22:08:16 +00001129 [self _setBoolValue: flag forKey: WebKitJavaEnabledPreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +00001130}
1131
rjw8787c562003-03-27 03:05:55 +00001132- (BOOL)isJavaScriptEnabled
sullivan6b34b0c2002-03-21 19:38:37 +00001133{
rjw5fd5a7f2003-02-07 22:08:16 +00001134 return [self _boolValueForKey: WebKitJavaScriptEnabledPreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +00001135}
1136
rjwabbd1ad2003-04-03 23:39:44 +00001137- (void)setJavaScriptEnabled:(BOOL)flag
sullivan6b34b0c2002-03-21 19:38:37 +00001138{
rjw5fd5a7f2003-02-07 22:08:16 +00001139 [self _setBoolValue: flag forKey: WebKitJavaScriptEnabledPreferenceKey];
mjs7b37be22002-05-31 00:41:12 +00001140}
1141
rjw8787c562003-03-27 03:05:55 +00001142- (BOOL)javaScriptCanOpenWindowsAutomatically
mjs7b37be22002-05-31 00:41:12 +00001143{
rjw5fd5a7f2003-02-07 22:08:16 +00001144 return [self _boolValueForKey: WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey];
mjs7b37be22002-05-31 00:41:12 +00001145}
1146
1147- (void)setJavaScriptCanOpenWindowsAutomatically:(BOOL)flag
1148{
rjw5fd5a7f2003-02-07 22:08:16 +00001149 [self _setBoolValue: flag forKey: WebKitJavaScriptCanOpenWindowsAutomaticallyPreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +00001150}
1151
rjw8787c562003-03-27 03:05:55 +00001152- (BOOL)arePlugInsEnabled
sullivan6b34b0c2002-03-21 19:38:37 +00001153{
rjw5fd5a7f2003-02-07 22:08:16 +00001154 return [self _boolValueForKey: WebKitPluginsEnabledPreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +00001155}
1156
rjwabbd1ad2003-04-03 23:39:44 +00001157- (void)setPlugInsEnabled:(BOOL)flag
sullivan6b34b0c2002-03-21 19:38:37 +00001158{
rjw5fd5a7f2003-02-07 22:08:16 +00001159 [self _setBoolValue: flag forKey: WebKitPluginsEnabledPreferenceKey];
sullivan6b34b0c2002-03-21 19:38:37 +00001160}
1161
rjw8787c562003-03-27 03:05:55 +00001162- (BOOL)allowsAnimatedImages
rjw5fd5a7f2003-02-07 22:08:16 +00001163{
1164 return [self _boolValueForKey: WebKitAllowAnimatedImagesPreferenceKey];
1165}
1166
ddkilzer@apple.com0bf35982009-01-29 15:46:09 +00001167- (void)setAllowsAnimatedImages:(BOOL)flag
rjw5fd5a7f2003-02-07 22:08:16 +00001168{
1169 [self _setBoolValue: flag forKey: WebKitAllowAnimatedImagesPreferenceKey];
1170}
1171
rjw8787c562003-03-27 03:05:55 +00001172- (BOOL)allowsAnimatedImageLooping
rjw5fd5a7f2003-02-07 22:08:16 +00001173{
1174 return [self _boolValueForKey: WebKitAllowAnimatedImageLoopingPreferenceKey];
1175}
1176
rjw8787c562003-03-27 03:05:55 +00001177- (void)setAllowsAnimatedImageLooping: (BOOL)flag
rjw5fd5a7f2003-02-07 22:08:16 +00001178{
1179 [self _setBoolValue: flag forKey: WebKitAllowAnimatedImageLoopingPreferenceKey];
1180}
1181
rjw8787c562003-03-27 03:05:55 +00001182- (void)setLoadsImagesAutomatically: (BOOL)flag
rjw5fd5a7f2003-02-07 22:08:16 +00001183{
1184 [self _setBoolValue: flag forKey: WebKitDisplayImagesKey];
1185}
1186
rjw8787c562003-03-27 03:05:55 +00001187- (BOOL)loadsImagesAutomatically
rjw5fd5a7f2003-02-07 22:08:16 +00001188{
1189 return [self _boolValueForKey: WebKitDisplayImagesKey];
1190}
1191
said@apple.com5c8ad7d2019-02-05 00:47:17 +00001192- (void)setAdditionalSupportedImageTypes:(NSArray<NSString*> *)imageTypes
1193{
1194 [self _setStringArrayValueForKey:imageTypes forKey:WebKitAdditionalSupportedImageTypesKey];
1195}
1196
1197- (NSArray<NSString *> *)additionalSupportedImageTypes
1198{
1199 return [self _stringArrayValueForKey:WebKitAdditionalSupportedImageTypesKey];
1200}
1201
ddkilzer@apple.com0bf35982009-01-29 15:46:09 +00001202- (void)setAutosaves:(BOOL)flag
rjw46467492003-05-22 03:52:50 +00001203{
1204 _private->autosaves = flag;
1205}
1206
1207- (BOOL)autosaves
1208{
1209 return _private->autosaves;
1210}
1211
ap@apple.com1e8475922018-10-18 21:38:50 +00001212#if !PLATFORM(IOS_FAMILY)
kocienda995dbef2003-11-13 21:37:17 +00001213- (void)setTabsToLinks:(BOOL)flag
1214{
1215 [self _setBoolValue: flag forKey: WebKitTabToLinksPreferenceKey];
1216}
1217
1218- (BOOL)tabsToLinks
1219{
darin86e09922004-07-02 17:27:36 +00001220 return [self _boolValueForKey:WebKitTabToLinksPreferenceKey];
kocienda995dbef2003-11-13 21:37:17 +00001221}
aestes@apple.coma43fba52013-12-31 23:46:34 +00001222#endif
kocienda995dbef2003-11-13 21:37:17 +00001223
ap@apple.come3691aa2014-01-15 21:30:26 +00001224- (void)setPrivateBrowsingEnabled:(BOOL)enabled
sullivan3ed99b72004-03-29 22:16:19 +00001225{
ap@apple.come3691aa2014-01-15 21:30:26 +00001226 [self _updatePrivateBrowsingStateTo:enabled];
1227 [self _setBoolValue:enabled forKey:WebKitPrivateBrowsingEnabledPreferenceKey];
sullivan3ed99b72004-03-29 22:16:19 +00001228}
1229
sullivan834fc032004-04-14 20:39:56 +00001230- (BOOL)privateBrowsingEnabled
sullivan3ed99b72004-03-29 22:16:19 +00001231{
ap@apple.come3691aa2014-01-15 21:30:26 +00001232 // Changes to private browsing defaults do not have effect on existing WebPreferences, and must be done through -setPrivateBrowsingEnabled.
1233 // This is needed to accurately track private browsing sessions in the process.
1234 return _private->inPrivateBrowsing;
1235}
1236
1237- (void)_updatePrivateBrowsingStateTo:(BOOL)enabled
1238{
ap@apple.com858bf6572014-01-15 22:35:19 +00001239 if (!_private) {
1240 ASSERT(!enabled);
1241 return;
1242 }
1243
ap@apple.come3691aa2014-01-15 21:30:26 +00001244 if (enabled == _private->inPrivateBrowsing)
1245 return;
1246 if (enabled > _private->inPrivateBrowsing) {
1247 WebFrameNetworkingContext::ensurePrivateBrowsingSession();
1248 ++webPreferencesInstanceCountWithPrivateBrowsingEnabled;
1249 } else {
1250 ASSERT(webPreferencesInstanceCountWithPrivateBrowsingEnabled);
1251 --webPreferencesInstanceCountWithPrivateBrowsingEnabled;
1252 if (!webPreferencesInstanceCountWithPrivateBrowsingEnabled)
1253 WebFrameNetworkingContext::destroyPrivateBrowsingSession();
1254 }
1255 _private->inPrivateBrowsing = enabled;
sullivan3ed99b72004-03-29 22:16:19 +00001256}
1257
ggaren2e941232007-05-26 00:28:27 +00001258- (void)setUsesPageCache:(BOOL)usesPageCache
1259{
1260 [self _setBoolValue:usesPageCache forKey:WebKitUsesPageCachePreferenceKey];
1261}
1262
1263- (BOOL)usesPageCache
1264{
1265 return [self _boolValueForKey:WebKitUsesPageCachePreferenceKey];
1266}
1267
benjamin@webkit.orgc5e20682012-07-14 23:31:03 +00001268- (void)_postCacheModelChangedNotification
1269{
ap@apple.com1e8475922018-10-18 21:38:50 +00001270#if !PLATFORM(IOS_FAMILY)
benjamin@webkit.orgc5e20682012-07-14 23:31:03 +00001271 if (!pthread_main_np()) {
1272 [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO];
1273 return;
1274 }
aestes@apple.coma43fba52013-12-31 23:46:34 +00001275#endif
benjamin@webkit.orgc5e20682012-07-14 23:31:03 +00001276
1277 [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesCacheModelChangedInternalNotification object:self userInfo:nil];
1278}
1279
ggaren19c40db2007-09-26 23:26:27 +00001280- (void)setCacheModel:(WebCacheModel)cacheModel
1281{
1282 [self _setIntegerValue:cacheModel forKey:WebKitCacheModelPreferenceKey];
1283 [self setAutomaticallyDetectsCacheModel:NO];
benjamin@webkit.orgc5e20682012-07-14 23:31:03 +00001284 [self _postCacheModelChangedNotification];
ggaren19c40db2007-09-26 23:26:27 +00001285}
1286
1287- (WebCacheModel)cacheModel
1288{
mrowe@apple.com28611202013-12-11 09:27:32 +00001289 return (WebCacheModel)[self _integerValueForKey:WebKitCacheModelPreferenceKey];
ggaren19c40db2007-09-26 23:26:27 +00001290}
1291
aestes@apple.come034b592012-02-24 06:24:47 +00001292
1293- (void)setSuppressesIncrementalRendering:(BOOL)suppressesIncrementalRendering
1294{
1295 [self _setBoolValue:suppressesIncrementalRendering forKey:WebKitSuppressesIncrementalRenderingKey];
1296}
1297
1298- (BOOL)suppressesIncrementalRendering
1299{
1300 return [self _boolValueForKey:WebKitSuppressesIncrementalRenderingKey];
1301}
1302
jonlee@apple.com1dd92ab2015-05-28 07:44:41 +00001303- (BOOL)allowsAirPlayForMediaPlayback
1304{
1305#if ENABLE(WIRELESS_TARGET_PLAYBACK)
1306 return [self _boolValueForKey:WebKitAllowsAirPlayForMediaPlaybackPreferenceKey];
1307#else
1308 return false;
1309#endif
1310}
1311
1312- (void)setAllowsAirPlayForMediaPlayback:(BOOL)flag
1313{
1314#if ENABLE(WIRELESS_TARGET_PLAYBACK)
1315 [self _setBoolValue:flag forKey:WebKitAllowsAirPlayForMediaPlaybackPreferenceKey];
1316#endif
1317}
1318
sullivan386083c2004-04-28 20:05:38 +00001319@end
1320
1321@implementation WebPreferences (WebPrivate)
1322
timothy@apple.com217852f2010-07-01 19:32:15 +00001323- (BOOL)isDNSPrefetchingEnabled
1324{
1325 return [self _boolValueForKey:WebKitDNSPrefetchingEnabledPreferenceKey];
1326}
1327
1328- (void)setDNSPrefetchingEnabled:(BOOL)flag
1329{
1330 [self _setBoolValue:flag forKey:WebKitDNSPrefetchingEnabledPreferenceKey];
1331}
1332
timothy@apple.comb64b60d2007-10-31 23:12:35 +00001333- (BOOL)developerExtrasEnabled
1334{
1335 NSUserDefaults *defaults = [NSUserDefaults standardUserDefaults];
1336 if ([defaults boolForKey:@"DisableWebKitDeveloperExtras"])
1337 return NO;
1338#ifdef NDEBUG
1339 if ([defaults boolForKey:@"WebKitDeveloperExtras"] || [defaults boolForKey:@"IncludeDebugMenu"])
1340 return YES;
1341 return [self _boolValueForKey:WebKitDeveloperExtrasEnabledPreferenceKey];
1342#else
1343 return YES; // always enable in debug builds
1344#endif
1345}
1346
utatane.tea@gmail.com8d6f6ea2015-02-24 18:20:45 +00001347- (WebKitJavaScriptRuntimeFlags)javaScriptRuntimeFlags
barraclough@apple.com6e5e8962012-05-22 19:10:43 +00001348{
utatane.tea@gmail.com8d6f6ea2015-02-24 18:20:45 +00001349 return static_cast<WebKitJavaScriptRuntimeFlags>([self _unsignedIntValueForKey:WebKitJavaScriptRuntimeFlagsPreferenceKey]);
barraclough@apple.com6e5e8962012-05-22 19:10:43 +00001350}
1351
utatane.tea@gmail.com8d6f6ea2015-02-24 18:20:45 +00001352- (void)setJavaScriptRuntimeFlags:(WebKitJavaScriptRuntimeFlags)flags
barraclough@apple.com6e5e8962012-05-22 19:10:43 +00001353{
utatane.tea@gmail.com8d6f6ea2015-02-24 18:20:45 +00001354 [self _setUnsignedIntValue:flags forKey:WebKitJavaScriptRuntimeFlagsPreferenceKey];
barraclough@apple.com6e5e8962012-05-22 19:10:43 +00001355}
1356
timothy@apple.comb64b60d2007-10-31 23:12:35 +00001357- (void)setDeveloperExtrasEnabled:(BOOL)flag
1358{
1359 [self _setBoolValue:flag forKey:WebKitDeveloperExtrasEnabledPreferenceKey];
1360}
1361
timothy@apple.combf423a12007-11-27 17:15:19 +00001362- (BOOL)authorAndUserStylesEnabled
1363{
1364 return [self _boolValueForKey:WebKitAuthorAndUserStylesEnabledPreferenceKey];
1365}
1366
beidson@apple.com69fa0752008-04-15 17:54:18 +00001367- (void)setAuthorAndUserStylesEnabled:(BOOL)flag
1368{
1369 [self _setBoolValue:flag forKey:WebKitAuthorAndUserStylesEnabledPreferenceKey];
1370}
1371
dino@apple.com2f492142015-01-08 20:24:52 +00001372// FIXME: applicationChromeMode is no longer needed by ToT, but is still used in Safari 8.
timothy@apple.com79cb13a2008-08-27 22:03:24 +00001373- (BOOL)applicationChromeModeEnabled
1374{
dino@apple.com2f492142015-01-08 20:24:52 +00001375 return NO;
timothy@apple.com79cb13a2008-08-27 22:03:24 +00001376}
1377
timothy@apple.com04ecc212008-09-06 05:19:43 +00001378- (void)setApplicationChromeModeEnabled:(BOOL)flag
timothy@apple.com79cb13a2008-08-27 22:03:24 +00001379{
timothy@apple.com79cb13a2008-08-27 22:03:24 +00001380}
1381
cdumez@apple.com9d3e4a72014-11-19 00:56:33 +00001382- (BOOL)domTimersThrottlingEnabled
1383{
1384 return [self _boolValueForKey:WebKitDOMTimersThrottlingEnabledPreferenceKey];
1385}
1386
1387- (void)setDOMTimersThrottlingEnabled:(BOOL)flag
1388{
1389 [self _setBoolValue:flag forKey:WebKitDOMTimersThrottlingEnabledPreferenceKey];
1390}
1391
beidson@apple.com69fa0752008-04-15 17:54:18 +00001392- (BOOL)webArchiveDebugModeEnabled
beidson@apple.comaf2e0112008-04-15 00:40:33 +00001393{
1394 return [self _boolValueForKey:WebKitWebArchiveDebugModeEnabledPreferenceKey];
1395}
1396
beidson@apple.com69fa0752008-04-15 17:54:18 +00001397- (void)setWebArchiveDebugModeEnabled:(BOOL)flag
timothy@apple.combf423a12007-11-27 17:15:19 +00001398{
beidson@apple.com69fa0752008-04-15 17:54:18 +00001399 [self _setBoolValue:flag forKey:WebKitWebArchiveDebugModeEnabledPreferenceKey];
timothy@apple.combf423a12007-11-27 17:15:19 +00001400}
1401
beidson@apple.comb16bd432009-07-02 00:38:02 +00001402- (BOOL)localFileContentSniffingEnabled
1403{
1404 return [self _boolValueForKey:WebKitLocalFileContentSniffingEnabledPreferenceKey];
1405}
1406
1407- (void)setLocalFileContentSniffingEnabled:(BOOL)flag
1408{
1409 [self _setBoolValue:flag forKey:WebKitLocalFileContentSniffingEnabledPreferenceKey];
1410}
1411
andersca@apple.comc3a561b2008-04-25 23:36:19 +00001412- (BOOL)offlineWebApplicationCacheEnabled
1413{
1414 return [self _boolValueForKey:WebKitOfflineWebApplicationCacheEnabledPreferenceKey];
1415}
1416
1417- (void)setOfflineWebApplicationCacheEnabled:(BOOL)flag
1418{
1419 [self _setBoolValue:flag forKey:WebKitOfflineWebApplicationCacheEnabledPreferenceKey];
1420}
1421
sullivan@apple.com99a39322008-07-31 21:42:45 +00001422- (BOOL)zoomsTextOnly
1423{
1424 return [self _boolValueForKey:WebKitZoomsTextOnlyPreferenceKey];
1425}
1426
1427- (void)setZoomsTextOnly:(BOOL)flag
1428{
1429 [self _setBoolValue:flag forKey:WebKitZoomsTextOnlyPreferenceKey];
1430}
1431
abarth@webkit.org616e41e2010-05-03 21:50:27 +00001432- (BOOL)javaScriptCanAccessClipboard
1433{
1434 return [self _boolValueForKey:WebKitJavaScriptCanAccessClipboardPreferenceKey];
1435}
1436
1437- (void)setJavaScriptCanAccessClipboard:(BOOL)flag
1438{
1439 [self _setBoolValue:flag forKey:WebKitJavaScriptCanAccessClipboardPreferenceKey];
1440}
1441
abarth@webkit.org33c12c62009-06-19 08:12:37 +00001442- (BOOL)isXSSAuditorEnabled
1443{
1444 return [self _boolValueForKey:WebKitXSSAuditorEnabledPreferenceKey];
1445}
1446
1447- (void)setXSSAuditorEnabled:(BOOL)flag
1448{
1449 [self _setBoolValue:flag forKey:WebKitXSSAuditorEnabledPreferenceKey];
1450}
1451
ap@apple.com1e8475922018-10-18 21:38:50 +00001452#if !PLATFORM(IOS_FAMILY)
sullivanfd93e2f2004-09-27 21:30:50 +00001453- (BOOL)respectStandardStyleKeyEquivalents
1454{
1455 return [self _boolValueForKey:WebKitRespectStandardStyleKeyEquivalentsPreferenceKey];
1456}
1457
1458- (void)setRespectStandardStyleKeyEquivalents:(BOOL)flag
1459{
1460 [self _setBoolValue:flag forKey:WebKitRespectStandardStyleKeyEquivalentsPreferenceKey];
1461}
1462
sullivand64529c2004-12-16 21:33:09 +00001463- (BOOL)showsURLsInToolTips
1464{
1465 return [self _boolValueForKey:WebKitShowsURLsInToolTipsPreferenceKey];
1466}
1467
1468- (void)setShowsURLsInToolTips:(BOOL)flag
1469{
1470 [self _setBoolValue:flag forKey:WebKitShowsURLsInToolTipsPreferenceKey];
1471}
1472
mitz@apple.com13ed5592011-08-13 06:25:30 +00001473- (BOOL)showsToolTipOverTruncatedText
1474{
1475 return [self _boolValueForKey:WebKitShowsToolTipOverTruncatedTextPreferenceKey];
1476}
1477
1478- (void)setShowsToolTipOverTruncatedText:(BOOL)flag
1479{
1480 [self _setBoolValue:flag forKey:WebKitShowsToolTipOverTruncatedTextPreferenceKey];
1481}
1482
sullivan6b395972005-05-24 17:20:36 +00001483- (BOOL)textAreasAreResizable
1484{
1485 return [self _boolValueForKey: WebKitTextAreasAreResizablePreferenceKey];
1486}
1487
1488- (void)setTextAreasAreResizable:(BOOL)flag
1489{
1490 [self _setBoolValue: flag forKey: WebKitTextAreasAreResizablePreferenceKey];
1491}
ap@apple.com1e8475922018-10-18 21:38:50 +00001492#endif // !PLATFORM(IOS_FAMILY)
sullivan6b395972005-05-24 17:20:36 +00001493
andersca662d7ba2007-05-24 01:36:55 +00001494- (BOOL)shrinksStandaloneImagesToFit
1495{
andersca@apple.com5d1ba5e2007-11-29 22:10:11 +00001496 return [self _boolValueForKey:WebKitShrinksStandaloneImagesToFitPreferenceKey];
andersca662d7ba2007-05-24 01:36:55 +00001497}
1498
1499- (void)setShrinksStandaloneImagesToFit:(BOOL)flag
1500{
andersca@apple.com5d1ba5e2007-11-29 22:10:11 +00001501 [self _setBoolValue:flag forKey:WebKitShrinksStandaloneImagesToFitPreferenceKey];
andersca662d7ba2007-05-24 01:36:55 +00001502}
1503
ggaren414ee7e2007-09-08 00:40:53 +00001504- (BOOL)automaticallyDetectsCacheModel
1505{
1506 return _private->automaticallyDetectsCacheModel;
1507}
1508
1509- (void)setAutomaticallyDetectsCacheModel:(BOOL)automaticallyDetectsCacheModel
1510{
1511 _private->automaticallyDetectsCacheModel = automaticallyDetectsCacheModel;
sullivan386083c2004-04-28 20:05:38 +00001512}
1513
eric@webkit.orgb59b8a52009-03-27 00:01:58 +00001514- (BOOL)usesEncodingDetector
1515{
1516 return [self _boolValueForKey: WebKitUsesEncodingDetectorPreferenceKey];
1517}
1518
1519- (void)setUsesEncodingDetector:(BOOL)flag
1520{
1521 [self _setBoolValue: flag forKey: WebKitUsesEncodingDetectorPreferenceKey];
1522}
1523
abarth@webkit.orgaf477982009-01-31 08:42:29 +00001524- (BOOL)isWebSecurityEnabled
1525{
1526 return [self _boolValueForKey: WebKitWebSecurityEnabledPreferenceKey];
1527}
1528
1529- (void)setWebSecurityEnabled:(BOOL)flag
1530{
1531 [self _setBoolValue: flag forKey: WebKitWebSecurityEnabledPreferenceKey];
1532}
1533
abarth@webkit.orgf63d8312009-03-04 19:56:27 +00001534- (BOOL)allowUniversalAccessFromFileURLs
abarth@webkit.org083c72e2009-02-27 20:52:55 +00001535{
abarth@webkit.orgf63d8312009-03-04 19:56:27 +00001536 return [self _boolValueForKey: WebKitAllowUniversalAccessFromFileURLsPreferenceKey];
abarth@webkit.org083c72e2009-02-27 20:52:55 +00001537}
1538
abarth@webkit.orgf63d8312009-03-04 19:56:27 +00001539- (void)setAllowUniversalAccessFromFileURLs:(BOOL)flag
abarth@webkit.org083c72e2009-02-27 20:52:55 +00001540{
abarth@webkit.orgf63d8312009-03-04 19:56:27 +00001541 [self _setBoolValue: flag forKey: WebKitAllowUniversalAccessFromFileURLsPreferenceKey];
abarth@webkit.org083c72e2009-02-27 20:52:55 +00001542}
1543
eric@webkit.orge85e2372010-02-17 07:32:30 +00001544- (BOOL)allowFileAccessFromFileURLs
1545{
1546 return [self _boolValueForKey: WebKitAllowFileAccessFromFileURLsPreferenceKey];
1547}
1548
1549- (void)setAllowFileAccessFromFileURLs:(BOOL)flag
1550{
1551 [self _setBoolValue: flag forKey: WebKitAllowFileAccessFromFileURLsPreferenceKey];
1552}
1553
dbates@webkit.orgd94563d2018-02-14 22:27:52 +00001554- (BOOL)allowCrossOriginSubresourcesToAskForCredentials
1555{
1556 return [self _boolValueForKey:WebKitAllowCrossOriginSubresourcesToAskForCredentialsKey];
1557}
1558
1559- (void)setAllowCrossOriginSubresourcesToAskForCredentials:(BOOL)flag
1560{
1561 [self _setBoolValue:flag forKey:WebKitAllowCrossOriginSubresourcesToAskForCredentialsKey];
1562}
1563
bfulgham@apple.comf2d5a2e2016-11-10 00:58:35 +00001564- (BOOL)needsStorageAccessFromFileURLsQuirk
1565{
1566 return [self _boolValueForKey: WebKitNeedsStorageAccessFromFileURLsQuirkKey];
1567}
1568
1569-(void)setNeedsStorageAccessFromFileURLsQuirk:(BOOL)flag
1570{
1571 [self _setBoolValue: flag forKey: WebKitNeedsStorageAccessFromFileURLsQuirkKey];
1572}
1573
sullivan386083c2004-04-28 20:05:38 +00001574- (NSTimeInterval)_backForwardCacheExpirationInterval
1575{
alice.liu@apple.com03a44192013-03-14 07:30:59 +00001576 return (NSTimeInterval)[self _floatValueForKey:WebKitBackForwardCacheExpirationIntervalKey];
sullivan386083c2004-04-28 20:05:38 +00001577}
1578
ap@apple.com1e8475922018-10-18 21:38:50 +00001579#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +00001580- (BOOL)_standalone
1581{
1582 return [self _boolValueForKey:WebKitStandalonePreferenceKey];
1583}
1584
1585- (void)_setStandalone:(BOOL)flag
1586{
1587 [self _setBoolValue:flag forKey:WebKitStandalonePreferenceKey];
1588}
1589
1590- (void)_setTelephoneNumberParsingEnabled:(BOOL)flag
1591{
1592 [self _setBoolValue:flag forKey:WebKitTelephoneParsingEnabledPreferenceKey];
1593}
1594
1595- (BOOL)_telephoneNumberParsingEnabled
1596{
1597 return [self _boolValueForKey:WebKitTelephoneParsingEnabledPreferenceKey];
1598}
zalan@apple.com7de69d92019-03-08 00:36:42 +00001599
1600- (BOOL)contentChangeObserverEnabled
1601{
1602 return [self _boolValueForKey:WebKitContentChangeObserverEnabledPreferenceKey];
1603}
1604
1605- (void)setContentChangeObserverEnabled:(BOOL)enabled
1606{
1607 [self _setBoolValue:enabled forKey:WebKitContentChangeObserverEnabledPreferenceKey];
1608}
aestes@apple.coma43fba52013-12-31 23:46:34 +00001609#endif
1610
dbates@webkit.org102013c2016-09-26 21:51:25 +00001611#if ENABLE(TEXT_AUTOSIZING)
dbates@webkit.orgacb8f4f2013-09-11 02:39:05 +00001612- (void)_setMinimumZoomFontSize:(float)size
1613{
1614 [self _setFloatValue:size forKey:WebKitMinimumZoomFontSizePreferenceKey];
1615}
1616
1617- (float)_minimumZoomFontSize
1618{
1619 return [self _floatValueForKey:WebKitMinimumZoomFontSizePreferenceKey];
1620}
simon.fraser@apple.com36676e52016-05-07 00:05:58 +00001621
1622- (void)_setTextAutosizingEnabled:(BOOL)enabled
1623{
1624 [self _setBoolValue:enabled forKey:WebKitTextAutosizingEnabledPreferenceKey];
1625}
1626
1627- (BOOL)_textAutosizingEnabled
1628{
1629 return [self _boolValueForKey:WebKitTextAutosizingEnabledPreferenceKey];
1630}
dbates@webkit.orgacb8f4f2013-09-11 02:39:05 +00001631#endif
1632
ap@apple.com1e8475922018-10-18 21:38:50 +00001633#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +00001634- (void)_setLayoutInterval:(int)l
1635{
1636 [self _setIntegerValue:l forKey:WebKitLayoutIntervalPreferenceKey];
1637}
1638
1639- (int)_layoutInterval
1640{
1641 return [self _integerValueForKey:WebKitLayoutIntervalPreferenceKey];
1642}
1643
1644- (void)_setMaxParseDuration:(float)d
1645{
1646 [self _setFloatValue:d forKey:WebKitMaxParseDurationPreferenceKey];
1647}
1648
1649- (float)_maxParseDuration
1650{
1651 return [self _floatValueForKey:WebKitMaxParseDurationPreferenceKey];
1652}
1653
aestes@apple.coma43fba52013-12-31 23:46:34 +00001654- (void)_setAllowMultiElementImplicitFormSubmission:(BOOL)flag
1655{
1656 [self _setBoolValue:flag forKey:WebKitAllowMultiElementImplicitFormSubmissionPreferenceKey];
1657}
1658
1659- (BOOL)_allowMultiElementImplicitFormSubmission
1660{
1661 return [self _boolValueForKey:WebKitAllowMultiElementImplicitFormSubmissionPreferenceKey];
1662}
1663
1664- (void)_setAlwaysRequestGeolocationPermission:(BOOL)flag
1665{
1666 [self _setBoolValue:flag forKey:WebKitAlwaysRequestGeolocationPermissionPreferenceKey];
1667}
1668
1669- (BOOL)_alwaysRequestGeolocationPermission
1670{
1671 return [self _boolValueForKey:WebKitAlwaysRequestGeolocationPermissionPreferenceKey];
1672}
1673
1674- (void)_setAlwaysUseAcceleratedOverflowScroll:(BOOL)flag
1675{
1676 [self _setBoolValue:flag forKey:WebKitAlwaysUseAcceleratedOverflowScrollPreferenceKey];
1677}
1678
1679- (BOOL)_alwaysUseAcceleratedOverflowScroll
1680{
1681 return [self _boolValueForKey:WebKitAlwaysUseAcceleratedOverflowScrollPreferenceKey];
1682}
1683
1684- (void)_setInterpolationQuality:(int)quality
1685{
1686 [self _setIntegerValue:quality forKey:WebKitInterpolationQualityPreferenceKey];
1687}
1688
1689- (int)_interpolationQuality
1690{
1691 return [self _integerValueForKey:WebKitInterpolationQualityPreferenceKey];
1692}
1693
1694- (BOOL)_allowPasswordEcho
1695{
1696 return [self _boolValueForKey:WebKitPasswordEchoEnabledPreferenceKey];
1697}
1698
1699- (float)_passwordEchoDuration
1700{
1701 return [self _floatValueForKey:WebKitPasswordEchoDurationPreferenceKey];
1702}
1703
ap@apple.com1e8475922018-10-18 21:38:50 +00001704#endif // PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +00001705
ap@apple.com1e8475922018-10-18 21:38:50 +00001706#if !PLATFORM(IOS_FAMILY)
sullivanf33213d2005-08-01 17:50:35 +00001707- (float)PDFScaleFactor
1708{
1709 return [self _floatValueForKey:WebKitPDFScaleFactorPreferenceKey];
1710}
1711
1712- (void)setPDFScaleFactor:(float)factor
1713{
1714 [self _setFloatValue:factor forKey:WebKitPDFScaleFactorPreferenceKey];
1715}
aestes@apple.coma43fba52013-12-31 23:46:34 +00001716#endif
sullivanf33213d2005-08-01 17:50:35 +00001717
joepeck@webkit.org4112f8b2010-07-31 02:22:05 +00001718- (int64_t)applicationCacheTotalQuota
1719{
joepeck@webkit.org4112f8b2010-07-31 02:22:05 +00001720 return [self _longLongValueForKey:WebKitApplicationCacheTotalQuota];
1721}
1722
1723- (void)setApplicationCacheTotalQuota:(int64_t)quota
1724{
1725 [self _setLongLongValue:quota forKey:WebKitApplicationCacheTotalQuota];
1726
1727 // Application Cache Preferences are stored on the global cache storage manager, not in Settings.
1728 [WebApplicationCache setMaximumSize:quota];
1729}
1730
1731- (int64_t)applicationCacheDefaultOriginQuota
1732{
joepeck@webkit.org4112f8b2010-07-31 02:22:05 +00001733 return [self _longLongValueForKey:WebKitApplicationCacheDefaultOriginQuota];
1734}
1735
1736- (void)setApplicationCacheDefaultOriginQuota:(int64_t)quota
1737{
1738 [self _setLongLongValue:quota forKey:WebKitApplicationCacheDefaultOriginQuota];
1739}
1740
ap@apple.com1e8475922018-10-18 21:38:50 +00001741#if !PLATFORM(IOS_FAMILY)
ddkilzer@apple.com0bf35982009-01-29 15:46:09 +00001742- (PDFDisplayMode)PDFDisplayMode
sullivanf33213d2005-08-01 17:50:35 +00001743{
timothy_horton@apple.comaee8d6b2016-03-24 19:05:22 +00001744 PDFDisplayMode value = static_cast<PDFDisplayMode>([self _integerValueForKey:WebKitPDFDisplayModePreferenceKey]);
sullivanf33213d2005-08-01 17:50:35 +00001745 if (value != kPDFDisplaySinglePage && value != kPDFDisplaySinglePageContinuous && value != kPDFDisplayTwoUp && value != kPDFDisplayTwoUpContinuous) {
1746 // protect against new modes from future versions of OS X stored in defaults
1747 value = kPDFDisplaySinglePageContinuous;
1748 }
1749 return value;
1750}
1751
1752- (void)setPDFDisplayMode:(PDFDisplayMode)mode
1753{
1754 [self _setIntegerValue:mode forKey:WebKitPDFDisplayModePreferenceKey];
1755}
aestes@apple.coma43fba52013-12-31 23:46:34 +00001756#endif
sullivanf33213d2005-08-01 17:50:35 +00001757
bdashfb3f9562006-10-04 02:31:10 +00001758- (WebKitEditableLinkBehavior)editableLinkBehavior
1759{
slewis@apple.coma7615ca2008-07-12 05:51:33 +00001760 WebKitEditableLinkBehavior value = static_cast<WebKitEditableLinkBehavior> ([self _integerValueForKey:WebKitEditableLinkBehaviorPreferenceKey]);
bdashfb3f9562006-10-04 02:31:10 +00001761 if (value != WebKitEditableLinkDefaultBehavior &&
1762 value != WebKitEditableLinkAlwaysLive &&
thatcherc5c8ec62006-11-15 05:42:44 +00001763 value != WebKitEditableLinkNeverLive &&
bdashfb3f9562006-10-04 02:31:10 +00001764 value != WebKitEditableLinkOnlyLiveWithShiftKey &&
1765 value != WebKitEditableLinkLiveWhenNotFocused) {
1766 // ensure that a valid result is returned
1767 value = WebKitEditableLinkDefaultBehavior;
1768 }
harrison046c9532006-12-08 18:53:51 +00001769
harrisond10eff82006-12-11 18:03:41 +00001770 return value;
bdashfb3f9562006-10-04 02:31:10 +00001771}
1772
1773- (void)setEditableLinkBehavior:(WebKitEditableLinkBehavior)behavior
1774{
1775 [self _setIntegerValue:behavior forKey:WebKitEditableLinkBehaviorPreferenceKey];
1776}
1777
mitz@apple.comd6ceec82008-11-14 23:50:00 +00001778- (WebTextDirectionSubmenuInclusionBehavior)textDirectionSubmenuInclusionBehavior
1779{
1780 WebTextDirectionSubmenuInclusionBehavior value = static_cast<WebTextDirectionSubmenuInclusionBehavior>([self _integerValueForKey:WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey]);
1781 if (value != WebTextDirectionSubmenuNeverIncluded &&
1782 value != WebTextDirectionSubmenuAutomaticallyIncluded &&
1783 value != WebTextDirectionSubmenuAlwaysIncluded) {
1784 // Ensure that a valid result is returned.
1785 value = WebTextDirectionSubmenuNeverIncluded;
1786 }
1787 return value;
1788}
1789
1790- (void)setTextDirectionSubmenuInclusionBehavior:(WebTextDirectionSubmenuInclusionBehavior)behavior
1791{
1792 [self _setIntegerValue:behavior forKey:WebKitTextDirectionSubmenuInclusionBehaviorPreferenceKey];
1793}
1794
sullivan079a7d42007-03-24 17:25:09 +00001795- (BOOL)_useSiteSpecificSpoofing
1796{
1797 return [self _boolValueForKey:WebKitUseSiteSpecificSpoofingPreferenceKey];
1798}
1799
1800- (void)_setUseSiteSpecificSpoofing:(BOOL)newValue
1801{
1802 [self _setBoolValue:newValue forKey:WebKitUseSiteSpecificSpoofingPreferenceKey];
1803}
bdashfb3f9562006-10-04 02:31:10 +00001804
mitz@apple.comc278ea22008-11-08 19:12:23 +00001805- (BOOL)databasesEnabled
1806{
1807 return [self _boolValueForKey:WebKitDatabasesEnabledPreferenceKey];
1808}
1809
1810- (void)setDatabasesEnabled:(BOOL)databasesEnabled
1811{
1812 [self _setBoolValue:databasesEnabled forKey:WebKitDatabasesEnabledPreferenceKey];
1813}
1814
ap@apple.com1e8475922018-10-18 21:38:50 +00001815#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +00001816- (BOOL)storageTrackerEnabled
1817{
1818 return [self _boolValueForKey:WebKitStorageTrackerEnabledPreferenceKey];
1819}
1820
1821- (void)setStorageTrackerEnabled:(BOOL)storageTrackerEnabled
1822{
1823 [self _setBoolValue:storageTrackerEnabled forKey:WebKitStorageTrackerEnabledPreferenceKey];
1824}
1825#endif
1826
mitz@apple.comc278ea22008-11-08 19:12:23 +00001827- (BOOL)localStorageEnabled
1828{
1829 return [self _boolValueForKey:WebKitLocalStorageEnabledPreferenceKey];
1830}
1831
1832- (void)setLocalStorageEnabled:(BOOL)localStorageEnabled
1833{
1834 [self _setBoolValue:localStorageEnabled forKey:WebKitLocalStorageEnabledPreferenceKey];
1835}
1836
atwilson@chromium.org046e5022009-09-25 02:45:14 +00001837- (BOOL)experimentalNotificationsEnabled
1838{
1839 return [self _boolValueForKey:WebKitExperimentalNotificationsEnabledPreferenceKey];
1840}
1841
1842- (void)setExperimentalNotificationsEnabled:(BOOL)experimentalNotificationsEnabled
1843{
1844 [self _setBoolValue:experimentalNotificationsEnabled forKey:WebKitExperimentalNotificationsEnabledPreferenceKey];
1845}
1846
rjw46467492003-05-22 03:52:50 +00001847+ (WebPreferences *)_getInstanceForIdentifier:(NSString *)ident
1848{
ggaren414ee7e2007-09-08 00:40:53 +00001849 LOG(Encoding, "requesting for %@\n", ident);
rjw3a8520a2003-08-28 23:17:07 +00001850
ggaren414ee7e2007-09-08 00:40:53 +00001851 if (!ident)
1852 return _standardPreferences;
rjw3a8520a2003-08-28 23:17:07 +00001853
1854 WebPreferences *instance = [webPreferencesInstances objectForKey:[self _concatenateKeyWithIBCreatorID:ident]];
1855
rjw46467492003-05-22 03:52:50 +00001856 return instance;
1857}
1858
1859+ (void)_setInstance:(WebPreferences *)instance forIdentifier:(NSString *)ident
1860{
1861 if (!webPreferencesInstances)
1862 webPreferencesInstances = [[NSMutableDictionary alloc] init];
rjw3a8520a2003-08-28 23:17:07 +00001863 if (ident) {
1864 [webPreferencesInstances setObject:instance forKey:[self _concatenateKeyWithIBCreatorID:ident]];
ggaren414ee7e2007-09-08 00:40:53 +00001865 LOG(Encoding, "recording %p for %@\n", instance, [self _concatenateKeyWithIBCreatorID:ident]);
rjw3a8520a2003-08-28 23:17:07 +00001866 }
rjw46467492003-05-22 03:52:50 +00001867}
1868
ggaren414ee7e2007-09-08 00:40:53 +00001869+ (void)_checkLastReferenceForIdentifier:(id)identifier
1870{
1871 // FIXME: This won't work at all under garbage collection because retainCount returns a constant.
1872 // We may need to change WebPreferences API so there's an explicit way to end the lifetime of one.
1873 WebPreferences *instance = [webPreferencesInstances objectForKey:identifier];
1874 if ([instance retainCount] == 1)
1875 [webPreferencesInstances removeObjectForKey:identifier];
1876}
1877
rjw46467492003-05-22 03:52:50 +00001878+ (void)_removeReferenceForIdentifier:(NSString *)ident
1879{
ggaren414ee7e2007-09-08 00:40:53 +00001880 if (ident)
1881 [self performSelector:@selector(_checkLastReferenceForIdentifier:) withObject:[self _concatenateKeyWithIBCreatorID:ident] afterDelay:0.1];
rjw46467492003-05-22 03:52:50 +00001882}
1883
mjs@apple.com60484932011-04-08 19:33:04 +00001884- (void)_postPreferencesChangedNotification
rjw46467492003-05-22 03:52:50 +00001885{
ap@apple.com1e8475922018-10-18 21:38:50 +00001886#if !PLATFORM(IOS_FAMILY)
darin@apple.com1a76b3b2009-04-10 23:59:39 +00001887 if (!pthread_main_np()) {
1888 [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO];
1889 return;
1890 }
aestes@apple.coma43fba52013-12-31 23:46:34 +00001891#endif
darin@apple.com1a76b3b2009-04-10 23:59:39 +00001892
mjs@apple.com60484932011-04-08 19:33:04 +00001893 [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedInternalNotification object:self userInfo:nil];
1894 [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedNotification object:self userInfo:nil];
1895}
1896
1897- (void)_postPreferencesChangedAPINotification
1898{
1899 if (!pthread_main_np()) {
1900 [self performSelectorOnMainThread:_cmd withObject:nil waitUntilDone:NO];
1901 return;
1902 }
1903
1904 [[NSNotificationCenter defaultCenter] postNotificationName:WebPreferencesChangedNotification object:self userInfo:nil];
rjw46467492003-05-22 03:52:50 +00001905}
1906
darinddf7c7e2005-01-30 17:52:27 +00001907+ (CFStringEncoding)_systemCFStringEncoding
sullivan331bf882004-09-23 17:56:45 +00001908{
aestes@apple.comdc1b9ad2017-08-29 00:55:01 +00001909 return webDefaultCFStringEncoding();
darinddf7c7e2005-01-30 17:52:27 +00001910}
1911
1912+ (void)_setInitialDefaultTextEncodingToSystemEncoding
1913{
sullivan331bf882004-09-23 17:56:45 +00001914 [[NSUserDefaults standardUserDefaults] registerDefaults:
ap@apple.com7ce55d22014-08-06 20:25:00 +00001915 [NSDictionary dictionaryWithObject:defaultTextEncodingNameForSystemLanguage() forKey:WebKitDefaultTextEncodingNamePreferenceKey]];
sullivan331bf882004-09-23 17:56:45 +00001916}
1917
darin86e09922004-07-02 17:27:36 +00001918static NSString *classIBCreatorID = nil;
rjw2293d4a2003-07-29 01:23:26 +00001919
1920+ (void)_setIBCreatorID:(NSString *)string
1921{
darin86e09922004-07-02 17:27:36 +00001922 NSString *old = classIBCreatorID;
1923 classIBCreatorID = [string copy];
1924 [old release];
rjw2293d4a2003-07-29 01:23:26 +00001925}
1926
ap@apple.com5d809022011-08-30 18:57:08 +00001927+ (void)_switchNetworkLoaderToNewTestingSession
1928{
ap@apple.com1e8475922018-10-18 21:38:50 +00001929#if PLATFORM(IOS_FAMILY)
aestes@apple.com29fde572016-12-24 04:39:52 +00001930 WebThreadLock();
1931#endif
achristensen@apple.comcc76ce82019-01-22 21:28:28 +00001932 NetworkStorageSessionMap::switchToNewTestingSession();
ap@apple.com5d809022011-08-30 18:57:08 +00001933}
1934
ap@apple.coma2b64ced2014-11-09 03:17:02 +00001935+ (void)_clearNetworkLoaderSession
1936{
achristensen@apple.comcc76ce82019-01-22 21:28:28 +00001937 NetworkStorageSessionMap::defaultStorageSession().deleteAllCookies();
ap@apple.coma2b64ced2014-11-09 03:17:02 +00001938}
1939
ap@apple.com5d809022011-08-30 18:57:08 +00001940+ (void)_setCurrentNetworkLoaderSessionCookieAcceptPolicy:(NSHTTPCookieAcceptPolicy)policy
1941{
achristensen@apple.comcc76ce82019-01-22 21:28:28 +00001942 RetainPtr<CFHTTPCookieStorageRef> cookieStorage = NetworkStorageSessionMap::defaultStorageSession().cookieStorage();
1943 ASSERT(cookieStorage); // Will fail when NetworkStorageSessionMap::switchToNewTestingSession() was not called beforehand.
aestes@apple.com23df1462015-12-22 23:52:00 +00001944 CFHTTPCookieStorageSetCookieAcceptPolicy(cookieStorage.get(), policy);
ap@apple.com5d809022011-08-30 18:57:08 +00001945}
1946
ggarenb6474732007-04-10 18:19:51 +00001947- (BOOL)isDOMPasteAllowed
1948{
1949 return [self _boolValueForKey:WebKitDOMPasteAllowedPreferenceKey];
1950}
1951
1952- (void)setDOMPasteAllowed:(BOOL)DOMPasteAllowed
1953{
1954 [self _setBoolValue:DOMPasteAllowed forKey:WebKitDOMPasteAllowedPreferenceKey];
1955}
1956
beidson@apple.comb2da40e2008-04-19 07:26:21 +00001957- (NSString *)_localStorageDatabasePath
1958{
beidson@apple.com1b422542008-05-16 22:19:43 +00001959 return [[self _stringValueForKey:WebKitLocalStorageDatabasePathPreferenceKey] stringByStandardizingPath];
beidson@apple.comb2da40e2008-04-19 07:26:21 +00001960}
1961
1962- (void)_setLocalStorageDatabasePath:(NSString *)path
1963{
beidson@apple.com1b422542008-05-16 22:19:43 +00001964 [self _setStringValue:[path stringByStandardizingPath] forKey:WebKitLocalStorageDatabasePathPreferenceKey];
beidson@apple.comb2da40e2008-04-19 07:26:21 +00001965}
1966
beidson7a243282007-07-14 22:25:31 +00001967- (NSString *)_ftpDirectoryTemplatePath
1968{
beidson@apple.com1b422542008-05-16 22:19:43 +00001969 return [[self _stringValueForKey:WebKitFTPDirectoryTemplatePath] stringByStandardizingPath];
beidson7a243282007-07-14 22:25:31 +00001970}
1971
simon.fraser@apple.comd71db3e2009-07-02 16:33:40 +00001972- (void)_setFTPDirectoryTemplatePath:(NSString *)path
beidson7a243282007-07-14 22:25:31 +00001973{
simon.fraser@apple.comd71db3e2009-07-02 16:33:40 +00001974 [self _setStringValue:[path stringByStandardizingPath] forKey:WebKitFTPDirectoryTemplatePath];
beidson7a243282007-07-14 22:25:31 +00001975}
1976
1977- (BOOL)_forceFTPDirectoryListings
1978{
1979 return [self _boolValueForKey:WebKitForceFTPDirectoryListings];
1980}
1981
simon.fraser@apple.comd71db3e2009-07-02 16:33:40 +00001982- (void)_setForceFTPDirectoryListings:(BOOL)force
1983{
1984 [self _setBoolValue:force forKey:WebKitForceFTPDirectoryListings];
1985}
1986
simon.fraser@apple.comd7638512011-02-17 04:54:24 +00001987- (BOOL)acceleratedDrawingEnabled
1988{
1989 return [self _boolValueForKey:WebKitAcceleratedDrawingEnabledPreferenceKey];
1990}
1991
1992- (void)setAcceleratedDrawingEnabled:(BOOL)enabled
1993{
1994 [self _setBoolValue:enabled forKey:WebKitAcceleratedDrawingEnabledPreferenceKey];
1995}
1996
simon.fraser@apple.com956c3252016-01-07 01:43:25 +00001997- (BOOL)displayListDrawingEnabled
1998{
1999 return [self _boolValueForKey:WebKitDisplayListDrawingEnabledPreferenceKey];
2000}
2001
2002- (void)setDisplayListDrawingEnabled:(BOOL)enabled
2003{
2004 [self _setBoolValue:enabled forKey:WebKitDisplayListDrawingEnabledPreferenceKey];
2005}
2006
bfulgham@apple.comb0f69c92016-02-16 05:36:38 +00002007- (BOOL)resourceLoadStatisticsEnabled
2008{
2009 return [self _boolValueForKey:WebKitResourceLoadStatisticsEnabledPreferenceKey];
2010}
2011
2012- (void)setResourceLoadStatisticsEnabled:(BOOL)enabled
2013{
2014 [self _setBoolValue:enabled forKey:WebKitResourceLoadStatisticsEnabledPreferenceKey];
2015}
2016
commit-queue@webkit.orgd57dde42016-11-30 23:48:00 +00002017- (BOOL)largeImageAsyncDecodingEnabled
commit-queue@webkit.org2d0b9fd2016-11-04 21:54:44 +00002018{
commit-queue@webkit.orgd57dde42016-11-30 23:48:00 +00002019 return [self _boolValueForKey:WebKitLargeImageAsyncDecodingEnabledPreferenceKey];
commit-queue@webkit.org2d0b9fd2016-11-04 21:54:44 +00002020}
2021
commit-queue@webkit.orgd57dde42016-11-30 23:48:00 +00002022- (void)setLargeImageAsyncDecodingEnabled:(BOOL)enabled
commit-queue@webkit.org2d0b9fd2016-11-04 21:54:44 +00002023{
commit-queue@webkit.orgd57dde42016-11-30 23:48:00 +00002024 [self _setBoolValue:enabled forKey:WebKitLargeImageAsyncDecodingEnabledPreferenceKey];
2025}
2026
2027- (BOOL)animatedImageAsyncDecodingEnabled
2028{
2029 return [self _boolValueForKey:WebKitAnimatedImageAsyncDecodingEnabledPreferenceKey];
2030}
2031
2032- (void)setAnimatedImageAsyncDecodingEnabled:(BOOL)enabled
2033{
2034 [self _setBoolValue:enabled forKey:WebKitAnimatedImageAsyncDecodingEnabledPreferenceKey];
commit-queue@webkit.org2d0b9fd2016-11-04 21:54:44 +00002035}
2036
mdelaney@apple.come84b3162011-03-10 21:41:00 +00002037- (BOOL)canvasUsesAcceleratedDrawing
2038{
2039 return [self _boolValueForKey:WebKitCanvasUsesAcceleratedDrawingPreferenceKey];
2040}
2041
2042- (void)setCanvasUsesAcceleratedDrawing:(BOOL)enabled
2043{
2044 [self _setBoolValue:enabled forKey:WebKitCanvasUsesAcceleratedDrawingPreferenceKey];
2045}
2046
simon.fraser@apple.comd71db3e2009-07-02 16:33:40 +00002047- (BOOL)acceleratedCompositingEnabled
2048{
2049 return [self _boolValueForKey:WebKitAcceleratedCompositingEnabledPreferenceKey];
2050}
2051
2052- (void)setAcceleratedCompositingEnabled:(BOOL)enabled
2053{
2054 [self _setBoolValue:enabled forKey:WebKitAcceleratedCompositingEnabledPreferenceKey];
2055}
2056
cmarrin@apple.comf2dff332009-11-18 19:23:44 +00002057- (BOOL)showDebugBorders
2058{
2059 return [self _boolValueForKey:WebKitShowDebugBordersPreferenceKey];
2060}
2061
2062- (void)setShowDebugBorders:(BOOL)enabled
2063{
2064 [self _setBoolValue:enabled forKey:WebKitShowDebugBordersPreferenceKey];
2065}
2066
simon.fraser@apple.comd8bbcf32017-02-22 00:30:32 +00002067- (BOOL)subpixelAntialiasedLayerTextEnabled
2068{
2069 return [self _boolValueForKey:WebKitSubpixelAntialiasedLayerTextEnabledPreferenceKey];
2070}
2071
2072- (void)setSubpixelAntialiasedLayerTextEnabled:(BOOL)enabled
2073{
2074 [self _setBoolValue:enabled forKey:WebKitSubpixelAntialiasedLayerTextEnabledPreferenceKey];
2075}
2076
zalan@apple.comb7e6a662017-01-25 05:02:56 +00002077- (BOOL)simpleLineLayoutEnabled
2078{
2079 return [self _boolValueForKey:WebKitSimpleLineLayoutEnabledPreferenceKey];
2080}
2081
2082- (void)setSimpleLineLayoutEnabled:(BOOL)enabled
2083{
2084 [self _setBoolValue:enabled forKey:WebKitSimpleLineLayoutEnabledPreferenceKey];
2085}
2086
zalan@apple.comb1f545f2014-11-22 00:59:27 +00002087- (BOOL)simpleLineLayoutDebugBordersEnabled
2088{
2089 return [self _boolValueForKey:WebKitSimpleLineLayoutDebugBordersEnabledPreferenceKey];
2090}
2091
2092- (void)setSimpleLineLayoutDebugBordersEnabled:(BOOL)enabled
2093{
2094 [self _setBoolValue:enabled forKey:WebKitSimpleLineLayoutDebugBordersEnabledPreferenceKey];
2095}
2096
cmarrin@apple.comf2dff332009-11-18 19:23:44 +00002097- (BOOL)showRepaintCounter
2098{
2099 return [self _boolValueForKey:WebKitShowRepaintCounterPreferenceKey];
2100}
2101
2102- (void)setShowRepaintCounter:(BOOL)enabled
2103{
2104 [self _setBoolValue:enabled forKey:WebKitShowRepaintCounterPreferenceKey];
2105}
2106
crogers@google.com181d9872011-01-21 21:43:03 +00002107- (BOOL)webAudioEnabled
2108{
2109 return [self _boolValueForKey:WebKitWebAudioEnabledPreferenceKey];
2110}
2111
2112- (void)setWebAudioEnabled:(BOOL)enabled
2113{
2114 [self _setBoolValue:enabled forKey:WebKitWebAudioEnabledPreferenceKey];
2115}
2116
zalan@apple.comb080c582014-05-18 00:40:15 +00002117- (BOOL)subpixelCSSOMElementMetricsEnabled
2118{
2119 return [self _boolValueForKey:WebKitSubpixelCSSOMElementMetricsEnabledPreferenceKey];
2120}
2121
timothy_horton@apple.comd0c1e852014-07-08 22:24:41 +00002122- (void)setSubpixelCSSOMElementMetricsEnabled:(BOOL)enabled
zalan@apple.comb080c582014-05-18 00:40:15 +00002123{
2124 [self _setBoolValue:enabled forKey:WebKitSubpixelCSSOMElementMetricsEnabledPreferenceKey];
2125}
2126
cmarrin@apple.combaf6fd02009-10-02 00:25:12 +00002127- (BOOL)webGLEnabled
2128{
2129 return [self _boolValueForKey:WebKitWebGLEnabledPreferenceKey];
2130}
2131
2132- (void)setWebGLEnabled:(BOOL)enabled
2133{
2134 [self _setBoolValue:enabled forKey:WebKitWebGLEnabledPreferenceKey];
2135}
2136
commit-queue@webkit.orgd1adeef2016-04-05 11:22:17 +00002137- (BOOL)webGL2Enabled
2138{
2139 return [self _boolValueForKey:WebKitWebGL2EnabledPreferenceKey];
2140}
2141
2142- (void)setWebGL2Enabled:(BOOL)enabled
2143{
2144 [self _setBoolValue:enabled forKey:WebKitWebGL2EnabledPreferenceKey];
2145}
2146
dino@apple.com997f7b12017-02-14 23:31:12 +00002147- (BOOL)forceLowPowerGPUForWebGL
timothy_horton@apple.comd359e892017-01-04 08:55:38 +00002148{
dino@apple.com997f7b12017-02-14 23:31:12 +00002149 return [self _boolValueForKey:WebKitForceWebGLUsesLowPowerPreferenceKey];
timothy_horton@apple.comd359e892017-01-04 08:55:38 +00002150}
2151
dino@apple.com997f7b12017-02-14 23:31:12 +00002152- (void)setForceWebGLUsesLowPower:(BOOL)forceLowPower
timothy_horton@apple.comd359e892017-01-04 08:55:38 +00002153{
dino@apple.com997f7b12017-02-14 23:31:12 +00002154 [self _setBoolValue:forceLowPower forKey:WebKitForceWebGLUsesLowPowerPreferenceKey];
timothy_horton@apple.comd359e892017-01-04 08:55:38 +00002155}
2156
justin_fan@apple.comc21759c2018-10-16 04:57:47 +00002157- (BOOL)webGPUEnabled
2158{
2159 return [self _boolValueForKey:WebKitWebGPUEnabledPreferenceKey];
2160}
2161
2162- (void)setWebGPUEnabled:(BOOL)enabled
2163{
2164 [self _setBoolValue:enabled forKey:WebKitWebGPUEnabledPreferenceKey];
2165}
2166
cmarrin@apple.com09fa67e2010-09-17 18:35:46 +00002167- (BOOL)accelerated2dCanvasEnabled
2168{
2169 return [self _boolValueForKey:WebKitAccelerated2dCanvasEnabledPreferenceKey];
2170}
2171
2172- (void)setAccelerated2dCanvasEnabled:(BOOL)enabled
2173{
2174 [self _setBoolValue:enabled forKey:WebKitAccelerated2dCanvasEnabledPreferenceKey];
2175}
2176
psolanki@apple.comfe67f4a2014-09-05 01:02:43 +00002177- (void)setDiskImageCacheEnabled:(BOOL)enabled
2178{
2179 // Staging. Can be removed once there are no more callers.
2180}
2181
kenneth@webkit.org6af77fe2010-03-29 14:03:06 +00002182- (BOOL)isFrameFlatteningEnabled
eric@webkit.org55c6f212010-02-10 19:44:08 +00002183{
commit-queue@webkit.org8168b792017-06-19 07:41:11 +00002184 return [self _unsignedIntValueForKey:WebKitFrameFlatteningPreferenceKey] != WebKitFrameFlatteningDisabled;
eric@webkit.org55c6f212010-02-10 19:44:08 +00002185}
2186
commit-queue@webkit.org8168b792017-06-19 07:41:11 +00002187- (void)setFrameFlatteningEnabled:(BOOL)flattening
eric@webkit.org55c6f212010-02-10 19:44:08 +00002188{
commit-queue@webkit.org8168b792017-06-19 07:41:11 +00002189 WebKitFrameFlattening value = flattening ? WebKitFrameFlatteningFullyEnabled : WebKitFrameFlatteningDisabled;
2190 [self _setUnsignedIntValue:value forKey:WebKitFrameFlatteningPreferenceKey];
2191}
2192
2193- (WebKitFrameFlattening)frameFlattening
2194{
2195 return static_cast<WebKitFrameFlattening>([self _unsignedIntValueForKey:WebKitFrameFlatteningPreferenceKey]);
2196}
2197
2198- (void)setFrameFlattening:(WebKitFrameFlattening)flattening
2199{
2200 [self _setUnsignedIntValue:flattening forKey:WebKitFrameFlatteningPreferenceKey];
eric@webkit.org55c6f212010-02-10 19:44:08 +00002201}
2202
fred.wang@free.fr24211532017-06-20 06:04:55 +00002203- (BOOL)asyncFrameScrollingEnabled
2204{
2205 return [self _boolValueForKey:WebKitAsyncFrameScrollingEnabledPreferenceKey];
2206}
2207
2208- (void)setAsyncFrameScrollingEnabled:(BOOL)enabled
2209{
2210 [self _setBoolValue:enabled forKey:WebKitAsyncFrameScrollingEnabledPreferenceKey];
2211}
2212
tonikitoo@webkit.orgac61429a2010-10-08 03:53:57 +00002213- (BOOL)isSpatialNavigationEnabled
2214{
2215 return [self _boolValueForKey:WebKitSpatialNavigationEnabledPreferenceKey];
2216}
2217
2218- (void)setSpatialNavigationEnabled:(BOOL)flag
2219{
2220 [self _setBoolValue:flag forKey:WebKitSpatialNavigationEnabledPreferenceKey];
2221}
2222
hyatt@apple.com6a934682010-06-01 21:41:15 +00002223- (BOOL)paginateDuringLayoutEnabled
2224{
2225 return [self _boolValueForKey:WebKitPaginateDuringLayoutEnabledPreferenceKey];
2226}
2227
2228- (void)setPaginateDuringLayoutEnabled:(BOOL)flag
2229{
2230 [self _setBoolValue:flag forKey:WebKitPaginateDuringLayoutEnabledPreferenceKey];
2231}
2232
japhet@chromium.orgf5d746b2010-09-23 18:02:15 +00002233- (BOOL)hyperlinkAuditingEnabled
2234{
2235 return [self _boolValueForKey:WebKitHyperlinkAuditingEnabledPreferenceKey];
2236}
2237
2238- (void)setHyperlinkAuditingEnabled:(BOOL)flag
2239{
2240 [self _setBoolValue:flag forKey:WebKitHyperlinkAuditingEnabledPreferenceKey];
2241}
2242
aestes@apple.com7fb43f62010-09-20 23:01:12 +00002243- (BOOL)usePreHTML5ParserQuirks
2244{
2245 return [self _boolValueForKey:WebKitUsePreHTML5ParserQuirksKey];
2246}
2247
2248- (void)setUsePreHTML5ParserQuirks:(BOOL)flag
2249{
2250 [self _setBoolValue:flag forKey:WebKitUsePreHTML5ParserQuirksKey];
2251}
2252
ggaren414ee7e2007-09-08 00:40:53 +00002253- (void)didRemoveFromWebView
2254{
2255 ASSERT(_private->numWebViews);
2256 if (--_private->numWebViews == 0)
2257 [[NSNotificationCenter defaultCenter]
2258 postNotificationName:WebPreferencesRemovedNotification
2259 object:self
2260 userInfo:nil];
2261}
2262
2263- (void)willAddToWebView
2264{
2265 ++_private->numWebViews;
2266}
dimich@chromium.org238152d2009-08-11 17:42:43 +00002267
2268- (void)_setPreferenceForTestWithValue:(NSString *)value forKey:(NSString *)key
2269{
2270 [self _setStringValue:value forKey:key];
2271}
2272
jer.noble@apple.comc5584f32010-08-27 20:49:02 +00002273- (void)setFullScreenEnabled:(BOOL)flag
2274{
2275 [self _setBoolValue:flag forKey:WebKitFullScreenEnabledPreferenceKey];
2276}
2277
2278- (BOOL)fullScreenEnabled
2279{
2280 return [self _boolValueForKey:WebKitFullScreenEnabledPreferenceKey];
2281}
2282
morrita@google.com7a18fee2010-12-13 06:06:19 +00002283- (void)setAsynchronousSpellCheckingEnabled:(BOOL)flag
2284{
2285 [self _setBoolValue:flag forKey:WebKitAsynchronousSpellCheckingEnabledPreferenceKey];
2286}
2287
2288- (BOOL)asynchronousSpellCheckingEnabled
2289{
2290 return [self _boolValueForKey:WebKitAsynchronousSpellCheckingEnabledPreferenceKey];
2291}
2292
mrowe@apple.comcc98cb12010-09-15 00:19:27 +00002293+ (void)setWebKitLinkTimeVersion:(int)version
2294{
2295 setWebKitLinkTimeVersion(version);
2296}
2297
alice.liu@apple.comdc9ed392011-04-12 20:22:22 +00002298- (void)setLoadsSiteIconsIgnoringImageLoadingPreference: (BOOL)flag
2299{
2300 [self _setBoolValue: flag forKey: WebKitLoadSiteIconsKey];
2301}
2302
2303- (BOOL)loadsSiteIconsIgnoringImageLoadingPreference
2304{
2305 return [self _boolValueForKey: WebKitLoadSiteIconsKey];
2306}
2307
jer.noble@apple.com93d40322011-04-22 17:51:00 +00002308- (void)setAVFoundationEnabled:(BOOL)flag
2309{
2310 [self _setBoolValue:flag forKey:WebKitAVFoundationEnabledKey];
2311}
2312
2313- (BOOL)isAVFoundationEnabled
2314{
2315 return [self _boolValueForKey:WebKitAVFoundationEnabledKey];
2316}
yutak@chromium.org3f9b22b2011-06-24 12:18:18 +00002317
jer.noble@apple.com9a726962016-02-09 20:56:48 +00002318- (void)setAVFoundationNSURLSessionEnabled:(BOOL)flag
2319{
2320 [self _setBoolValue:flag forKey:WebKitAVFoundationNSURLSessionEnabledKey];
2321}
2322
2323- (BOOL)isAVFoundationNSURLSessionEnabled
2324{
2325 return [self _boolValueForKey:WebKitAVFoundationNSURLSessionEnabledKey];
2326}
2327
jer.noble@apple.combff86892013-11-04 22:53:32 +00002328- (void)setVideoPluginProxyEnabled:(BOOL)flag
2329{
simon.fraser@apple.com136ac2e2014-05-01 02:19:33 +00002330 // No-op, left for SPI compatibility.
jer.noble@apple.combff86892013-11-04 22:53:32 +00002331}
2332
2333- (BOOL)isVideoPluginProxyEnabled
2334{
simon.fraser@apple.com136ac2e2014-05-01 02:19:33 +00002335 return NO;
jer.noble@apple.combff86892013-11-04 22:53:32 +00002336}
2337
yutak@chromium.org3f9b22b2011-06-24 12:18:18 +00002338- (void)setHixie76WebSocketProtocolEnabled:(BOOL)flag
2339{
yutak@chromium.org3f9b22b2011-06-24 12:18:18 +00002340}
2341
2342- (BOOL)isHixie76WebSocketProtocolEnabled
2343{
abarth@webkit.org51456252012-07-10 23:53:21 +00002344 return false;
yutak@chromium.org3f9b22b2011-06-24 12:18:18 +00002345}
dino@apple.comef970382011-07-19 02:21:40 +00002346
bfulgham@apple.coma6c7b142014-03-17 20:33:20 +00002347- (BOOL)isInheritURIQueryComponentEnabled
2348{
2349 return [self _boolValueForKey: WebKitEnableInheritURIQueryComponentPreferenceKey];
2350}
2351
2352- (void)setEnableInheritURIQueryComponent:(BOOL)flag
2353{
2354 [self _setBoolValue:flag forKey: WebKitEnableInheritURIQueryComponentPreferenceKey];
2355}
2356
ap@apple.com1e8475922018-10-18 21:38:50 +00002357#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +00002358- (BOOL)mediaPlaybackAllowsAirPlay
2359{
jonlee@apple.com37162702015-05-23 01:55:41 +00002360 return [self _boolValueForKey:WebKitAllowsAirPlayForMediaPlaybackPreferenceKey];
aestes@apple.coma43fba52013-12-31 23:46:34 +00002361}
2362
2363- (void)setMediaPlaybackAllowsAirPlay:(BOOL)flag
2364{
jonlee@apple.com37162702015-05-23 01:55:41 +00002365 [self _setBoolValue:flag forKey:WebKitAllowsAirPlayForMediaPlaybackPreferenceKey];
aestes@apple.coma43fba52013-12-31 23:46:34 +00002366}
2367
2368- (unsigned)audioSessionCategoryOverride
2369{
2370 return [self _unsignedIntValueForKey:WebKitAudioSessionCategoryOverride];
2371}
2372
2373- (void)setAudioSessionCategoryOverride:(unsigned)override
2374{
2375 if (override > AudioSession::AudioProcessing) {
2376 // Clients are passing us OSTypes values from AudioToolbox/AudioSession.h,
2377 // which need to be translated into AudioSession::CategoryType:
2378 switch (override) {
eric.carlson@apple.com536f9f82019-04-05 18:21:40 +00002379 case WebKitAudioSessionCategoryAmbientSound:
aestes@apple.coma43fba52013-12-31 23:46:34 +00002380 override = AudioSession::AmbientSound;
2381 break;
eric.carlson@apple.com536f9f82019-04-05 18:21:40 +00002382 case WebKitAudioSessionCategorySoloAmbientSound:
aestes@apple.coma43fba52013-12-31 23:46:34 +00002383 override = AudioSession::SoloAmbientSound;
2384 break;
eric.carlson@apple.com536f9f82019-04-05 18:21:40 +00002385 case WebKitAudioSessionCategoryMediaPlayback:
aestes@apple.coma43fba52013-12-31 23:46:34 +00002386 override = AudioSession::MediaPlayback;
2387 break;
eric.carlson@apple.com536f9f82019-04-05 18:21:40 +00002388 case WebKitAudioSessionCategoryRecordAudio:
aestes@apple.coma43fba52013-12-31 23:46:34 +00002389 override = AudioSession::RecordAudio;
2390 break;
eric.carlson@apple.com536f9f82019-04-05 18:21:40 +00002391 case WebKitAudioSessionCategoryPlayAndRecord:
aestes@apple.coma43fba52013-12-31 23:46:34 +00002392 override = AudioSession::PlayAndRecord;
2393 break;
eric.carlson@apple.com536f9f82019-04-05 18:21:40 +00002394 case WebKitAudioSessionCategoryAudioProcessing:
aestes@apple.coma43fba52013-12-31 23:46:34 +00002395 override = AudioSession::AudioProcessing;
2396 break;
2397 default:
2398 override = AudioSession::None;
2399 break;
2400 }
2401 }
2402
2403 [self _setUnsignedIntValue:override forKey:WebKitAudioSessionCategoryOverride];
2404}
2405
commit-queue@webkit.org631001b2014-01-20 22:41:25 +00002406- (BOOL)avKitEnabled
2407{
2408 return [self _boolValueForKey:WebKitAVKitEnabled];
2409}
2410
2411- (void)setAVKitEnabled:(bool)flag
2412{
aestes@apple.com18ea6992015-04-10 08:33:41 +00002413#if HAVE(AVKIT)
commit-queue@webkit.org631001b2014-01-20 22:41:25 +00002414 [self _setBoolValue:flag forKey:WebKitAVKitEnabled];
aestes@apple.com18ea6992015-04-10 08:33:41 +00002415#endif
commit-queue@webkit.org631001b2014-01-20 22:41:25 +00002416}
2417
aestes@apple.coma43fba52013-12-31 23:46:34 +00002418- (BOOL)networkDataUsageTrackingEnabled
2419{
2420 return [self _boolValueForKey:WebKitNetworkDataUsageTrackingEnabledPreferenceKey];
2421}
2422
2423- (void)setNetworkDataUsageTrackingEnabled:(bool)trackingEnabled
2424{
2425 [self _setBoolValue:trackingEnabled forKey:WebKitNetworkDataUsageTrackingEnabledPreferenceKey];
2426}
2427
2428- (NSString *)networkInterfaceName
2429{
2430 return [self _stringValueForKey:WebKitNetworkInterfaceNamePreferenceKey];
2431}
2432
2433- (void)setNetworkInterfaceName:(NSString *)name
2434{
2435 [self _setStringValue:name forKey:WebKitNetworkInterfaceNamePreferenceKey];
2436}
ap@apple.com1e8475922018-10-18 21:38:50 +00002437#endif // PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +00002438
jer.noble@apple.com75a4eb82016-03-10 21:35:10 +00002439// Deprecated. Use -videoPlaybackRequiresUserGesture and -audioPlaybackRequiresUserGesture instead.
dino@apple.comef970382011-07-19 02:21:40 +00002440- (BOOL)mediaPlaybackRequiresUserGesture
2441{
jonlee@apple.com6ed1c192015-05-22 23:56:38 +00002442 return [self _boolValueForKey:WebKitRequiresUserGestureForMediaPlaybackPreferenceKey];
dino@apple.comef970382011-07-19 02:21:40 +00002443}
2444
jer.noble@apple.com75a4eb82016-03-10 21:35:10 +00002445// Deprecated. Use -setVideoPlaybackRequiresUserGesture and -setAudioPlaybackRequiresUserGesture instead.
dino@apple.comef970382011-07-19 02:21:40 +00002446- (void)setMediaPlaybackRequiresUserGesture:(BOOL)flag
2447{
jonlee@apple.com6ed1c192015-05-22 23:56:38 +00002448 [self _setBoolValue:flag forKey:WebKitRequiresUserGestureForMediaPlaybackPreferenceKey];
dino@apple.comef970382011-07-19 02:21:40 +00002449}
2450
jer.noble@apple.com75a4eb82016-03-10 21:35:10 +00002451- (BOOL)videoPlaybackRequiresUserGesture
2452{
2453 return [self _boolValueForKey:WebKitRequiresUserGestureForVideoPlaybackPreferenceKey];
2454}
2455
2456- (void)setVideoPlaybackRequiresUserGesture:(BOOL)flag
2457{
2458 [self _setBoolValue:flag forKey:WebKitRequiresUserGestureForVideoPlaybackPreferenceKey];
2459}
2460
jer.noble@apple.com770bb872015-11-18 23:04:36 +00002461- (BOOL)audioPlaybackRequiresUserGesture
2462{
2463 return [self _boolValueForKey:WebKitRequiresUserGestureForAudioPlaybackPreferenceKey];
2464}
2465
2466- (void)setAudioPlaybackRequiresUserGesture:(BOOL)flag
2467{
2468 [self _setBoolValue:flag forKey:WebKitRequiresUserGestureForAudioPlaybackPreferenceKey];
2469}
2470
jer.noble@apple.com5b542ab2016-03-11 00:34:57 +00002471- (BOOL)overrideUserGestureRequirementForMainContent
2472{
2473 return [self _boolValueForKey:WebKitMainContentUserGestureOverrideEnabledPreferenceKey];
2474}
2475
2476- (void)setOverrideUserGestureRequirementForMainContent:(BOOL)flag
2477{
2478 [self _setBoolValue:flag forKey:WebKitMainContentUserGestureOverrideEnabledPreferenceKey];
2479}
2480
dino@apple.comef970382011-07-19 02:21:40 +00002481- (BOOL)mediaPlaybackAllowsInline
2482{
jonlee@apple.com0c65d8b2015-05-23 01:57:43 +00002483 return [self _boolValueForKey:WebKitAllowsInlineMediaPlaybackPreferenceKey];
dino@apple.comef970382011-07-19 02:21:40 +00002484}
2485
2486- (void)setMediaPlaybackAllowsInline:(BOOL)flag
2487{
jonlee@apple.com0c65d8b2015-05-23 01:57:43 +00002488 [self _setBoolValue:flag forKey:WebKitAllowsInlineMediaPlaybackPreferenceKey];
dino@apple.comef970382011-07-19 02:21:40 +00002489}
mitz@apple.com676a2002011-07-26 20:23:50 +00002490
mmaxfield@apple.com9807e042016-07-26 23:36:52 +00002491- (BOOL)inlineMediaPlaybackRequiresPlaysInlineAttribute
2492{
2493 return [self _boolValueForKey:WebKitInlineMediaPlaybackRequiresPlaysInlineAttributeKey];
2494}
2495
2496- (void)setInlineMediaPlaybackRequiresPlaysInlineAttribute:(BOOL)flag
2497{
2498 [self _setBoolValue:flag forKey:WebKitInlineMediaPlaybackRequiresPlaysInlineAttributeKey];
2499}
2500
jer.noble@apple.com1150ab42015-12-03 23:39:38 +00002501- (BOOL)invisibleAutoplayNotPermitted
2502{
2503 return [self _boolValueForKey:WebKitInvisibleAutoplayNotPermittedKey];
2504}
2505
2506- (void)setInvisibleAutoplayNotPermitted:(BOOL)flag
2507{
2508 [self _setBoolValue:flag forKey:WebKitInvisibleAutoplayNotPermittedKey];
2509}
2510
dino@apple.com5d4e6342015-06-29 20:53:59 +00002511- (BOOL)mediaControlsScaleWithPageZoom
2512{
2513 return [self _boolValueForKey:WebKitMediaControlsScaleWithPageZoomPreferenceKey];
2514}
2515
2516- (void)setMediaControlsScaleWithPageZoom:(BOOL)flag
2517{
2518 [self _setBoolValue:flag forKey:WebKitMediaControlsScaleWithPageZoomPreferenceKey];
2519}
2520
eric.carlson@apple.comee6bbff2014-11-17 14:07:04 +00002521- (BOOL)allowsAlternateFullscreen
2522{
jonlee@apple.com92313232015-06-18 23:42:22 +00002523 return [self allowsPictureInPictureMediaPlayback];
eric.carlson@apple.comee6bbff2014-11-17 14:07:04 +00002524}
2525
2526- (void)setAllowsAlternateFullscreen:(BOOL)flag
2527{
jonlee@apple.com92313232015-06-18 23:42:22 +00002528 [self setAllowsPictureInPictureMediaPlayback:flag];
2529}
2530
2531- (BOOL)allowsPictureInPictureMediaPlayback
2532{
2533 return [self _boolValueForKey:WebKitAllowsPictureInPictureMediaPlaybackPreferenceKey];
2534}
2535
2536- (void)setAllowsPictureInPictureMediaPlayback:(BOOL)flag
2537{
2538 [self _setBoolValue:flag forKey:WebKitAllowsPictureInPictureMediaPlaybackPreferenceKey];
eric.carlson@apple.comee6bbff2014-11-17 14:07:04 +00002539}
2540
simon.fraser@apple.com1746eda2011-09-17 01:12:48 +00002541- (BOOL)mockScrollbarsEnabled
2542{
2543 return [self _boolValueForKey:WebKitMockScrollbarsEnabledPreferenceKey];
2544}
2545
2546- (void)setMockScrollbarsEnabled:(BOOL)flag
2547{
2548 [self _setBoolValue:flag forKey:WebKitMockScrollbarsEnabledPreferenceKey];
2549}
2550
mitz@apple.com676a2002011-07-26 20:23:50 +00002551- (NSString *)pictographFontFamily
2552{
2553 return [self _stringValueForKey: WebKitPictographFontPreferenceKey];
2554}
2555
2556- (void)setPictographFontFamily:(NSString *)family
2557{
2558 [self _setStringValue: family forKey: WebKitPictographFontPreferenceKey];
2559}
2560
beidson@apple.com343e49b2011-12-12 22:00:31 +00002561- (BOOL)pageCacheSupportsPlugins
2562{
2563 return [self _boolValueForKey:WebKitPageCacheSupportsPluginsPreferenceKey];
2564}
2565
2566- (void)setPageCacheSupportsPlugins:(BOOL)flag
2567{
2568 [self _setBoolValue:flag forKey:WebKitPageCacheSupportsPluginsPreferenceKey];
2569
2570}
2571
ap@apple.com1e8475922018-10-18 21:38:50 +00002572#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +00002573- (void)_invalidateCachedPreferences
2574{
2575 dispatch_barrier_sync(_private->readWriteQueue, ^{
2576 if (_private->values)
2577 _private->values = adoptNS([[NSMutableDictionary alloc] init]);
2578 });
2579
ap@apple.com0c269282014-01-15 22:53:20 +00002580 [self _updatePrivateBrowsingStateTo:[self privateBrowsingEnabled]];
ap@apple.come3691aa2014-01-15 21:30:26 +00002581
aestes@apple.coma43fba52013-12-31 23:46:34 +00002582 // Tell any live WebViews to refresh their preferences
2583 [self _postPreferencesChangedNotification];
2584}
2585
2586- (void)_synchronizeWebStoragePolicyWithCookiePolicy
2587{
ap@apple.com664c7b32014-01-17 00:33:35 +00002588 // FIXME: This should be done in clients, WebKit shouldn't be making such policy decisions.
2589
aestes@apple.coma43fba52013-12-31 23:46:34 +00002590 NSHTTPCookieAcceptPolicy cookieAcceptPolicy = [[NSHTTPCookieStorage sharedHTTPCookieStorage] cookieAcceptPolicy];
2591 WebStorageBlockingPolicy storageBlockingPolicy;
ap@apple.com6c6ba6a2014-01-17 21:24:21 +00002592 switch (static_cast<unsigned>(cookieAcceptPolicy)) {
aestes@apple.coma43fba52013-12-31 23:46:34 +00002593 case NSHTTPCookieAcceptPolicyAlways:
2594 storageBlockingPolicy = WebAllowAllStorage;
2595 break;
2596 case NSHTTPCookieAcceptPolicyOnlyFromMainDocumentDomain:
ap@apple.com664c7b32014-01-17 00:33:35 +00002597 case NSHTTPCookieAcceptPolicyExclusivelyFromMainDocumentDomain:
aestes@apple.coma43fba52013-12-31 23:46:34 +00002598 storageBlockingPolicy = WebBlockThirdPartyStorage;
2599 break;
2600 case NSHTTPCookieAcceptPolicyNever:
2601 storageBlockingPolicy = WebBlockAllStorage;
2602 break;
ap@apple.com6c6ba6a2014-01-17 21:24:21 +00002603 default:
2604 ASSERT_NOT_REACHED();
2605 storageBlockingPolicy = WebBlockAllStorage;
2606 break;
aestes@apple.coma43fba52013-12-31 23:46:34 +00002607 }
2608
2609 [self setStorageBlockingPolicy:storageBlockingPolicy];
2610}
2611#endif
2612
sullivan@apple.comc94bb9c2011-10-28 22:07:16 +00002613- (void)setBackspaceKeyNavigationEnabled:(BOOL)flag
2614{
2615 [self _setBoolValue:flag forKey:WebKitBackspaceKeyNavigationEnabledKey];
2616}
2617
2618- (BOOL)backspaceKeyNavigationEnabled
2619{
2620 return [self _boolValueForKey:WebKitBackspaceKeyNavigationEnabledKey];
2621}
2622
jhoneycutt@apple.com5d98acc2012-05-03 01:39:16 +00002623- (void)setWantsBalancedSetDefersLoadingBehavior:(BOOL)flag
2624{
2625 [self _setBoolValue:flag forKey:WebKitWantsBalancedSetDefersLoadingBehaviorKey];
2626}
2627
2628- (BOOL)wantsBalancedSetDefersLoadingBehavior
2629{
2630 return [self _boolValueForKey:WebKitWantsBalancedSetDefersLoadingBehaviorKey];
2631}
2632
eric.carlson@apple.com4eb26b52011-12-05 08:42:27 +00002633- (void)setShouldDisplaySubtitles:(BOOL)flag
2634{
2635 [self _setBoolValue:flag forKey:WebKitShouldDisplaySubtitlesPreferenceKey];
2636}
2637
2638- (BOOL)shouldDisplaySubtitles
2639{
2640 return [self _boolValueForKey:WebKitShouldDisplaySubtitlesPreferenceKey];
2641}
2642
2643- (void)setShouldDisplayCaptions:(BOOL)flag
2644{
2645 [self _setBoolValue:flag forKey:WebKitShouldDisplayCaptionsPreferenceKey];
2646}
2647
2648- (BOOL)shouldDisplayCaptions
2649{
2650 return [self _boolValueForKey:WebKitShouldDisplayCaptionsPreferenceKey];
2651}
2652
2653- (void)setShouldDisplayTextDescriptions:(BOOL)flag
2654{
2655 [self _setBoolValue:flag forKey:WebKitShouldDisplayTextDescriptionsPreferenceKey];
2656}
2657
2658- (BOOL)shouldDisplayTextDescriptions
2659{
2660 return [self _boolValueForKey:WebKitShouldDisplayTextDescriptionsPreferenceKey];
2661}
2662
jonlee@apple.com793d5142012-02-22 00:00:59 +00002663- (void)setNotificationsEnabled:(BOOL)flag
2664{
2665 [self _setBoolValue:flag forKey:WebKitNotificationsEnabledKey];
2666}
2667
2668- (BOOL)notificationsEnabled
2669{
2670 return [self _boolValueForKey:WebKitNotificationsEnabledKey];
2671}
2672
timothy_horton@apple.com04ef44a2012-04-06 20:02:59 +00002673- (void)setShouldRespectImageOrientation:(BOOL)flag
2674{
2675 [self _setBoolValue:flag forKey:WebKitShouldRespectImageOrientationKey];
2676}
2677
2678- (BOOL)shouldRespectImageOrientation
2679{
2680 return [self _boolValueForKey:WebKitShouldRespectImageOrientationKey];
2681}
2682
dino@apple.com2c7328e2012-05-05 21:38:17 +00002683- (BOOL)requestAnimationFrameEnabled
2684{
2685 return [self _boolValueForKey:WebKitRequestAnimationFrameEnabledPreferenceKey];
2686}
2687
2688- (void)setRequestAnimationFrameEnabled:(BOOL)enabled
2689{
2690 [self _setBoolValue:enabled forKey:WebKitRequestAnimationFrameEnabledPreferenceKey];
2691}
2692
aestes@apple.com4544ec12012-04-24 07:43:40 +00002693- (void)setIncrementalRenderingSuppressionTimeoutInSeconds:(NSTimeInterval)timeout
2694{
2695 [self _setFloatValue:timeout forKey:WebKitIncrementalRenderingSuppressionTimeoutInSecondsKey];
2696}
2697
2698- (NSTimeInterval)incrementalRenderingSuppressionTimeoutInSeconds
2699{
2700 return [self _floatValueForKey:WebKitIncrementalRenderingSuppressionTimeoutInSecondsKey];
2701}
2702
jer.noble@apple.comc35303d2012-07-26 18:26:32 +00002703- (BOOL)diagnosticLoggingEnabled
2704{
2705 return [self _boolValueForKey:WebKitDiagnosticLoggingEnabledKey];
2706}
2707
2708- (void)setDiagnosticLoggingEnabled:(BOOL)enabled
2709{
2710 [self _setBoolValue:enabled forKey:WebKitDiagnosticLoggingEnabledKey];
2711}
2712
jpfau@apple.com8219a2e2012-09-25 23:00:25 +00002713- (void)setStorageBlockingPolicy:(WebStorageBlockingPolicy)storageBlockingPolicy
2714{
ap@apple.com1e8475922018-10-18 21:38:50 +00002715#if PLATFORM(IOS_FAMILY)
aestes@apple.coma43fba52013-12-31 23:46:34 +00002716 // We don't want to write the setting out, so we just reset the default instead of storing the new setting.
ap@apple.come3691aa2014-01-15 21:30:26 +00002717 // FIXME: This code removes any defaults previously registered by client process, which is not appropriate for this method to do.
aestes@apple.coma43fba52013-12-31 23:46:34 +00002718 NSDictionary *dict = [NSDictionary dictionaryWithObject:[NSNumber numberWithInt:storageBlockingPolicy] forKey:WebKitStorageBlockingPolicyKey];
2719 [[NSUserDefaults standardUserDefaults] registerDefaults:dict];
2720#else
jpfau@apple.com8219a2e2012-09-25 23:00:25 +00002721 [self _setIntegerValue:storageBlockingPolicy forKey:WebKitStorageBlockingPolicyKey];
aestes@apple.coma43fba52013-12-31 23:46:34 +00002722#endif
jpfau@apple.com8219a2e2012-09-25 23:00:25 +00002723}
2724
2725- (WebStorageBlockingPolicy)storageBlockingPolicy
2726{
2727 return static_cast<WebStorageBlockingPolicy>([self _integerValueForKey:WebKitStorageBlockingPolicyKey]);
2728}
2729
jonlee@apple.com3f4a62e2012-10-05 17:53:04 +00002730- (BOOL)plugInSnapshottingEnabled
2731{
2732 return [self _boolValueForKey:WebKitPlugInSnapshottingEnabledPreferenceKey];
2733}
2734
2735- (void)setPlugInSnapshottingEnabled:(BOOL)enabled
2736{
2737 [self _setBoolValue:enabled forKey:WebKitPlugInSnapshottingEnabledPreferenceKey];
2738}
2739
cmuppala@apple.coma756fa62013-03-23 02:15:36 +00002740- (BOOL)hiddenPageDOMTimerThrottlingEnabled
2741{
2742 return [self _boolValueForKey:WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey];
2743}
2744
2745- (void)setHiddenPageDOMTimerThrottlingEnabled:(BOOL)enabled
2746{
2747 [self _setBoolValue:enabled forKey:WebKitHiddenPageDOMTimerThrottlingEnabledPreferenceKey];
2748}
2749
2750- (BOOL)hiddenPageCSSAnimationSuspensionEnabled
2751{
2752 return [self _boolValueForKey:WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey];
2753}
2754
2755- (void)setHiddenPageCSSAnimationSuspensionEnabled:(BOOL)enabled
2756{
2757 [self _setBoolValue:enabled forKey:WebKitHiddenPageCSSAnimationSuspensionEnabledPreferenceKey];
2758}
2759
jer.noble@apple.comde0138e2013-07-01 18:40:27 +00002760- (BOOL)lowPowerVideoAudioBufferSizeEnabled
2761{
2762 return [self _boolValueForKey:WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey];
2763}
2764
2765- (void)setLowPowerVideoAudioBufferSizeEnabled:(BOOL)enabled
2766{
2767 [self _setBoolValue:enabled forKey:WebKitLowPowerVideoAudioBufferSizeEnabledPreferenceKey];
2768}
2769
hyatt@apple.coma5626692013-11-18 23:08:30 +00002770- (BOOL)useLegacyTextAlignPositionedElementBehavior
2771{
2772 return [self _boolValueForKey:WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey];
2773}
2774
2775- (void)setUseLegacyTextAlignPositionedElementBehavior:(BOOL)enabled
2776{
2777 [self _setBoolValue:enabled forKey:WebKitUseLegacyTextAlignPositionedElementBehaviorPreferenceKey];
2778}
2779
jer.noble@apple.com9c31d752013-12-07 00:56:24 +00002780- (BOOL)mediaSourceEnabled
2781{
2782 return [self _boolValueForKey:WebKitMediaSourceEnabledPreferenceKey];
2783}
2784
2785- (void)setMediaSourceEnabled:(BOOL)enabled
2786{
2787 [self _setBoolValue:enabled forKey:WebKitMediaSourceEnabledPreferenceKey];
2788}
2789
jer.noble@apple.com8088fcc2018-08-16 17:57:01 +00002790- (BOOL)sourceBufferChangeTypeEnabled
2791{
2792 return [self _boolValueForKey:WebKitSourceBufferChangeTypeEnabledPreferenceKey];
2793}
2794
2795- (void)setSourceBufferChangeTypeEnabled:(BOOL)enabled
2796{
2797 [self _setBoolValue:enabled forKey:WebKitSourceBufferChangeTypeEnabledPreferenceKey];
2798}
2799
beidson@apple.com42ee7a12014-02-21 00:39:35 +00002800- (BOOL)imageControlsEnabled
2801{
2802 return [self _boolValueForKey:WebKitImageControlsEnabledPreferenceKey];
2803}
2804
2805- (void)setImageControlsEnabled:(BOOL)enabled
2806{
2807 [self _setBoolValue:enabled forKey:WebKitImageControlsEnabledPreferenceKey];
2808}
2809
timothy_horton@apple.com09bd9852014-10-09 20:56:16 +00002810- (BOOL)serviceControlsEnabled
2811{
2812 return [self _boolValueForKey:WebKitServiceControlsEnabledPreferenceKey];
2813}
2814
2815- (void)setServiceControlsEnabled:(BOOL)enabled
2816{
2817 [self _setBoolValue:enabled forKey:WebKitServiceControlsEnabledPreferenceKey];
2818}
2819
beidson@apple.come84e0e72014-06-24 23:17:22 +00002820- (BOOL)gamepadsEnabled
2821{
2822 return [self _boolValueForKey:WebKitGamepadsEnabledPreferenceKey];
2823}
2824
2825- (void)setGamepadsEnabled:(BOOL)flag
2826{
2827 [self _setBoolValue:flag forKey:WebKitGamepadsEnabledPreferenceKey];
2828}
2829
mmaxfield@apple.com9980c9a2014-02-13 21:55:29 +00002830- (BOOL)shouldConvertPositionStyleOnCopy
mmaxfield@apple.comb7281d42014-02-12 00:06:01 +00002831{
mmaxfield@apple.com9980c9a2014-02-13 21:55:29 +00002832 return [self _boolValueForKey:WebKitShouldConvertPositionStyleOnCopyPreferenceKey];
mmaxfield@apple.comb7281d42014-02-12 00:06:01 +00002833}
2834
mmaxfield@apple.com9980c9a2014-02-13 21:55:29 +00002835- (void)setShouldConvertPositionStyleOnCopy:(BOOL)enabled
mmaxfield@apple.comb7281d42014-02-12 00:06:01 +00002836{
mmaxfield@apple.com9980c9a2014-02-13 21:55:29 +00002837 [self _setBoolValue:enabled forKey:WebKitShouldConvertPositionStyleOnCopyPreferenceKey];
mmaxfield@apple.comb7281d42014-02-12 00:06:01 +00002838}
2839
jer.noble@apple.com6aa71d22014-10-31 00:18:21 +00002840- (NSString *)mediaKeysStorageDirectory
2841{
2842 return [[self _stringValueForKey:WebKitMediaKeysStorageDirectoryKey] stringByStandardizingPath];
2843}
2844
2845- (void)setMediaKeysStorageDirectory:(NSString *)directory
2846{
2847 [self _setStringValue:directory forKey:WebKitMediaKeysStorageDirectoryKey];
2848}
2849
commit-queue@webkit.org74391d02017-04-28 20:42:40 +00002850- (BOOL)mediaDevicesEnabled
2851{
2852 return [self _boolValueForKey:WebKitMediaDevicesEnabledPreferenceKey];
2853}
2854
2855- (void)setMediaDevicesEnabled:(BOOL)flag
2856{
2857 [self _setBoolValue:flag forKey:WebKitMediaDevicesEnabledPreferenceKey];
2858}
2859
eric.carlson@apple.coma4923bc2016-12-10 02:46:31 +00002860- (BOOL)mediaStreamEnabled
2861{
2862 return [self _boolValueForKey:WebKitMediaStreamEnabledPreferenceKey];
2863}
2864
2865- (void)setMediaStreamEnabled:(BOOL)flag
2866{
2867 [self _setBoolValue:flag forKey:WebKitMediaStreamEnabledPreferenceKey];
2868}
2869
2870- (BOOL)peerConnectionEnabled
2871{
2872 return [self _boolValueForKey:WebKitPeerConnectionEnabledPreferenceKey];
2873}
2874
2875- (void)setPeerConnectionEnabled:(BOOL)flag
2876{
2877 [self _setBoolValue:flag forKey:WebKitPeerConnectionEnabledPreferenceKey];
2878}
jiewen_tan@apple.come3656212016-12-02 03:30:37 +00002879
yoav@yoav.ws29331eb2017-01-28 22:53:54 +00002880- (BOOL)linkPreloadEnabled
2881{
2882 return [self _boolValueForKey:WebKitLinkPreloadEnabledPreferenceKey];
2883}
2884
2885- (void)setLinkPreloadEnabled:(BOOL)flag
2886{
2887 [self _setBoolValue:flag forKey:WebKitLinkPreloadEnabledPreferenceKey];
2888}
2889
yoav@yoav.ws51a6fed2017-06-06 22:36:27 +00002890- (BOOL)mediaPreloadingEnabled
2891{
2892 return [self _boolValueForKey:WebKitMediaPreloadingEnabledPreferenceKey];
2893}
2894
2895- (void)setMediaPreloadingEnabled:(BOOL)flag
2896{
2897 [self _setBoolValue:flag forKey:WebKitMediaPreloadingEnabledPreferenceKey];
2898}
2899
beidson@apple.combf157ae2015-05-01 18:19:58 +00002900- (void)setMetaRefreshEnabled:(BOOL)enabled
2901{
beidson@apple.com855d88b2015-07-02 20:19:36 +00002902 [self setHTTPEquivEnabled:enabled];
beidson@apple.combf157ae2015-05-01 18:19:58 +00002903}
2904
2905- (BOOL)metaRefreshEnabled
2906{
beidson@apple.com34f15de2015-07-21 16:19:32 +00002907 return [self httpEquivEnabled];
beidson@apple.com855d88b2015-07-02 20:19:36 +00002908}
2909
2910- (void)setHTTPEquivEnabled:(BOOL)enabled
2911{
2912 [self _setBoolValue:enabled forKey:WebKitHTTPEquivEnabledPreferenceKey];
2913}
2914
2915- (BOOL)httpEquivEnabled
2916{
2917 return [self _boolValueForKey:WebKitHTTPEquivEnabledPreferenceKey];
beidson@apple.combf157ae2015-05-01 18:19:58 +00002918}
2919
weinig@apple.com21e76be2015-04-17 00:28:20 +00002920- (BOOL)javaScriptMarkupEnabled
2921{
2922 return [self _boolValueForKey:WebKitJavaScriptMarkupEnabledPreferenceKey];
2923}
2924
2925- (void)setJavaScriptMarkupEnabled:(BOOL)flag
2926{
2927 [self _setBoolValue:flag forKey:WebKitJavaScriptMarkupEnabledPreferenceKey];
2928}
2929
jer.noble@apple.com8b34ebd2015-08-28 22:57:01 +00002930- (BOOL)mediaDataLoadsAutomatically
2931{
2932 return [self _boolValueForKey:WebKitMediaDataLoadsAutomaticallyPreferenceKey];
2933}
2934
2935- (void)setMediaDataLoadsAutomatically:(BOOL)flag
2936{
2937 [self _setBoolValue:flag forKey:WebKitMediaDataLoadsAutomaticallyPreferenceKey];
2938}
2939
dino@apple.com07bc2602016-03-14 01:09:17 +00002940- (BOOL)attachmentElementEnabled
2941{
2942 return [self _boolValueForKey:WebKitAttachmentElementEnabledPreferenceKey];
2943}
2944
2945- (void)setAttachmentElementEnabled:(BOOL)flag
2946{
2947 [self _setBoolValue:flag forKey:WebKitAttachmentElementEnabledPreferenceKey];
2948}
2949
jer.noble@apple.com9fa59132016-05-19 21:59:12 +00002950- (BOOL)allowsInlineMediaPlaybackAfterFullscreen
2951{
2952 return [self _boolValueForKey:WebKitAllowsInlineMediaPlaybackAfterFullscreenPreferenceKey];
2953}
2954
2955- (void)setAllowsInlineMediaPlaybackAfterFullscreen:(BOOL)flag
2956{
2957 [self _setBoolValue:flag forKey:WebKitAllowsInlineMediaPlaybackAfterFullscreenPreferenceKey];
2958}
2959
eric.carlson@apple.com59a4bdb2015-12-12 01:52:43 +00002960- (BOOL)mockCaptureDevicesEnabled
2961{
2962 return [self _boolValueForKey:WebKitMockCaptureDevicesEnabledPreferenceKey];
2963}
2964
2965- (void)setMockCaptureDevicesEnabled:(BOOL)flag
2966{
2967 [self _setBoolValue:flag forKey:WebKitMockCaptureDevicesEnabledPreferenceKey];
2968}
2969
commit-queue@webkit.org4de71602017-06-06 16:53:55 +00002970- (BOOL)mockCaptureDevicesPromptEnabled
2971{
2972 return [self _boolValueForKey:WebKitMockCaptureDevicesPromptEnabledPreferenceKey];
2973}
2974
2975- (void)setMockCaptureDevicesPromptEnabled:(BOOL)flag
2976{
2977 [self _setBoolValue:flag forKey:WebKitMockCaptureDevicesPromptEnabledPreferenceKey];
2978}
2979
commit-queue@webkit.orgfe10fb62017-03-02 16:24:30 +00002980- (BOOL)enumeratingAllNetworkInterfacesEnabled
2981{
2982 return [self _boolValueForKey:WebKitEnumeratingAllNetworkInterfacesEnabledPreferenceKey];
2983}
2984
2985- (void)setEnumeratingAllNetworkInterfacesEnabled:(BOOL)flag
2986{
2987 [self _setBoolValue:flag forKey:WebKitEnumeratingAllNetworkInterfacesEnabledPreferenceKey];
2988}
2989
2990- (BOOL)iceCandidateFilteringEnabled
2991{
2992 return [self _boolValueForKey:WebKitICECandidateFilteringEnabledPreferenceKey];
2993}
2994
2995- (void)setIceCandidateFilteringEnabled:(BOOL)flag
2996{
2997 [self _setBoolValue:flag forKey:WebKitICECandidateFilteringEnabledPreferenceKey];
2998}
2999
eric.carlson@apple.com7ad2bbd2016-11-01 22:00:23 +00003000- (BOOL)mediaCaptureRequiresSecureConnection
3001{
3002 return [self _boolValueForKey:WebKitMediaCaptureRequiresSecureConnectionPreferenceKey];
3003}
3004
3005- (void)setMediaCaptureRequiresSecureConnection:(BOOL)flag
3006{
3007 [self _setBoolValue:flag forKey:WebKitMediaCaptureRequiresSecureConnectionPreferenceKey];
3008}
3009
rniwa@webkit.org8c504b62016-03-10 04:43:14 +00003010- (BOOL)shadowDOMEnabled
3011{
3012 return [self _boolValueForKey:WebKitShadowDOMEnabledPreferenceKey];
3013}
3014
3015- (void)setShadowDOMEnabled:(BOOL)flag
3016{
3017 [self _setBoolValue:flag forKey:WebKitShadowDOMEnabledPreferenceKey];
3018}
3019
3020- (BOOL)customElementsEnabled
3021{
3022 return [self _boolValueForKey:WebKitCustomElementsEnabledPreferenceKey];
3023}
3024
3025- (void)setCustomElementsEnabled:(BOOL)flag
3026{
3027 [self _setBoolValue:flag forKey:WebKitCustomElementsEnabledPreferenceKey];
3028}
3029
rniwa@webkit.org863da802017-08-12 22:14:53 +00003030- (BOOL)dataTransferItemsEnabled
3031{
3032 return [self _boolValueForKey:WebKitDataTransferItemsEnabledPreferenceKey];
3033}
3034
3035- (void)setDataTransferItemsEnabled:(BOOL)flag
3036{
3037 [self _setBoolValue:flag forKey:WebKitDataTransferItemsEnabledPreferenceKey];
3038}
3039
rniwa@webkit.org1436d422017-10-11 04:12:30 +00003040- (BOOL)customPasteboardDataEnabled
3041{
3042 return [self _boolValueForKey:WebKitCustomPasteboardDataEnabledPreferenceKey];
3043}
3044
3045- (void)setCustomPasteboardDataEnabled:(BOOL)flag
3046{
3047 [self _setBoolValue:flag forKey:WebKitCustomPasteboardDataEnabledPreferenceKey];
3048}
3049
commit-queue@webkit.orgd4f19662019-07-17 18:58:14 +00003050- (BOOL)dialogElementEnabled
3051{
3052 return [self _boolValueForKey:WebKitDialogElementEnabledPreferenceKey];
3053}
3054
3055- (void)setDialogElementEnabled:(BOOL)flag
3056{
3057 [self _setBoolValue:flag forKey:WebKitDialogElementEnabledPreferenceKey];
3058}
3059
commit-queue@webkit.org37a1da42017-08-05 05:06:13 +00003060- (BOOL)cacheAPIEnabled
3061{
3062 return [self _boolValueForKey:WebKitCacheAPIEnabledPreferenceKey];
3063}
3064
3065- (void)setCacheAPIEnabled:(BOOL)flag
3066{
3067 [self _setBoolValue:flag forKey:WebKitCacheAPIEnabledPreferenceKey];
3068}
3069
achristensen@apple.comb8e4fdd2016-04-05 23:20:15 +00003070- (BOOL)fetchAPIEnabled
3071{
3072 return [self _boolValueForKey:WebKitFetchAPIEnabledPreferenceKey];
3073}
3074
3075- (void)setFetchAPIEnabled:(BOOL)flag
3076{
3077 [self _setBoolValue:flag forKey:WebKitFetchAPIEnabledPreferenceKey];
3078}
3079
commit-queue@webkit.orgcf57fe22017-04-17 21:24:37 +00003080- (BOOL)readableByteStreamAPIEnabled
3081{
3082 return [self _boolValueForKey:WebKitReadableByteStreamAPIEnabledPreferenceKey];
3083}
3084
3085- (void)setReadableByteStreamAPIEnabled:(BOOL)flag
3086{
3087 [self _setBoolValue:flag forKey:WebKitReadableByteStreamAPIEnabledPreferenceKey];
3088}
3089
3090- (BOOL)writableStreamAPIEnabled
3091{
3092 return [self _boolValueForKey:WebKitWritableStreamAPIEnabledPreferenceKey];
3093}
3094
3095- (void)setWritableStreamAPIEnabled:(BOOL)flag
3096{
3097 [self _setBoolValue:flag forKey:WebKitWritableStreamAPIEnabledPreferenceKey];
3098}
3099
bfulgham@apple.comff4e25e2016-04-15 00:45:52 +00003100- (BOOL)downloadAttributeEnabled
3101{
3102 return [self _boolValueForKey:WebKitDownloadAttributeEnabledPreferenceKey];
3103}
3104
3105- (void)setDownloadAttributeEnabled:(BOOL)flag
3106{
3107 [self _setBoolValue:flag forKey:WebKitDownloadAttributeEnabledPreferenceKey];
3108}
3109
cdumez@apple.com04a3cca2017-08-25 02:05:54 +00003110- (void)setDirectoryUploadEnabled:(BOOL)flag
3111{
3112 [self _setBoolValue:flag forKey:WebKitDirectoryUploadEnabledPreferenceKey];
3113}
3114
3115- (BOOL)directoryUploadEnabled
3116{
3117 return [self _boolValueForKey:WebKitDirectoryUploadEnabledPreferenceKey];
3118}
3119
commit-queue@webkit.orgf2afcaa2017-11-22 22:20:26 +00003120- (BOOL)visualViewportAPIEnabled
3121{
3122 return [self _boolValueForKey:WebKitVisualViewportAPIEnabledPreferenceKey];
3123}
3124
3125- (void)setVisualViewportAPIEnabled:(BOOL)flag
3126{
3127 [self _setBoolValue:flag forKey:WebKitVisualViewportAPIEnabledPreferenceKey];
3128}
simon.fraser@apple.com4f41ba22018-04-27 00:10:48 +00003129
commit-queue@webkit.org6b0ee982018-08-31 07:49:32 +00003130- (BOOL)CSSOMViewScrollingAPIEnabled
3131{
3132 return [self _boolValueForKey:WebKitCSSOMViewScrollingAPIEnabledPreferenceKey];
3133}
3134
3135- (void)setCSSOMViewScrollingAPIEnabled:(BOOL)flag
3136{
3137 [self _setBoolValue:flag forKey:WebKitCSSOMViewScrollingAPIEnabledPreferenceKey];
3138}
3139
commit-queue@webkit.orgcb6e9d62016-08-18 13:58:37 +00003140- (BOOL)webAnimationsEnabled
3141{
3142 return [self _boolValueForKey:WebKitWebAnimationsEnabledPreferenceKey];
3143}
3144
3145- (void)setWebAnimationsEnabled:(BOOL)flag
3146{
3147 [self _setBoolValue:flag forKey:WebKitWebAnimationsEnabledPreferenceKey];
3148}
3149
commit-queue@webkit.org19a4b722019-02-27 19:02:03 +00003150- (BOOL)pointerEventsEnabled
3151{
3152 return [self _boolValueForKey:WebKitPointerEventsEnabledPreferenceKey];
3153}
3154
3155- (void)setPointerEventsEnabled:(BOOL)flag
3156{
3157 [self _setBoolValue:flag forKey:WebKitPointerEventsEnabledPreferenceKey];
3158}
3159
megan_gardner@apple.com31cdd982019-06-14 21:00:13 +00003160- (BOOL)syntheticEditingCommandsEnabled
3161{
3162 return [self _boolValueForKey:WebKitPointerEventsEnabledPreferenceKey];
3163}
3164
3165- (void)setSyntheticEditingCommandsEnabled:(BOOL)flag
3166{
3167 [self _setBoolValue:flag forKey:WebKitPointerEventsEnabledPreferenceKey];
3168}
3169
commit-queue@webkit.orgecc55612018-01-17 21:06:48 +00003170- (BOOL)fetchAPIKeepAliveEnabled
3171{
3172 return [self _boolValueForKey:WebKitFetchAPIEnabledPreferenceKey];
3173}
3174
3175- (void)setFetchAPIKeepAliveEnabled:(BOOL)flag
3176{
3177 [self _setBoolValue:flag forKey:WebKitFetchAPIEnabledPreferenceKey];
3178}
3179
graouts@webkit.org9b6bfe22016-09-23 09:32:09 +00003180- (BOOL)modernMediaControlsEnabled
3181{
3182 return [self _boolValueForKey:WebKitModernMediaControlsEnabledPreferenceKey];
3183}
3184
3185- (void)setModernMediaControlsEnabled:(BOOL)flag
3186{
3187 [self _setBoolValue:flag forKey:WebKitModernMediaControlsEnabledPreferenceKey];
3188}
3189
graouts@webkit.orgf00493452018-05-15 11:01:46 +00003190- (BOOL)webAnimationsCSSIntegrationEnabled
graouts@webkit.org9a1f7c02018-03-12 12:56:14 +00003191{
graouts@webkit.orgf00493452018-05-15 11:01:46 +00003192 return [self _boolValueForKey:WebKitWebAnimationsCSSIntegrationEnabledPreferenceKey];
graouts@webkit.org9a1f7c02018-03-12 12:56:14 +00003193}
3194
graouts@webkit.orgf00493452018-05-15 11:01:46 +00003195- (void)setWebAnimationsCSSIntegrationEnabled:(BOOL)flag
graouts@webkit.org9a1f7c02018-03-12 12:56:14 +00003196{
graouts@webkit.orgf00493452018-05-15 11:01:46 +00003197 [self _setBoolValue:flag forKey:WebKitWebAnimationsCSSIntegrationEnabledPreferenceKey];
graouts@webkit.org9a1f7c02018-03-12 12:56:14 +00003198}
3199
commit-queue@webkit.orge995e9d2016-11-27 04:21:49 +00003200- (BOOL)intersectionObserverEnabled
3201{
3202 return [self _boolValueForKey:WebKitIntersectionObserverEnabledPreferenceKey];
3203}
3204
3205- (void)setIntersectionObserverEnabled:(BOOL)flag
3206{
3207 [self _setBoolValue:flag forKey:WebKitIntersectionObserverEnabledPreferenceKey];
3208}
3209
commit-queue@webkit.orga0cd8b92017-11-04 08:20:03 +00003210- (BOOL)menuItemElementEnabled
3211{
3212 return [self _boolValueForKey:WebKitMenuItemElementEnabledPreferenceKey];
3213}
3214
3215- (void)setMenuItemElementEnabled:(BOOL)flag
3216{
3217 [self _setBoolValue:flag forKey:WebKitMenuItemElementEnabledPreferenceKey];
3218}
3219
commit-queue@webkit.org8e999b92017-05-23 13:34:46 +00003220- (BOOL)displayContentsEnabled
3221{
3222 return [self _boolValueForKey:WebKitDisplayContentsEnabledPreferenceKey];
3223}
3224
3225- (void)setDisplayContentsEnabled:(BOOL)flag
3226{
3227 [self _setBoolValue:flag forKey:WebKitDisplayContentsEnabledPreferenceKey];
3228}
3229
joepeck@webkit.org58cb1a72017-01-28 09:26:14 +00003230- (BOOL)userTimingEnabled
3231{
3232 return [self _boolValueForKey:WebKitUserTimingEnabledPreferenceKey];
3233}
3234
3235- (void)setUserTimingEnabled:(BOOL)flag
3236{
3237 [self _setBoolValue:flag forKey:WebKitUserTimingEnabledPreferenceKey];
3238}
3239
joepeck@webkit.org3f0a1982017-02-10 22:28:56 +00003240- (BOOL)resourceTimingEnabled
3241{
3242 return [self _boolValueForKey:WebKitResourceTimingEnabledPreferenceKey];
3243}
3244
3245- (void)setResourceTimingEnabled:(BOOL)flag
3246{
3247 [self _setBoolValue:flag forKey:WebKitResourceTimingEnabledPreferenceKey];
3248}
3249
jer.noble@apple.com333940e2017-05-15 22:46:13 +00003250- (BOOL)mediaUserGestureInheritsFromDocument
3251{
3252 return [self _boolValueForKey:WebKitMediaUserGestureInheritsFromDocument];
3253}
3254
3255- (void)setMediaUserGestureInheritsFromDocument:(BOOL)flag
3256{
3257 [self _setBoolValue:flag forKey:WebKitMediaUserGestureInheritsFromDocument];
3258}
3259
ap@apple.com1e8475922018-10-18 21:38:50 +00003260#if PLATFORM(IOS_FAMILY)
aestes@apple.comf000b5c2017-01-30 01:40:29 +00003261- (BOOL)quickLookDocumentSavingEnabled
3262{
3263 return [self _boolValueForKey:WebKitQuickLookDocumentSavingPreferenceKey];
3264}
3265
3266- (void)setQuickLookDocumentSavingEnabled:(BOOL)flag
3267{
3268 [self _setBoolValue:flag forKey:WebKitQuickLookDocumentSavingPreferenceKey];
3269}
3270#endif
3271
jer.noble@apple.com390d8212017-06-06 18:28:55 +00003272- (NSString *)mediaContentTypesRequiringHardwareSupport
3273{
3274 return [self _stringValueForKey:WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey];
3275}
3276
3277- (void)setMediaContentTypesRequiringHardwareSupport:(NSString *)value
3278{
3279 [self _setStringValue:value forKey:WebKitMediaContentTypesRequiringHardwareSupportPreferenceKey];
3280}
dbates@webkit.orgd3072e52017-06-13 20:21:00 +00003281
3282- (BOOL)isSecureContextAttributeEnabled
3283{
3284 return [self _boolValueForKey:WebKitIsSecureContextAttributeEnabledPreferenceKey];
3285}
3286
3287- (void)setIsSecureContextAttributeEnabled:(BOOL)flag
3288{
3289 [self _setBoolValue:flag forKey:WebKitIsSecureContextAttributeEnabledPreferenceKey];
3290}
3291
jer.noble@apple.com876bf002017-06-30 21:04:11 +00003292- (BOOL)legacyEncryptedMediaAPIEnabled
3293{
3294 return [self _boolValueForKey:WebKitLegacyEncryptedMediaAPIEnabledKey];
3295}
3296
3297- (void)setLegacyEncryptedMediaAPIEnabled:(BOOL)flag
3298{
3299 [self _setBoolValue:flag forKey:WebKitLegacyEncryptedMediaAPIEnabledKey];
3300}
3301
jer.noble@apple.come2f800d2017-11-14 20:29:05 +00003302- (BOOL)encryptedMediaAPIEnabled
3303{
3304 return [self _boolValueForKey:WebKitEncryptedMediaAPIEnabledKey];
3305}
3306
3307- (void)setEncryptedMediaAPIEnabled:(BOOL)flag
3308{
3309 [self _setBoolValue:flag forKey:WebKitEncryptedMediaAPIEnabledKey];
3310}
3311
timothy_horton@apple.com52ec9f72017-07-03 09:00:49 +00003312- (BOOL)viewportFitEnabled
3313{
3314 return [self _boolValueForKey:WebKitViewportFitEnabledPreferenceKey];
3315}
3316
3317- (void)setViewportFitEnabled:(BOOL)flag
3318{
3319 [self _setBoolValue:flag forKey:WebKitViewportFitEnabledPreferenceKey];
3320}
3321
3322- (BOOL)constantPropertiesEnabled
3323{
3324 return [self _boolValueForKey:WebKitConstantPropertiesEnabledPreferenceKey];
3325}
3326
3327- (void)setConstantPropertiesEnabled:(BOOL)flag
3328{
3329 [self _setBoolValue:flag forKey:WebKitConstantPropertiesEnabledPreferenceKey];
3330}
3331
simon.fraser@apple.com4f41ba22018-04-27 00:10:48 +00003332- (BOOL)colorFilterEnabled
3333{
3334 return [self _boolValueForKey:WebKitColorFilterEnabledPreferenceKey];
3335}
3336
3337- (void)setColorFilterEnabled:(BOOL)flag
3338{
3339 [self _setBoolValue:flag forKey:WebKitColorFilterEnabledPreferenceKey];
3340}
3341
dino@apple.com79c90412018-07-16 23:34:42 +00003342- (BOOL)punchOutWhiteBackgroundsInDarkMode
3343{
3344 return [self _boolValueForKey:WebKitPunchOutWhiteBackgroundsInDarkModePreferenceKey];
3345}
3346
3347- (void)setPunchOutWhiteBackgroundsInDarkMode:(BOOL)flag
3348{
3349 [self _setBoolValue:flag forKey:WebKitPunchOutWhiteBackgroundsInDarkModePreferenceKey];
3350}
3351
jer.noble@apple.comf2b5ea32017-07-14 22:04:20 +00003352- (BOOL)allowMediaContentTypesRequiringHardwareSupportAsFallback
3353{
3354 return [self _boolValueForKey:WebKitAllowMediaContentTypesRequiringHardwareSupportAsFallbackKey];
3355}
3356
3357- (void)setAllowMediaContentTypesRequiringHardwareSupportAsFallback:(BOOL)flag
3358{
3359 [self _setBoolValue:flag forKey:WebKitAllowMediaContentTypesRequiringHardwareSupportAsFallbackKey];
3360}
3361
drousso@apple.comed533c62017-08-07 23:55:36 +00003362- (BOOL)inspectorAdditionsEnabled
3363{
3364 return [self _boolValueForKey:WebKitInspectorAdditionsEnabledPreferenceKey];
3365}
3366
3367- (void)setInspectorAdditionsEnabled:(BOOL)flag
3368{
3369 [self _setBoolValue:flag forKey:WebKitInspectorAdditionsEnabledPreferenceKey];
3370}
3371
n_wang@apple.com5fe440a2017-11-15 07:56:04 +00003372- (BOOL)accessibilityObjectModelEnabled
3373{
3374 return [self _boolValueForKey:WebKitAccessibilityObjectModelEnabledPreferenceKey];
3375}
3376
3377- (void)setAccessibilityObjectModelEnabled:(BOOL)flag
3378{
3379 [self _setBoolValue:flag forKey:WebKitAccessibilityObjectModelEnabledPreferenceKey];
3380}
3381
n_wang@apple.comd02736d2018-08-01 22:07:42 +00003382- (BOOL)ariaReflectionEnabled
3383{
3384 return [self _boolValueForKey:WebKitAriaReflectionEnabledPreferenceKey];
3385}
3386
3387- (void)setAriaReflectionEnabled:(BOOL)flag
3388{
3389 [self _setBoolValue:flag forKey:WebKitAriaReflectionEnabledPreferenceKey];
3390}
3391
jer.noble@apple.com3b52acc2017-12-21 18:28:21 +00003392- (BOOL)mediaCapabilitiesEnabled
3393{
3394 return [self _boolValueForKey:WebKitMediaCapabilitiesEnabledPreferenceKey];
3395}
3396
3397- (void)setMediaCapabilitiesEnabled:(BOOL)flag
3398{
3399 [self _setBoolValue:flag forKey:WebKitMediaCapabilitiesEnabledPreferenceKey];
3400}
n_wang@apple.com5fe440a2017-11-15 07:56:04 +00003401
commit-queue@webkit.org4e7a4e72018-10-04 19:27:10 +00003402- (BOOL)mediaRecorderEnabled
3403{
3404 return [self _boolValueForKey:WebKitMediaRecorderEnabledPreferenceKey];
3405}
3406
3407- (void)setMediaRecorderEnabled:(BOOL)flag
3408{
3409 [self _setBoolValue:flag forKey:WebKitMediaRecorderEnabledPreferenceKey];
3410}
3411
commit-queue@webkit.org87d615c2018-05-11 18:33:43 +00003412- (BOOL)serverTimingEnabled
3413{
3414 return [self _boolValueForKey:WebKitServerTimingEnabledPreferenceKey];
3415}
3416
3417- (void)setServerTimingEnabled:(BOOL)flag
3418{
3419 [self _setBoolValue:flag forKey:WebKitServerTimingEnabledPreferenceKey];
3420}
3421
rniwa@webkit.orgdc2fc172018-09-26 20:02:57 +00003422- (BOOL)selectionAcrossShadowBoundariesEnabled
3423{
3424 return [self _boolValueForKey:WebKitSelectionAcrossShadowBoundariesEnabledPreferenceKey];
3425}
3426
3427- (void)setSelectionAcrossShadowBoundariesEnabled:(BOOL)flag
3428{
3429 [self _setBoolValue:flag forKey:WebKitSelectionAcrossShadowBoundariesEnabledPreferenceKey];
3430}
3431
commit-queue@webkit.org7cef8172019-01-22 09:52:48 +00003432- (BOOL)cssLogicalEnabled
3433{
3434 return [self _boolValueForKey:WebKitCSSLogicalEnabledPreferenceKey];
3435}
3436
3437- (void)setCSSLogicalEnabled:(BOOL)flag
3438{
3439 [self _setBoolValue:flag forKey:WebKitCSSLogicalEnabledPreferenceKey];
3440}
3441
wilander@apple.com04dcc7e2019-01-24 19:17:09 +00003442- (BOOL)adClickAttributionEnabled
3443{
3444 return [self _boolValueForKey:WebKitAdClickAttributionEnabledPreferenceKey];
3445}
3446
3447- (void)setAdClickAttributionEnabled:(BOOL)flag
3448{
3449 [self _setBoolValue:flag forKey:WebKitAdClickAttributionEnabledPreferenceKey];
3450}
3451
commit-queue@webkit.orgf59b72d2019-03-06 11:28:38 +00003452- (BOOL)referrerPolicyAttributeEnabled
3453{
3454 return [self _boolValueForKey:WebKitReferrerPolicyAttributeEnabledPreferenceKey];
3455}
3456
3457- (void)setReferrerPolicyAttributeEnabled:(BOOL)flag
3458{
3459 [self _setBoolValue:flag forKey:WebKitReferrerPolicyAttributeEnabledPreferenceKey];
3460}
3461
commit-queue@webkit.org30634002019-03-29 08:37:46 +00003462- (BOOL)resizeObserverEnabled
3463{
3464 return [self _boolValueForKey:WebKitResizeObserverEnabledPreferenceKey];
3465}
3466
3467- (void)setResizeObserverEnabled:(BOOL)flag
3468{
3469 [self _setBoolValue:flag forKey:WebKitResizeObserverEnabledPreferenceKey];
3470}
commit-queue@webkit.org0d74b3b2019-05-02 10:12:14 +00003471
3472- (BOOL)coreMathMLEnabled
3473{
3474 return [self _boolValueForKey:WebKitCoreMathMLEnabledPreferenceKey];
3475}
3476
3477- (void)setCoreMathMLEnabled:(BOOL)flag
3478{
3479 [self _setBoolValue:flag forKey:WebKitCoreMathMLEnabledPreferenceKey];
3480}
3481
commit-queue@webkit.orgcb884302019-06-03 20:49:53 +00003482- (BOOL)linkPreloadResponsiveImagesEnabled
3483{
3484 return [self _boolValueForKey:WebKitLinkPreloadResponsiveImagesEnabledPreferenceKey];
3485}
3486
3487- (void)setLinkPreloadResponsiveImagesEnabled:(BOOL)flag
3488{
3489 [self _setBoolValue:flag forKey:WebKitLinkPreloadResponsiveImagesEnabledPreferenceKey];
3490}
3491
darin86e09922004-07-02 17:27:36 +00003492@end
3493
3494@implementation WebPreferences (WebInternal)
3495
rjw2293d4a2003-07-29 01:23:26 +00003496+ (NSString *)_IBCreatorID
3497{
3498 return classIBCreatorID;
3499}
3500
rjw3a8520a2003-08-28 23:17:07 +00003501+ (NSString *)_concatenateKeyWithIBCreatorID:(NSString *)key
rjw2293d4a2003-07-29 01:23:26 +00003502{
3503 NSString *IBCreatorID = [WebPreferences _IBCreatorID];
3504 if (!IBCreatorID)
3505 return key;
3506 return [IBCreatorID stringByAppendingString:key];
3507}
3508
sullivan6b34b0c2002-03-21 19:38:37 +00003509@end