webkitwebsettings.cpp 61.1 KB
Newer Older
1 2
/*
 * Copyright (C) 2008 Christian Dywan <christian@imendio.com>
3 4
 * Copyright (C) 2008 Nuanti Ltd.
 * Copyright (C) 2008 Collabora Ltd.
5
 * Copyright (C) 2008 Holger Hans Peter Freyther
6
 * Copyright (C) 2009 Jan Michael Alonzo
7 8
 * Copyright (C) 2009 Movial Creative Technologies Inc.
 * Copyright (C) 2009 Igalia S.L.
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27
 *
 * This library is free software; you can redistribute it and/or
 * modify it under the terms of the GNU Library General Public
 * License as published by the Free Software Foundation; either
 * version 2 of the License, or (at your option) any later version.
 *
 * This library is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * Library General Public License for more details.
 *
 * You should have received a copy of the GNU Library General Public License
 * along with this library; see the file COPYING.LIB.  If not, write to
 * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
 * Boston, MA 02110-1301, USA.
 */

#include "config.h"
#include "webkitwebsettings.h"
28

29
#include "webkitenumtypes.h"
30
#include "webkitprivate.h"
31
#include "webkitversion.h"
32

33 34
#include "FileSystem.h"
#include "PluginDatabase.h"
35
#include "Language.h"
36
#include <wtf/text/CString.h>
37
#include <wtf/text/StringConcatenate.h>
38 39

#include <glib/gi18n-lib.h>
40
#if OS(UNIX)
41 42
#include <sys/utsname.h>
#endif
43

44 45 46 47
/**
 * SECTION:webkitwebsettings
 * @short_description: Control the behaviour of a #WebKitWebView
 *
48 49 50
 * #WebKitWebSettings can be applied to a #WebKitWebView to control text encoding, 
 * color, font sizes, printing mode, script support, loading of images and various other things. 
 * After creation, a #WebKitWebSettings object contains default settings. 
51 52 53 54 55 56 57 58 59 60 61
 *
 * <informalexample><programlisting>
 * /<!-- -->* Create a new websettings and disable java script *<!-- -->/
 * WebKitWebSettings *settings = webkit_web_settings_new ();
 * g_object_set (G_OBJECT(settings), "enable-scripts", FALSE, NULL);
 *
 * /<!-- -->* Apply the result *<!-- -->/
 * webkit_web_view_set_settings (WEBKIT_WEB_VIEW(my_webview), settings);
 * </programlisting></informalexample>
 */

62 63
using namespace WebCore;

64 65 66 67 68 69 70 71 72 73 74 75 76 77
G_DEFINE_TYPE(WebKitWebSettings, webkit_web_settings, G_TYPE_OBJECT)

struct _WebKitWebSettingsPrivate {
    gchar* default_encoding;
    gchar* cursive_font_family;
    gchar* default_font_family;
    gchar* fantasy_font_family;
    gchar* monospace_font_family;
    gchar* sans_serif_font_family;
    gchar* serif_font_family;
    guint default_font_size;
    guint default_monospace_font_size;
    guint minimum_font_size;
    guint minimum_logical_font_size;
78
    gboolean enforce_96_dpi;
79 80 81 82 83 84 85
    gboolean auto_load_images;
    gboolean auto_shrink_images;
    gboolean print_backgrounds;
    gboolean enable_scripts;
    gboolean enable_plugins;
    gboolean resizable_text_areas;
    gchar* user_stylesheet_uri;
86
    gfloat zoom_step;
87
    gboolean enable_developer_extras;
88
    gboolean enable_private_browsing;
89
    gboolean enable_spell_checking;
90
    gchar* spell_checking_languages;
91
    GSList* enchant_dicts;
92
    gboolean enable_caret_browsing;
93 94
    gboolean enable_html5_database;
    gboolean enable_html5_local_storage;
95
    gboolean enable_xss_auditor;
96
    gboolean enable_spatial_navigation;
97
    gboolean enable_frame_flattening;
98
    gchar* user_agent;
99
    gboolean javascript_can_open_windows_automatically;
100
    gboolean javascript_can_access_clipboard;
101
    gboolean enable_offline_web_application_cache;
102
    WebKitEditingBehavior editing_behavior;
103
    gboolean enable_universal_access_from_file_uris;
104
    gboolean enable_file_access_from_file_uris;
105
    gboolean enable_dom_paste;
106
    gboolean tab_key_cycles_through_elements;
kov@webkit.org's avatar
kov@webkit.org committed
107
    gboolean enable_default_context_menu;
108
    gboolean enable_site_specific_quirks;
109
    gboolean enable_page_cache;
110
    gboolean auto_resize_window;
xan@webkit.org's avatar
xan@webkit.org committed
111
    gboolean enable_java_applet;
112
    gboolean enable_hyperlink_auditing;
113
    gboolean enable_fullscreen;
114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131
};

#define WEBKIT_WEB_SETTINGS_GET_PRIVATE(obj) (G_TYPE_INSTANCE_GET_PRIVATE((obj), WEBKIT_TYPE_WEB_SETTINGS, WebKitWebSettingsPrivate))

enum {
    PROP_0,

