Add smartInsertDeleteEnabled setting to WebCore::Page
[WebKit-https.git] / Source / WebKit2 / UIProcess / API / C / WKPreferences.cpp
1 /*
2  * Copyright (C) 2010, 2012 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS''
14  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
15  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS
17  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
18  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
19  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
20  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
21  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
22  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
23  * THE POSSIBILITY OF SUCH DAMAGE.
24  */
25
26 #include "config.h"
27 #include "WKPreferences.h"
28 #include "WKPreferencesPrivate.h"
29
30 #include "WKAPICast.h"
31 #include "WebContext.h"
32 #include "WebPreferences.h"
33 #include <WebCore/Settings.h>
34 #include <wtf/PassRefPtr.h>
35 #include <wtf/RefPtr.h>
36
37 using namespace WebKit;
38
39 WKTypeID WKPreferencesGetTypeID()
40 {
41     return toAPI(WebPreferences::APIType);
42 }
43
44 WKPreferencesRef WKPreferencesCreate()
45 {
46     RefPtr<WebPreferences> preferences = WebPreferences::create();
47     return toAPI(preferences.release().leakRef());
48 }
49
50 WKPreferencesRef WKPreferencesCreateWithIdentifier(WKStringRef identifierRef)
51 {
52     RefPtr<WebPreferences> preferences = WebPreferences::create(toWTFString(identifierRef));
53     return toAPI(preferences.release().leakRef());
54 }
55
56 WKPreferencesRef WKPreferencesCreateCopy(WKPreferencesRef preferencesRef)
57 {
58     RefPtr<WebPreferences> preferences = WebPreferences::create(*toImpl(preferencesRef));
59     return toAPI(preferences.release().leakRef());
60 }
61
62 void WKPreferencesSetJavaScriptEnabled(WKPreferencesRef preferencesRef, bool javaScriptEnabled)
63 {
64     toImpl(preferencesRef)->setJavaScriptEnabled(javaScriptEnabled);
65 }
66
67 bool WKPreferencesGetJavaScriptEnabled(WKPreferencesRef preferencesRef)
68 {
69     return toImpl(preferencesRef)->javaScriptEnabled();
70 }
71
72 void WKPreferencesSetLoadsImagesAutomatically(WKPreferencesRef preferencesRef, bool loadsImagesAutomatically)
73 {
74     toImpl(preferencesRef)->setLoadsImagesAutomatically(loadsImagesAutomatically);
75 }
76
77 bool WKPreferencesGetLoadsImagesAutomatically(WKPreferencesRef preferencesRef)
78 {
79     return toImpl(preferencesRef)->loadsImagesAutomatically();
80 }
81
82 void WKPreferencesSetLoadsSiteIconsIgnoringImageLoadingPreference(WKPreferencesRef preferencesRef, bool loadsSiteIconsIgnoringImageLoadingPreference)
83 {
84     toImpl(preferencesRef)->setLoadsSiteIconsIgnoringImageLoadingPreference(loadsSiteIconsIgnoringImageLoadingPreference);
85 }
86
87 bool WKPreferencesGetLoadsSiteIconsIgnoringImageLoadingPreference(WKPreferencesRef preferencesRef)
88 {
89     return toImpl(preferencesRef)->loadsSiteIconsIgnoringImageLoadingPreference();
90 }
91
92 void WKPreferencesSetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferencesRef, bool offlineWebApplicationCacheEnabled)
93 {
94     toImpl(preferencesRef)->setOfflineWebApplicationCacheEnabled(offlineWebApplicationCacheEnabled);
95 }
96
97 bool WKPreferencesGetOfflineWebApplicationCacheEnabled(WKPreferencesRef preferencesRef)
98 {
99     return toImpl(preferencesRef)->offlineWebApplicationCacheEnabled();
100 }
101
102 void WKPreferencesSetLocalStorageEnabled(WKPreferencesRef preferencesRef, bool localStorageEnabled)
103 {
104     toImpl(preferencesRef)->setLocalStorageEnabled(localStorageEnabled);
105 }
106
107 bool WKPreferencesGetLocalStorageEnabled(WKPreferencesRef preferencesRef)
108 {
109     return toImpl(preferencesRef)->localStorageEnabled();
110 }
111
112 void WKPreferencesSetDatabasesEnabled(WKPreferencesRef preferencesRef, bool databasesEnabled)
113 {
114     toImpl(preferencesRef)->setDatabasesEnabled(databasesEnabled);
115 }
116
117 bool WKPreferencesGetDatabasesEnabled(WKPreferencesRef preferencesRef)
118 {
119     return toImpl(preferencesRef)->databasesEnabled();
120 }
121
122 void WKPreferencesSetXSSAuditorEnabled(WKPreferencesRef preferencesRef, bool xssAuditorEnabled)
123 {
124     toImpl(preferencesRef)->setXSSAuditorEnabled(xssAuditorEnabled);
125 }
126
127 bool WKPreferencesGetXSSAuditorEnabled(WKPreferencesRef preferencesRef)
128 {
129     return toImpl(preferencesRef)->xssAuditorEnabled();
130 }
131
132 void WKPreferencesSetFrameFlatteningEnabled(WKPreferencesRef preferencesRef, bool frameFlatteningEnabled)
133 {
134     toImpl(preferencesRef)->setFrameFlatteningEnabled(frameFlatteningEnabled);
135 }
136
137 bool WKPreferencesGetFrameFlatteningEnabled(WKPreferencesRef preferencesRef)
138 {
139     return toImpl(preferencesRef)->frameFlatteningEnabled();
140 }
141
142 void WKPreferencesSetPluginsEnabled(WKPreferencesRef preferencesRef, bool pluginsEnabled)
143 {
144     toImpl(preferencesRef)->setPluginsEnabled(pluginsEnabled);
145 }
146
147 bool WKPreferencesGetPluginsEnabled(WKPreferencesRef preferencesRef)
148 {
149     return toImpl(preferencesRef)->pluginsEnabled();
150 }
151
152 void WKPreferencesSetJavaEnabled(WKPreferencesRef preferencesRef, bool javaEnabled)
153 {
154     toImpl(preferencesRef)->setJavaEnabled(javaEnabled);
155 }
156
157 bool WKPreferencesGetJavaEnabled(WKPreferencesRef preferencesRef)
158 {
159     return toImpl(preferencesRef)->javaEnabled();
160 }
161
162 void WKPreferencesSetJavaEnabledForLocalFiles(WKPreferencesRef preferencesRef, bool javaEnabledForLocalFiles)
163 {
164     toImpl(preferencesRef)->setJavaEnabledForLocalFiles(javaEnabledForLocalFiles);
165 }
166
167 bool WKPreferencesGetJavaEnabledForLocalFiles(WKPreferencesRef preferencesRef)
168 {
169     return toImpl(preferencesRef)->javaEnabledForLocalFiles();
170 }
171
172 void WKPreferencesSetJavaScriptCanOpenWindowsAutomatically(WKPreferencesRef preferencesRef, bool javaScriptCanOpenWindowsAutomatically)
173 {
174     toImpl(preferencesRef)->setJavaScriptCanOpenWindowsAutomatically(javaScriptCanOpenWindowsAutomatically);
175 }
176
177 bool WKPreferencesGetJavaScriptCanOpenWindowsAutomatically(WKPreferencesRef preferencesRef)
178 {
179     return toImpl(preferencesRef)->javaScriptCanOpenWindowsAutomatically();
180 }
181
182 void WKPreferencesSetHyperlinkAuditingEnabled(WKPreferencesRef preferencesRef, bool hyperlinkAuditingEnabled)
183 {
184     toImpl(preferencesRef)->setHyperlinkAuditingEnabled(hyperlinkAuditingEnabled);
185 }
186
187 bool WKPreferencesGetHyperlinkAuditingEnabled(WKPreferencesRef preferencesRef)
188 {
189     return toImpl(preferencesRef)->hyperlinkAuditingEnabled();
190 }
191
192 void WKPreferencesSetStandardFontFamily(WKPreferencesRef preferencesRef, WKStringRef family)
193 {
194     toImpl(preferencesRef)->setStandardFontFamily(toWTFString(family));
195 }
196
197 WKStringRef WKPreferencesCopyStandardFontFamily(WKPreferencesRef preferencesRef)
198 {
199     return toCopiedAPI(toImpl(preferencesRef)->standardFontFamily());
200 }
201
202 void WKPreferencesSetFixedFontFamily(WKPreferencesRef preferencesRef, WKStringRef family)
203 {
204     toImpl(preferencesRef)->setFixedFontFamily(toWTFString(family));
205 }
206
207 WKStringRef WKPreferencesCopyFixedFontFamily(WKPreferencesRef preferencesRef)
208 {
209     return toCopiedAPI(toImpl(preferencesRef)->fixedFontFamily());
210 }
211
212 void WKPreferencesSetSerifFontFamily(WKPreferencesRef preferencesRef, WKStringRef family)
213 {
214     toImpl(preferencesRef)->setSerifFontFamily(toWTFString(family));
215 }
216
217 WKStringRef WKPreferencesCopySerifFontFamily(WKPreferencesRef preferencesRef)
218 {
219     return toCopiedAPI(toImpl(preferencesRef)->serifFontFamily());
220 }
221
222 void WKPreferencesSetSansSerifFontFamily(WKPreferencesRef preferencesRef, WKStringRef family)
223 {
224     toImpl(preferencesRef)->setSansSerifFontFamily(toWTFString(family));
225 }
226
227 WKStringRef WKPreferencesCopySansSerifFontFamily(WKPreferencesRef preferencesRef)
228 {
229     return toCopiedAPI(toImpl(preferencesRef)->sansSerifFontFamily());
230 }
231
232 void WKPreferencesSetCursiveFontFamily(WKPreferencesRef preferencesRef, WKStringRef family)
233 {
234     toImpl(preferencesRef)->setCursiveFontFamily(toWTFString(family));
235 }
236
237 WKStringRef WKPreferencesCopyCursiveFontFamily(WKPreferencesRef preferencesRef)
238 {
239     return toCopiedAPI(toImpl(preferencesRef)->cursiveFontFamily());
240 }
241
242 void WKPreferencesSetFantasyFontFamily(WKPreferencesRef preferencesRef, WKStringRef family)
243 {
244     toImpl(preferencesRef)->setFantasyFontFamily(toWTFString(family));
245 }
246
247 WKStringRef WKPreferencesCopyFantasyFontFamily(WKPreferencesRef preferencesRef)
248 {
249     return toCopiedAPI(toImpl(preferencesRef)->fantasyFontFamily());
250 }
251
252 void WKPreferencesSetPictographFontFamily(WKPreferencesRef preferencesRef, WKStringRef family)
253 {
254     toImpl(preferencesRef)->setPictographFontFamily(toWTFString(family));
255 }
256
257 WKStringRef WKPreferencesCopyPictographFontFamily(WKPreferencesRef preferencesRef)
258 {
259     return toCopiedAPI(toImpl(preferencesRef)->pictographFontFamily());
260 }
261
262 void WKPreferencesSetDefaultFontSize(WKPreferencesRef preferencesRef, uint32_t size)
263 {
264     toImpl(preferencesRef)->setDefaultFontSize(size);
265 }
266
267 uint32_t WKPreferencesGetDefaultFontSize(WKPreferencesRef preferencesRef)
268 {
269     return toImpl(preferencesRef)->defaultFontSize();
270 }
271
272 void WKPreferencesSetDefaultFixedFontSize(WKPreferencesRef preferencesRef, uint32_t size)
273 {
274     toImpl(preferencesRef)->setDefaultFixedFontSize(size);
275 }
276
277 uint32_t WKPreferencesGetDefaultFixedFontSize(WKPreferencesRef preferencesRef)
278 {
279     return toImpl(preferencesRef)->defaultFixedFontSize();
280 }
281
282 void WKPreferencesSetMinimumFontSize(WKPreferencesRef preferencesRef, uint32_t size)
283 {
284     toImpl(preferencesRef)->setMinimumFontSize(size);
285 }
286
287 uint32_t WKPreferencesGetMinimumFontSize(WKPreferencesRef preferencesRef)
288 {
289     return toImpl(preferencesRef)->minimumFontSize();
290 }
291
292 void WKPreferencesSetScreenFontSubstitutionEnabled(WKPreferencesRef preferencesRef, bool enabled)
293 {
294     toImpl(preferencesRef)->setScreenFontSubstitutionEnabled(enabled);
295 }
296
297 bool WKPreferencesGetScreenFontSubstitutionEnabled(WKPreferencesRef preferencesRef)
298 {
299     return toImpl(preferencesRef)->screenFontSubstitutionEnabled();
300 }
301
302 void WKPreferencesSetCookieEnabled(WKPreferencesRef preferencesRef, bool enabled)
303 {
304     toImpl(preferencesRef)->setCookieEnabled(enabled);
305 }
306
307 bool WKPreferencesGetCookieEnabled(WKPreferencesRef preferencesRef)
308 {
309     return toImpl(preferencesRef)->cookieEnabled();
310 }
311
312 void WKPreferencesSetEditableLinkBehavior(WKPreferencesRef preferencesRef, WKEditableLinkBehavior wkBehavior)
313 {
314     toImpl(preferencesRef)->setEditableLinkBehavior(toEditableLinkBehavior(wkBehavior));
315 }
316
317 WKEditableLinkBehavior WKPreferencesGetEditableLinkBehavior(WKPreferencesRef preferencesRef)
318 {
319     return toAPI(static_cast<WebCore::EditableLinkBehavior>(toImpl(preferencesRef)->editableLinkBehavior()));
320 }
321
322 void WKPreferencesSetDefaultTextEncodingName(WKPreferencesRef preferencesRef, WKStringRef name)
323 {
324     toImpl(preferencesRef)->setDefaultTextEncodingName(toWTFString(name));
325 }
326
327 WKStringRef WKPreferencesCopyDefaultTextEncodingName(WKPreferencesRef preferencesRef)
328 {
329     return toCopiedAPI(toImpl(preferencesRef)->defaultTextEncodingName());
330 }
331
332 void WKPreferencesSetPrivateBrowsingEnabled(WKPreferencesRef preferencesRef, bool enabled)
333 {
334     if (toImpl(preferencesRef)->privateBrowsingEnabled() == enabled)
335         return;
336
337     // Regardless of whether there are any open pages, we should tell WebContext, so that it could track browsing sessions.
338     if (enabled)
339         WebContext::willStartUsingPrivateBrowsing();
340     else
341         WebContext::willStopUsingPrivateBrowsing();
342
343     toImpl(preferencesRef)->setPrivateBrowsingEnabled(enabled);
344 }
345
346 bool WKPreferencesGetPrivateBrowsingEnabled(WKPreferencesRef preferencesRef)
347 {
348     return toImpl(preferencesRef)->privateBrowsingEnabled();
349 }
350
351 void WKPreferencesSetDeveloperExtrasEnabled(WKPreferencesRef preferencesRef, bool enabled)
352 {
353     toImpl(preferencesRef)->setDeveloperExtrasEnabled(enabled);
354 }
355
356 bool WKPreferencesGetDeveloperExtrasEnabled(WKPreferencesRef preferencesRef)
357 {
358     return toImpl(preferencesRef)->developerExtrasEnabled();
359 }
360
361 void WKPreferencesSetJavaScriptExperimentsEnabled(WKPreferencesRef preferencesRef, bool enabled)
362 {
363     toImpl(preferencesRef)->setJavaScriptExperimentsEnabled(enabled);
364 }
365
366 bool WKPreferencesGetJavaScriptExperimentsEnabled(WKPreferencesRef preferencesRef)
367 {
368     return toImpl(preferencesRef)->javaScriptExperimentsEnabled();
369 }
370
371 void WKPreferencesSetTextAreasAreResizable(WKPreferencesRef preferencesRef, bool resizable)
372 {
373     toImpl(preferencesRef)->setTextAreasAreResizable(resizable);
374 }
375
376 bool WKPreferencesGetTextAreasAreResizable(WKPreferencesRef preferencesRef)
377 {
378     return toImpl(preferencesRef)->textAreasAreResizable();
379 }
380
381 void WKPreferencesSetFontSmoothingLevel(WKPreferencesRef preferencesRef, WKFontSmoothingLevel wkLevel)
382 {
383     toImpl(preferencesRef)->setFontSmoothingLevel(toFontSmoothingLevel(wkLevel));
384 }
385
386 WKFontSmoothingLevel WKPreferencesGetFontSmoothingLevel(WKPreferencesRef preferencesRef)
387 {
388     return toAPI(static_cast<FontSmoothingLevel>(toImpl(preferencesRef)->fontSmoothingLevel()));
389 }
390
391 void WKPreferencesSetAcceleratedDrawingEnabled(WKPreferencesRef preferencesRef, bool flag)
392 {
393     toImpl(preferencesRef)->setAcceleratedDrawingEnabled(flag);
394 }
395
396 bool WKPreferencesGetAcceleratedDrawingEnabled(WKPreferencesRef preferencesRef)
397 {
398     return toImpl(preferencesRef)->acceleratedDrawingEnabled();
399 }
400
401 void WKPreferencesSetCanvasUsesAcceleratedDrawing(WKPreferencesRef preferencesRef, bool flag)
402 {
403     toImpl(preferencesRef)->setCanvasUsesAcceleratedDrawing(flag);
404 }
405
406 bool WKPreferencesGetCanvasUsesAcceleratedDrawing(WKPreferencesRef preferencesRef)
407 {
408     return toImpl(preferencesRef)->canvasUsesAcceleratedDrawing();
409 }
410
411 void WKPreferencesSetAcceleratedCompositingEnabled(WKPreferencesRef preferencesRef, bool flag)
412 {
413     toImpl(preferencesRef)->setAcceleratedCompositingEnabled(flag);
414 }
415
416 bool WKPreferencesGetAcceleratedCompositingEnabled(WKPreferencesRef preferencesRef)
417 {
418     return toImpl(preferencesRef)->acceleratedCompositingEnabled();
419 }
420
421 void WKPreferencesSetCompositingBordersVisible(WKPreferencesRef preferencesRef, bool flag)
422 {
423     toImpl(preferencesRef)->setCompositingBordersVisible(flag);
424 }
425
426 bool WKPreferencesGetCompositingBordersVisible(WKPreferencesRef preferencesRef)
427 {
428     return toImpl(preferencesRef)->compositingBordersVisible();
429 }
430
431 void WKPreferencesSetCompositingRepaintCountersVisible(WKPreferencesRef preferencesRef, bool flag)
432 {
433     toImpl(preferencesRef)->setCompositingRepaintCountersVisible(flag);
434 }
435
436 bool WKPreferencesGetCompositingRepaintCountersVisible(WKPreferencesRef preferencesRef)
437 {
438     return toImpl(preferencesRef)->compositingRepaintCountersVisible();
439 }
440
441 void WKPreferencesSetTiledScrollingIndicatorVisible(WKPreferencesRef preferencesRef, bool flag)
442 {
443     toImpl(preferencesRef)->setTiledScrollingIndicatorVisible(flag);
444 }
445
446 bool WKPreferencesGetTiledScrollingIndicatorVisible(WKPreferencesRef preferencesRef)
447 {
448     return toImpl(preferencesRef)->tiledScrollingIndicatorVisible();
449 }
450
451 void WKPreferencesSetCSSCustomFilterEnabled(WKPreferencesRef preferencesRef, bool flag)
452 {
453     toImpl(preferencesRef)->setCSSCustomFilterEnabled(flag);
454 }
455
456 bool WKPreferencesGetCSSCustomFilterEnabled(WKPreferencesRef preferencesRef)
457 {
458     return toImpl(preferencesRef)->cssCustomFilterEnabled();
459 }
460
461 void WKPreferencesSetWebGLEnabled(WKPreferencesRef preferencesRef, bool flag)
462 {
463     toImpl(preferencesRef)->setWebGLEnabled(flag);
464 }
465
466 bool WKPreferencesGetWebGLEnabled(WKPreferencesRef preferencesRef)
467 {
468     return toImpl(preferencesRef)->webGLEnabled();
469 }
470
471 void WKPreferencesSetAccelerated2DCanvasEnabled(WKPreferencesRef preferencesRef, bool flag)
472 {
473     toImpl(preferencesRef)->setAccelerated2dCanvasEnabled(flag);
474 }
475
476 bool WKPreferencesGetAccelerated2DCanvasEnabled(WKPreferencesRef preferencesRef)
477 {
478     return toImpl(preferencesRef)->accelerated2dCanvasEnabled();
479 }
480
481 void WKPreferencesSetCSSRegionsEnabled(WKPreferencesRef preferencesRef, bool flag)
482 {
483     toImpl(preferencesRef)->setCSSRegionsEnabled(flag);
484 }
485
486 bool WKPreferencesGetCSSRegionsEnabled(WKPreferencesRef preferencesRef)
487 {
488     return toImpl(preferencesRef)->cssRegionsEnabled();
489 }
490
491 void WKPreferencesSetCSSGridLayoutEnabled(WKPreferencesRef preferencesRef, bool flag)
492 {
493     toImpl(preferencesRef)->setCSSGridLayoutEnabled(flag);
494 }
495
496 bool WKPreferencesGetCSSGridLayoutEnabled(WKPreferencesRef preferencesRef)
497 {
498     return toImpl(preferencesRef)->cssGridLayoutEnabled();
499 }
500
501 void WKPreferencesSetRegionBasedColumnsEnabled(WKPreferencesRef preferencesRef, bool flag)
502 {
503     toImpl(preferencesRef)->setRegionBasedColumnsEnabled(flag);
504 }
505
506 bool WKPreferencesGetRegionBasedColumnsEnabled(WKPreferencesRef preferencesRef)
507 {
508     return toImpl(preferencesRef)->regionBasedColumnsEnabled();
509 }
510
511 void WKPreferencesSetNeedsSiteSpecificQuirks(WKPreferencesRef preferencesRef, bool flag)
512 {
513     toImpl(preferencesRef)->setNeedsSiteSpecificQuirks(flag);
514 }
515
516 bool WKPreferencesGetNeedsSiteSpecificQuirks(WKPreferencesRef preferencesRef)
517 {
518     return toImpl(preferencesRef)->needsSiteSpecificQuirks();
519 }
520
521 void WKPreferencesSetForceFTPDirectoryListings(WKPreferencesRef preferencesRef, bool flag)
522 {
523     toImpl(preferencesRef)->setForceFTPDirectoryListings(flag);
524 }
525
526 bool WKPreferencesGetForceFTPDirectoryListings(WKPreferencesRef preferencesRef)
527 {
528     return toImpl(preferencesRef)->forceFTPDirectoryListings();
529 }
530
531 void WKPreferencesSetFTPDirectoryTemplatePath(WKPreferencesRef preferencesRef, WKStringRef pathRef)
532 {
533     toImpl(preferencesRef)->setFTPDirectoryTemplatePath(toWTFString(pathRef));
534 }
535
536 WKStringRef WKPreferencesCopyFTPDirectoryTemplatePath(WKPreferencesRef preferencesRef)
537 {
538     return toCopiedAPI(toImpl(preferencesRef)->ftpDirectoryTemplatePath());
539 }
540
541 void WKPreferencesSetTabsToLinks(WKPreferencesRef preferencesRef, bool tabsToLinks)
542 {
543     toImpl(preferencesRef)->setTabsToLinks(tabsToLinks);
544 }
545
546 bool WKPreferencesGetTabsToLinks(WKPreferencesRef preferencesRef)
547 {
548     return toImpl(preferencesRef)->tabsToLinks();
549 }
550
551 void WKPreferencesSetDNSPrefetchingEnabled(WKPreferencesRef preferencesRef, bool enabled)
552 {
553     toImpl(preferencesRef)->setDNSPrefetchingEnabled(enabled);
554 }
555
556 bool WKPreferencesGetDNSPrefetchingEnabled(WKPreferencesRef preferencesRef)
557 {
558     return toImpl(preferencesRef)->dnsPrefetchingEnabled();
559 }
560
561 void WKPreferencesSetAuthorAndUserStylesEnabled(WKPreferencesRef preferencesRef, bool enabled)
562 {
563     toImpl(preferencesRef)->setAuthorAndUserStylesEnabled(enabled);
564 }
565
566 bool WKPreferencesGetAuthorAndUserStylesEnabled(WKPreferencesRef preferencesRef)
567 {
568     return toImpl(preferencesRef)->authorAndUserStylesEnabled();
569 }
570
571 void WKPreferencesSetShouldPrintBackgrounds(WKPreferencesRef preferencesRef, bool flag)
572 {
573     toImpl(preferencesRef)->setShouldPrintBackgrounds(flag);
574 }
575
576 bool WKPreferencesGetShouldPrintBackgrounds(WKPreferencesRef preferencesRef)
577 {
578     return toImpl(preferencesRef)->shouldPrintBackgrounds();
579 }
580
581 void WKPreferencesSetWebArchiveDebugModeEnabled(WKPreferencesRef preferencesRef, bool enabled)
582 {
583     toImpl(preferencesRef)->setWebArchiveDebugModeEnabled(enabled);
584 }
585
586 bool WKPreferencesGetWebArchiveDebugModeEnabled(WKPreferencesRef preferencesRef)
587 {
588     return toImpl(preferencesRef)->webArchiveDebugModeEnabled();
589 }
590
591 void WKPreferencesSetLocalFileContentSniffingEnabled(WKPreferencesRef preferencesRef, bool enabled)
592 {
593     toImpl(preferencesRef)->setLocalFileContentSniffingEnabled(enabled);
594 }
595
596 bool WKPreferencesGetLocalFileContentSniffingEnabled(WKPreferencesRef preferencesRef)
597 {
598     return toImpl(preferencesRef)->localFileContentSniffingEnabled();
599 }
600
601 void WKPreferencesSetPageCacheEnabled(WKPreferencesRef preferencesRef, bool enabled)
602 {
603     toImpl(preferencesRef)->setUsesPageCache(enabled);
604 }
605
606 bool WKPreferencesGetPageCacheEnabled(WKPreferencesRef preferencesRef)
607 {
608     return toImpl(preferencesRef)->usesPageCache();
609 }
610
611 void WKPreferencesSetPageCacheSupportsPlugins(WKPreferencesRef preferencesRef, bool pageCacheSupportsPlugins)
612 {
613     toImpl(preferencesRef)->setPageCacheSupportsPlugins(pageCacheSupportsPlugins);
614 }
615
616 bool WKPreferencesGetPageCacheSupportsPlugins(WKPreferencesRef preferencesRef)
617 {
618     return toImpl(preferencesRef)->pageCacheSupportsPlugins();
619 }
620
621 void WKPreferencesSetPaginateDuringLayoutEnabled(WKPreferencesRef preferencesRef, bool enabled)
622 {
623     toImpl(preferencesRef)->setPaginateDuringLayoutEnabled(enabled);
624 }
625
626 bool WKPreferencesGetPaginateDuringLayoutEnabled(WKPreferencesRef preferencesRef)
627 {
628     return toImpl(preferencesRef)->paginateDuringLayoutEnabled();
629 }
630
631 void WKPreferencesSetDOMPasteAllowed(WKPreferencesRef preferencesRef, bool enabled)
632 {
633     toImpl(preferencesRef)->setDOMPasteAllowed(enabled);
634 }
635
636 bool WKPreferencesGetDOMPasteAllowed(WKPreferencesRef preferencesRef)
637 {
638     return toImpl(preferencesRef)->domPasteAllowed();
639 }
640
641 void WKPreferencesSetJavaScriptCanAccessClipboard(WKPreferencesRef preferencesRef, bool enabled)
642 {
643     toImpl(preferencesRef)->setJavaScriptCanAccessClipboard(enabled);
644 }
645
646 bool WKPreferencesGetJavaScriptCanAccessClipboard(WKPreferencesRef preferencesRef)
647 {
648     return toImpl(preferencesRef)->javaScriptCanAccessClipboard();
649 }
650
651 void WKPreferencesSetFullScreenEnabled(WKPreferencesRef preferencesRef, bool enabled)
652 {
653     toImpl(preferencesRef)->setFullScreenEnabled(enabled);
654 }
655
656 bool WKPreferencesGetFullScreenEnabled(WKPreferencesRef preferencesRef)
657 {
658     return toImpl(preferencesRef)->fullScreenEnabled();
659 }
660
661 void WKPreferencesSetAVFoundationEnabled(WKPreferencesRef preferencesRef, bool enabled)
662 {
663     toImpl(preferencesRef)->setAVFoundationEnabled(enabled);
664 }
665
666 bool WKPreferencesGetAVFoundationEnabled(WKPreferencesRef preferencesRef)
667 {
668     return toImpl(preferencesRef)->isAVFoundationEnabled();
669 }
670
671 void WKPreferencesSetWebSecurityEnabled(WKPreferencesRef preferencesRef, bool enabled)
672 {
673     toImpl(preferencesRef)->setWebSecurityEnabled(enabled);
674 }
675
676 bool WKPreferencesGetWebSecurityEnabled(WKPreferencesRef preferencesRef)
677 {
678     return toImpl(preferencesRef)->webSecurityEnabled();
679 }
680
681 void WKPreferencesSetUniversalAccessFromFileURLsAllowed(WKPreferencesRef preferencesRef, bool allowed)
682 {
683     toImpl(preferencesRef)->setAllowUniversalAccessFromFileURLs(allowed);
684 }
685
686 bool WKPreferencesGetUniversalAccessFromFileURLsAllowed(WKPreferencesRef preferencesRef)
687 {
688     return toImpl(preferencesRef)->allowUniversalAccessFromFileURLs();
689 }
690
691 void WKPreferencesSetFileAccessFromFileURLsAllowed(WKPreferencesRef preferencesRef, bool allowed)
692 {
693     toImpl(preferencesRef)->setAllowFileAccessFromFileURLs(allowed);
694 }
695
696 bool WKPreferencesGetFileAccessFromFileURLsAllowed(WKPreferencesRef preferencesRef)
697 {
698     return toImpl(preferencesRef)->allowFileAccessFromFileURLs();
699 }
700
701 void WKPreferencesSetHixie76WebSocketProtocolEnabled(WKPreferencesRef, bool /*enabled*/)
702 {
703 }
704
705 bool WKPreferencesGetHixie76WebSocketProtocolEnabled(WKPreferencesRef)
706 {
707     return false;
708 }
709
710 void WKPreferencesSetMediaPlaybackRequiresUserGesture(WKPreferencesRef preferencesRef, bool flag)
711 {
712     toImpl(preferencesRef)->setMediaPlaybackRequiresUserGesture(flag);
713 }
714
715 bool WKPreferencesGetMediaPlaybackRequiresUserGesture(WKPreferencesRef preferencesRef)
716 {
717     return toImpl(preferencesRef)->mediaPlaybackRequiresUserGesture();
718 }
719
720 void WKPreferencesSetMediaPlaybackAllowsInline(WKPreferencesRef preferencesRef, bool flag)
721 {
722     toImpl(preferencesRef)->setMediaPlaybackAllowsInline(flag);
723 }
724
725 bool WKPreferencesGetMediaPlaybackAllowsInline(WKPreferencesRef preferencesRef)
726 {
727     return toImpl(preferencesRef)->mediaPlaybackAllowsInline();
728 }
729
730 void WKPreferencesSetShowsToolTipOverTruncatedText(WKPreferencesRef preferencesRef, bool flag)
731 {
732     toImpl(preferencesRef)->setShowsToolTipOverTruncatedText(flag);
733 }
734
735 bool WKPreferencesGetShowsToolTipOverTruncatedText(WKPreferencesRef preferencesRef)
736 {
737     return toImpl(preferencesRef)->showsToolTipOverTruncatedText();
738 }
739
740 void WKPreferencesSetMockScrollbarsEnabled(WKPreferencesRef preferencesRef, bool flag)
741 {
742     toImpl(preferencesRef)->setMockScrollbarsEnabled(flag);
743 }
744
745 bool WKPreferencesGetMockScrollbarsEnabled(WKPreferencesRef preferencesRef)
746 {
747     return toImpl(preferencesRef)->mockScrollbarsEnabled();
748 }
749
750 void WKPreferencesSetWebAudioEnabled(WKPreferencesRef preferencesRef, bool enabled)
751 {
752     toImpl(preferencesRef)->setWebAudioEnabled(enabled);
753 }
754
755 bool WKPreferencesGetWebAudioEnabled(WKPreferencesRef preferencesRef)
756 {
757     return toImpl(preferencesRef)->webAudioEnabled();
758 }
759
760 void WKPreferencesSetApplicationChromeModeEnabled(WKPreferencesRef preferencesRef, bool enabled)
761 {
762     toImpl(preferencesRef)->setApplicationChromeModeEnabled(enabled);
763 }
764
765 bool WKPreferencesGetApplicationChromeModeEnabled(WKPreferencesRef preferencesRef)
766 {
767     return toImpl(preferencesRef)->applicationChromeMode();
768 }
769
770 void WKPreferencesSetInspectorUsesWebKitUserInterface(WKPreferencesRef preferencesRef, bool enabled)
771 {
772     toImpl(preferencesRef)->setInspectorUsesWebKitUserInterface(enabled);
773 }
774
775 bool WKPreferencesGetInspectorUsesWebKitUserInterface(WKPreferencesRef preferencesRef)
776 {
777     return toImpl(preferencesRef)->inspectorUsesWebKitUserInterface();
778 }
779
780 void WKPreferencesSetSuppressesIncrementalRendering(WKPreferencesRef preferencesRef, bool enabled)
781 {
782     toImpl(preferencesRef)->setSuppressesIncrementalRendering(enabled);
783 }
784
785 bool WKPreferencesGetSuppressesIncrementalRendering(WKPreferencesRef preferencesRef)
786 {
787     return toImpl(preferencesRef)->suppressesIncrementalRendering();
788 }
789
790 void WKPreferencesSetBackspaceKeyNavigationEnabled(WKPreferencesRef preferencesRef, bool enabled)
791 {
792     toImpl(preferencesRef)->setBackspaceKeyNavigationEnabled(enabled);
793 }
794
795 bool WKPreferencesGetBackspaceKeyNavigationEnabled(WKPreferencesRef preferencesRef)
796 {
797     return toImpl(preferencesRef)->backspaceKeyNavigationEnabled();
798 }
799
800 void WKPreferencesSetCaretBrowsingEnabled(WKPreferencesRef preferencesRef, bool enabled)
801 {
802     toImpl(preferencesRef)->setCaretBrowsingEnabled(enabled);
803 }
804
805 bool WKPreferencesGetCaretBrowsingEnabled(WKPreferencesRef preferencesRef)
806 {
807     return toImpl(preferencesRef)->caretBrowsingEnabled();
808 }
809
810 void WKPreferencesSetShouldDisplaySubtitles(WKPreferencesRef preferencesRef, bool enabled)
811 {
812     toImpl(preferencesRef)->setShouldDisplaySubtitles(enabled);
813 }
814
815 bool WKPreferencesGetShouldDisplaySubtitles(WKPreferencesRef preferencesRef)
816 {
817     return toImpl(preferencesRef)->shouldDisplaySubtitles();
818 }
819
820 void WKPreferencesSetShouldDisplayCaptions(WKPreferencesRef preferencesRef, bool enabled)
821 {
822     toImpl(preferencesRef)->setShouldDisplayCaptions(enabled);
823 }
824
825 bool WKPreferencesGetShouldDisplayCaptions(WKPreferencesRef preferencesRef)
826 {
827     return toImpl(preferencesRef)->shouldDisplayCaptions();
828 }
829
830 void WKPreferencesSetShouldDisplayTextDescriptions(WKPreferencesRef preferencesRef, bool enabled)
831 {
832     toImpl(preferencesRef)->setShouldDisplayTextDescriptions(enabled);
833 }
834
835 bool WKPreferencesGetShouldDisplayTextDescriptions(WKPreferencesRef preferencesRef)
836 {
837     return toImpl(preferencesRef)->shouldDisplayTextDescriptions();
838 }
839
840 void WKPreferencesSetNotificationsEnabled(WKPreferencesRef preferencesRef, bool enabled)
841 {
842     toImpl(preferencesRef)->setNotificationsEnabled(enabled);
843 }
844
845 bool WKPreferencesGetNotificationsEnabled(WKPreferencesRef preferencesRef)
846 {
847     return toImpl(preferencesRef)->notificationsEnabled();
848 }
849
850 void WKPreferencesSetShouldRespectImageOrientation(WKPreferencesRef preferencesRef, bool enabled)
851 {
852     toImpl(preferencesRef)->setShouldRespectImageOrientation(enabled);
853 }
854
855 bool WKPreferencesGetShouldRespectImageOrientation(WKPreferencesRef preferencesRef)
856 {
857     return toImpl(preferencesRef)->shouldRespectImageOrientation();
858 }
859
860 void WKPreferencesSetRequestAnimationFrameEnabled(WKPreferencesRef preferencesRef, bool flag)
861 {
862     toImpl(preferencesRef)->setRequestAnimationFrameEnabled(flag);
863 }
864
865 bool WKPreferencesGetRequestAnimationFrameEnabled(WKPreferencesRef preferencesRef)
866 {
867     return toImpl(preferencesRef)->requestAnimationFrameEnabled();
868 }
869
870 void WKPreferencesSetStorageBlockingPolicy(WKPreferencesRef preferencesRef, WKStorageBlockingPolicy policy)
871 {
872     toImpl(preferencesRef)->setStorageBlockingPolicy(toStorageBlockingPolicy(policy));
873 }
874
875 WKStorageBlockingPolicy WKPreferencesGetStorageBlockingPolicy(WKPreferencesRef preferencesRef)
876 {
877     return toAPI(static_cast<WebCore::SecurityOrigin::StorageBlockingPolicy>(toImpl(preferencesRef)->storageBlockingPolicy()));
878 }
879
880 void WKPreferencesResetTestRunnerOverrides(WKPreferencesRef preferencesRef)
881 {
882     // Currently we reset the overrides on the web process when preferencesDidChange() is called. Since WTR preferences
883     // are usually always the same (in the UI process), they are not sent to web process, not triggering the reset.
884     toImpl(preferencesRef)->forceUpdate();
885 }
886
887 void WKPreferencesSetDiagnosticLoggingEnabled(WKPreferencesRef preferencesRef, bool enabled)
888 {
889     toImpl(preferencesRef)->setDiagnosticLoggingEnabled(enabled);
890 }
891
892 bool WKPreferencesGetDiagnosticLoggingEnabled(WKPreferencesRef preferencesRef)
893 {
894     return toImpl(preferencesRef)->diagnosticLoggingEnabled();
895 }
896
897 void WKPreferencesSetAsynchronousPluginInitializationEnabled(WKPreferencesRef preferencesRef, bool enabled)
898 {
899     toImpl(preferencesRef)->setAsynchronousPluginInitializationEnabled(enabled);
900 }
901
902 bool WKPreferencesGetAsynchronousPluginInitializationEnabled(WKPreferencesRef preferencesRef)
903 {
904     return toImpl(preferencesRef)->asynchronousPluginInitializationEnabled();
905 }
906
907 void WKPreferencesSetAsynchronousPluginInitializationEnabledForAllPlugins(WKPreferencesRef preferencesRef, bool enabled)
908 {
909     toImpl(preferencesRef)->setAsynchronousPluginInitializationEnabledForAllPlugins(enabled);
910 }
911
912 bool WKPreferencesGetAsynchronousPluginInitializationEnabledForAllPlugins(WKPreferencesRef preferencesRef)
913 {
914     return toImpl(preferencesRef)->asynchronousPluginInitializationEnabledForAllPlugins();
915 }
916
917 void WKPreferencesSetArtificialPluginInitializationDelayEnabled(WKPreferencesRef preferencesRef, bool enabled)
918 {
919     toImpl(preferencesRef)->setArtificialPluginInitializationDelayEnabled(enabled);
920 }
921
922 bool WKPreferencesGetArtificialPluginInitializationDelayEnabled(WKPreferencesRef preferencesRef)
923 {
924     return toImpl(preferencesRef)->artificialPluginInitializationDelayEnabled();
925 }
926
927 void WKPreferencesSetTabToLinksEnabled(WKPreferencesRef preferencesRef, bool enabled)
928 {
929     toImpl(preferencesRef)->setTabToLinksEnabled(enabled);
930 }
931
932 bool WKPreferencesGetTabToLinksEnabled(WKPreferencesRef preferencesRef)
933 {
934     return toImpl(preferencesRef)->tabToLinksEnabled();
935 }
936
937 void WKPreferencesSetInteractiveFormValidationEnabled(WKPreferencesRef preferencesRef, bool enabled)
938 {
939     toImpl(preferencesRef)->setInteractiveFormValidationEnabled(enabled);
940 }
941
942 bool WKPreferencesGetInteractiveFormValidationEnabled(WKPreferencesRef preferencesRef)
943 {
944     return toImpl(preferencesRef)->interactiveFormValidationEnabled();
945 }
946
947 void WKPreferencesSetScrollingPerformanceLoggingEnabled(WKPreferencesRef preferencesRef, bool enabled)
948 {
949     toImpl(preferencesRef)->setScrollingPerformanceLoggingEnabled(enabled);
950 }
951
952 bool WKPreferencesGetScrollingPerformanceLoggingEnabled(WKPreferencesRef preferencesRef)
953 {
954     return toImpl(preferencesRef)->scrollingPerformanceLoggingEnabled();
955 }
956
957 void WKPreferencesSetPlugInSnapshottingEnabled(WKPreferencesRef preferencesRef, bool enabled)
958 {
959     toImpl(preferencesRef)->setPlugInSnapshottingEnabled(enabled);
960 }
961
962 bool WKPreferencesGetPlugInSnapshottingEnabled(WKPreferencesRef preferencesRef)
963 {
964     return toImpl(preferencesRef)->plugInSnapshottingEnabled();
965 }
966
967 void WKPreferencesSetPDFPluginEnabled(WKPreferencesRef preferencesRef, bool enabled)
968 {
969     toImpl(preferencesRef)->setPDFPluginEnabled(enabled);
970 }
971
972 bool WKPreferencesGetPDFPluginEnabled(WKPreferencesRef preferencesRef)
973 {
974     return toImpl(preferencesRef)->pdfPluginEnabled();
975 }
976
977 void WKPreferencesSetEncodingDetectorEnabled(WKPreferencesRef preferencesRef, bool enabled)
978 {
979     toImpl(preferencesRef)->setUsesEncodingDetector(enabled);
980 }
981
982 bool WKPreferencesGetEncodingDetectorEnabled(WKPreferencesRef preferencesRef)
983 {
984     return toImpl(preferencesRef)->usesEncodingDetector();
985 }
986
987 void WKPreferencesSetTextAutosizingEnabled(WKPreferencesRef preferencesRef, bool textAutosizingEnabled)
988 {
989     toImpl(preferencesRef)->setTextAutosizingEnabled(textAutosizingEnabled);
990 }
991
992 bool WKPreferencesGetTextAutosizingEnabled(WKPreferencesRef preferencesRef)
993 {
994     return toImpl(preferencesRef)->textAutosizingEnabled();
995 }
996
997 void WKPreferencesSetAggressiveTileRetentionEnabled(WKPreferencesRef preferencesRef, bool enabled)
998 {
999     toImpl(preferencesRef)->setAggressiveTileRetentionEnabled(enabled);
1000 }
1001
1002 bool WKPreferencesGetAggressiveTileRetentionEnabled(WKPreferencesRef preferencesRef)
1003 {
1004     return toImpl(preferencesRef)->aggressiveTileRetentionEnabled();
1005 }
1006
1007 void WKPreferencesSetQTKitEnabled(WKPreferencesRef preferencesRef, bool enabled)
1008 {
1009     toImpl(preferencesRef)->setQTKitEnabled(enabled);
1010 }
1011
1012 bool WKPreferencesGetQTKitEnabled(WKPreferencesRef preferencesRef)
1013 {
1014     return toImpl(preferencesRef)->isQTKitEnabled();
1015 }
1016
1017 void WKPreferencesSetLogsPageMessagesToSystemConsoleEnabled(WKPreferencesRef preferencesRef, bool enabled)
1018 {
1019     toImpl(preferencesRef)->setLogsPageMessagesToSystemConsoleEnabled(enabled);
1020 }
1021
1022 bool WKPreferencesGetLogsPageMessagesToSystemConsoleEnabled(WKPreferencesRef preferencesRef)
1023 {
1024     return toImpl(preferencesRef)->logsPageMessagesToSystemConsoleEnabled();
1025 }
1026
1027 void WKPreferencesSetPageVisibilityBasedProcessSuppressionEnabled(WKPreferencesRef preferencesRef, bool enabled)
1028 {
1029     toImpl(preferencesRef)->setPageVisibilityBasedProcessSuppressionEnabled(enabled);
1030 }
1031
1032 bool WKPreferencesGetPageVisibilityBasedProcessSuppressionEnabled(WKPreferencesRef preferencesRef)
1033 {
1034     return toImpl(preferencesRef)->pageVisibilityBasedProcessSuppressionEnabled();
1035 }
1036
1037 void WKPreferencesSetSmartInsertDeleteEnabled(WKPreferencesRef preferencesRef, bool enabled)
1038 {
1039     toImpl(preferencesRef)->setSmartInsertDeleteEnabled(enabled);
1040 }
1041
1042 bool WKPreferencesGetSmartInsertDeleteEnabled(WKPreferencesRef preferencesRef)
1043 {
1044     return toImpl(preferencesRef)->smartInsertDeleteEnabled();
1045 }