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