    PROP_DEFAULT_ENCODING,
    PROP_CURSIVE_FONT_FAMILY,
    PROP_DEFAULT_FONT_FAMILY,
    PROP_FANTASY_FONT_FAMILY,
    PROP_MONOSPACE_FONT_FAMILY,
    PROP_SANS_SERIF_FONT_FAMILY,
    PROP_SERIF_FONT_FAMILY,
    PROP_DEFAULT_FONT_SIZE,
    PROP_DEFAULT_MONOSPACE_FONT_SIZE,
    PROP_MINIMUM_FONT_SIZE,
    PROP_MINIMUM_LOGICAL_FONT_SIZE,
132
    PROP_ENFORCE_96_DPI,
133 134 135 136 137 138
    PROP_AUTO_LOAD_IMAGES,
    PROP_AUTO_SHRINK_IMAGES,
    PROP_PRINT_BACKGROUNDS,
    PROP_ENABLE_SCRIPTS,
    PROP_ENABLE_PLUGINS,
    PROP_RESIZABLE_TEXT_AREAS,
139
    PROP_USER_STYLESHEET_URI,
140
    PROP_ZOOM_STEP,
141
    PROP_ENABLE_DEVELOPER_EXTRAS,
142
    PROP_ENABLE_PRIVATE_BROWSING,
143
    PROP_ENABLE_SPELL_CHECKING,
144
    PROP_SPELL_CHECKING_LANGUAGES,
145 146
    PROP_ENABLE_CARET_BROWSING,
    PROP_ENABLE_HTML5_DATABASE,
147
    PROP_ENABLE_HTML5_LOCAL_STORAGE,
148
    PROP_ENABLE_XSS_AUDITOR,
149
    PROP_ENABLE_SPATIAL_NAVIGATION,
150
    PROP_ENABLE_FRAME_FLATTENING,
151
    PROP_USER_AGENT,
152
    PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY,
153
    PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD,
154
    PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE,
155
    PROP_EDITING_BEHAVIOR,
kov@webkit.org's avatar
kov@webkit.org committed
156
    PROP_ENABLE_UNIVERSAL_ACCESS_FROM_FILE_URIS,
157
    PROP_ENABLE_FILE_ACCESS_FROM_FILE_URIS,
158
    PROP_ENABLE_DOM_PASTE,
kov@webkit.org's avatar
kov@webkit.org committed
159
    PROP_TAB_KEY_CYCLES_THROUGH_ELEMENTS,
160
    PROP_ENABLE_DEFAULT_CONTEXT_MENU,
161
    PROP_ENABLE_SITE_SPECIFIC_QUIRKS,
162
    PROP_ENABLE_PAGE_CACHE,
163
    PROP_AUTO_RESIZE_WINDOW,
164
    PROP_ENABLE_JAVA_APPLET,
165 166
    PROP_ENABLE_HYPERLINK_AUDITING,
    PROP_ENABLE_FULLSCREEN
167 168
};

169 170 171
// Create a default user agent string
// This is a liberal interpretation of http://www.mozilla.org/build/revised-user-agent-strings.html
// See also http://developer.apple.com/internet/safari/faq.html#anchor2
172
static String webkitPlatform()
173 174
{
#if PLATFORM(X11)
175
    DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("X11")));
176
#elif OS(WINDOWS)
177
    DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("Windows")));
178
#elif PLATFORM(MAC)
179
    DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("Macintosh")));
180
#elif defined(GDK_WINDOWING_DIRECTFB)
181
    DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("DirectFB")));
182
#else
183
    DEFINE_STATIC_LOCAL(const String, uaPlatform, (String("Unknown")));
184 185
#endif

186 187 188 189 190
    return uaPlatform;
}

static String webkitOSVersion()
{
191
   // FIXME: platform/version detection can be shared.
192
#if OS(DARWIN)
193

194
#if CPU(X86)
195
    DEFINE_STATIC_LOCAL(const String, uaOSVersion, (String("Intel Mac OS X")));
196
#else
197
    DEFINE_STATIC_LOCAL(const String, uaOSVersion, (String("PPC Mac OS X")));
198 199
#endif

200
#elif OS(UNIX)
201 202 203 204 205
    DEFINE_STATIC_LOCAL(String, uaOSVersion, (String()));

    if (!uaOSVersion.isEmpty())
        return uaOSVersion;

206 207
    struct utsname name;
    if (uname(&name) != -1)
208
        uaOSVersion = makeString(name.sysname, ' ', name.machine);
209
    else
210
        uaOSVersion = String("Unknown");
211
#elif OS(WINDOWS)
212
    DEFINE_STATIC_LOCAL(const String, uaOSVersion, (String("Windows")));
213
#else
214
    DEFINE_STATIC_LOCAL(const String, uaOSVersion, (String("Unknown")));
215 216
#endif

217 218 219 220 221
    return uaOSVersion;
}

String webkitUserAgent()
{
222 223 224
    // We mention Safari since many broken sites check for it (OmniWeb does this too)
    // We re-use the WebKit version, though it doesn't seem to matter much in practice

225 226 227
    DEFINE_STATIC_LOCAL(const String, uaVersion, (makeString(String::number(WEBKIT_USER_AGENT_MAJOR_VERSION), '.', String::number(WEBKIT_USER_AGENT_MINOR_VERSION), '+')));
    DEFINE_STATIC_LOCAL(const String, staticUA, (makeString("Mozilla/5.0 (", webkitPlatform(), "; U; ", webkitOSVersion(), "; ", defaultLanguage(), ") AppleWebKit/", uaVersion) +
                                                 makeString(" (KHTML, like Gecko) Version/5.0 Safari/", uaVersion)));
228 229 230 231

    return staticUA;
}

232 233 234 235 236 237 238 239 240 241 242 243 244
static void webkit_web_settings_finalize(GObject* object);

static void webkit_web_settings_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec);

static void webkit_web_settings_get_property(GObject* object, guint prop_id, GValue* value, GParamSpec* pspec);

