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