[GStreamer][WebRTC] Add API to enable/disable device mocks
[WebKit-https.git] / Source / WebKit / UIProcess / API / glib / WebKitSettings.cpp
1 /*
2  * Copyright (c) 2011 Motorola Mobility, Inc.  All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without modification,
5  * are permitted provided that the following conditions are met:
6  *
7  * Redistributions of source code must retain the above copyright notice,
8  * this list of conditions and the following disclaimer.
9  *
10  * Redistributions in binary form must reproduce the above copyright notice,
11  * this list of conditions and the following disclaimer in the documentation and/or
12  * other materials provided with the distribution.
13  *
14  * Neither the name of Motorola Mobility, Inc. nor the names of its contributors may
15  * be used to endorse or promote products derived from this software without
16  * specific prior written permission.
17  *
18  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19  * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
20  * THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
21  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
22  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
23  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
24  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
25  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
26  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
27  * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28  * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
29  */
30
31 #include "config.h"
32 #include "WebKitSettings.h"
33
34 #include "WebKitEnumTypes.h"
35 #include "WebKitSettingsPrivate.h"
36 #include "WebPageProxy.h"
37 #include "WebPreferences.h"
38 #include <WebCore/PlatformScreen.h>
39 #include <WebCore/TextEncodingRegistry.h>
40 #include <WebCore/UserAgent.h>
41 #include <cmath>
42 #include <glib/gi18n-lib.h>
43 #include <wtf/glib/WTFGType.h>
44 #include <wtf/text/CString.h>
45
46 #if PLATFORM(GTK)
47 #include "HardwareAccelerationManager.h"
48 #endif
49
50 #if PLATFORM(WAYLAND)
51 #include <WebCore/PlatformDisplay.h>
52 #endif
53
54 using namespace WebKit;
55
56 struct _WebKitSettingsPrivate {
57     _WebKitSettingsPrivate()
58         : preferences(WebPreferences::create(String(), "WebKit2.", "WebKit2."))
59     {
60         defaultFontFamily = preferences->standardFontFamily().utf8();
61         monospaceFontFamily = preferences->fixedFontFamily().utf8();
62         serifFontFamily = preferences->serifFontFamily().utf8();
63         sansSerifFontFamily = preferences->sansSerifFontFamily().utf8();
64         cursiveFontFamily = preferences->cursiveFontFamily().utf8();
65         fantasyFontFamily = preferences->fantasyFontFamily().utf8();
66         pictographFontFamily = preferences->pictographFontFamily().utf8();
67         defaultCharset = preferences->defaultTextEncodingName().utf8();
68     }
69
70     RefPtr<WebPreferences> preferences;
71     CString defaultFontFamily;
72     CString monospaceFontFamily;
73     CString serifFontFamily;
74     CString sansSerifFontFamily;
75     CString cursiveFontFamily;
76     CString fantasyFontFamily;
77     CString pictographFontFamily;
78     CString defaultCharset;
79     CString userAgent;
80     bool allowModalDialogs { false };
81     bool zoomTextOnly { false };
82     double screenDpi { 96 };
83 };
84
85 /**
86  * SECTION:WebKitSettings
87  * @short_description: Control the behaviour of a #WebKitWebView
88  *
89  * #WebKitSettings can be applied to a #WebKitWebView to control text charset,
90  * color, font sizes, printing mode, script support, loading of images and various
91  * other things on a #WebKitWebView. After creation, a #WebKitSettings object
92  * contains default settings.
93  *
94  * <informalexample><programlisting>
95  * /<!-- -->* Disable JavaScript. *<!-- -->/
96  * WebKitSettings *settings = webkit_web_view_group_get_settings (my_view_group);
97  * webkit_settings_set_enable_javascript (settings, FALSE);
98  *
99  * </programlisting></informalexample>
100  */
101
102 WEBKIT_DEFINE_TYPE(WebKitSettings, webkit_settings, G_TYPE_OBJECT)
103
104 enum {
105     PROP_0,
106
107     PROP_ENABLE_JAVASCRIPT,
108     PROP_AUTO_LOAD_IMAGES,
109     PROP_LOAD_ICONS_IGNORING_IMAGE_LOAD_SETTING,
110     PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE,
111     PROP_ENABLE_HTML5_LOCAL_STORAGE,
112     PROP_ENABLE_HTML5_DATABASE,
113     PROP_ENABLE_XSS_AUDITOR,
114     PROP_ENABLE_FRAME_FLATTENING,
115     PROP_ENABLE_PLUGINS,
116     PROP_ENABLE_JAVA,
117     PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY,
118     PROP_ENABLE_HYPERLINK_AUDITING,
119     PROP_DEFAULT_FONT_FAMILY,
120     PROP_MONOSPACE_FONT_FAMILY,
121     PROP_SERIF_FONT_FAMILY,
122     PROP_SANS_SERIF_FONT_FAMILY,
123     PROP_CURSIVE_FONT_FAMILY,
124     PROP_FANTASY_FONT_FAMILY,
125     PROP_PICTOGRAPH_FONT_FAMILY,
126     PROP_DEFAULT_FONT_SIZE,
127     PROP_DEFAULT_MONOSPACE_FONT_SIZE,
128     PROP_MINIMUM_FONT_SIZE,
129     PROP_DEFAULT_CHARSET,
130 #if PLATFORM(GTK)
131     PROP_ENABLE_PRIVATE_BROWSING,
132 #endif
133     PROP_ENABLE_DEVELOPER_EXTRAS,
134     PROP_ENABLE_RESIZABLE_TEXT_AREAS,
135     PROP_ENABLE_TABS_TO_LINKS,
136     PROP_ENABLE_DNS_PREFETCHING,
137     PROP_ENABLE_CARET_BROWSING,
138     PROP_ENABLE_FULLSCREEN,
139     PROP_PRINT_BACKGROUNDS,
140     PROP_ENABLE_WEBAUDIO,
141     PROP_ENABLE_WEBGL,
142     PROP_ALLOW_MODAL_DIALOGS,
143     PROP_ZOOM_TEXT_ONLY,
144     PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD,
145     PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE,
146     PROP_MEDIA_PLAYBACK_ALLOWS_INLINE,
147     PROP_DRAW_COMPOSITING_INDICATORS,
148     PROP_ENABLE_SITE_SPECIFIC_QUIRKS,
149     PROP_ENABLE_PAGE_CACHE,
150     PROP_USER_AGENT,
151     PROP_ENABLE_SMOOTH_SCROLLING,
152     PROP_ENABLE_ACCELERATED_2D_CANVAS,
153     PROP_ENABLE_WRITE_CONSOLE_MESSAGES_TO_STDOUT,
154     PROP_ENABLE_MEDIA_STREAM,
155     PROP_ENABLE_MOCK_CAPTURE_DEVICES,
156     PROP_ENABLE_SPATIAL_NAVIGATION,
157     PROP_ENABLE_MEDIASOURCE,
158     PROP_ENABLE_ENCRYPTED_MEDIA,
159     PROP_ENABLE_MEDIA_CAPABILITIES,
160     PROP_ALLOW_FILE_ACCESS_FROM_FILE_URLS,
161     PROP_ALLOW_UNIVERSAL_ACCESS_FROM_FILE_URLS,
162 #if PLATFORM(GTK)
163     PROP_HARDWARE_ACCELERATION_POLICY,
164 #endif
165 };
166
167 static void webKitSettingsDispose(GObject* object)
168 {
169     WebCore::setScreenDPIObserverHandler(nullptr, object);
170     G_OBJECT_CLASS(webkit_settings_parent_class)->dispose(object);
171 }
172
173 static void webKitSettingsConstructed(GObject* object)
174 {
175     G_OBJECT_CLASS(webkit_settings_parent_class)->constructed(object);
176
177     WebKitSettings* settings = WEBKIT_SETTINGS(object);
178     WebPreferences* prefs = settings->priv->preferences.get();
179     prefs->setShouldRespectImageOrientation(true);
180
181     bool mediaStreamEnabled = prefs->mediaStreamEnabled();
182     prefs->setMediaDevicesEnabled(mediaStreamEnabled);
183     prefs->setPeerConnectionEnabled(mediaStreamEnabled);
184
185     settings->priv->screenDpi = WebCore::screenDPI();
186     WebCore::setScreenDPIObserverHandler([settings]() {
187         auto newScreenDpi = WebCore::screenDPI();
188         if (newScreenDpi == settings->priv->screenDpi)
189             return;
190
191         auto scalingFactor = newScreenDpi / settings->priv->screenDpi;
192         auto fontSize = settings->priv->preferences->defaultFontSize();
193         auto monospaceFontSize = settings->priv->preferences->defaultFixedFontSize();
194         settings->priv->screenDpi = newScreenDpi;
195
196         g_object_freeze_notify(G_OBJECT(settings));
197         webkit_settings_set_default_font_size(settings, std::round(fontSize * scalingFactor));
198         webkit_settings_set_default_monospace_font_size(settings, std::round(monospaceFontSize * scalingFactor));
199         g_object_thaw_notify(G_OBJECT(settings));
200     }, object);
201 }
202
203 static void webKitSettingsSetProperty(GObject* object, guint propId, const GValue* value, GParamSpec* paramSpec)
204 {
205     WebKitSettings* settings = WEBKIT_SETTINGS(object);
206
207     switch (propId) {
208     case PROP_ENABLE_JAVASCRIPT:
209         webkit_settings_set_enable_javascript(settings, g_value_get_boolean(value));
210         break;
211     case PROP_AUTO_LOAD_IMAGES:
212         webkit_settings_set_auto_load_images(settings, g_value_get_boolean(value));
213         break;
214     case PROP_LOAD_ICONS_IGNORING_IMAGE_LOAD_SETTING:
215         webkit_settings_set_load_icons_ignoring_image_load_setting(settings, g_value_get_boolean(value));
216         break;
217     case PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE:
218         webkit_settings_set_enable_offline_web_application_cache(settings, g_value_get_boolean(value));
219         break;
220     case PROP_ENABLE_HTML5_LOCAL_STORAGE:
221         webkit_settings_set_enable_html5_local_storage(settings, g_value_get_boolean(value));
222         break;
223     case PROP_ENABLE_HTML5_DATABASE:
224         webkit_settings_set_enable_html5_database(settings, g_value_get_boolean(value));
225         break;
226     case PROP_ENABLE_XSS_AUDITOR:
227         webkit_settings_set_enable_xss_auditor(settings, g_value_get_boolean(value));
228         break;
229     case PROP_ENABLE_FRAME_FLATTENING:
230         webkit_settings_set_enable_frame_flattening(settings, g_value_get_boolean(value));
231         break;
232     case PROP_ENABLE_PLUGINS:
233         webkit_settings_set_enable_plugins(settings, g_value_get_boolean(value));
234         break;
235     case PROP_ENABLE_JAVA:
236         webkit_settings_set_enable_java(settings, g_value_get_boolean(value));
237         break;
238     case PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY:
239         webkit_settings_set_javascript_can_open_windows_automatically(settings, g_value_get_boolean(value));
240         break;
241     case PROP_ENABLE_HYPERLINK_AUDITING:
242         webkit_settings_set_enable_hyperlink_auditing(settings, g_value_get_boolean(value));
243         break;
244     case PROP_DEFAULT_FONT_FAMILY:
245         webkit_settings_set_default_font_family(settings, g_value_get_string(value));
246         break;
247     case PROP_MONOSPACE_FONT_FAMILY:
248         webkit_settings_set_monospace_font_family(settings, g_value_get_string(value));
249         break;
250     case PROP_SERIF_FONT_FAMILY:
251         webkit_settings_set_serif_font_family(settings, g_value_get_string(value));
252         break;
253     case PROP_SANS_SERIF_FONT_FAMILY:
254         webkit_settings_set_sans_serif_font_family(settings, g_value_get_string(value));
255         break;
256     case PROP_CURSIVE_FONT_FAMILY:
257         webkit_settings_set_cursive_font_family(settings, g_value_get_string(value));
258         break;
259     case PROP_FANTASY_FONT_FAMILY:
260         webkit_settings_set_fantasy_font_family(settings, g_value_get_string(value));
261         break;
262     case PROP_PICTOGRAPH_FONT_FAMILY:
263         webkit_settings_set_pictograph_font_family(settings, g_value_get_string(value));
264         break;
265     case PROP_DEFAULT_FONT_SIZE:
266         webkit_settings_set_default_font_size(settings, g_value_get_uint(value));
267         break;
268     case PROP_DEFAULT_MONOSPACE_FONT_SIZE:
269         webkit_settings_set_default_monospace_font_size(settings, g_value_get_uint(value));
270         break;
271     case PROP_MINIMUM_FONT_SIZE:
272         webkit_settings_set_minimum_font_size(settings, g_value_get_uint(value));
273         break;
274     case PROP_DEFAULT_CHARSET:
275         webkit_settings_set_default_charset(settings, g_value_get_string(value));
276         break;
277 #if PLATFORM(GTK)
278     case PROP_ENABLE_PRIVATE_BROWSING:
279         G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
280         webkit_settings_set_enable_private_browsing(settings, g_value_get_boolean(value));
281         G_GNUC_END_IGNORE_DEPRECATIONS;
282         break;
283 #endif
284     case PROP_ENABLE_DEVELOPER_EXTRAS:
285         webkit_settings_set_enable_developer_extras(settings, g_value_get_boolean(value));
286         break;
287     case PROP_ENABLE_RESIZABLE_TEXT_AREAS:
288         webkit_settings_set_enable_resizable_text_areas(settings, g_value_get_boolean(value));
289         break;
290     case PROP_ENABLE_TABS_TO_LINKS:
291         webkit_settings_set_enable_tabs_to_links(settings, g_value_get_boolean(value));
292         break;
293     case PROP_ENABLE_DNS_PREFETCHING:
294         webkit_settings_set_enable_dns_prefetching(settings, g_value_get_boolean(value));
295         break;
296     case PROP_ENABLE_CARET_BROWSING:
297         webkit_settings_set_enable_caret_browsing(settings, g_value_get_boolean(value));
298         break;
299     case PROP_ENABLE_FULLSCREEN:
300         webkit_settings_set_enable_fullscreen(settings, g_value_get_boolean(value));
301         break;
302     case PROP_PRINT_BACKGROUNDS:
303         webkit_settings_set_print_backgrounds(settings, g_value_get_boolean(value));
304         break;
305     case PROP_ENABLE_WEBAUDIO:
306         webkit_settings_set_enable_webaudio(settings, g_value_get_boolean(value));
307         break;
308     case PROP_ENABLE_WEBGL:
309         webkit_settings_set_enable_webgl(settings, g_value_get_boolean(value));
310         break;
311     case PROP_ALLOW_MODAL_DIALOGS:
312         webkit_settings_set_allow_modal_dialogs(settings, g_value_get_boolean(value));
313         break;
314     case PROP_ZOOM_TEXT_ONLY:
315         webkit_settings_set_zoom_text_only(settings, g_value_get_boolean(value));
316         break;
317     case PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD:
318         webkit_settings_set_javascript_can_access_clipboard(settings, g_value_get_boolean(value));
319         break;
320     case PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE:
321         webkit_settings_set_media_playback_requires_user_gesture(settings, g_value_get_boolean(value));
322         break;
323     case PROP_MEDIA_PLAYBACK_ALLOWS_INLINE:
324         webkit_settings_set_media_playback_allows_inline(settings, g_value_get_boolean(value));
325         break;
326     case PROP_DRAW_COMPOSITING_INDICATORS:
327         if (g_value_get_boolean(value))
328             webkit_settings_set_draw_compositing_indicators(settings, g_value_get_boolean(value));
329         else {
330             char* debugVisualsEnvironment = getenv("WEBKIT_SHOW_COMPOSITING_DEBUG_VISUALS");
331             bool showDebugVisuals = debugVisualsEnvironment && !strcmp(debugVisualsEnvironment, "1");
332             webkit_settings_set_draw_compositing_indicators(settings, showDebugVisuals);
333         }
334         break;
335     case PROP_ENABLE_SITE_SPECIFIC_QUIRKS:
336         webkit_settings_set_enable_site_specific_quirks(settings, g_value_get_boolean(value));
337         break;
338     case PROP_ENABLE_PAGE_CACHE:
339         webkit_settings_set_enable_page_cache(settings, g_value_get_boolean(value));
340         break;
341     case PROP_USER_AGENT:
342         webkit_settings_set_user_agent(settings, g_value_get_string(value));
343         break;
344     case PROP_ENABLE_SMOOTH_SCROLLING:
345         webkit_settings_set_enable_smooth_scrolling(settings, g_value_get_boolean(value));
346         break;
347     case PROP_ENABLE_ACCELERATED_2D_CANVAS:
348         webkit_settings_set_enable_accelerated_2d_canvas(settings, g_value_get_boolean(value));
349         break;
350     case PROP_ENABLE_WRITE_CONSOLE_MESSAGES_TO_STDOUT:
351         webkit_settings_set_enable_write_console_messages_to_stdout(settings, g_value_get_boolean(value));
352         break;
353     case PROP_ENABLE_MEDIA_STREAM:
354         webkit_settings_set_enable_media_stream(settings, g_value_get_boolean(value));
355         break;
356     case PROP_ENABLE_MOCK_CAPTURE_DEVICES:
357         webkit_settings_set_enable_mock_capture_devices(settings, g_value_get_boolean(value));
358         break;
359     case PROP_ENABLE_SPATIAL_NAVIGATION:
360         webkit_settings_set_enable_spatial_navigation(settings, g_value_get_boolean(value));
361         break;
362     case PROP_ENABLE_MEDIASOURCE:
363         webkit_settings_set_enable_mediasource(settings, g_value_get_boolean(value));
364         break;
365     case PROP_ENABLE_ENCRYPTED_MEDIA:
366         webkit_settings_set_enable_encrypted_media(settings, g_value_get_boolean(value));
367         break;
368     case PROP_ENABLE_MEDIA_CAPABILITIES:
369         webkit_settings_set_enable_media_capabilities(settings, g_value_get_boolean(value));
370         break;
371     case PROP_ALLOW_FILE_ACCESS_FROM_FILE_URLS:
372         webkit_settings_set_allow_file_access_from_file_urls(settings, g_value_get_boolean(value));
373         break;
374     case PROP_ALLOW_UNIVERSAL_ACCESS_FROM_FILE_URLS:
375         webkit_settings_set_allow_universal_access_from_file_urls(settings, g_value_get_boolean(value));
376         break;
377 #if PLATFORM(GTK)
378     case PROP_HARDWARE_ACCELERATION_POLICY:
379         webkit_settings_set_hardware_acceleration_policy(settings, static_cast<WebKitHardwareAccelerationPolicy>(g_value_get_enum(value)));
380         break;
381 #endif
382     default:
383         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
384         break;
385     }
386 }
387
388 static void webKitSettingsGetProperty(GObject* object, guint propId, GValue* value, GParamSpec* paramSpec)
389 {
390     WebKitSettings* settings = WEBKIT_SETTINGS(object);
391
392     switch (propId) {
393     case PROP_ENABLE_JAVASCRIPT:
394         g_value_set_boolean(value, webkit_settings_get_enable_javascript(settings));
395         break;
396     case PROP_AUTO_LOAD_IMAGES:
397         g_value_set_boolean(value, webkit_settings_get_auto_load_images(settings));
398         break;
399     case PROP_LOAD_ICONS_IGNORING_IMAGE_LOAD_SETTING:
400         g_value_set_boolean(value, webkit_settings_get_load_icons_ignoring_image_load_setting(settings));
401         break;
402     case PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE:
403         g_value_set_boolean(value, webkit_settings_get_enable_offline_web_application_cache(settings));
404         break;
405     case PROP_ENABLE_HTML5_LOCAL_STORAGE:
406         g_value_set_boolean(value, webkit_settings_get_enable_html5_local_storage(settings));
407         break;
408     case PROP_ENABLE_HTML5_DATABASE:
409         g_value_set_boolean(value, webkit_settings_get_enable_html5_database(settings));
410         break;
411     case PROP_ENABLE_XSS_AUDITOR:
412         g_value_set_boolean(value, webkit_settings_get_enable_xss_auditor(settings));
413         break;
414     case PROP_ENABLE_FRAME_FLATTENING:
415         g_value_set_boolean(value, webkit_settings_get_enable_frame_flattening(settings));
416         break;
417     case PROP_ENABLE_PLUGINS:
418         g_value_set_boolean(value, webkit_settings_get_enable_plugins(settings));
419         break;
420     case PROP_ENABLE_JAVA:
421         g_value_set_boolean(value, webkit_settings_get_enable_java(settings));
422         break;
423     case PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY:
424         g_value_set_boolean(value, webkit_settings_get_javascript_can_open_windows_automatically(settings));
425         break;
426     case PROP_ENABLE_HYPERLINK_AUDITING:
427         g_value_set_boolean(value, webkit_settings_get_enable_hyperlink_auditing(settings));
428         break;
429     case PROP_DEFAULT_FONT_FAMILY:
430         g_value_set_string(value, webkit_settings_get_default_font_family(settings));
431         break;
432     case PROP_MONOSPACE_FONT_FAMILY:
433         g_value_set_string(value, webkit_settings_get_monospace_font_family(settings));
434         break;
435     case PROP_SERIF_FONT_FAMILY:
436         g_value_set_string(value, webkit_settings_get_serif_font_family(settings));
437         break;
438     case PROP_SANS_SERIF_FONT_FAMILY:
439         g_value_set_string(value, webkit_settings_get_sans_serif_font_family(settings));
440         break;
441     case PROP_CURSIVE_FONT_FAMILY:
442         g_value_set_string(value, webkit_settings_get_cursive_font_family(settings));
443         break;
444     case PROP_FANTASY_FONT_FAMILY:
445         g_value_set_string(value, webkit_settings_get_fantasy_font_family(settings));
446         break;
447     case PROP_PICTOGRAPH_FONT_FAMILY:
448         g_value_set_string(value, webkit_settings_get_pictograph_font_family(settings));
449         break;
450     case PROP_DEFAULT_FONT_SIZE:
451         g_value_set_uint(value, webkit_settings_get_default_font_size(settings));
452         break;
453     case PROP_DEFAULT_MONOSPACE_FONT_SIZE:
454         g_value_set_uint(value, webkit_settings_get_default_monospace_font_size(settings));
455         break;
456     case PROP_MINIMUM_FONT_SIZE:
457         g_value_set_uint(value, webkit_settings_get_minimum_font_size(settings));
458         break;
459     case PROP_DEFAULT_CHARSET:
460         g_value_set_string(value, webkit_settings_get_default_charset(settings));
461         break;
462 #if PLATFORM(GTK)
463     case PROP_ENABLE_PRIVATE_BROWSING:
464         G_GNUC_BEGIN_IGNORE_DEPRECATIONS;
465         g_value_set_boolean(value, webkit_settings_get_enable_private_browsing(settings));
466         G_GNUC_END_IGNORE_DEPRECATIONS;
467         break;
468 #endif
469     case PROP_ENABLE_DEVELOPER_EXTRAS:
470         g_value_set_boolean(value, webkit_settings_get_enable_developer_extras(settings));
471         break;
472     case PROP_ENABLE_RESIZABLE_TEXT_AREAS:
473         g_value_set_boolean(value, webkit_settings_get_enable_resizable_text_areas(settings));
474         break;
475     case PROP_ENABLE_TABS_TO_LINKS:
476         g_value_set_boolean(value, webkit_settings_get_enable_tabs_to_links(settings));
477         break;
478     case PROP_ENABLE_DNS_PREFETCHING:
479         g_value_set_boolean(value, webkit_settings_get_enable_dns_prefetching(settings));
480         break;
481     case PROP_ENABLE_CARET_BROWSING:
482         g_value_set_boolean(value, webkit_settings_get_enable_caret_browsing(settings));
483         break;
484     case PROP_ENABLE_FULLSCREEN:
485         g_value_set_boolean(value, webkit_settings_get_enable_fullscreen(settings));
486         break;
487     case PROP_PRINT_BACKGROUNDS:
488         g_value_set_boolean(value, webkit_settings_get_print_backgrounds(settings));
489         break;
490     case PROP_ENABLE_WEBAUDIO:
491         g_value_set_boolean(value, webkit_settings_get_enable_webaudio(settings));
492         break;
493     case PROP_ENABLE_WEBGL:
494         g_value_set_boolean(value, webkit_settings_get_enable_webgl(settings));
495         break;
496     case PROP_ALLOW_MODAL_DIALOGS:
497         g_value_set_boolean(value, webkit_settings_get_allow_modal_dialogs(settings));
498         break;
499     case PROP_ZOOM_TEXT_ONLY:
500         g_value_set_boolean(value, webkit_settings_get_zoom_text_only(settings));
501         break;
502     case PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD:
503         g_value_set_boolean(value, webkit_settings_get_javascript_can_access_clipboard(settings));
504         break;
505     case PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE:
506         g_value_set_boolean(value, webkit_settings_get_media_playback_requires_user_gesture(settings));
507         break;
508     case PROP_MEDIA_PLAYBACK_ALLOWS_INLINE:
509         g_value_set_boolean(value, webkit_settings_get_media_playback_allows_inline(settings));
510         break;
511     case PROP_DRAW_COMPOSITING_INDICATORS:
512         g_value_set_boolean(value, webkit_settings_get_draw_compositing_indicators(settings));
513         break;
514     case PROP_ENABLE_SITE_SPECIFIC_QUIRKS:
515         g_value_set_boolean(value, webkit_settings_get_enable_site_specific_quirks(settings));
516         break;
517     case PROP_ENABLE_PAGE_CACHE:
518         g_value_set_boolean(value, webkit_settings_get_enable_page_cache(settings));
519         break;
520     case PROP_USER_AGENT:
521         g_value_set_string(value, webkit_settings_get_user_agent(settings));
522         break;
523     case PROP_ENABLE_SMOOTH_SCROLLING:
524         g_value_set_boolean(value, webkit_settings_get_enable_smooth_scrolling(settings));
525         break;
526     case PROP_ENABLE_ACCELERATED_2D_CANVAS:
527         g_value_set_boolean(value, webkit_settings_get_enable_accelerated_2d_canvas(settings));
528         break;
529     case PROP_ENABLE_WRITE_CONSOLE_MESSAGES_TO_STDOUT:
530         g_value_set_boolean(value, webkit_settings_get_enable_write_console_messages_to_stdout(settings));
531         break;
532     case PROP_ENABLE_MEDIA_STREAM:
533         g_value_set_boolean(value, webkit_settings_get_enable_media_stream(settings));
534         break;
535     case PROP_ENABLE_MOCK_CAPTURE_DEVICES:
536         g_value_set_boolean(value, webkit_settings_get_enable_mock_capture_devices(settings));
537         break;
538     case PROP_ENABLE_SPATIAL_NAVIGATION:
539         g_value_set_boolean(value, webkit_settings_get_enable_spatial_navigation(settings));
540         break;
541     case PROP_ENABLE_MEDIASOURCE:
542         g_value_set_boolean(value, webkit_settings_get_enable_mediasource(settings));
543         break;
544     case PROP_ENABLE_ENCRYPTED_MEDIA:
545         g_value_set_boolean(value, webkit_settings_get_enable_encrypted_media(settings));
546         break;
547     case PROP_ENABLE_MEDIA_CAPABILITIES:
548         g_value_set_boolean(value, webkit_settings_get_enable_media_capabilities(settings));
549         break;
550     case PROP_ALLOW_FILE_ACCESS_FROM_FILE_URLS:
551         g_value_set_boolean(value, webkit_settings_get_allow_file_access_from_file_urls(settings));
552         break;
553     case PROP_ALLOW_UNIVERSAL_ACCESS_FROM_FILE_URLS:
554         g_value_set_boolean(value, webkit_settings_get_allow_universal_access_from_file_urls(settings));
555         break;
556 #if PLATFORM(GTK)
557     case PROP_HARDWARE_ACCELERATION_POLICY:
558         g_value_set_enum(value, webkit_settings_get_hardware_acceleration_policy(settings));
559         break;
560 #endif
561     default:
562         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
563         break;
564     }
565 }
566
567 static void webkit_settings_class_init(WebKitSettingsClass* klass)
568 {
569     GObjectClass* gObjectClass = G_OBJECT_CLASS(klass);
570     gObjectClass->constructed = webKitSettingsConstructed;
571     gObjectClass->dispose = webKitSettingsDispose;
572     gObjectClass->set_property = webKitSettingsSetProperty;
573     gObjectClass->get_property = webKitSettingsGetProperty;
574
575     GParamFlags readWriteConstructParamFlags = static_cast<GParamFlags>(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT);
576
577     /**
578      * WebKitSettings:enable-javascript:
579      *
580      * Determines whether or not JavaScript executes within a page.
581      */
582     g_object_class_install_property(gObjectClass,
583                                     PROP_ENABLE_JAVASCRIPT,
584                                     g_param_spec_boolean("enable-javascript",
585                                                          _("Enable JavaScript"),
586                                                          _("Enable JavaScript."),
587                                                          TRUE,
588                                                          readWriteConstructParamFlags));
589
590     /**
591      * WebKitSettings:auto-load-images:
592      *
593      * Determines whether images should be automatically loaded or not.
594      * On devices where network bandwidth is of concern, it might be
595      * useful to turn this property off.
596      */
597     g_object_class_install_property(gObjectClass,
598                                     PROP_AUTO_LOAD_IMAGES,
599                                     g_param_spec_boolean("auto-load-images",
600                                                          _("Auto load images"),
601                                                          _("Load images automatically."),
602                                                          TRUE,
603                                                          readWriteConstructParamFlags));
604
605     /**
606      * WebKitSettings:load-icons-ignoring-image-load-setting:
607      *
608      * Determines whether a site can load favicons irrespective
609      * of the value of #WebKitSettings:auto-load-images.
610      */
611     g_object_class_install_property(gObjectClass,
612                                     PROP_LOAD_ICONS_IGNORING_IMAGE_LOAD_SETTING,
613                                     g_param_spec_boolean("load-icons-ignoring-image-load-setting",
614                                                          _("Load icons ignoring image load setting"),
615                                                          _("Whether to load site icons ignoring image load setting."),
616                                                          FALSE,
617                                                          readWriteConstructParamFlags));
618
619     /**
620      * WebKitSettings:enable-offline-web-application-cache:
621      *
622      * Whether to enable HTML5 offline web application cache support. Offline
623      * web application cache allows web applications to run even when
624      * the user is not connected to the network.
625      *
626      * HTML5 offline web application specification is available at
627      * http://dev.w3.org/html5/spec/offline.html.
628      */
629     g_object_class_install_property(gObjectClass,
630                                     PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE,
631                                     g_param_spec_boolean("enable-offline-web-application-cache",
632                                                          _("Enable offline web application cache"),
633                                                          _("Whether to enable offline web application cache."),
634                                                          TRUE,
635                                                          readWriteConstructParamFlags));
636
637     /**
638      * WebKitSettings:enable-html5-local-storage:
639      *
640      * Whether to enable HTML5 local storage support. Local storage provides
641      * simple synchronous storage access.
642      *
643      * HTML5 local storage specification is available at
644      * http://dev.w3.org/html5/webstorage/.
645      */
646     g_object_class_install_property(gObjectClass,
647                                     PROP_ENABLE_HTML5_LOCAL_STORAGE,
648                                     g_param_spec_boolean("enable-html5-local-storage",
649                                                          _("Enable HTML5 local storage"),
650                                                          _("Whether to enable HTML5 Local Storage support."),
651                                                          TRUE,
652                                                          readWriteConstructParamFlags));
653
654     /**
655      * WebKitSettings:enable-html5-database:
656      *
657      * Whether to enable HTML5 client-side SQL database support. Client-side
658      * SQL database allows web pages to store structured data and be able to
659      * use SQL to manipulate that data asynchronously.
660      *
661      * HTML5 database specification is available at
662      * http://www.w3.org/TR/webdatabase/.
663      */
664     g_object_class_install_property(gObjectClass,
665                                     PROP_ENABLE_HTML5_DATABASE,
666                                     g_param_spec_boolean("enable-html5-database",
667                                                          _("Enable HTML5 database"),
668                                                          _("Whether to enable HTML5 database support."),
669                                                          TRUE,
670                                                          readWriteConstructParamFlags));
671
672     /**
673      * WebKitSettings:enable-xss-auditor:
674      *
675      * Whether to enable the XSS auditor. This feature filters some kinds of
676      * reflective XSS attacks on vulnerable web sites.
677      */
678     g_object_class_install_property(gObjectClass,
679                                     PROP_ENABLE_XSS_AUDITOR,
680                                     g_param_spec_boolean("enable-xss-auditor",
681                                                          _("Enable XSS auditor"),
682                                                          _("Whether to enable the XSS auditor."),
683                                                          TRUE,
684                                                          readWriteConstructParamFlags));
685
686
687     /**
688      * WebKitSettings:enable-frame-flattening:
689      *
690      * Whether to enable the frame flattening. With this setting each subframe is expanded
691      * to its contents, which will flatten all the frames to become one scrollable page.
692      * On touch devices scrollable subframes on a page can result in a confusing user experience.
693      */
694     g_object_class_install_property(gObjectClass,
695                                     PROP_ENABLE_FRAME_FLATTENING,
696                                     g_param_spec_boolean("enable-frame-flattening",
697                                                          _("Enable frame flattening"),
698                                                          _("Whether to enable frame flattening."),
699                                                          FALSE,
700                                                          readWriteConstructParamFlags));
701
702     /**
703      * WebKitSettings:enable-plugins:
704      *
705      * Determines whether or not plugins on the page are enabled.
706      */
707     g_object_class_install_property(gObjectClass,
708                                     PROP_ENABLE_PLUGINS,
709                                     g_param_spec_boolean("enable-plugins",
710                                                          _("Enable plugins"),
711                                                          _("Enable embedded plugin objects."),
712                                                          TRUE,
713                                                          readWriteConstructParamFlags));
714
715     /**
716      * WebKitSettings:enable-java:
717      *
718      * Determines whether or not Java is enabled on the page.
719      */
720     g_object_class_install_property(gObjectClass,
721                                     PROP_ENABLE_JAVA,
722                                     g_param_spec_boolean("enable-java",
723                                                          _("Enable Java"),
724                                                          _("Whether Java support should be enabled."),
725                                                          TRUE,
726                                                          readWriteConstructParamFlags));
727
728     /**
729      * WebKitSettings:javascript-can-open-windows-automatically:
730      *
731      * Whether JavaScript can open popup windows automatically without user
732      * intervention.
733      */
734     g_object_class_install_property(gObjectClass,
735                                     PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY,
736                                     g_param_spec_boolean("javascript-can-open-windows-automatically",
737                                                          _("JavaScript can open windows automatically"),
738                                                          _("Whether JavaScript can open windows automatically."),
739                                                          FALSE,
740                                                          readWriteConstructParamFlags));
741
742     /**
743      * WebKitSettings:enable-hyperlink-auditing:
744      *
745      * Determines whether or not hyperlink auditing is enabled.
746      *
747      * The hyperlink auditing specification is available at
748      * http://www.whatwg.org/specs/web-apps/current-work/multipage/links.html#hyperlink-auditing.
749      */
750     g_object_class_install_property(gObjectClass,
751                                     PROP_ENABLE_HYPERLINK_AUDITING,
752                                     g_param_spec_boolean("enable-hyperlink-auditing",
753                                                          _("Enable hyperlink auditing"),
754                                                          _("Whether <a ping> should be able to send pings."),
755                                                          FALSE,
756                                                          readWriteConstructParamFlags));
757
758     /**
759      * WebKitSettings:default-font-family:
760      *
761      * The font family to use as the default for content that does not specify a font.
762      */
763     g_object_class_install_property(gObjectClass,
764                                     PROP_DEFAULT_FONT_FAMILY,
765                                     g_param_spec_string("default-font-family",
766                                                         _("Default font family"),
767                                                         _("The font family to use as the default for content that does not specify a font."),
768                                                         "sans-serif",
769                                                         readWriteConstructParamFlags));
770
771     /**
772      * WebKitSettings:monospace-font-family:
773      *
774      * The font family used as the default for content using a monospace font.
775      *
776      */
777     g_object_class_install_property(gObjectClass,
778                                     PROP_MONOSPACE_FONT_FAMILY,
779                                     g_param_spec_string("monospace-font-family",
780                                                         _("Monospace font family"),
781                                                         _("The font family used as the default for content using monospace font."),
782                                                         "monospace",
783                                                         readWriteConstructParamFlags));
784
785     /**
786      * WebKitSettings:serif-font-family:
787      *
788      * The font family used as the default for content using a serif font.
789      */
790     g_object_class_install_property(gObjectClass,
791                                     PROP_SERIF_FONT_FAMILY,
792                                     g_param_spec_string("serif-font-family",
793                                                         _("Serif font family"),
794                                                         _("The font family used as the default for content using serif font."),
795                                                         "serif",
796                                                         readWriteConstructParamFlags));
797
798     /**
799      * WebKitSettings:sans-serif-font-family:
800      *
801      * The font family used as the default for content using a sans-serif font.
802      */
803     g_object_class_install_property(gObjectClass,
804                                     PROP_SANS_SERIF_FONT_FAMILY,
805                                     g_param_spec_string("sans-serif-font-family",
806                                                         _("Sans-serif font family"),
807                                                         _("The font family used as the default for content using sans-serif font."),
808                                                         "sans-serif",
809                                                         readWriteConstructParamFlags));
810
811     /**
812      * WebKitSettings:cursive-font-family:
813      *
814      * The font family used as the default for content using a cursive font.
815      */
816     g_object_class_install_property(gObjectClass,
817                                     PROP_CURSIVE_FONT_FAMILY,
818                                     g_param_spec_string("cursive-font-family",
819                                                         _("Cursive font family"),
820                                                         _("The font family used as the default for content using cursive font."),
821                                                         "serif",
822                                                         readWriteConstructParamFlags));
823
824     /**
825      * WebKitSettings:fantasy-font-family:
826      *
827      * The font family used as the default for content using a fantasy font.
828      */
829     g_object_class_install_property(gObjectClass,
830                                     PROP_FANTASY_FONT_FAMILY,
831                                     g_param_spec_string("fantasy-font-family",
832                                                         _("Fantasy font family"),
833                                                         _("The font family used as the default for content using fantasy font."),
834                                                         "serif",
835                                                         readWriteConstructParamFlags));
836
837     /**
838      * WebKitSettings:pictograph-font-family:
839      *
840      * The font family used as the default for content using a pictograph font.
841      */
842     g_object_class_install_property(gObjectClass,
843                                     PROP_PICTOGRAPH_FONT_FAMILY,
844                                     g_param_spec_string("pictograph-font-family",
845                                                         _("Pictograph font family"),
846                                                         _("The font family used as the default for content using pictograph font."),
847                                                         "serif",
848                                                         readWriteConstructParamFlags));
849
850     /**
851      * WebKitSettings:default-font-size:
852      *
853      * The default font size in pixels to use for content displayed if
854      * no font size is specified.
855      */
856     g_object_class_install_property(gObjectClass,
857                                     PROP_DEFAULT_FONT_SIZE,
858                                     g_param_spec_uint("default-font-size",
859                                                       _("Default font size"),
860                                                       _("The default font size used to display text."),
861                                                       0, G_MAXUINT, 16,
862                                                       readWriteConstructParamFlags));
863
864     /**
865      * WebKitSettings:default-monospace-font-size:
866      *
867      * The default font size in pixels to use for content displayed in
868      * monospace font if no font size is specified.
869      */
870     g_object_class_install_property(gObjectClass,
871                                     PROP_DEFAULT_MONOSPACE_FONT_SIZE,
872                                     g_param_spec_uint("default-monospace-font-size",
873                                                       _("Default monospace font size"),
874                                                       _("The default font size used to display monospace text."),
875                                                       0, G_MAXUINT, 13,
876                                                       readWriteConstructParamFlags));
877
878     /**
879      * WebKitSettings:minimum-font-size:
880      *
881      * The minimum font size in pixels used to display text. This setting
882      * controls the absolute smallest size. Values other than 0 can
883      * potentially break page layouts.
884      */
885     g_object_class_install_property(gObjectClass,
886                                     PROP_MINIMUM_FONT_SIZE,
887                                     g_param_spec_uint("minimum-font-size",
888                                                       _("Minimum font size"),
889                                                       _("The minimum font size used to display text."),
890                                                       0, G_MAXUINT, 0,
891                                                       readWriteConstructParamFlags));
892
893     /**
894      * WebKitSettings:default-charset:
895      *
896      * The default text charset used when interpreting content with an unspecified charset.
897      */
898     g_object_class_install_property(gObjectClass,
899                                     PROP_DEFAULT_CHARSET,
900                                     g_param_spec_string("default-charset",
901                                                         _("Default charset"),
902                                                         _("The default text charset used when interpreting content with unspecified charset."),
903                                                         "iso-8859-1",
904                                                         readWriteConstructParamFlags));
905
906 #if PLATFORM(GTK)
907     /**
908      * WebKitSettings:enable-private-browsing:
909      *
910      * Determines whether or not private browsing is enabled. Private browsing
911      * will disable history, cache and form auto-fill for any pages visited.
912      *
913      * Deprecated: 2.16. Use #WebKitWebView:is-ephemeral or #WebKitWebsiteDataManager:is-ephemeral instead.
914      */
915     g_object_class_install_property(gObjectClass,
916                                     PROP_ENABLE_PRIVATE_BROWSING,
917                                     g_param_spec_boolean("enable-private-browsing",
918                                                          _("Enable private browsing"),
919                                                          _("Whether to enable private browsing"),
920                                                          FALSE,
921                                                          readWriteConstructParamFlags));
922 #endif
923
924     /**
925      * WebKitSettings:enable-developer-extras:
926      *
927      * Determines whether or not developer tools, such as the Web Inspector, are enabled.
928      */
929     g_object_class_install_property(gObjectClass,
930                                     PROP_ENABLE_DEVELOPER_EXTRAS,
931                                     g_param_spec_boolean("enable-developer-extras",
932                                                          _("Enable developer extras"),
933                                                          _("Whether to enable developer extras"),
934                                                          FALSE,
935                                                          readWriteConstructParamFlags));
936
937     /**
938      * WebKitSettings:enable-resizable-text-areas:
939      *
940      * Determines whether or not text areas can be resized.
941      */
942     g_object_class_install_property(gObjectClass,
943                                     PROP_ENABLE_RESIZABLE_TEXT_AREAS,
944                                     g_param_spec_boolean("enable-resizable-text-areas",
945                                                          _("Enable resizable text areas"),
946                                                          _("Whether to enable resizable text areas"),
947                                                          TRUE,
948                                                          readWriteConstructParamFlags));
949
950     /**
951      * WebKitSettings:enable-tabs-to-links:
952      *
953      * Determines whether the tab key cycles through the elements on the page.
954      * When this setting is enabled, users will be able to focus the next element
955      * in the page by pressing the tab key. If the selected element is editable,
956      * then pressing tab key will insert the tab character.
957      */
958     g_object_class_install_property(gObjectClass,
959                                     PROP_ENABLE_TABS_TO_LINKS,
960                                     g_param_spec_boolean("enable-tabs-to-links",
961                                                          _("Enable tabs to links"),
962                                                          _("Whether to enable tabs to links"),
963                                                          TRUE,
964                                                          readWriteConstructParamFlags));
965
966     /**
967      * WebKitSettings:enable-dns-prefetching:
968      *
969      * Determines whether or not to prefetch domain names. DNS prefetching attempts
970      * to resolve domain names before a user tries to follow a link.
971      */
972     g_object_class_install_property(gObjectClass,
973                                     PROP_ENABLE_DNS_PREFETCHING,
974                                     g_param_spec_boolean("enable-dns-prefetching",
975                                                          _("Enable DNS prefetching"),
976                                                          _("Whether to enable DNS prefetching"),
977                                                          FALSE,
978                                                          readWriteConstructParamFlags));
979
980     /**
981      * WebKitSettings:enable-caret-browsing:
982      *
983      * Whether to enable accessibility enhanced keyboard navigation.
984      */
985     g_object_class_install_property(gObjectClass,
986                                     PROP_ENABLE_CARET_BROWSING,
987                                     g_param_spec_boolean("enable-caret-browsing",
988                                                          _("Enable Caret Browsing"),
989                                                          _("Whether to enable accessibility enhanced keyboard navigation"),
990                                                          FALSE,
991                                                          readWriteConstructParamFlags));
992
993     /**
994      * WebKitSettings:enable-fullscreen:
995      *
996      * Whether to enable the Javascript Fullscreen API. The API
997      * allows any HTML element to request fullscreen display. See also
998      * the current draft of the spec:
999      * http://www.w3.org/TR/fullscreen/
1000      */
1001     g_object_class_install_property(gObjectClass,
1002         PROP_ENABLE_FULLSCREEN,
1003         g_param_spec_boolean("enable-fullscreen",
1004             _("Enable Fullscreen"),
1005             _("Whether to enable the Javascript Fullscreen API"),
1006             TRUE,
1007             readWriteConstructParamFlags));
1008
1009     /**
1010      * WebKitSettings:print-backgrounds:
1011      *
1012      * Whether background images should be drawn during printing.
1013      */
1014     g_object_class_install_property(gObjectClass,
1015                                     PROP_PRINT_BACKGROUNDS,
1016                                     g_param_spec_boolean("print-backgrounds",
1017                                                          _("Print Backgrounds"),
1018                                                          _("Whether background images should be drawn during printing"),
1019                                                          TRUE,
1020                                                          readWriteConstructParamFlags));
1021
1022     /**
1023      * WebKitSettings:enable-webaudio:
1024      *
1025      *
1026      * Enable or disable support for WebAudio on pages. WebAudio is an
1027      * experimental proposal for allowing web pages to generate Audio
1028      * WAVE data from JavaScript. The standard is currently a
1029      * work-in-progress by the W3C Audio Working Group.
1030      *
1031      * See also https://dvcs.w3.org/hg/audio/raw-file/tip/webaudio/specification.html
1032      */
1033     g_object_class_install_property(gObjectClass,
1034                                     PROP_ENABLE_WEBAUDIO,
1035                                     g_param_spec_boolean("enable-webaudio",
1036                                                          _("Enable WebAudio"),
1037                                                          _("Whether WebAudio content should be handled"),
1038                                                          FALSE,
1039                                                          readWriteConstructParamFlags));
1040
1041     /**
1042     * WebKitSettings:enable-webgl:
1043     *
1044     * Enable or disable support for WebGL on pages. WebGL is an experimental
1045     * proposal for allowing web pages to use OpenGL ES-like calls directly. The
1046     * standard is currently a work-in-progress by the Khronos Group.
1047     */
1048     g_object_class_install_property(gObjectClass,
1049                                     PROP_ENABLE_WEBGL,
1050                                     g_param_spec_boolean("enable-webgl",
1051                                                          _("Enable WebGL"),
1052                                                          _("Whether WebGL content should be rendered"),
1053                                                          FALSE,
1054                                                          readWriteConstructParamFlags));
1055
1056     /**
1057      * WebKitSettings:allow-modal-dialogs:
1058      *
1059      * Determine whether it's allowed to create and run modal dialogs
1060      * from a #WebKitWebView through JavaScript with
1061      * <function>window.showModalDialog</function>. If it's set to
1062      * %FALSE, the associated #WebKitWebView won't be able to create
1063      * new modal dialogs, so not even the #WebKitWebView::create
1064      * signal will be emitted.
1065      */
1066     g_object_class_install_property(gObjectClass,
1067                                     PROP_ALLOW_MODAL_DIALOGS,
1068                                     g_param_spec_boolean("allow-modal-dialogs",
1069                                                          _("Allow modal dialogs"),
1070                                                          _("Whether it is possible to create modal dialogs"),
1071                                                          FALSE,
1072                                                          readWriteConstructParamFlags));
1073
1074     /**
1075      * WebKitSettings:zoom-text-only:
1076      *
1077      * Whether #WebKitWebView:zoom-level affects only the
1078      * text of the page or all the contents. Other contents containing text
1079      * like form controls will be also affected by zoom factor when
1080      * this property is enabled.
1081      */
1082     g_object_class_install_property(gObjectClass,
1083                                     PROP_ZOOM_TEXT_ONLY,
1084                                     g_param_spec_boolean("zoom-text-only",
1085                                                          _("Zoom Text Only"),
1086                                                          _("Whether zoom level of web view changes only the text size"),
1087                                                          FALSE,
1088                                                          readWriteConstructParamFlags));
1089
1090     /**
1091      * WebKitSettings:javascript-can-access-clipboard:
1092      *
1093      * Whether JavaScript can access the clipboard. The default value is %FALSE. If
1094      * set to %TRUE, document.execCommand() allows cut, copy and paste commands.
1095      *
1096      */
1097     g_object_class_install_property(gObjectClass,
1098                                     PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD,
1099                                     g_param_spec_boolean("javascript-can-access-clipboard",
1100                                                          _("JavaScript can access clipboard"),
1101                                                          _("Whether JavaScript can access Clipboard"),
1102                                                          FALSE,
1103                                                          readWriteConstructParamFlags));
1104
1105     /**
1106      * WebKitSettings:media-playback-requires-user-gesture:
1107      *
1108      * Whether a user gesture (such as clicking the play button)
1109      * would be required to start media playback or load media. This is off
1110      * by default, so media playback could start automatically.
1111      * Setting it on requires a gesture by the user to start playback, or to
1112      * load the media.
1113      */
1114     g_object_class_install_property(gObjectClass,
1115                                     PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE,
1116                                     g_param_spec_boolean("media-playback-requires-user-gesture",
1117                                                          _("Media playback requires user gesture"),
1118                                                          _("Whether media playback requires user gesture"),
1119                                                          FALSE,
1120                                                          readWriteConstructParamFlags));
1121
1122     /**
1123      * WebKitSettings:media-playback-allows-inline:
1124      *
1125      * Whether media playback is full-screen only or inline playback is allowed.
1126      * This is %TRUE by default, so media playback can be inline. Setting it to
1127      * %FALSE allows specifying that media playback should be always fullscreen.
1128      */
1129     g_object_class_install_property(gObjectClass,
1130                                     PROP_MEDIA_PLAYBACK_ALLOWS_INLINE,
1131                                     g_param_spec_boolean("media-playback-allows-inline",
1132                                                          _("Media playback allows inline"),
1133                                                          _("Whether media playback allows inline"),
1134                                                          TRUE,
1135                                                          readWriteConstructParamFlags));
1136
1137     /**
1138      * WebKitSettings:draw-compositing-indicators:
1139      *
1140      * Whether to draw compositing borders and repaint counters on layers drawn
1141      * with accelerated compositing. This is useful for debugging issues related
1142      * to web content that is composited with the GPU.
1143      */
1144     g_object_class_install_property(gObjectClass,
1145                                     PROP_DRAW_COMPOSITING_INDICATORS,
1146                                     g_param_spec_boolean("draw-compositing-indicators",
1147                                                          _("Draw compositing indicators"),
1148                                                          _("Whether to draw compositing borders and repaint counters"),
1149                                                          FALSE,
1150                                                          readWriteConstructParamFlags));
1151
1152     /**
1153      * WebKitSettings:enable-site-specific-quirks:
1154      *
1155      * Whether to turn on site-specific quirks. Turning this on will
1156      * tell WebKit to use some site-specific workarounds for
1157      * better web compatibility. For example, older versions of
1158      * MediaWiki will incorrectly send to WebKit a CSS file with KHTML
1159      * workarounds. By turning on site-specific quirks, WebKit will
1160      * special-case this and other cases to make some specific sites work.
1161      */
1162     g_object_class_install_property(
1163         gObjectClass,
1164         PROP_ENABLE_SITE_SPECIFIC_QUIRKS,
1165         g_param_spec_boolean(
1166             "enable-site-specific-quirks",
1167             _("Enable Site Specific Quirks"),
1168             _("Enables the site-specific compatibility workarounds"),
1169             TRUE,
1170             readWriteConstructParamFlags));
1171
1172     /**
1173      * WebKitSettings:enable-page-cache:
1174      *
1175      * Enable or disable the page cache. Disabling the page cache is
1176      * generally only useful for special circumstances like low-memory
1177      * scenarios or special purpose applications like static HTML
1178      * viewers. This setting only controls the Page Cache, this cache
1179      * is different than the disk-based or memory-based traditional
1180      * resource caches, its point is to make going back and forth
1181      * between pages much faster. For details about the different types
1182      * of caches and their purposes see:
1183      * http://webkit.org/blog/427/webkit-page-cache-i-the-basics/
1184      */
1185     g_object_class_install_property(gObjectClass,
1186                                     PROP_ENABLE_PAGE_CACHE,
1187                                     g_param_spec_boolean("enable-page-cache",
1188                                                          _("Enable page cache"),
1189                                                          _("Whether the page cache should be used"),
1190                                                          TRUE,
1191                                                          readWriteConstructParamFlags));
1192
1193     /**
1194      * WebKitSettings:user-agent:
1195      *
1196      * The user-agent string used by WebKit. Unusual user-agent strings may cause web
1197      * content to render incorrectly or fail to run, as many web pages are written to
1198      * parse the user-agent strings of only the most popular browsers. Therefore, it's
1199      * typically better to not completely override the standard user-agent, but to use
1200      * webkit_settings_set_user_agent_with_application_details() instead.
1201      *
1202      * If this property is set to the empty string or %NULL, it will revert to the standard
1203      * user-agent.
1204      */
1205     g_object_class_install_property(gObjectClass,
1206                                     PROP_USER_AGENT,
1207                                     g_param_spec_string("user-agent",
1208                                                         _("User agent string"),
1209                                                         _("The user agent string"),
1210                                                         0, // A null string forces the standard user agent.
1211                                                         readWriteConstructParamFlags));
1212
1213     /**
1214      * WebKitSettings:enable-smooth-scrolling:
1215      *
1216      * Enable or disable smooth scrolling.
1217      */
1218     g_object_class_install_property(gObjectClass,
1219                                     PROP_ENABLE_SMOOTH_SCROLLING,
1220                                     g_param_spec_boolean("enable-smooth-scrolling",
1221                                                          _("Enable smooth scrolling"),
1222                                                          _("Whether to enable smooth scrolling"),
1223                                                          FALSE,
1224                                                          readWriteConstructParamFlags));
1225
1226     /**
1227      * WebKitSettings:enable-accelerated-2d-canvas:
1228      *
1229      * Enable or disable accelerated 2D canvas. Accelerated 2D canvas is only available
1230      * if WebKitGTK+ was compiled with a version of Cairo including the unstable CairoGL API.
1231      * When accelerated 2D canvas is enabled, WebKit may render some 2D canvas content
1232      * using hardware accelerated drawing operations.
1233      *
1234      * Since: 2.2
1235      */
1236     g_object_class_install_property(gObjectClass,
1237         PROP_ENABLE_ACCELERATED_2D_CANVAS,
1238         g_param_spec_boolean("enable-accelerated-2d-canvas",
1239             _("Enable accelerated 2D canvas"),
1240             _("Whether to enable accelerated 2D canvas"),
1241             FALSE,
1242             readWriteConstructParamFlags));
1243
1244     /**
1245      * WebKitSettings:enable-write-console-messages-to-stdout:
1246      *
1247      * Enable or disable writing console messages to stdout. These are messages
1248      * sent to the console with console.log and related methods.
1249      *
1250      * Since: 2.2
1251      */
1252     g_object_class_install_property(gObjectClass,
1253         PROP_ENABLE_WRITE_CONSOLE_MESSAGES_TO_STDOUT,
1254         g_param_spec_boolean("enable-write-console-messages-to-stdout",
1255             _("Write console messages on stdout"),
1256             _("Whether to write console messages on stdout"),
1257             FALSE,
1258             readWriteConstructParamFlags));
1259
1260     /**
1261      * WebKitSettings:enable-media-stream:
1262      *
1263      * Enable or disable support for MediaStream on pages. MediaStream
1264      * is an experimental proposal for allowing web pages to access
1265      * audio and video devices for capture.
1266      *
1267      * See also http://dev.w3.org/2011/webrtc/editor/getusermedia.html
1268      *
1269      * Since: 2.4
1270      */
1271     g_object_class_install_property(gObjectClass,
1272         PROP_ENABLE_MEDIA_STREAM,
1273         g_param_spec_boolean("enable-media-stream",
1274             _("Enable MediaStream"),
1275             _("Whether MediaStream content should be handled"),
1276             FALSE,
1277             readWriteConstructParamFlags));
1278
1279     /**
1280      * WebKitSettings:enable-mock-capture-devices:
1281      *
1282      * Enable or disable the Mock Capture Devices. Those are fake
1283      * Microphone and Camera devices to be used as MediaStream
1284      * sources.
1285      *
1286      * Since: 2.24
1287      */
1288     g_object_class_install_property(gObjectClass,
1289         PROP_ENABLE_MOCK_CAPTURE_DEVICES,
1290         g_param_spec_boolean("enable-mock-capture-devices",
1291             _("Enable mock capture devices"),
1292             _("Whether we expose mock capture devices or not"),
1293             FALSE,
1294             readWriteConstructParamFlags));
1295
1296    /**
1297      * WebKitSettings:enable-spatial-navigation:
1298      *
1299      * Whether to enable Spatial Navigation. This feature consists in the ability
1300      * to navigate between focusable elements in a Web page, such as hyperlinks
1301      * and form controls, by using Left, Right, Up and Down arrow keys.
1302      * For example, if an user presses the Right key, heuristics determine whether
1303      * there is an element they might be trying to reach towards the right, and if
1304      * there are multiple elements, which element they probably wants.
1305      *
1306      * Since: 2.4
1307      */
1308     g_object_class_install_property(gObjectClass,
1309         PROP_ENABLE_SPATIAL_NAVIGATION,
1310         g_param_spec_boolean("enable-spatial-navigation",
1311             _("Enable Spatial Navigation"),
1312             _("Whether to enable Spatial Navigation support."),
1313             FALSE,
1314             readWriteConstructParamFlags));
1315
1316     /**
1317      * WebKitSettings:enable-mediasource:
1318      *
1319      * Enable or disable support for MediaSource on pages. MediaSource
1320      * extends HTMLMediaElement to allow JavaScript to generate media
1321      * streams for playback.
1322      *
1323      * See also http://www.w3.org/TR/media-source/
1324      *
1325      * Since: 2.4
1326      */
1327     g_object_class_install_property(gObjectClass,
1328         PROP_ENABLE_MEDIASOURCE,
1329         g_param_spec_boolean("enable-mediasource",
1330             _("Enable MediaSource"),
1331             _("Whether MediaSource should be enabled."),
1332             TRUE,
1333             readWriteConstructParamFlags));
1334
1335
1336    /**
1337      * WebKitSettings:enable-encrypted-media:
1338      *
1339      * Enable or disable support for Encrypted Media API on pages.
1340      * EncryptedMedia is an experimental JavaScript API for playing encrypted media in HTML.
1341      * This property will only work as intended if the EncryptedMedia feature is enabled at build time
1342      * with the ENABLE_ENCRYPTED_MEDIA flag.
1343      *
1344      * See https://www.w3.org/TR/encrypted-media/
1345      *
1346      * Since: 2.20
1347      */
1348     g_object_class_install_property(gObjectClass,
1349         PROP_ENABLE_ENCRYPTED_MEDIA,
1350         g_param_spec_boolean("enable-encrypted-media",
1351             _("Enable EncryptedMedia"),
1352             _("Whether EncryptedMedia should be enabled."),
1353             FALSE,
1354             readWriteConstructParamFlags));
1355
1356     /**
1357      * WebKitSettings:enable-media-capabilities:
1358      *
1359      * Enable or disable support for MediaCapabilities on pages. This
1360      * specification intends to provide APIs to allow websites to make an optimal
1361      * decision when picking media content for the user. The APIs will expose
1362      * information about the decoding and encoding capabilities for a given format
1363      * but also output capabilities to find the best match based on the device‚Äôs
1364      * display.
1365      *
1366      * See also https://wicg.github.io/media-capabilities/
1367      *
1368      * Since: 2.22
1369      */
1370     g_object_class_install_property(gObjectClass,
1371         PROP_ENABLE_MEDIA_CAPABILITIES,
1372         g_param_spec_boolean("enable-media-capabilities",
1373             _("Enable MediaCapabilities"),
1374             _("Whether MediaCapabilities should be enabled."),
1375             FALSE,
1376             readWriteConstructParamFlags));
1377
1378     /**
1379      * WebKitSettings:allow-file-access-from-file-urls:
1380      *
1381      * Whether file access is allowed from file URLs. By default, when
1382      * something is loaded in a #WebKitWebView using a file URI, cross
1383      * origin requests to other file resources are not allowed. This
1384      * setting allows you to change that behaviour, so that it would be
1385      * possible to do a XMLHttpRequest of a local file, for example.
1386      *
1387      * Since: 2.10
1388      */
1389     g_object_class_install_property(gObjectClass,
1390         PROP_ALLOW_FILE_ACCESS_FROM_FILE_URLS,
1391         g_param_spec_boolean("allow-file-access-from-file-urls",
1392             _("Allow file access from file URLs"),
1393             _("Whether file access is allowed from file URLs."),
1394             FALSE,
1395             readWriteConstructParamFlags));
1396
1397     /**
1398      * WebKitSettings:allow-universal-access-from-file-urls:
1399      *
1400      * Whether or not JavaScript running in the context of a file scheme URL
1401      * should be allowed to access content from any origin.  By default, when
1402      * something is loaded in a #WebKitWebView using a file scheme URL,
1403      * access to the local file system and arbitrary local storage is not
1404      * allowed. This setting allows you to change that behaviour, so that
1405      * it would be possible to use local storage, for example.
1406      *
1407      * Since: 2.14
1408      */
1409     g_object_class_install_property(gObjectClass,
1410         PROP_ALLOW_UNIVERSAL_ACCESS_FROM_FILE_URLS,
1411         g_param_spec_boolean("allow-universal-access-from-file-urls",
1412             _("Allow universal access from the context of file scheme URLs"),
1413             _("Whether or not universal access is allowed from the context of file scheme URLs"),
1414             FALSE,
1415             readWriteConstructParamFlags));
1416
1417 #if PLATFORM(GTK)
1418     /**
1419      * WebKitSettings:hardware-acceleration-policy:
1420      *
1421      * The #WebKitHardwareAccelerationPolicy to decide how to enable and disable
1422      * hardware acceleration. The default value %WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND
1423      * enables the hardware acceleration when the web contents request it, disabling it again
1424      * when no longer needed. It's possible to enforce hardware acceleration to be always enabled
1425      * by using %WEBKIT_HARDWARE_ACCELERATION_POLICY_ALWAYS. And it's also possible to disable it
1426      * completely using %WEBKIT_HARDWARE_ACCELERATION_POLICY_NEVER. Note that disabling hardware
1427      * acceleration might cause some websites to not render correctly or consume more CPU.
1428      *
1429      * Note that changing this setting might not be possible if hardware acceleration is not
1430      * supported by the hardware or the system. In that case you can get the value to know the
1431      * actual policy being used, but changing the setting will not have any effect.
1432      *
1433      * Since: 2.16
1434      */
1435     g_object_class_install_property(gObjectClass,
1436         PROP_HARDWARE_ACCELERATION_POLICY,
1437         g_param_spec_enum("hardware-acceleration-policy",
1438             _("Hardware Acceleration Policy"),
1439             _("The policy to decide how to enable and disable hardware acceleration"),
1440             WEBKIT_TYPE_HARDWARE_ACCELERATION_POLICY,
1441             WEBKIT_HARDWARE_ACCELERATION_POLICY_ON_DEMAND,
1442             readWriteConstructParamFlags));
1443 #endif // PLATFOTM(GTK)
1444 }
1445
1446 WebPreferences* webkitSettingsGetPreferences(WebKitSettings* settings)
1447 {
1448     return settings->priv->preferences.get();
1449 }
1450
1451 /**
1452  * webkit_settings_new:
1453  *
1454  * Creates a new #WebKitSettings instance with default values. It must
1455  * be manually attached to a #WebKitWebView.
1456  * See also webkit_settings_new_with_settings().
1457  *
1458  * Returns: a new #WebKitSettings instance.
1459  */
1460 WebKitSettings* webkit_settings_new()
1461 {
1462     return WEBKIT_SETTINGS(g_object_new(WEBKIT_TYPE_SETTINGS, NULL));
1463 }
1464
1465 /**
1466  * webkit_settings_new_with_settings:
1467  * @first_setting_name: name of first setting to set
1468  * @...: value of first setting, followed by more settings,
1469  *    %NULL-terminated
1470  *
1471  * Creates a new #WebKitSettings instance with the given settings. It must
1472  * be manually attached to a #WebKitWebView.
1473  *
1474  * Returns: a new #WebKitSettings instance.
1475  */
1476 WebKitSettings* webkit_settings_new_with_settings(const gchar* firstSettingName, ...)
1477 {
1478     va_list args;
1479     va_start(args, firstSettingName);
1480     WebKitSettings* settings = WEBKIT_SETTINGS(g_object_new_valist(WEBKIT_TYPE_SETTINGS, firstSettingName, args));
1481     va_end(args);
1482     return settings;
1483 }
1484
1485 /**
1486  * webkit_settings_get_enable_javascript:
1487  * @settings: a #WebKitSettings
1488  *
1489  * Get the #WebKitSettings:enable-javascript property.
1490  *
1491  * Returns: %TRUE If JavaScript is enabled or %FALSE otherwise.
1492  */
1493 gboolean webkit_settings_get_enable_javascript(WebKitSettings* settings)
1494 {
1495     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1496
1497     return settings->priv->preferences->javaScriptEnabled();
1498 }
1499
1500 /**
1501  * webkit_settings_set_enable_javascript:
1502  * @settings: a #WebKitSettings
1503  * @enabled: Value to be set
1504  *
1505  * Set the #WebKitSettings:enable-javascript property.
1506  */
1507 void webkit_settings_set_enable_javascript(WebKitSettings* settings, gboolean enabled)
1508 {
1509     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1510
1511     WebKitSettingsPrivate* priv = settings->priv;
1512     bool currentValue = priv->preferences->javaScriptEnabled();
1513     if (currentValue == enabled)
1514         return;
1515
1516     priv->preferences->setJavaScriptEnabled(enabled);
1517     g_object_notify(G_OBJECT(settings), "enable-javascript");
1518 }
1519
1520 /**
1521  * webkit_settings_get_auto_load_images:
1522  * @settings: a #WebKitSettings
1523  *
1524  * Get the #WebKitSettings:auto-load-images property.
1525  *
1526  * Returns: %TRUE If auto loading of images is enabled or %FALSE otherwise.
1527  */
1528 gboolean webkit_settings_get_auto_load_images(WebKitSettings* settings)
1529 {
1530     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1531
1532     return settings->priv->preferences->loadsImagesAutomatically();
1533 }
1534
1535 /**
1536  * webkit_settings_set_auto_load_images:
1537  * @settings: a #WebKitSettings
1538  * @enabled: Value to be set
1539  *
1540  * Set the #WebKitSettings:auto-load-images property.
1541  */
1542 void webkit_settings_set_auto_load_images(WebKitSettings* settings, gboolean enabled)
1543 {
1544     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1545
1546     WebKitSettingsPrivate* priv = settings->priv;
1547     bool currentValue = priv->preferences->loadsImagesAutomatically();
1548     if (currentValue == enabled)
1549         return;
1550
1551     priv->preferences->setLoadsImagesAutomatically(enabled);
1552     g_object_notify(G_OBJECT(settings), "auto-load-images");
1553 }
1554
1555 /**
1556  * webkit_settings_get_load_icons_ignoring_image_load_setting:
1557  * @settings: a #WebKitSettings
1558  *
1559  * Get the #WebKitSettings:load-icons-ignoring-image-load-setting property.
1560  *
1561  * Returns: %TRUE If site icon can be loaded irrespective of image loading preference or %FALSE otherwise.
1562  */
1563 gboolean webkit_settings_get_load_icons_ignoring_image_load_setting(WebKitSettings* settings)
1564 {
1565     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1566
1567     return settings->priv->preferences->loadsSiteIconsIgnoringImageLoadingPreference();
1568 }
1569
1570 /**
1571  * webkit_settings_set_load_icons_ignoring_image_load_setting:
1572  * @settings: a #WebKitSettings
1573  * @enabled: Value to be set
1574  *
1575  * Set the #WebKitSettings:load-icons-ignoring-image-load-setting property.
1576  */
1577 void webkit_settings_set_load_icons_ignoring_image_load_setting(WebKitSettings* settings, gboolean enabled)
1578 {
1579     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1580
1581     WebKitSettingsPrivate* priv = settings->priv;
1582     bool currentValue = priv->preferences->loadsSiteIconsIgnoringImageLoadingPreference();
1583     if (currentValue == enabled)
1584         return;
1585
1586     priv->preferences->setLoadsSiteIconsIgnoringImageLoadingPreference(enabled);
1587     g_object_notify(G_OBJECT(settings), "load-icons-ignoring-image-load-setting");
1588 }
1589
1590 /**
1591  * webkit_settings_get_enable_offline_web_application_cache:
1592  * @settings: a #WebKitSettings
1593  *
1594  * Get the #WebKitSettings:enable-offline-web-application-cache property.
1595  *
1596  * Returns: %TRUE If HTML5 offline web application cache support is enabled or %FALSE otherwise.
1597  */
1598 gboolean webkit_settings_get_enable_offline_web_application_cache(WebKitSettings* settings)
1599 {
1600     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1601
1602     return settings->priv->preferences->offlineWebApplicationCacheEnabled();
1603 }
1604
1605 /**
1606  * webkit_settings_set_enable_offline_web_application_cache:
1607  * @settings: a #WebKitSettings
1608  * @enabled: Value to be set
1609  *
1610  * Set the #WebKitSettings:enable-offline-web-application-cache property.
1611  */
1612 void webkit_settings_set_enable_offline_web_application_cache(WebKitSettings* settings, gboolean enabled)
1613 {
1614     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1615
1616     WebKitSettingsPrivate* priv = settings->priv;
1617     bool currentValue = priv->preferences->offlineWebApplicationCacheEnabled();
1618     if (currentValue == enabled)
1619         return;
1620
1621     priv->preferences->setOfflineWebApplicationCacheEnabled(enabled);
1622     g_object_notify(G_OBJECT(settings), "enable-offline-web-application-cache");
1623 }
1624
1625 /**
1626  * webkit_settings_get_enable_html5_local_storage:
1627  * @settings: a #WebKitSettings
1628  *
1629  * Get the #WebKitSettings:enable-html5-local-storage property.
1630  *
1631  * Returns: %TRUE If HTML5 local storage support is enabled or %FALSE otherwise.
1632  */
1633 gboolean webkit_settings_get_enable_html5_local_storage(WebKitSettings* settings)
1634 {
1635     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1636
1637     return settings->priv->preferences->localStorageEnabled();
1638 }
1639
1640 /**
1641  * webkit_settings_set_enable_html5_local_storage:
1642  * @settings: a #WebKitSettings
1643  * @enabled: Value to be set
1644  *
1645  * Set the #WebKitSettings:enable-html5-local-storage property.
1646  */
1647 void webkit_settings_set_enable_html5_local_storage(WebKitSettings* settings, gboolean enabled)
1648 {
1649     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1650
1651     WebKitSettingsPrivate* priv = settings->priv;
1652     bool currentValue = priv->preferences->localStorageEnabled();
1653     if (currentValue == enabled)
1654         return;
1655
1656     priv->preferences->setLocalStorageEnabled(enabled);
1657     g_object_notify(G_OBJECT(settings), "enable-html5-local-storage");
1658 }
1659
1660 /**
1661  * webkit_settings_get_enable_html5_database:
1662  * @settings: a #WebKitSettings
1663  *
1664  * Get the #WebKitSettings:enable-html5-database property.
1665  *
1666  * Returns: %TRUE If HTML5 database support is enabled or %FALSE otherwise.
1667  */
1668 gboolean webkit_settings_get_enable_html5_database(WebKitSettings* settings)
1669 {
1670     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1671
1672     return settings->priv->preferences->databasesEnabled();
1673 }
1674
1675 /**
1676  * webkit_settings_set_enable_html5_database:
1677  * @settings: a #WebKitSettings
1678  * @enabled: Value to be set
1679  *
1680  * Set the #WebKitSettings:enable-html5-database property.
1681  */
1682 void webkit_settings_set_enable_html5_database(WebKitSettings* settings, gboolean enabled)
1683 {
1684     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1685
1686     WebKitSettingsPrivate* priv = settings->priv;
1687     bool currentValue = priv->preferences->databasesEnabled();
1688     if (currentValue == enabled)
1689         return;
1690
1691     priv->preferences->setDatabasesEnabled(enabled);
1692     g_object_notify(G_OBJECT(settings), "enable-html5-database");
1693 }
1694
1695 /**
1696  * webkit_settings_get_enable_xss_auditor:
1697  * @settings: a #WebKitSettings
1698  *
1699  * Get the #WebKitSettings:enable-xss-auditor property.
1700  *
1701  * Returns: %TRUE If XSS auditing is enabled or %FALSE otherwise.
1702  */
1703 gboolean webkit_settings_get_enable_xss_auditor(WebKitSettings* settings)
1704 {
1705     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1706
1707     return settings->priv->preferences->xssAuditorEnabled();
1708 }
1709
1710 /**
1711  * webkit_settings_set_enable_xss_auditor:
1712  * @settings: a #WebKitSettings
1713  * @enabled: Value to be set
1714  *
1715  * Set the #WebKitSettings:enable-xss-auditor property.
1716  */
1717 void webkit_settings_set_enable_xss_auditor(WebKitSettings* settings, gboolean enabled)
1718 {
1719     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1720
1721     WebKitSettingsPrivate* priv = settings->priv;
1722     bool currentValue = priv->preferences->xssAuditorEnabled();
1723     if (currentValue == enabled)
1724         return;
1725
1726     priv->preferences->setXSSAuditorEnabled(enabled);
1727     g_object_notify(G_OBJECT(settings), "enable-xss-auditor");
1728 }
1729
1730 /**
1731  * webkit_settings_get_enable_frame_flattening:
1732  * @settings: a #WebKitSettings
1733  *
1734  * Get the #WebKitSettings:enable-frame-flattening property.
1735  *
1736  * Returns: %TRUE If frame flattening is enabled or %FALSE otherwise.
1737  *
1738  **/
1739 gboolean webkit_settings_get_enable_frame_flattening(WebKitSettings* settings)
1740 {
1741     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1742
1743     return settings->priv->preferences->frameFlatteningEnabled();
1744 }
1745
1746 /**
1747  * webkit_settings_set_enable_frame_flattening:
1748  * @settings: a #WebKitSettings
1749  * @enabled: Value to be set
1750  *
1751  * Set the #WebKitSettings:enable-frame-flattening property.
1752  */
1753 void webkit_settings_set_enable_frame_flattening(WebKitSettings* settings, gboolean enabled)
1754 {
1755     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1756
1757     WebKitSettingsPrivate* priv = settings->priv;
1758     if (priv->preferences->frameFlatteningEnabled() == enabled)
1759         return;
1760
1761     priv->preferences->setFrameFlatteningEnabled(enabled);
1762     g_object_notify(G_OBJECT(settings), "enable-frame-flattening");
1763 }
1764
1765 /**
1766  * webkit_settings_get_enable_plugins:
1767  * @settings: a #WebKitSettings
1768  *
1769  * Get the #WebKitSettings:enable-plugins property.
1770  *
1771  * Returns: %TRUE If plugins are enabled or %FALSE otherwise.
1772  */
1773 gboolean webkit_settings_get_enable_plugins(WebKitSettings* settings)
1774 {
1775     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1776
1777     return settings->priv->preferences->pluginsEnabled();
1778 }
1779
1780 /**
1781  * webkit_settings_set_enable_plugins:
1782  * @settings: a #WebKitSettings
1783  * @enabled: Value to be set
1784  *
1785  * Set the #WebKitSettings:enable-plugins property.
1786  */
1787 void webkit_settings_set_enable_plugins(WebKitSettings* settings, gboolean enabled)
1788 {
1789     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1790
1791     WebKitSettingsPrivate* priv = settings->priv;
1792     bool currentValue = priv->preferences->pluginsEnabled();
1793     if (currentValue == enabled)
1794         return;
1795
1796     priv->preferences->setPluginsEnabled(enabled);
1797     g_object_notify(G_OBJECT(settings), "enable-plugins");
1798 }
1799
1800 /**
1801  * webkit_settings_get_enable_java:
1802  * @settings: a #WebKitSettings
1803  *
1804  * Get the #WebKitSettings:enable-java property.
1805  *
1806  * Returns: %TRUE If Java is enabled or %FALSE otherwise.
1807  */
1808 gboolean webkit_settings_get_enable_java(WebKitSettings* settings)
1809 {
1810     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1811
1812     return settings->priv->preferences->javaEnabled();
1813 }
1814
1815 /**
1816  * webkit_settings_set_enable_java:
1817  * @settings: a #WebKitSettings
1818  * @enabled: Value to be set
1819  *
1820  * Set the #WebKitSettings:enable-java property.
1821  */
1822 void webkit_settings_set_enable_java(WebKitSettings* settings, gboolean enabled)
1823 {
1824     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1825
1826     WebKitSettingsPrivate* priv = settings->priv;
1827     bool currentValue = priv->preferences->javaEnabled();
1828     if (currentValue == enabled)
1829         return;
1830
1831     priv->preferences->setJavaEnabled(enabled);
1832     g_object_notify(G_OBJECT(settings), "enable-java");
1833 }
1834
1835 /**
1836  * webkit_settings_get_javascript_can_open_windows_automatically:
1837  * @settings: a #WebKitSettings
1838  *
1839  * Get the #WebKitSettings:javascript-can-open-windows-automatically property.
1840  *
1841  * Returns: %TRUE If JavaScript can open window automatically or %FALSE otherwise.
1842  */
1843 gboolean webkit_settings_get_javascript_can_open_windows_automatically(WebKitSettings* settings)
1844 {
1845     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1846
1847     return settings->priv->preferences->javaScriptCanOpenWindowsAutomatically();
1848 }
1849
1850 /**
1851  * webkit_settings_set_javascript_can_open_windows_automatically:
1852  * @settings: a #WebKitSettings
1853  * @enabled: Value to be set
1854  *
1855  * Set the #WebKitSettings:javascript-can-open-windows-automatically property.
1856  */
1857 void webkit_settings_set_javascript_can_open_windows_automatically(WebKitSettings* settings, gboolean enabled)
1858 {
1859     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1860
1861     WebKitSettingsPrivate* priv = settings->priv;
1862     bool currentValue = priv->preferences->javaScriptCanOpenWindowsAutomatically();
1863     if (currentValue == enabled)
1864         return;
1865
1866     priv->preferences->setJavaScriptCanOpenWindowsAutomatically(enabled);
1867     g_object_notify(G_OBJECT(settings), "javascript-can-open-windows-automatically");
1868 }
1869
1870 /**
1871  * webkit_settings_get_enable_hyperlink_auditing:
1872  * @settings: a #WebKitSettings
1873  *
1874  * Get the #WebKitSettings:enable-hyperlink-auditing property.
1875  *
1876  * Returns: %TRUE If hyper link auditing is enabled or %FALSE otherwise.
1877  */
1878 gboolean webkit_settings_get_enable_hyperlink_auditing(WebKitSettings* settings)
1879 {
1880     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
1881
1882     return settings->priv->preferences->hyperlinkAuditingEnabled();
1883 }
1884
1885 /**
1886  * webkit_settings_set_enable_hyperlink_auditing:
1887  * @settings: a #WebKitSettings
1888  * @enabled: Value to be set
1889  *
1890  * Set the #WebKitSettings:enable-hyperlink-auditing property.
1891  */
1892 void webkit_settings_set_enable_hyperlink_auditing(WebKitSettings* settings, gboolean enabled)
1893 {
1894     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1895
1896     WebKitSettingsPrivate* priv = settings->priv;
1897     bool currentValue = priv->preferences->hyperlinkAuditingEnabled();
1898     if (currentValue == enabled)
1899         return;
1900
1901     priv->preferences->setHyperlinkAuditingEnabled(enabled);
1902     g_object_notify(G_OBJECT(settings), "enable-hyperlink-auditing");
1903 }
1904
1905 /**
1906  * webkit_web_settings_get_default_font_family:
1907  * @settings: a #WebKitSettings
1908  *
1909  * Gets the #WebKitSettings:default-font-family property.
1910  *
1911  * Returns: The default font family used to display content that does not specify a font.
1912  */
1913 const gchar* webkit_settings_get_default_font_family(WebKitSettings* settings)
1914 {
1915     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1916
1917     return settings->priv->defaultFontFamily.data();
1918 }
1919
1920 /**
1921  * webkit_settings_set_default_font_family:
1922  * @settings: a #WebKitSettings
1923  * @default_font_family: the new default font family
1924  *
1925  * Set the #WebKitSettings:default-font-family property.
1926  */
1927 void webkit_settings_set_default_font_family(WebKitSettings* settings, const gchar* defaultFontFamily)
1928 {
1929     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1930     g_return_if_fail(defaultFontFamily);
1931
1932     WebKitSettingsPrivate* priv = settings->priv;
1933     if (!g_strcmp0(priv->defaultFontFamily.data(), defaultFontFamily))
1934         return;
1935
1936     String standardFontFamily = String::fromUTF8(defaultFontFamily);
1937     priv->preferences->setStandardFontFamily(standardFontFamily);
1938     priv->defaultFontFamily = standardFontFamily.utf8();
1939     g_object_notify(G_OBJECT(settings), "default-font-family");
1940 }
1941
1942 /**
1943  * webkit_settings_get_monospace_font_family:
1944  * @settings: a #WebKitSettings
1945  *
1946  * Gets the #WebKitSettings:monospace-font-family property.
1947  *
1948  * Returns: Default font family used to display content marked with monospace font.
1949  */
1950 const gchar* webkit_settings_get_monospace_font_family(WebKitSettings* settings)
1951 {
1952     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1953
1954     return settings->priv->monospaceFontFamily.data();
1955 }
1956
1957 /**
1958  * webkit_settings_set_monospace_font_family:
1959  * @settings: a #WebKitSettings
1960  * @monospace_font_family: the new default monospace font family
1961  *
1962  * Set the #WebKitSettings:monospace-font-family property.
1963  */
1964 void webkit_settings_set_monospace_font_family(WebKitSettings* settings, const gchar* monospaceFontFamily)
1965 {
1966     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
1967     g_return_if_fail(monospaceFontFamily);
1968
1969     WebKitSettingsPrivate* priv = settings->priv;
1970     if (!g_strcmp0(priv->monospaceFontFamily.data(), monospaceFontFamily))
1971         return;
1972
1973     String fixedFontFamily = String::fromUTF8(monospaceFontFamily);
1974     priv->preferences->setFixedFontFamily(fixedFontFamily);
1975     priv->monospaceFontFamily = fixedFontFamily.utf8();
1976     g_object_notify(G_OBJECT(settings), "monospace-font-family");
1977 }
1978
1979 /**
1980  * webkit_settings_get_serif_font_family:
1981  * @settings: a #WebKitSettings
1982  *
1983  * Gets the #WebKitSettings:serif-font-family property.
1984  *
1985  * Returns: The default font family used to display content marked with serif font.
1986  */
1987 const gchar* webkit_settings_get_serif_font_family(WebKitSettings* settings)
1988 {
1989     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
1990
1991     return settings->priv->serifFontFamily.data();
1992 }
1993
1994 /**
1995  * webkit_settings_set_serif_font_family:
1996  * @settings: a #WebKitSettings
1997  * @serif_font_family: the new default serif font family
1998  *
1999  * Set the #WebKitSettings:serif-font-family property.
2000  */
2001 void webkit_settings_set_serif_font_family(WebKitSettings* settings, const gchar* serifFontFamily)
2002 {
2003     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2004     g_return_if_fail(serifFontFamily);
2005
2006     WebKitSettingsPrivate* priv = settings->priv;
2007     if (!g_strcmp0(priv->serifFontFamily.data(), serifFontFamily))
2008         return;
2009
2010     String serifFontFamilyString = String::fromUTF8(serifFontFamily);
2011     priv->preferences->setSerifFontFamily(serifFontFamilyString);
2012     priv->serifFontFamily = serifFontFamilyString.utf8();
2013     g_object_notify(G_OBJECT(settings), "serif-font-family");
2014 }
2015
2016 /**
2017  * webkit_settings_get_sans_serif_font_family:
2018  * @settings: a #WebKitSettings
2019  *
2020  * Gets the #WebKitSettings:sans-serif-font-family property.
2021  *
2022  * Returns: The default font family used to display content marked with sans-serif font.
2023  */
2024 const gchar* webkit_settings_get_sans_serif_font_family(WebKitSettings* settings)
2025 {
2026     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
2027
2028     return settings->priv->sansSerifFontFamily.data();
2029 }
2030
2031 /**
2032  * webkit_settings_set_sans_serif_font_family:
2033  * @settings: a #WebKitSettings
2034  * @sans_serif_font_family: the new default sans-serif font family
2035  *
2036  * Set the #WebKitSettings:sans-serif-font-family property.
2037  */
2038 void webkit_settings_set_sans_serif_font_family(WebKitSettings* settings, const gchar* sansSerifFontFamily)
2039 {
2040     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2041     g_return_if_fail(sansSerifFontFamily);
2042
2043     WebKitSettingsPrivate* priv = settings->priv;
2044     if (!g_strcmp0(priv->sansSerifFontFamily.data(), sansSerifFontFamily))
2045         return;
2046
2047     String sansSerifFontFamilyString = String::fromUTF8(sansSerifFontFamily);
2048     priv->preferences->setSansSerifFontFamily(sansSerifFontFamilyString);
2049     priv->sansSerifFontFamily = sansSerifFontFamilyString.utf8();
2050     g_object_notify(G_OBJECT(settings), "sans-serif-font-family");
2051 }
2052
2053 /**
2054  * webkit_settings_get_cursive_font_family:
2055  * @settings: a #WebKitSettings
2056  *
2057  * Gets the #WebKitSettings:cursive-font-family property.
2058  *
2059  * Returns: The default font family used to display content marked with cursive font.
2060  */
2061 const gchar* webkit_settings_get_cursive_font_family(WebKitSettings* settings)
2062 {
2063     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
2064
2065     return settings->priv->cursiveFontFamily.data();
2066 }
2067
2068 /**
2069  * webkit_settings_set_cursive_font_family:
2070  * @settings: a #WebKitSettings
2071  * @cursive_font_family: the new default cursive font family
2072  *
2073  * Set the #WebKitSettings:cursive-font-family property.
2074  */
2075 void webkit_settings_set_cursive_font_family(WebKitSettings* settings, const gchar* cursiveFontFamily)
2076 {
2077     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2078     g_return_if_fail(cursiveFontFamily);
2079
2080     WebKitSettingsPrivate* priv = settings->priv;
2081     if (!g_strcmp0(priv->cursiveFontFamily.data(), cursiveFontFamily))
2082         return;
2083
2084     String cursiveFontFamilyString = String::fromUTF8(cursiveFontFamily);
2085     priv->preferences->setCursiveFontFamily(cursiveFontFamilyString);
2086     priv->cursiveFontFamily = cursiveFontFamilyString.utf8();
2087     g_object_notify(G_OBJECT(settings), "cursive-font-family");
2088 }
2089
2090 /**
2091  * webkit_settings_get_fantasy_font_family:
2092  * @settings: a #WebKitSettings
2093  *
2094  * Gets the #WebKitSettings:fantasy-font-family property.
2095  *
2096  * Returns: The default font family used to display content marked with fantasy font.
2097  */
2098 const gchar* webkit_settings_get_fantasy_font_family(WebKitSettings* settings)
2099 {
2100     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
2101
2102     return settings->priv->fantasyFontFamily.data();
2103 }
2104
2105 /**
2106  * webkit_settings_set_fantasy_font_family:
2107  * @settings: a #WebKitSettings
2108  * @fantasy_font_family: the new default fantasy font family
2109  *
2110  * Set the #WebKitSettings:fantasy-font-family property.
2111  */
2112 void webkit_settings_set_fantasy_font_family(WebKitSettings* settings, const gchar* fantasyFontFamily)
2113 {
2114     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2115     g_return_if_fail(fantasyFontFamily);
2116
2117     WebKitSettingsPrivate* priv = settings->priv;
2118     if (!g_strcmp0(priv->fantasyFontFamily.data(), fantasyFontFamily))
2119         return;
2120
2121     String fantasyFontFamilyString = String::fromUTF8(fantasyFontFamily);
2122     priv->preferences->setFantasyFontFamily(fantasyFontFamilyString);
2123     priv->fantasyFontFamily = fantasyFontFamilyString.utf8();
2124     g_object_notify(G_OBJECT(settings), "fantasy-font-family");
2125 }
2126
2127 /**
2128  * webkit_settings_get_pictograph_font_family:
2129  * @settings: a #WebKitSettings
2130  *
2131  * Gets the #WebKitSettings:pictograph-font-family property.
2132  *
2133  * Returns: The default font family used to display content marked with pictograph font.
2134  */
2135 const gchar* webkit_settings_get_pictograph_font_family(WebKitSettings* settings)
2136 {
2137     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
2138
2139     return settings->priv->pictographFontFamily.data();
2140 }
2141
2142 /**
2143  * webkit_settings_set_pictograph_font_family:
2144  * @settings: a #WebKitSettings
2145  * @pictograph_font_family: the new default pictograph font family
2146  *
2147  * Set the #WebKitSettings:pictograph-font-family property.
2148  */
2149 void webkit_settings_set_pictograph_font_family(WebKitSettings* settings, const gchar* pictographFontFamily)
2150 {
2151     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2152     g_return_if_fail(pictographFontFamily);
2153
2154     WebKitSettingsPrivate* priv = settings->priv;
2155     if (!g_strcmp0(priv->pictographFontFamily.data(), pictographFontFamily))
2156         return;
2157
2158     String pictographFontFamilyString = String::fromUTF8(pictographFontFamily);
2159     priv->preferences->setPictographFontFamily(pictographFontFamilyString);
2160     priv->pictographFontFamily = pictographFontFamilyString.utf8();
2161     g_object_notify(G_OBJECT(settings), "pictograph-font-family");
2162 }
2163
2164 /**
2165  * webkit_settings_get_default_font_size:
2166  * @settings: a #WebKitSettings
2167  *
2168  * Gets the #WebKitSettings:default-font-size property.
2169  *
2170  * Returns: The default font size, in pixels.
2171  */
2172 guint32 webkit_settings_get_default_font_size(WebKitSettings* settings)
2173 {
2174     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
2175
2176     return settings->priv->preferences->defaultFontSize();
2177 }
2178
2179 /**
2180  * webkit_settings_set_default_font_size:
2181  * @settings: a #WebKitSettings
2182  * @font_size: default font size to be set in pixels
2183  *
2184  * Set the #WebKitSettings:default-font-size property.
2185  */
2186 void webkit_settings_set_default_font_size(WebKitSettings* settings, guint32 fontSize)
2187 {
2188     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2189
2190     WebKitSettingsPrivate* priv = settings->priv;
2191     uint32_t currentSize = priv->preferences->defaultFontSize();
2192     if (currentSize == fontSize)
2193         return;
2194
2195     priv->preferences->setDefaultFontSize(fontSize);
2196     g_object_notify(G_OBJECT(settings), "default-font-size");
2197 }
2198
2199 /**
2200  * webkit_settings_get_default_monospace_font_size:
2201  * @settings: a #WebKitSettings
2202  *
2203  * Gets the #WebKitSettings:default-monospace-font-size property.
2204  *
2205  * Returns: Default monospace font size, in pixels.
2206  */
2207 guint32 webkit_settings_get_default_monospace_font_size(WebKitSettings* settings)
2208 {
2209     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
2210
2211     return settings->priv->preferences->defaultFixedFontSize();
2212 }
2213
2214 /**
2215  * webkit_settings_set_default_monospace_font_size:
2216  * @settings: a #WebKitSettings
2217  * @font_size: default monospace font size to be set in pixels
2218  *
2219  * Set the #WebKitSettings:default-monospace-font-size property.
2220  */
2221 void webkit_settings_set_default_monospace_font_size(WebKitSettings* settings, guint32 fontSize)
2222 {
2223     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2224
2225     WebKitSettingsPrivate* priv = settings->priv;
2226     uint32_t currentSize = priv->preferences->defaultFixedFontSize();
2227     if (currentSize == fontSize)
2228         return;
2229
2230     priv->preferences->setDefaultFixedFontSize(fontSize);
2231     g_object_notify(G_OBJECT(settings), "default-monospace-font-size");
2232 }
2233
2234 /**
2235  * webkit_settings_get_minimum_font_size:
2236  * @settings: a #WebKitSettings
2237  *
2238  * Gets the #WebKitSettings:minimum-font-size property.
2239  *
2240  * Returns: Minimum font size, in pixels.
2241  */
2242 guint32 webkit_settings_get_minimum_font_size(WebKitSettings* settings)
2243 {
2244     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
2245
2246     return settings->priv->preferences->minimumFontSize();
2247 }
2248
2249 /**
2250  * webkit_settings_set_minimum_font_size:
2251  * @settings: a #WebKitSettings
2252  * @font_size: minimum font size to be set in pixels
2253  *
2254  * Set the #WebKitSettings:minimum-font-size property.
2255  */
2256 void webkit_settings_set_minimum_font_size(WebKitSettings* settings, guint32 fontSize)
2257 {
2258     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2259
2260     WebKitSettingsPrivate* priv = settings->priv;
2261     uint32_t currentSize = priv->preferences->minimumFontSize();
2262     if (currentSize == fontSize)
2263         return;
2264
2265     priv->preferences->setMinimumFontSize(fontSize);
2266     g_object_notify(G_OBJECT(settings), "minimum-font-size");
2267 }
2268
2269 /**
2270  * webkit_settings_get_default_charset:
2271  * @settings: a #WebKitSettings
2272  *
2273  * Gets the #WebKitSettings:default-charset property.
2274  *
2275  * Returns: Default charset.
2276  */
2277 const gchar* webkit_settings_get_default_charset(WebKitSettings* settings)
2278 {
2279     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
2280
2281     return settings->priv->defaultCharset.data();
2282 }
2283
2284 /**
2285  * webkit_settings_set_default_charset:
2286  * @settings: a #WebKitSettings
2287  * @default_charset: default charset to be set
2288  *
2289  * Set the #WebKitSettings:default-charset property.
2290  */
2291 void webkit_settings_set_default_charset(WebKitSettings* settings, const gchar* defaultCharset)
2292 {
2293     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2294     g_return_if_fail(defaultCharset);
2295
2296     WebKitSettingsPrivate* priv = settings->priv;
2297     if (!g_strcmp0(priv->defaultCharset.data(), defaultCharset))
2298         return;
2299
2300     String defaultCharsetString = String::fromUTF8(defaultCharset);
2301     priv->preferences->setDefaultTextEncodingName(defaultCharsetString);
2302     priv->defaultCharset = defaultCharsetString.utf8();
2303     g_object_notify(G_OBJECT(settings), "default-charset");
2304 }
2305
2306 #if PLATFORM(GTK)
2307 /**
2308  * webkit_settings_get_enable_private_browsing:
2309  * @settings: a #WebKitSettings
2310  *
2311  * Get the #WebKitSettings:enable-private-browsing property.
2312  *
2313  * Returns: %TRUE If private browsing is enabled or %FALSE otherwise.
2314  *
2315  * Deprecated: 2.16. Use #WebKitWebView:is-ephemeral or #WebKitWebContext:is-ephemeral instead.
2316  */
2317 gboolean webkit_settings_get_enable_private_browsing(WebKitSettings* settings)
2318 {
2319     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2320
2321     return settings->priv->preferences->privateBrowsingEnabled();
2322 }
2323
2324 /**
2325  * webkit_settings_set_enable_private_browsing:
2326  * @settings: a #WebKitSettings
2327  * @enabled: Value to be set
2328  *
2329  * Set the #WebKitSettings:enable-private-browsing property.
2330  *
2331  * Deprecated: 2.16. Use #WebKitWebView:is-ephemeral or #WebKitWebContext:is-ephemeral instead.
2332  */
2333 void webkit_settings_set_enable_private_browsing(WebKitSettings* settings, gboolean enabled)
2334 {
2335     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2336
2337     WebKitSettingsPrivate* priv = settings->priv;
2338     bool currentValue = priv->preferences->privateBrowsingEnabled();
2339     if (currentValue == enabled)
2340         return;
2341
2342     priv->preferences->setPrivateBrowsingEnabled(enabled);
2343     g_object_notify(G_OBJECT(settings), "enable-private-browsing");
2344 }
2345 #endif
2346
2347 /**
2348  * webkit_settings_get_enable_developer_extras:
2349  * @settings: a #WebKitSettings
2350  *
2351  * Get the #WebKitSettings:enable-developer-extras property.
2352  *
2353  * Returns: %TRUE If developer extras is enabled or %FALSE otherwise.
2354  */
2355 gboolean webkit_settings_get_enable_developer_extras(WebKitSettings* settings)
2356 {
2357     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2358
2359     return settings->priv->preferences->developerExtrasEnabled();
2360 }
2361
2362 /**
2363  * webkit_settings_set_enable_developer_extras:
2364  * @settings: a #WebKitSettings
2365  * @enabled: Value to be set
2366  *
2367  * Set the #WebKitSettings:enable-developer-extras property.
2368  */
2369 void webkit_settings_set_enable_developer_extras(WebKitSettings* settings, gboolean enabled)
2370 {
2371     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2372
2373     WebKitSettingsPrivate* priv = settings->priv;
2374     bool currentValue = priv->preferences->developerExtrasEnabled();
2375     if (currentValue == enabled)
2376         return;
2377
2378     priv->preferences->setDeveloperExtrasEnabled(enabled);
2379     g_object_notify(G_OBJECT(settings), "enable-developer-extras");
2380 }
2381
2382 /**
2383  * webkit_settings_get_enable_resizable_text_areas:
2384  * @settings: a #WebKitSettings
2385  *
2386  * Get the #WebKitSettings:enable-resizable-text-areas property.
2387  *
2388  * Returns: %TRUE If text areas can be resized or %FALSE otherwise.
2389  */
2390 gboolean webkit_settings_get_enable_resizable_text_areas(WebKitSettings* settings)
2391 {
2392     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2393
2394     return settings->priv->preferences->textAreasAreResizable();
2395 }
2396
2397 /**
2398  * webkit_settings_set_enable_resizable_text_areas:
2399  * @settings: a #WebKitSettings
2400  * @enabled: Value to be set
2401  *
2402  * Set the #WebKitSettings:enable-resizable-text-areas property.
2403  */
2404 void webkit_settings_set_enable_resizable_text_areas(WebKitSettings* settings, gboolean enabled)
2405 {
2406     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2407
2408     WebKitSettingsPrivate* priv = settings->priv;
2409     bool currentValue = priv->preferences->textAreasAreResizable();
2410     if (currentValue == enabled)
2411         return;
2412
2413     priv->preferences->setTextAreasAreResizable(enabled);
2414     g_object_notify(G_OBJECT(settings), "enable-resizable-text-areas");
2415 }
2416
2417 /**
2418  * webkit_settings_get_enable_tabs_to_links:
2419  * @settings: a #WebKitSettings
2420  *
2421  * Get the #WebKitSettings:enable-tabs-to-links property.
2422  *
2423  * Returns: %TRUE If tabs to link is enabled or %FALSE otherwise.
2424  */
2425 gboolean webkit_settings_get_enable_tabs_to_links(WebKitSettings* settings)
2426 {
2427     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2428
2429     return settings->priv->preferences->tabsToLinks();
2430 }
2431
2432 /**
2433  * webkit_settings_set_enable_tabs_to_links:
2434  * @settings: a #WebKitSettings
2435  * @enabled: Value to be set
2436  *
2437  * Set the #WebKitSettings:enable-tabs-to-links property.
2438  */
2439 void webkit_settings_set_enable_tabs_to_links(WebKitSettings* settings, gboolean enabled)
2440 {
2441     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2442
2443     WebKitSettingsPrivate* priv = settings->priv;
2444     bool currentValue = priv->preferences->tabsToLinks();
2445     if (currentValue == enabled)
2446         return;
2447
2448     priv->preferences->setTabsToLinks(enabled);
2449     g_object_notify(G_OBJECT(settings), "enable-tabs-to-links");
2450 }
2451
2452 /**
2453  * webkit_settings_get_enable_dns_prefetching:
2454  * @settings: a #WebKitSettings
2455  *
2456  * Get the #WebKitSettings:enable-dns-prefetching property.
2457  *
2458  * Returns: %TRUE If DNS prefetching is enabled or %FALSE otherwise.
2459  */
2460 gboolean webkit_settings_get_enable_dns_prefetching(WebKitSettings* settings)
2461 {
2462     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2463
2464     return settings->priv->preferences->dnsPrefetchingEnabled();
2465 }
2466
2467 /**
2468  * webkit_settings_set_enable_dns_prefetching:
2469  * @settings: a #WebKitSettings
2470  * @enabled: Value to be set
2471  *
2472  * Set the #WebKitSettings:enable-dns-prefetching property.
2473  */
2474 void webkit_settings_set_enable_dns_prefetching(WebKitSettings* settings, gboolean enabled)
2475 {
2476     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2477
2478     WebKitSettingsPrivate* priv = settings->priv;
2479     bool currentValue = priv->preferences->dnsPrefetchingEnabled();
2480     if (currentValue == enabled)
2481         return;
2482
2483     priv->preferences->setDNSPrefetchingEnabled(enabled);
2484     g_object_notify(G_OBJECT(settings), "enable-dns-prefetching");
2485 }
2486
2487 /**
2488  * webkit_settings_get_enable_caret_browsing:
2489  * @settings: a #WebKitSettings
2490  *
2491  * Get the #WebKitSettings:enable-caret-browsing property.
2492  *
2493  * Returns: %TRUE If caret browsing is enabled or %FALSE otherwise.
2494  */
2495 gboolean webkit_settings_get_enable_caret_browsing(WebKitSettings* settings)
2496 {
2497     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2498
2499     return settings->priv->preferences->caretBrowsingEnabled();
2500 }
2501
2502 /**
2503  * webkit_settings_set_enable_caret_browsing:
2504  * @settings: a #WebKitSettings
2505  * @enabled: Value to be set
2506  *
2507  * Set the #WebKitSettings:enable-caret-browsing property.
2508  */
2509 void webkit_settings_set_enable_caret_browsing(WebKitSettings* settings, gboolean enabled)
2510 {
2511     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2512
2513     WebKitSettingsPrivate* priv = settings->priv;
2514     bool currentValue = priv->preferences->caretBrowsingEnabled();
2515     if (currentValue == enabled)
2516         return;
2517
2518     priv->preferences->setCaretBrowsingEnabled(enabled);
2519     g_object_notify(G_OBJECT(settings), "enable-caret-browsing");
2520 }
2521
2522 /**
2523  * webkit_settings_get_enable_fullscreen:
2524  * @settings: a #WebKitSettings
2525  *
2526  * Get the #WebKitSettings:enable-fullscreen property.
2527  *
2528  * Returns: %TRUE If fullscreen support is enabled or %FALSE otherwise.
2529  */
2530 gboolean webkit_settings_get_enable_fullscreen(WebKitSettings* settings)
2531 {
2532     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2533
2534     return settings->priv->preferences->fullScreenEnabled();
2535 }
2536
2537 /**
2538  * webkit_settings_set_enable_fullscreen:
2539  * @settings: a #WebKitSettings
2540  * @enabled: Value to be set
2541  *
2542  * Set the #WebKitSettings:enable-fullscreen property.
2543  */
2544 void webkit_settings_set_enable_fullscreen(WebKitSettings* settings, gboolean enabled)
2545 {
2546     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2547
2548     WebKitSettingsPrivate* priv = settings->priv;
2549     bool currentValue = priv->preferences->fullScreenEnabled();
2550     if (currentValue == enabled)
2551         return;
2552
2553     priv->preferences->setFullScreenEnabled(enabled);
2554     g_object_notify(G_OBJECT(settings), "enable-fullscreen");
2555 }
2556
2557 /**
2558  * webkit_settings_get_print_backgrounds:
2559  * @settings: a #WebKitSettings
2560  *
2561  * Get the #WebKitSettings:print-backgrounds property.
2562  *
2563  * Returns: %TRUE If background images should be printed or %FALSE otherwise.
2564  */
2565 gboolean webkit_settings_get_print_backgrounds(WebKitSettings* settings)
2566 {
2567     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2568
2569     return settings->priv->preferences->shouldPrintBackgrounds();
2570 }
2571
2572 /**
2573  * webkit_settings_set_print_backgrounds:
2574  * @settings: a #WebKitSettings
2575  * @print_backgrounds: Value to be set
2576  *
2577  * Set the #WebKitSettings:print-backgrounds property.
2578  */
2579 void webkit_settings_set_print_backgrounds(WebKitSettings* settings, gboolean printBackgrounds)
2580 {
2581     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2582
2583     WebKitSettingsPrivate* priv = settings->priv;
2584     bool currentValue = priv->preferences->shouldPrintBackgrounds();
2585     if (currentValue == printBackgrounds)
2586         return;
2587
2588     priv->preferences->setShouldPrintBackgrounds(printBackgrounds);
2589     g_object_notify(G_OBJECT(settings), "print-backgrounds");
2590 }
2591
2592 /**
2593  * webkit_settings_get_enable_webaudio:
2594  * @settings: a #WebKitSettings
2595  *
2596  * Get the #WebKitSettings:enable-webaudio property.
2597  *
2598  * Returns: %TRUE If webaudio support is enabled or %FALSE otherwise.
2599  */
2600 gboolean webkit_settings_get_enable_webaudio(WebKitSettings* settings)
2601 {
2602     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2603
2604     return settings->priv->preferences->webAudioEnabled();
2605 }
2606
2607 /**
2608  * webkit_settings_set_enable_webaudio:
2609  * @settings: a #WebKitSettings
2610  * @enabled: Value to be set
2611  *
2612  * Set the #WebKitSettings:enable-webaudio property.
2613  */
2614 void webkit_settings_set_enable_webaudio(WebKitSettings* settings, gboolean enabled)
2615 {
2616     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2617
2618     WebKitSettingsPrivate* priv = settings->priv;
2619     bool currentValue = priv->preferences->webAudioEnabled();
2620     if (currentValue == enabled)
2621         return;
2622
2623     priv->preferences->setWebAudioEnabled(enabled);
2624     g_object_notify(G_OBJECT(settings), "enable-webaudio");
2625 }
2626
2627 /**
2628  * webkit_settings_get_enable_webgl:
2629  * @settings: a #WebKitSettings
2630  *
2631  * Get the #WebKitSettings:enable-webgl property.
2632  *
2633  * Returns: %TRUE If WebGL support is enabled or %FALSE otherwise.
2634  */
2635 gboolean webkit_settings_get_enable_webgl(WebKitSettings* settings)
2636 {
2637     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2638
2639     return settings->priv->preferences->webGLEnabled();
2640 }
2641
2642 /**
2643  * webkit_settings_set_enable_webgl:
2644  * @settings: a #WebKitSettings
2645  * @enabled: Value to be set
2646  *
2647  * Set the #WebKitSettings:enable-webgl property.
2648  */
2649 void webkit_settings_set_enable_webgl(WebKitSettings* settings, gboolean enabled)
2650 {
2651     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2652
2653     WebKitSettingsPrivate* priv = settings->priv;
2654     bool currentValue = priv->preferences->webGLEnabled();
2655     if (currentValue == enabled)
2656         return;
2657
2658     priv->preferences->setWebGLEnabled(enabled);
2659     g_object_notify(G_OBJECT(settings), "enable-webgl");
2660 }
2661
2662 /**
2663  * webkit_settings_get_allow_modal_dialogs:
2664  * @settings: a #WebKitSettings
2665  *
2666  * Get the #WebKitSettings:allow-modal-dialogs property.
2667  *
2668  * Returns: %TRUE if it's allowed to create and run modal dialogs or %FALSE otherwise.
2669  */
2670 gboolean webkit_settings_get_allow_modal_dialogs(WebKitSettings* settings)
2671 {
2672     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2673     return settings->priv->allowModalDialogs;
2674 }
2675
2676 /**
2677  * webkit_settings_set_allow_modal_dialogs:
2678  * @settings: a #WebKitSettings
2679  * @allowed: Value to be set
2680  *
2681  * Set the #WebKitSettings:allow-modal-dialogs property.
2682  */
2683 void webkit_settings_set_allow_modal_dialogs(WebKitSettings* settings, gboolean allowed)
2684 {
2685     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2686
2687     WebKitSettingsPrivate* priv = settings->priv;
2688     if (priv->allowModalDialogs == allowed)
2689         return;
2690
2691     priv->allowModalDialogs = allowed;
2692     g_object_notify(G_OBJECT(settings), "allow-modal-dialogs");
2693 }
2694
2695 /**
2696  * webkit_settings_get_zoom_text_only:
2697  * @settings: a #WebKitSettings
2698  *
2699  * Get the #WebKitSettings:zoom-text-only property.
2700  *
2701  * Returns: %TRUE If zoom level of the view should only affect the text
2702  *    or %FALSE if all view contents should be scaled.
2703  */
2704 gboolean webkit_settings_get_zoom_text_only(WebKitSettings* settings)
2705 {
2706     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2707
2708     return settings->priv->zoomTextOnly;
2709 }
2710
2711 /**
2712  * webkit_settings_set_zoom_text_only:
2713  * @settings: a #WebKitSettings
2714  * @zoom_text_only: Value to be set
2715  *
2716  * Set the #WebKitSettings:zoom-text-only property.
2717  */
2718 void webkit_settings_set_zoom_text_only(WebKitSettings* settings, gboolean zoomTextOnly)
2719 {
2720     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2721
2722     WebKitSettingsPrivate* priv = settings->priv;
2723     if (priv->zoomTextOnly == zoomTextOnly)
2724         return;
2725
2726     priv->zoomTextOnly = zoomTextOnly;
2727     g_object_notify(G_OBJECT(settings), "zoom-text-only");
2728 }
2729
2730 /**
2731  * webkit_settings_get_javascript_can_access_clipboard:
2732  * @settings: a #WebKitSettings
2733  *
2734  * Get the #WebKitSettings:javascript-can-access-clipboard property.
2735  *
2736  * Returns: %TRUE If javascript-can-access-clipboard is enabled or %FALSE otherwise.
2737  */
2738 gboolean webkit_settings_get_javascript_can_access_clipboard(WebKitSettings* settings)
2739 {
2740     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2741
2742     return settings->priv->preferences->javaScriptCanAccessClipboard()
2743         && settings->priv->preferences->domPasteAllowed();
2744 }
2745
2746 /**
2747  * webkit_settings_set_javascript_can_access_clipboard:
2748  * @settings: a #WebKitSettings
2749  * @enabled: Value to be set
2750  *
2751  * Set the #WebKitSettings:javascript-can-access-clipboard property.
2752  */
2753 void webkit_settings_set_javascript_can_access_clipboard(WebKitSettings* settings, gboolean enabled)
2754 {
2755     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2756
2757     WebKitSettingsPrivate* priv = settings->priv;
2758     bool currentValue = priv->preferences->javaScriptCanAccessClipboard() && priv->preferences->domPasteAllowed();
2759     if (currentValue == enabled)
2760         return;
2761
2762     priv->preferences->setJavaScriptCanAccessClipboard(enabled);
2763     priv->preferences->setDOMPasteAllowed(enabled);
2764     g_object_notify(G_OBJECT(settings), "javascript-can-access-clipboard");
2765 }
2766
2767 /**
2768  * webkit_settings_get_media_playback_requires_user_gesture:
2769  * @settings: a #WebKitSettings
2770  *
2771  * Get the #WebKitSettings:media-playback-requires-user-gesture property.
2772  *
2773  * Returns: %TRUE If an user gesture is needed to play or load media
2774  *    or %FALSE if no user gesture is needed.
2775  */
2776 gboolean webkit_settings_get_media_playback_requires_user_gesture(WebKitSettings* settings)
2777 {
2778     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2779
2780     return settings->priv->preferences->requiresUserGestureForMediaPlayback();
2781 }
2782
2783 /**
2784  * webkit_settings_set_media_playback_requires_user_gesture:
2785  * @settings: a #WebKitSettings
2786  * @enabled: Value to be set
2787  *
2788  * Set the #WebKitSettings:media-playback-requires-user-gesture property.
2789  */
2790 void webkit_settings_set_media_playback_requires_user_gesture(WebKitSettings* settings, gboolean enabled)
2791 {
2792     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2793
2794     WebKitSettingsPrivate* priv = settings->priv;
2795     bool currentValue = priv->preferences->requiresUserGestureForMediaPlayback();
2796     if (currentValue == enabled)
2797         return;
2798
2799     priv->preferences->setRequiresUserGestureForMediaPlayback(enabled);
2800     g_object_notify(G_OBJECT(settings), "media-playback-requires-user-gesture");
2801 }
2802
2803 /**
2804  * webkit_settings_get_media_playback_allows_inline:
2805  * @settings: a #WebKitSettings
2806  *
2807  * Get the #WebKitSettings:media-playback-allows-inline property.
2808  *
2809  * Returns: %TRUE If inline playback is allowed for media
2810  *    or %FALSE if only fullscreen playback is allowed.
2811  */
2812 gboolean webkit_settings_get_media_playback_allows_inline(WebKitSettings* settings)
2813 {
2814     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), TRUE);
2815
2816     return settings->priv->preferences->allowsInlineMediaPlayback();
2817 }
2818
2819 /**
2820  * webkit_settings_set_media_playback_allows_inline:
2821  * @settings: a #WebKitSettings
2822  * @enabled: Value to be set
2823  *
2824  * Set the #WebKitSettings:media-playback-allows-inline property.
2825  */
2826 void webkit_settings_set_media_playback_allows_inline(WebKitSettings* settings, gboolean enabled)
2827 {
2828     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2829
2830     WebKitSettingsPrivate* priv = settings->priv;
2831     bool currentValue = priv->preferences->allowsInlineMediaPlayback();
2832     if (currentValue == enabled)
2833         return;
2834
2835     priv->preferences->setAllowsInlineMediaPlayback(enabled);
2836     g_object_notify(G_OBJECT(settings), "media-playback-allows-inline");
2837 }
2838
2839 /**
2840  * webkit_settings_get_draw_compositing_indicators:
2841  * @settings: a #WebKitSettings
2842  *
2843  * Get the #WebKitSettings:draw-compositing-indicators property.
2844  *
2845  * Returns: %TRUE If compositing borders are drawn or %FALSE otherwise.
2846  */
2847 gboolean webkit_settings_get_draw_compositing_indicators(WebKitSettings* settings)
2848 {
2849     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2850     return settings->priv->preferences->compositingBordersVisible()
2851         && settings->priv->preferences->compositingRepaintCountersVisible();
2852 }
2853
2854 /**
2855  * webkit_settings_set_draw_compositing_indicators:
2856  * @settings: a #WebKitSettings
2857  * @enabled: Value to be set
2858  *
2859  * Set the #WebKitSettings:draw-compositing-indicators property.
2860  */
2861 void webkit_settings_set_draw_compositing_indicators(WebKitSettings* settings, gboolean enabled)
2862 {
2863     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2864
2865     WebKitSettingsPrivate* priv = settings->priv;
2866     if (priv->preferences->compositingBordersVisible() == enabled
2867         && priv->preferences->compositingRepaintCountersVisible() == enabled)
2868         return;
2869
2870     priv->preferences->setCompositingBordersVisible(enabled);
2871     priv->preferences->setCompositingRepaintCountersVisible(enabled);
2872     g_object_notify(G_OBJECT(settings), "draw-compositing-indicators");
2873 }
2874
2875 /**
2876  * webkit_settings_get_enable_site_specific_quirks:
2877  * @settings: a #WebKitSettings
2878  *
2879  * Get the #WebKitSettings:enable-site-specific-quirks property.
2880  *
2881  * Returns: %TRUE if site specific quirks are enabled or %FALSE otherwise.
2882  */
2883 gboolean webkit_settings_get_enable_site_specific_quirks(WebKitSettings* settings)
2884 {
2885     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2886
2887     return settings->priv->preferences->needsSiteSpecificQuirks();
2888 }
2889
2890 /**
2891  * webkit_settings_set_enable_site_specific_quirks:
2892  * @settings: a #WebKitSettings
2893  * @enabled: Value to be set
2894  *
2895  * Set the #WebKitSettings:enable-site-specific-quirks property.
2896  */
2897 void webkit_settings_set_enable_site_specific_quirks(WebKitSettings* settings, gboolean enabled)
2898 {
2899     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2900
2901     WebKitSettingsPrivate* priv = settings->priv;
2902     bool currentValue = priv->preferences->needsSiteSpecificQuirks();
2903     if (currentValue == enabled)
2904         return;
2905
2906     priv->preferences->setNeedsSiteSpecificQuirks(enabled);
2907     g_object_notify(G_OBJECT(settings), "enable-site-specific-quirks");
2908 }
2909
2910 /**
2911  * webkit_settings_get_enable_page_cache:
2912  * @settings: a #WebKitSettings
2913  *
2914  * Get the #WebKitSettings:enable-page-cache property.
2915  *
2916  * Returns: %TRUE if page cache enabled or %FALSE otherwise.
2917  */
2918 gboolean webkit_settings_get_enable_page_cache(WebKitSettings* settings)
2919 {
2920     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
2921
2922     return settings->priv->preferences->usesPageCache();
2923 }
2924
2925 /**
2926  * webkit_settings_set_enable_page_cache:
2927  * @settings: a #WebKitSettings
2928  * @enabled: Value to be set
2929  *
2930  * Set the #WebKitSettings:enable-page-cache property.
2931  */
2932 void webkit_settings_set_enable_page_cache(WebKitSettings* settings, gboolean enabled)
2933 {
2934     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2935
2936     WebKitSettingsPrivate* priv = settings->priv;
2937     bool currentValue = priv->preferences->usesPageCache();
2938     if (currentValue == enabled)
2939         return;
2940
2941     priv->preferences->setUsesPageCache(enabled);
2942     g_object_notify(G_OBJECT(settings), "enable-page-cache");
2943 }
2944
2945 /**
2946  * webkit_settings_get_user_agent:
2947  * @settings: a #WebKitSettings
2948  *
2949  * Get the #WebKitSettings:user-agent property.
2950  *
2951  * Returns: The current value of the user-agent property.
2952  */
2953 const char* webkit_settings_get_user_agent(WebKitSettings* settings)
2954 {
2955     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), 0);
2956
2957     WebKitSettingsPrivate* priv = settings->priv;
2958     ASSERT(!priv->userAgent.isNull());
2959     return priv->userAgent.data();
2960 }
2961
2962 /**
2963  * webkit_settings_set_user_agent:
2964  * @settings: a #WebKitSettings
2965  * @user_agent: (allow-none): The new custom user agent string or %NULL to use the default user agent
2966  *
2967  * Set the #WebKitSettings:user-agent property.
2968  */
2969 void webkit_settings_set_user_agent(WebKitSettings* settings, const char* userAgent)
2970 {
2971     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2972
2973     WebKitSettingsPrivate* priv = settings->priv;
2974     CString newUserAgent = (!userAgent || !strlen(userAgent)) ? WebCore::standardUserAgent("").utf8() : userAgent;
2975     if (newUserAgent == priv->userAgent)
2976         return;
2977
2978     priv->userAgent = newUserAgent;
2979     g_object_notify(G_OBJECT(settings), "user-agent");
2980 }
2981
2982 /**
2983  * webkit_settings_set_user_agent_with_application_details:
2984  * @settings: a #WebKitSettings
2985  * @application_name: (allow-none): The application name used for the user agent or %NULL to use the default user agent.
2986  * @application_version: (allow-none): The application version for the user agent or %NULL to user the default version.
2987  *
2988  * Set the #WebKitSettings:user-agent property by appending the application details to the default user
2989  * agent. If no application name or version is given, the default user agent used will be used. If only
2990  * the version is given, the default engine version is used with the given application name.
2991  */
2992 void webkit_settings_set_user_agent_with_application_details(WebKitSettings* settings, const char* applicationName, const char* applicationVersion)
2993 {
2994     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
2995
2996     CString newUserAgent = WebCore::standardUserAgent(String::fromUTF8(applicationName), String::fromUTF8(applicationVersion)).utf8();
2997     webkit_settings_set_user_agent(settings, newUserAgent.data());
2998 }
2999
3000 /**
3001  * webkit_settings_get_enable_smooth_scrolling:
3002  * @settings: a #WebKitSettings
3003  *
3004  * Get the #WebKitSettings:enable-smooth-scrolling property.
3005  *
3006  * Returns: %TRUE if smooth scrolling is enabled or %FALSE otherwise.
3007  */
3008 gboolean webkit_settings_get_enable_smooth_scrolling(WebKitSettings* settings)
3009 {
3010     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
3011
3012     return settings->priv->preferences->scrollAnimatorEnabled();
3013 }
3014
3015 /**
3016  * webkit_settings_set_enable_smooth_scrolling:
3017  * @settings: a #WebKitSettings
3018  * @enabled: Value to be set
3019  *
3020  * Set the #WebKitSettings:enable-smooth-scrolling property.
3021  */
3022 void webkit_settings_set_enable_smooth_scrolling(WebKitSettings* settings, gboolean enabled)
3023 {
3024     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
3025
3026     WebKitSettingsPrivate* priv = settings->priv;
3027     bool currentValue = priv->preferences->scrollAnimatorEnabled();
3028     if (currentValue == enabled)
3029         return;
3030
3031     priv->preferences->setScrollAnimatorEnabled(enabled);
3032     g_object_notify(G_OBJECT(settings), "enable-smooth-scrolling");
3033 }
3034
3035 /**
3036  * webkit_settings_get_enable_accelerated_2d_canvas:
3037  * @settings: a #WebKitSettings
3038  *
3039  * Get the #WebKitSettings:enable-accelerated-2d-canvas property.
3040  *
3041  * Returns: %TRUE if accelerated 2D canvas is enabled or %FALSE otherwise.
3042  *
3043  * Since: 2.2
3044  */
3045 gboolean webkit_settings_get_enable_accelerated_2d_canvas(WebKitSettings* settings)
3046 {
3047     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
3048
3049     return settings->priv->preferences->accelerated2dCanvasEnabled();
3050 }
3051
3052 /**
3053  * webkit_settings_set_enable_accelerated_2d_canvas:
3054  * @settings: a #WebKitSettings
3055  * @enabled: Value to be set
3056  *
3057  * Set the #WebKitSettings:enable-accelerated-2d-canvas property.
3058  *
3059  * Since: 2.2
3060  */
3061 void webkit_settings_set_enable_accelerated_2d_canvas(WebKitSettings* settings, gboolean enabled)
3062 {
3063     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
3064
3065     WebKitSettingsPrivate* priv = settings->priv;
3066     if (priv->preferences->accelerated2dCanvasEnabled() == enabled)
3067         return;
3068
3069     priv->preferences->setAccelerated2dCanvasEnabled(enabled);
3070     g_object_notify(G_OBJECT(settings), "enable-accelerated-2d-canvas");
3071 }
3072
3073 /**
3074  * webkit_settings_get_enable_write_console_messages_to_stdout:
3075  * @settings: a #WebKitSettings
3076  *
3077  * Get the #WebKitSettings:enable-write-console-messages-to-stdout property.
3078  *
3079  * Returns: %TRUE if writing console messages to stdout is enabled or %FALSE
3080  * otherwise.
3081  *
3082  * Since: 2.2
3083  */
3084 gboolean webkit_settings_get_enable_write_console_messages_to_stdout(WebKitSettings* settings)
3085 {
3086     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
3087
3088     return settings->priv->preferences->logsPageMessagesToSystemConsoleEnabled();
3089 }
3090
3091 /**
3092  * webkit_settings_set_enable_write_console_messages_to_stdout:
3093  * @settings: a #WebKitSettings
3094  * @enabled: Value to be set
3095  *
3096  * Set the #WebKitSettings:enable-write-console-messages-to-stdout property.
3097  *
3098  * Since: 2.2
3099  */
3100 void webkit_settings_set_enable_write_console_messages_to_stdout(WebKitSettings* settings, gboolean enabled)
3101 {
3102     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
3103
3104     WebKitSettingsPrivate* priv = settings->priv;
3105     bool currentValue = priv->preferences->logsPageMessagesToSystemConsoleEnabled();
3106     if (currentValue == enabled)
3107         return;
3108
3109     priv->preferences->setLogsPageMessagesToSystemConsoleEnabled(enabled);
3110     g_object_notify(G_OBJECT(settings), "enable-write-console-messages-to-stdout");
3111 }
3112
3113 /**
3114  * webkit_settings_get_enable_media_stream:
3115  * @settings: a #WebKitSettings
3116  *
3117  * Get the #WebKitSettings:enable-media-stream property.
3118  *
3119  * Returns: %TRUE If mediastream support is enabled or %FALSE otherwise.
3120  *
3121  * Since: 2.4
3122  */
3123 gboolean webkit_settings_get_enable_media_stream(WebKitSettings* settings)
3124 {
3125     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
3126
3127     return settings->priv->preferences->mediaStreamEnabled();
3128 }
3129
3130 /**
3131  * webkit_settings_set_enable_media_stream:
3132  * @settings: a #WebKitSettings
3133  * @enabled: Value to be set
3134  *
3135  * Set the #WebKitSettings:enable-media-stream property.
3136  *
3137  * Since: 2.4
3138  */
3139 void webkit_settings_set_enable_media_stream(WebKitSettings* settings, gboolean enabled)
3140 {
3141     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
3142
3143     WebKitSettingsPrivate* priv = settings->priv;
3144     bool currentValue = priv->preferences->mediaStreamEnabled();
3145     if (currentValue == enabled)
3146         return;
3147
3148     priv->preferences->setMediaDevicesEnabled(enabled);
3149     priv->preferences->setMediaStreamEnabled(enabled);
3150     priv->preferences->setPeerConnectionEnabled(enabled);
3151     g_object_notify(G_OBJECT(settings), "enable-media-stream");
3152 }
3153
3154 /**
3155  * webkit_settings_get_enable_mock_capture_devices:
3156  * @settings: a #WebKitSettings
3157  *
3158  * Get the #WebKitSettings:enable-mock-capture-devices property.
3159  *
3160  * Returns: %TRUE If mock capture devices is enabled or %FALSE otherwise.
3161  *
3162  * Since: 2.24
3163  */
3164 gboolean webkit_settings_get_enable_mock_capture_devices(WebKitSettings* settings)
3165 {
3166     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
3167
3168     return settings->priv->preferences->mockCaptureDevicesEnabled();
3169 }
3170
3171 /**
3172  * webkit_settings_set_enable_mock_capture_devices:
3173  * @settings: a #WebKitSettings
3174  * @enabled: Value to be set
3175  *
3176  * Set the #WebKitSettings:enable-mock-capture-devices property.
3177  *
3178  * Since: 2.4
3179  */
3180 void webkit_settings_set_enable_mock_capture_devices(WebKitSettings* settings, gboolean enabled)
3181 {
3182     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
3183
3184     WebKitSettingsPrivate* priv = settings->priv;
3185     bool currentValue = priv->preferences->mockCaptureDevicesEnabled();
3186     if (currentValue == enabled)
3187         return;
3188
3189     priv->preferences->setMockCaptureDevicesEnabled(enabled);
3190     g_object_notify(G_OBJECT(settings), "enable-mock-capture-devices");
3191 }
3192
3193 /**
3194  * webkit_settings_set_enable_spatial_navigation:
3195  * @settings: a #WebKitSettings
3196  * @enabled: Value to be set
3197  *
3198  * Set the #WebKitSettings:enable-spatial-navigation property.
3199  *
3200  * Since: 2.2
3201  */
3202 void webkit_settings_set_enable_spatial_navigation(WebKitSettings* settings, gboolean enabled)
3203 {
3204     g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
3205
3206     WebKitSettingsPrivate* priv = settings->priv;
3207     bool currentValue = priv->preferences->spatialNavigationEnabled();
3208
3209     if (currentValue == enabled)
3210         return;
3211
3212     priv->preferences->setSpatialNavigationEnabled(enabled);
3213     g_object_notify(G_OBJECT(settings), "enable-spatial-navigation");
3214 }
3215
3216
3217 /**
3218  * webkit_settings_get_enable_spatial_navigation:
3219  * @settings: a #WebKitSettings
3220  *
3221  * Get the #WebKitSettings:enable-spatial-navigation property.
3222  *
3223  * Returns: %TRUE If HTML5 spatial navigation support is enabled or %FALSE otherwise.
3224  *
3225  * Since: 2.2
3226  */
3227 gboolean webkit_settings_get_enable_spatial_navigation(WebKitSettings* settings)
3228 {
3229     g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
3230
3231     return settings->priv->preferences->spatialNavigationEnabled();