static void webkit_web_settings_class_init(WebKitWebSettingsClass* klass)
{
    GObjectClass* gobject_class = G_OBJECT_CLASS(klass);
    gobject_class->finalize = webkit_web_settings_finalize;
    gobject_class->set_property = webkit_web_settings_set_property;
    gobject_class->get_property = webkit_web_settings_get_property;

245 246
    webkit_init();

247 248 249 250 251 252
    GParamFlags flags = (GParamFlags)(WEBKIT_PARAM_READWRITE | G_PARAM_CONSTRUCT);

    g_object_class_install_property(gobject_class,
                                    PROP_DEFAULT_ENCODING,
                                    g_param_spec_string(
                                    "default-encoding",
kov@webkit.org's avatar
kov@webkit.org committed
253 254
                                    _("Default Encoding"),
                                    _("The default encoding used to display text."),
255 256 257 258 259 260 261
                                    "iso-8859-1",
                                    flags));

    g_object_class_install_property(gobject_class,
                                    PROP_CURSIVE_FONT_FAMILY,
                                    g_param_spec_string(
                                    "cursive-font-family",
kov@webkit.org's avatar
kov@webkit.org committed
262 263
                                    _("Cursive Font Family"),
                                    _("The default Cursive font family used to display text."),
264 265 266 267 268 269 270
                                    "serif",
                                    flags));

    g_object_class_install_property(gobject_class,
                                    PROP_DEFAULT_FONT_FAMILY,
                                    g_param_spec_string(
                                    "default-font-family",
kov@webkit.org's avatar
kov@webkit.org committed
271 272
                                    _("Default Font Family"),
                                    _("The default font family used to display text."),
273 274 275 276 277 278 279
                                    "sans-serif",
                                    flags));

    g_object_class_install_property(gobject_class,
                                    PROP_FANTASY_FONT_FAMILY,
                                    g_param_spec_string(
                                    "fantasy-font-family",
kov@webkit.org's avatar
kov@webkit.org committed
280 281
                                    _("Fantasy Font Family"),
                                    _("The default Fantasy font family used to display text."),
282 283 284 285 286 287 288
                                    "serif",
                                    flags));

    g_object_class_install_property(gobject_class,
                                    PROP_MONOSPACE_FONT_FAMILY,
                                    g_param_spec_string(
                                    "monospace-font-family",
kov@webkit.org's avatar
kov@webkit.org committed
289 290
                                    _("Monospace Font Family"),
                                    _("The default font family used to display monospace text."),
291 292 293 294 295 296 297
                                    "monospace",
                                    flags));

    g_object_class_install_property(gobject_class,
                                    PROP_SANS_SERIF_FONT_FAMILY,
                                    g_param_spec_string(
                                    "sans-serif-font-family",
kov@webkit.org's avatar
kov@webkit.org committed
298 299
                                    _("Sans Serif Font Family"),
                                    _("The default Sans Serif font family used to display text."),
300 301 302 303 304 305 306
                                    "sans-serif",
                                    flags));

    g_object_class_install_property(gobject_class,
                                    PROP_SERIF_FONT_FAMILY,
                                    g_param_spec_string(
                                    "serif-font-family",
kov@webkit.org's avatar
kov@webkit.org committed
307 308
                                    _("Serif Font Family"),
                                    _("The default Serif font family used to display text."),
309 310 311 312 313 314 315
                                    "serif",
                                    flags));

    g_object_class_install_property(gobject_class,
                                    PROP_DEFAULT_FONT_SIZE,
                                    g_param_spec_int(
                                    "default-font-size",
kov@webkit.org's avatar
kov@webkit.org committed
316 317
                                    _("Default Font Size"),
                                    _("The default font size used to display text."),
318
                                    5, G_MAXINT, 12,
319 320 321 322 323 324
                                    flags));

    g_object_class_install_property(gobject_class,
                                    PROP_DEFAULT_MONOSPACE_FONT_SIZE,
                                    g_param_spec_int(
                                    "default-monospace-font-size",
kov@webkit.org's avatar
kov@webkit.org committed
325 326
                                    _("Default Monospace Font Size"),
                                    _("The default font size used to display monospace text."),
327 328 329 330 331 332 333
                                    5, G_MAXINT, 10,
                                    flags));

    g_object_class_install_property(gobject_class,
                                    PROP_MINIMUM_FONT_SIZE,
                                    g_param_spec_int(
                                    "minimum-font-size",
kov@webkit.org's avatar
kov@webkit.org committed
334 335
                                    _("Minimum Font Size"),
                                    _("The minimum font size used to display text."),
336 337 338 339 340 341 342
                                    1, G_MAXINT, 5,
                                    flags));

    g_object_class_install_property(gobject_class,
                                    PROP_MINIMUM_LOGICAL_FONT_SIZE,
                                    g_param_spec_int(
                                    "minimum-logical-font-size",
kov@webkit.org's avatar
kov@webkit.org committed
343 344
                                    _("Minimum Logical Font Size"),
                                    _("The minimum logical font size used to display text."),
345 346 347
                                    1, G_MAXINT, 5,
                                    flags));

348 349 350 351 352 353 354 355 356 357 358 359 360 361 362
    /**
    * WebKitWebSettings:enforce-96-dpi:
    *
    * Enforce a resolution of 96 DPI. This is meant for compatibility
    * with web pages which cope badly with different screen resolutions
    * and for automated testing.
    * Web browsers and applications that typically display arbitrary
    * content from the web should provide a preference for this.
    *
    * Since: 1.0.3
    */
    g_object_class_install_property(gobject_class,
                                    PROP_ENFORCE_96_DPI,
                                    g_param_spec_boolean(
                                    "enforce-96-dpi",
kov@webkit.org's avatar
kov@webkit.org committed
363 364
                                    _("Enforce 96 DPI"),
                                    _("Enforce a resolution of 96 DPI"),
365 366 367
                                    FALSE,
                                    flags));

368 369 370 371
    g_object_class_install_property(gobject_class,
                                    PROP_AUTO_LOAD_IMAGES,
                                    g_param_spec_boolean(
                                    "auto-load-images",
kov@webkit.org's avatar
kov@webkit.org committed
372 373
                                    _("Auto Load Images"),
                                    _("Load images automatically."),
374 375 376 377 378 379 380
                                    TRUE,
                                    flags));

    g_object_class_install_property(gobject_class,
                                    PROP_AUTO_SHRINK_IMAGES,
                                    g_param_spec_boolean(
                                    "auto-shrink-images",
kov@webkit.org's avatar
kov@webkit.org committed
381 382
                                    _("Auto Shrink Images"),
                                    _("Automatically shrink standalone images to fit."),
383 384 385 386 387 388 389
                                    TRUE,
                                    flags));

    g_object_class_install_property(gobject_class,
                                    PROP_PRINT_BACKGROUNDS,
                                    g_param_spec_boolean(
                                    "print-backgrounds",
kov@webkit.org's avatar
kov@webkit.org committed
390 391
                                    _("Print Backgrounds"),
                                    _("Whether background images should be printed."),
392 393 394 395 396 397 398
                                    TRUE,
                                    flags));

    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_SCRIPTS,
                                    g_param_spec_boolean(
                                    "enable-scripts",
kov@webkit.org's avatar
kov@webkit.org committed
399 400
                                    _("Enable Scripts"),
                                    _("Enable embedded scripting languages."),
401 402 403 404 405 406 407
                                    TRUE,
                                    flags));

    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_PLUGINS,
                                    g_param_spec_boolean(
                                    "enable-plugins",
kov@webkit.org's avatar
kov@webkit.org committed
408 409
                                    _("Enable Plugins"),
                                    _("Enable embedded plugin objects."),
410 411 412 413 414 415 416
                                    TRUE,
                                    flags));

    g_object_class_install_property(gobject_class,
                                    PROP_RESIZABLE_TEXT_AREAS,
                                    g_param_spec_boolean(
                                    "resizable-text-areas",
kov@webkit.org's avatar
kov@webkit.org committed
417 418
                                    _("Resizable Text Areas"),
                                    _("Whether text areas are resizable."),
419 420 421 422 423 424
                                    TRUE,
                                    flags));

    g_object_class_install_property(gobject_class,
                                    PROP_USER_STYLESHEET_URI,
                                    g_param_spec_string("user-stylesheet-uri",
kov@webkit.org's avatar
kov@webkit.org committed
425 426
                                    _("User Stylesheet URI"),
                                    _("The URI of a stylesheet that is applied to every page."),
427 428 429
                                    0,
                                    flags));

