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