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