430 431 432 433 434 435 436
    /**
    * WebKitWebSettings:zoom-step:
    *
    * The value by which the zoom level is changed when zooming in or out.
    *
    * Since: 1.0.1
    */
437 438 439 440
    g_object_class_install_property(gobject_class,
                                    PROP_ZOOM_STEP,
                                    g_param_spec_float(
                                    "zoom-step",
kov@webkit.org's avatar
kov@webkit.org committed
441 442
                                    _("Zoom Stepping Value"),
                                    _("The value by which the zoom level is changed when zooming in or out."),
443
                                    0.0f, G_MAXFLOAT, 0.1f,
444 445
                                    flags));

446 447 448 449 450 451 452 453
    /**
    * WebKitWebSettings:enable-developer-extras:
    *
    * Whether developer extensions should be enabled. This enables,
    * for now, the Web Inspector, which can be controlled using the
    * #WebKitWebInspector instance held by the #WebKitWebView this
    * setting is enabled for.
    *
454
    * Since: 1.0.3
455 456 457 458 459
    */
    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_DEVELOPER_EXTRAS,
                                    g_param_spec_boolean(
                                    "enable-developer-extras",
kov@webkit.org's avatar
kov@webkit.org committed
460 461
                                    _("Enable Developer Extras"),
                                    _("Enables special extensions that help developers"),
462 463 464
                                    FALSE,
                                    flags));

465 466 467
    /**
    * WebKitWebSettings:enable-private-browsing:
    *
468 469 470 471 472 473
    * Whether to enable private browsing mode. Private browsing mode prevents
    * WebKit from updating the global history and storing any session
    * information e.g., on-disk cache, as well as suppressing any messages
    * from being printed into the (javascript) console.
    *
    * This is currently experimental for WebKitGtk.
474
    *
475
    * Since: 1.1.2
476 477 478 479 480
    */
    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_PRIVATE_BROWSING,
                                    g_param_spec_boolean(
                                    "enable-private-browsing",
kov@webkit.org's avatar
kov@webkit.org committed
481 482
                                    _("Enable Private Browsing"),
                                    _("Enables private browsing mode"),
483 484 485
                                    FALSE,
                                    flags));

486 487 488
    /**
    * WebKitWebSettings:enable-spell-checking:
    *
489
    * Whether to enable spell checking while typing.
490
    *
491
    * Since: 1.1.6
492 493 494 495 496 497
    */
    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_SPELL_CHECKING,
                                    g_param_spec_boolean(
                                    "enable-spell-checking",
                                    _("Enable Spell Checking"),
498
                                    _("Enables spell checking while typing"),
499 500 501
                                    FALSE,
                                    flags));

502 503 504 505 506 507 508 509 510 511
    /**
    * WebKitWebSettings:spell-checking-languages:
    *
    * The languages to be used for spell checking, separated by commas.
    *
    * The locale string typically is in the form lang_COUNTRY, where lang
    * is an ISO-639 language code, and COUNTRY is an ISO-3166 country code.
    * For instance, sv_FI for Swedish as written in Finland or pt_BR
    * for Portuguese as written in Brazil.
    *
512 513
    * If no value is specified then the value returned by
    * gtk_get_default_language will be used.
514
    *
515
    * Since: 1.1.6
516 517 518 519 520 521 522 523 524 525
    */
    g_object_class_install_property(gobject_class,
                                    PROP_SPELL_CHECKING_LANGUAGES,
                                    g_param_spec_string(
                                    "spell-checking-languages",
                                    _("Languages to use for spell checking"),
                                    _("Comma separated list of languages to use for spell checking"),
                                    0,
                                    flags));

526 527 528 529 530
    /**
    * WebKitWebSettings:enable-caret-browsing:
    *
    * Whether to enable caret browsing mode.
    *
531
    * Since: 1.1.6
532 533 534 535 536 537 538 539
    */
    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_CARET_BROWSING,
                                    g_param_spec_boolean("enable-caret-browsing",
                                                         _("Enable Caret Browsing"),
                                                         _("Whether to enable accesibility enhanced keyboard navigation"),
                                                         FALSE,
                                                         flags));
540 541 542 543 544 545 546
    /**
    * WebKitWebSettings:enable-html5-database:
    *
    * Whether to enable HTML5 client-side SQL database support. Client-side
    * SQL database allows web pages to store structured data and be able to
    * use SQL to manipulate that data asynchronously.
    *
547
    * Since: 1.1.8
548 549 550 551 552 553 554 555 556 557 558 559 560 561 562
    */
    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_HTML5_DATABASE,
                                    g_param_spec_boolean("enable-html5-database",
                                                         _("Enable HTML5 Database"),
                                                         _("Whether to enable HTML5 database support"),
                                                         TRUE,
                                                         flags));

    /**
    * WebKitWebSettings:enable-html5-local-storage:
    *
    * Whether to enable HTML5 localStorage support. localStorage provides
    * simple synchronous storage access.
    *
563
    * Since: 1.1.8
564 565 566 567 568 569 570 571
    */
    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_HTML5_LOCAL_STORAGE,
                                    g_param_spec_boolean("enable-html5-local-storage",
                                                         _("Enable HTML5 Local Storage"),
                                                         _("Whether to enable HTML5 Local Storage support"),
                                                         TRUE,
                                                         flags));
572 573 574 575 576 577
    /**
    * WebKitWebSettings:enable-xss-auditor
    *
    * Whether to enable the XSS Auditor. This feature filters some kinds of
    * reflective XSS attacks on vulnerable web sites.
    *
578
    * Since: 1.1.11
579 580 581 582 583
    */
    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_XSS_AUDITOR,
                                    g_param_spec_boolean("enable-xss-auditor",
                                                         _("Enable XSS Auditor"),
584
                                                         _("Whether to enable the XSS auditor"),
585
                                                         TRUE,
586
                                                         flags));
587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605
    /**
    * WebKitWebSettings:enable-spatial-navigation
    *
    * Whether to enable the Spatial Navigation. This feature consists in the ability
    * to navigate between focusable elements in a Web page, such as hyperlinks and
    * form controls, by using Left, Right, Up and Down arrow keys. For example, if
    * an user presses the Right key, heuristics determine whether there is an element
    * he might be trying to reach towards the right, and if there are multiple elements,
    * which element he probably wants.
    *
    * Since: 1.1.23
    */
    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_SPATIAL_NAVIGATION,
                                    g_param_spec_boolean("enable-spatial-navigation",
                                                         _("Enable Spatial Navigation"),
                                                         _("Whether to enable Spatial Navigation"),
                                                         FALSE,
                                                         flags));
606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624
    /**
    * WebKitWebSettings:enable-frame-flattening
    *
    * Whether to enable the Frame Flattening. With this setting each subframe is expanded
    * to its contents, which will flatten all the frames to become one scrollable page.
    * On touch devices, it is desired to not have any scrollable sub parts of the page as
    * it results in a confusing user experience, with scrolling sometimes scrolling sub parts
    * and at other times scrolling the page itself. For this reason iframes and framesets are
    * barely usable on touch devices.
    *
    * Since: 1.3.5
    */
    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_FRAME_FLATTENING,
                                    g_param_spec_boolean("enable-frame-flattening",
                                                         _("Enable Frame Flattening"),
                                                         _("Whether to enable Frame Flattening"),
                                                         FALSE,
                                                         flags));
625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640
    /**
     * WebKitWebSettings:user-agent:
     *
     * The User-Agent string used by WebKitGtk.
     *
     * This will return a default User-Agent string if a custom string wasn't
     * provided by the application. Setting this property to a NULL value or
     * an empty string will result in the User-Agent string being reset to the
     * default value.
     *
     * Since: 1.1.11
     */
    g_object_class_install_property(gobject_class, PROP_USER_AGENT,
                                    g_param_spec_string("user-agent",
                                                        _("User Agent"),
                                                        _("The User-Agent string used by WebKitGtk"),
641
                                                        webkitUserAgent().utf8().data(),
642 643
                                                        flags));

644 645 646 647 648 649
    /**
    * WebKitWebSettings:javascript-can-open-windows-automatically
    *
    * Whether JavaScript can open popup windows automatically without user
    * intervention.
    *
650
    * Since: 1.1.11
651 652 653 654 655 656 657 658
    */
    g_object_class_install_property(gobject_class,
                                    PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY,
                                    g_param_spec_boolean("javascript-can-open-windows-automatically",
                                                         _("JavaScript can open windows automatically"),
                                                         _("Whether JavaScript can open windows automatically"),
                                                         FALSE,
                                                         flags));
659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674

    /**
    * WebKitWebSettings:javascript-can-access-clipboard
    *
    * Whether JavaScript can access Clipboard.
    *
    * Since: 1.3.0
    */
    g_object_class_install_property(gobject_class,
                                    PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD,
                                    g_param_spec_boolean("javascript-can-access-clipboard",
                                                         _("JavaScript can access Clipboard"),
                                                         _("Whether JavaScript can access Clipboard"),
                                                         FALSE,
                                                         flags));

675 676 677 678 679 680 681
    /**
    * WebKitWebSettings:enable-offline-web-application-cache
    *
    * Whether to enable HTML5 offline web application cache support. Offline
    * Web Application Cache ensures web applications are available even when
    * the user is not connected to the network.
    *
682
    * Since: 1.1.13
683 684 685 686 687 688 689 690 691
    */
    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE,
                                    g_param_spec_boolean("enable-offline-web-application-cache",
                                                         _("Enable offline web application cache"),
                                                         _("Whether to enable offline web application cache"),
                                                         TRUE,
                                                         flags));

692 693
    COMPILE_ASSERT(static_cast<int>(WEBKIT_EDITING_BEHAVIOR_MAC) == static_cast<int>(WebCore::EditingMacBehavior), editing_behavior_type_mac_match);
    COMPILE_ASSERT(static_cast<int>(WEBKIT_EDITING_BEHAVIOR_WINDOWS) == static_cast<int>(WebCore::EditingWindowsBehavior), editing_behavior_type_windows_match);
694
    COMPILE_ASSERT(static_cast<int>(WEBKIT_EDITING_BEHAVIOR_UNIX) == static_cast<int>(WebCore::EditingUnixBehavior), editing_behavior_type_unix_match);
695

696 697 698 699 700 701 702 703 704 705 706 707 708 709 710
    /**
    * WebKitWebSettings:editing-behavior
    *
    * This setting controls various editing behaviors that differ
    * between platforms and that have been combined in two groups,
    * 'Mac' and 'Windows'. Some examples:
    * 
    *  1) Clicking below the last line of an editable area puts the
    * caret at the end of the last line on Mac, but in the middle of
    * the last line on Windows.
    *
    *  2) Pushing down the arrow key on the last line puts the caret
    *  at the end of the last line on Mac, but does nothing on
    *  Windows. A similar case exists on the top line.
    *
711
    * Since: 1.1.13
712 713 714 715 716 717 718
    */
    g_object_class_install_property(gobject_class,
                                    PROP_EDITING_BEHAVIOR,
                                    g_param_spec_enum("editing-behavior",
                                                      _("Editing behavior"),
                                                      _("The behavior mode to use in editing mode"),
                                                      WEBKIT_TYPE_EDITING_BEHAVIOR,
719
                                                      WEBKIT_EDITING_BEHAVIOR_UNIX,
720
                                                      flags));
721

722
    /**
723
     * WebKitWebSettings:enable-universal-access-from-file-uris
724 725 726 727
     *
     * Whether to allow files loaded through file:// URIs universal access to
     * all pages.
     *
728
     * Since: 1.1.13
729 730 731 732
     */
    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_UNIVERSAL_ACCESS_FROM_FILE_URIS,
                                    g_param_spec_boolean("enable-universal-access-from-file-uris",
733
                                                         _("Enable universal access from file URIs"),
734 735 736 737
                                                         _("Whether to allow universal access from file URIs"),
                                                         FALSE,
                                                         flags));

738 739 740 741 742 743 744 745 746 747 748 749 750 751 752
    /**
     * WebKitWebSettings:enable-dom-paste
     *
     * Whether to enable DOM paste. If set to %TRUE, document.execCommand("Paste")
     * will correctly execute and paste content of the clipboard.
     *
     * Since: 1.1.16
     */
    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_DOM_PASTE,
                                    g_param_spec_boolean("enable-dom-paste",
                                                         _("Enable DOM paste"),
                                                         _("Whether to enable DOM paste"),
                                                         FALSE,
                                                         flags));
753
    /**
754
    * WebKitWebSettings:tab-key-cycles-through-elements:
755 756 757 758 759 760 761 762
    *
    * Whether the tab key cycles through elements on the page.
    *
    * If @flag is %TRUE, pressing the tab key will focus the next element in
    * the @web_view. If @flag is %FALSE, the @web_view will interpret tab
    * key presses as normal key presses. If the selected element is editable, the
    * tab key will cause the insertion of a tab character.
    *
763
    * Since: 1.1.17
764 765 766 767
    */
    g_object_class_install_property(gobject_class,
                                    PROP_TAB_KEY_CYCLES_THROUGH_ELEMENTS,
                                    g_param_spec_boolean("tab-key-cycles-through-elements",
768 769
                                                         _("Tab key cycles through elements"),
                                                         _("Whether the tab key cycles through elements on the page."),
770
                                                         TRUE,
771
                                                         flags));
772

kov@webkit.org's avatar
kov@webkit.org committed
773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793
    /**
     * WebKitWebSettings:enable-default-context-menu:
     *
     * Whether right-clicks should be handled automatically to create,
     * and display the context menu. Turning this off will make
     * WebKitGTK+ not emit the populate-popup signal. Notice that the
     * default button press event handler may still handle right
     * clicks for other reasons, such as in-page context menus, or
     * right-clicks that are handled by the page itself.
     *
     * Since: 1.1.18
     */
    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_DEFAULT_CONTEXT_MENU,
                                    g_param_spec_boolean(
                                    "enable-default-context-menu",
                                    _("Enable Default Context Menu"),
                                    _("Enables the handling of right-clicks for the creation of the default context menu"),
                                    TRUE,
                                    flags));

794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814
    /**
     * WebKitWebSettings::enable-site-specific-quirks
     *
     * Whether to turn on site-specific hacks.  Turning this on will
     * tell WebKitGTK+ to use some site-specific workarounds for
     * better web compatibility.  For example, older versions of
     * MediaWiki will incorrectly send WebKit a css file with KHTML
     * workarounds.  By turning on site-specific quirks, WebKit will
     * special-case this and other cases to make the sites work.
     *
     * Since: 1.1.18
     */
    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_SITE_SPECIFIC_QUIRKS,
                                    g_param_spec_boolean(
                                    "enable-site-specific-quirks",
                                    _("Enable Site Specific Quirks"),
                                    _("Enables the site-specific compatibility workarounds"),
                                    FALSE,
                                    flags));

815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834
    /**
    * WebKitWebSettings:enable-page-cache:
    *
    * Enable or disable the page cache. Disabling the page cache is
    * generally only useful for special circumstances like low-memory
    * scenarios or special purpose applications like static HTML
    * viewers. This setting only controls the Page Cache, this cache
    * is different than the disk-based or memory-based traditional
    * resource caches, its point is to make going back and forth
    * between pages much faster. For details about the different types
    * of caches and their purposes see:
    * http://webkit.org/blog/427/webkit-page-cache-i-the-basics/
    *
    * Since: 1.1.18
    */
    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_PAGE_CACHE,
                                    g_param_spec_boolean("enable-page-cache",
                                                         _("Enable page cache"),
                                                         _("Whether the page cache should be used"),
835
                                                         FALSE,
836 837
                                                         flags));

838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858
    /**
    * WebKitWebSettings:auto-resize-window:
    *
    * Web pages can request to modify the size and position of the
    * window containing the #WebKitWebView through various DOM methods
    * (resizeTo, moveTo, resizeBy, moveBy). By default WebKit will not
    * honor this requests, but you can set this property to %TRUE if
    * you'd like it to do so. If you wish to handle this manually, you
    * can connect to the notify signal for the
    * #WebKitWebWindowFeatures of your #WebKitWebView.
    * 
    * Since: 1.1.22
    */
    g_object_class_install_property(gobject_class,
                                    PROP_AUTO_RESIZE_WINDOW,
                                    g_param_spec_boolean("auto-resize-window",
                                                         _("Auto Resize Window"),
                                                         _("Automatically resize the toplevel window when a page requests it"),
                                                         FALSE,
                                                         flags));

859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874
    /**
     * WebKitWebSettings:enable-file-access-from-file-uris:
     *
     * Boolean property to control file access for file:// URIs. If this
     * option is enabled every file:// will have its own security unique domain.
     *
     * Since: 1.1.22
     */
     g_object_class_install_property(gobject_class,
                                     PROP_ENABLE_FILE_ACCESS_FROM_FILE_URIS,
                                     g_param_spec_boolean("enable-file-access-from-file-uris",
                                                          "Enable file access from file URIs",
                                                          "Controls file access for file:// URIs.",
                                                          FALSE,
                                                          flags));

875
   /**
xan@webkit.org's avatar
xan@webkit.org committed
876
    * WebKitWebSettings:enable-java-applet:
877
    *
878
    * Enable or disable support for the Java &lt;applet&gt; tag. Keep in
xan@webkit.org's avatar
xan@webkit.org committed
879
    * mind that Java content can be still shown in the page through
880
    * &lt;object&gt; or &lt;embed&gt;, which are the preferred tags for this task.
881 882 883 884
    *
    * Since: 1.1.22
    */
    g_object_class_install_property(gobject_class,
xan@webkit.org's avatar
xan@webkit.org committed
885 886 887 888
                                    PROP_ENABLE_JAVA_APPLET,
                                    g_param_spec_boolean("enable-java-applet",
                                                         _("Enable Java Applet"),
                                                         _("Whether Java Applet support through <applet> should be enabled"),
889 890
                                                         TRUE,
                                                         flags));
891

892 893 894 895 896
    /**
    * WebKitWebSettings:enable-hyperlink-auditing:
    *
    * Enable or disable support for <a ping>.
    *
897
    * Since: 1.2.5
898 899 900 901 902 903 904 905 906
    */
    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_HYPERLINK_AUDITING,
                                    g_param_spec_boolean("enable-hyperlink-auditing",
                                                         _("Enable Hyperlink Auditing"),
                                                         _("Whether <a ping> should be able to send pings"),
                                                         FALSE,
                                                         flags));

907 908 909 910 911 912 913 914 915
    /* Undocumented for now */
    g_object_class_install_property(gobject_class,
                                    PROP_ENABLE_FULLSCREEN,
                                    g_param_spec_boolean("enable-fullscreen",
                                                         _("Enable Fullscreen"),
                                                         _("Whether the Mozilla style API should be enabled."),
                                                         FALSE,
                                                         flags));

916 917 918 919 920 921 922 923
    g_type_class_add_private(klass, sizeof(WebKitWebSettingsPrivate));
}

static void webkit_web_settings_init(WebKitWebSettings* web_settings)
{
    web_settings->priv = WEBKIT_WEB_SETTINGS_GET_PRIVATE(web_settings);
}

924 925 926 927 928 929 930 931 932
static EnchantBroker* get_enchant_broker()
{
    static EnchantBroker* broker = 0;
    if (!broker)
        broker = enchant_broker_init();

    return broker;
}

933 934
static void free_spell_checking_language(gpointer data, gpointer user_data)
{
935 936
    EnchantDict* dict = static_cast<EnchantDict*>(data);
    EnchantBroker* broker = get_enchant_broker();
937

938
    enchant_broker_free_dict(broker, dict);
939 940
}

941 942 943 944 945 946 947 948 949 950 951 952 953
static void webkit_web_settings_finalize(GObject* object)
{
    WebKitWebSettings* web_settings = WEBKIT_WEB_SETTINGS(object);
    WebKitWebSettingsPrivate* priv = web_settings->priv;

    g_free(priv->default_encoding);
    g_free(priv->cursive_font_family);
    g_free(priv->default_font_family);
    g_free(priv->fantasy_font_family);
    g_free(priv->monospace_font_family);
    g_free(priv->sans_serif_font_family);
    g_free(priv->serif_font_family);
    g_free(priv->user_stylesheet_uri);
954 955
    g_free(priv->spell_checking_languages);

956 957
    g_slist_foreach(priv->enchant_dicts, free_spell_checking_language, 0);
    g_slist_free(priv->enchant_dicts);
958

959 960
    g_free(priv->user_agent);

961 962 963
    G_OBJECT_CLASS(webkit_web_settings_parent_class)->finalize(object);
}

964 965 966 967 968 969 970
static void getAvilableDictionariesCallback(const char* const languageTag, const char* const, const char* const, const char* const, void* data)
{
    Vector<CString>* dicts = static_cast<Vector<CString>*>(data);

    dicts->append(languageTag);
}

971 972 973 974
static void webkit_web_settings_set_property(GObject* object, guint prop_id, const GValue* value, GParamSpec* pspec)
{
    WebKitWebSettings* web_settings = WEBKIT_WEB_SETTINGS(object);
    WebKitWebSettingsPrivate* priv = web_settings->priv;
975
    EnchantBroker* broker;
976 977
    EnchantDict* dict;
    GSList* spellDictionaries = 0;
978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019

    switch(prop_id) {
    case PROP_DEFAULT_ENCODING:
        g_free(priv->default_encoding);
        priv->default_encoding = g_strdup(g_value_get_string(value));
        break;
    case PROP_CURSIVE_FONT_FAMILY:
        g_free(priv->cursive_font_family);
        priv->cursive_font_family = g_strdup(g_value_get_string(value));
        break;
    case PROP_DEFAULT_FONT_FAMILY:
        g_free(priv->default_font_family);
        priv->default_font_family = g_strdup(g_value_get_string(value));
        break;
    case PROP_FANTASY_FONT_FAMILY:
        g_free(priv->fantasy_font_family);
        priv->fantasy_font_family = g_strdup(g_value_get_string(value));
        break;
    case PROP_MONOSPACE_FONT_FAMILY:
        g_free(priv->monospace_font_family);
        priv->monospace_font_family = g_strdup(g_value_get_string(value));
        break;
    case PROP_SANS_SERIF_FONT_FAMILY:
        g_free(priv->sans_serif_font_family);
        priv->sans_serif_font_family = g_strdup(g_value_get_string(value));
        break;
    case PROP_SERIF_FONT_FAMILY:
        g_free(priv->serif_font_family);
        priv->serif_font_family = g_strdup(g_value_get_string(value));
        break;
    case PROP_DEFAULT_FONT_SIZE:
        priv->default_font_size = g_value_get_int(value);
        break;
    case PROP_DEFAULT_MONOSPACE_FONT_SIZE:
        priv->default_monospace_font_size = g_value_get_int(value);
        break;
    case PROP_MINIMUM_FONT_SIZE:
        priv->minimum_font_size = g_value_get_int(value);
        break;
    case PROP_MINIMUM_LOGICAL_FONT_SIZE:
        priv->minimum_logical_font_size = g_value_get_int(value);
        break;
1020 1021 1022
    case PROP_ENFORCE_96_DPI:
        priv->enforce_96_dpi = g_value_get_boolean(value);
        break;
1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044
    case PROP_AUTO_LOAD_IMAGES:
        priv->auto_load_images = g_value_get_boolean(value);
        break;
    case PROP_AUTO_SHRINK_IMAGES:
        priv->auto_shrink_images = g_value_get_boolean(value);
        break;
    case PROP_PRINT_BACKGROUNDS:
        priv->print_backgrounds = g_value_get_boolean(value);
        break;
    case PROP_ENABLE_SCRIPTS:
        priv->enable_scripts = g_value_get_boolean(value);
        break;
    case PROP_ENABLE_PLUGINS:
        priv->enable_plugins = g_value_get_boolean(value);
        break;
    case PROP_RESIZABLE_TEXT_AREAS:
        priv->resizable_text_areas = g_value_get_boolean(value);
        break;
    case PROP_USER_STYLESHEET_URI:
        g_free(priv->user_stylesheet_uri);
        priv->user_stylesheet_uri = g_strdup(g_value_get_string(value));
        break;
1045 1046 1047
    case PROP_ZOOM_STEP:
        priv->zoom_step = g_value_get_float(value);
        break;
1048 1049 1050
    case PROP_ENABLE_DEVELOPER_EXTRAS:
        priv->enable_developer_extras = g_value_get_boolean(value);
        break;
1051 1052
    case PROP_ENABLE_PRIVATE_BROWSING:
        priv->enable_private_browsing = g_value_get_boolean(value);
1053
        break;
1054 1055
    case PROP_ENABLE_CARET_BROWSING:
        priv->enable_caret_browsing = g_value_get_boolean(value);
1056
        break;
1057 1058 1059 1060 1061 1062
    case PROP_ENABLE_HTML5_DATABASE:
        priv->enable_html5_database = g_value_get_boolean(value);
        break;
    case PROP_ENABLE_HTML5_LOCAL_STORAGE:
        priv->enable_html5_local_storage = g_value_get_boolean(value);
        break;
1063 1064 1065
    case PROP_ENABLE_SPELL_CHECKING:
        priv->enable_spell_checking = g_value_get_boolean(value);
        break;
1066
    case PROP_SPELL_CHECKING_LANGUAGES:
1067
        g_free(priv->spell_checking_languages);
1068 1069
        priv->spell_checking_languages = g_strdup(g_value_get_string(value));

1070
        broker = get_enchant_broker();
1071 1072 1073
        if (priv->spell_checking_languages) {
            char** langs = g_strsplit(priv->spell_checking_languages, ",", -1);
            for (int i = 0; langs[i]; i++) {
1074
                if (enchant_broker_dict_exists(broker, langs[i])) {
1075 1076
                    dict = enchant_broker_request_dict(broker, langs[i]);
                    spellDictionaries = g_slist_append(spellDictionaries, dict);
1077
                }
1078 1079 1080 1081
            }
            g_strfreev(langs);
        } else {
            const char* language = pango_language_to_string(gtk_get_default_language());
1082
            if (enchant_broker_dict_exists(broker, language)) {
1083 1084
                dict = enchant_broker_request_dict(broker, language);
                spellDictionaries = g_slist_append(spellDictionaries, dict);
1085 1086 1087 1088 1089 1090 1091 1092
            } else {
                // No dictionaries selected, we get one from the list
                Vector<CString> allDictionaries;
                enchant_broker_list_dicts(broker, getAvilableDictionariesCallback, &allDictionaries);
                if (!allDictionaries.isEmpty()) {
                    dict = enchant_broker_request_dict(broker, allDictionaries[0].data());
                    spellDictionaries = g_slist_append(spellDictionaries, dict);
                }
1093
            }
1094
        }
1095 1096 1097
        g_slist_foreach(priv->enchant_dicts, free_spell_checking_language, 0);
        g_slist_free(priv->enchant_dicts);
        priv->enchant_dicts = spellDictionaries;
1098
        break;
1099 1100 1101
    case PROP_ENABLE_XSS_AUDITOR:
        priv->enable_xss_auditor = g_value_get_boolean(value);
        break;
1102 1103 1104
    case PROP_ENABLE_SPATIAL_NAVIGATION:
        priv->enable_spatial_navigation = g_value_get_boolean(value);
        break;
1105 1106 1107
    case PROP_ENABLE_FRAME_FLATTENING:
        priv->enable_frame_flattening = g_value_get_boolean(value);
        break;
1108 1109 1110
    case PROP_USER_AGENT:
        g_free(priv->user_agent);
        if (!g_value_get_string(value) || !strlen(g_value_get_string(value)))
1111
            priv->user_agent = g_strdup(webkitUserAgent().utf8().data());
1112 1113 1114
        else
            priv->user_agent = g_strdup(g_value_get_string(value));
        break;
1115 1116 1117
    case PROP_JAVASCRIPT_CAN_OPEN_WINDOWS_AUTOMATICALLY:
        priv->javascript_can_open_windows_automatically = g_value_get_boolean(value);
        break;
1118 1119 1120
    case PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD:
        priv->javascript_can_access_clipboard = g_value_get_boolean(value);
        break;
1121 1122 1123
    case PROP_ENABLE_OFFLINE_WEB_APPLICATION_CACHE:
        priv->enable_offline_web_application_cache = g_value_get_boolean(value);
        break;
1124 1125 1126
    case PROP_EDITING_BEHAVIOR:
        priv->editing_behavior = static_cast<WebKitEditingBehavior>(g_value_get_enum(value));
        break;
1127 1128 1129
    case PROP_ENABLE_UNIVERSAL_ACCESS_FROM_FILE_URIS:
        priv->enable_universal_access_from_file_uris = g_value_get_boolean(value);
        break;
1130 1131 1132
    case PROP_ENABLE_FILE_ACCESS_FROM_FILE_URIS:
        priv->enable_file_access_from_file_uris = g_value_get_boolean(value);
        break;
1133 1134 1135
    case PROP_ENABLE_DOM_PASTE:
        priv->enable_dom_paste = g_value_get_boolean(value);
        break;
1136
    case PROP_TAB_KEY_CYCLES_THROUGH_ELEMENTS:
1137
        priv->tab_key_cycles_through_elements = g_value_get_boolean(value);
1138
        break;
kov@webkit.org's avatar
kov@webkit.org committed
1139
    case PROP_ENABLE_DEFAULT_CONTEXT_MENU:
1140 1141 1142 1143
        priv->enable_default_context_menu = g_value_get_boolean(value);
        break;
    case PROP_ENABLE_SITE_SPECIFIC_QUIRKS:
        priv->enable_site_specific_quirks = g_value_get_boolean(value);
kov@webkit.org's avatar
kov@webkit.org committed
1144
        break;
1145 1146 1147
    case PROP_ENABLE_PAGE_CACHE:
        priv->enable_page_cache = g_value_get_boolean(value);
        break;
1148 1149 1150
    case PROP_AUTO_RESIZE_WINDOW:
        priv->auto_resize_window = g_value_get_boolean(value);
        break;
xan@webkit.org's avatar
xan@webkit.org committed
1151 1152
    case PROP_ENABLE_JAVA_APPLET:
        priv->enable_java_applet = g_value_get_boolean(value);
1153
        break;
1154 1155 1156
    case PROP_ENABLE_HYPERLINK_AUDITING:
        priv->enable_hyperlink_auditing = g_value_get_boolean(value);
        break;
1157 1158 1159
    case PROP_ENABLE_FULLSCREEN:
        priv->enable_fullscreen = g_value_get_boolean(value);
        break;
1160 1161 </