diff options
author | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-25 13:35:59 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@nokia.com> | 2012-06-25 13:35:59 +0200 |
commit | 79ad030d505ccf79cf10aa9f8189ca3e2f61f6f4 (patch) | |
tree | 0287b1a69d84492c901e8bc820e635e7133809a0 /Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp | |
parent | 682ab87480e7757346802ce7f54cfdbdfeb2339e (diff) | |
download | qtwebkit-79ad030d505ccf79cf10aa9f8189ca3e2f61f6f4.tar.gz |
Imported WebKit commit c4b613825abd39ac739a47d7b4410468fcef66dc (http://svn.webkit.org/repository/webkit/trunk@121147)
New snapshot that includes Win32 debug build fix (use SVGAllInOne)
Diffstat (limited to 'Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp | 61 |
1 files changed, 61 insertions, 0 deletions
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp index 02e82b020..9e24aabb1 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp @@ -33,6 +33,7 @@ #include "WebKitPrivate.h" #include "WebKitSettingsPrivate.h" +#include "WebPageProxy.h" #include <glib/gi18n-lib.h> #include <wtf/text/CString.h> @@ -46,6 +47,7 @@ struct _WebKitSettingsPrivate { CString fantasyFontFamily; CString pictographFontFamily; CString defaultCharset; + bool allowModalDialogs; bool zoomTextOnly; }; @@ -105,6 +107,7 @@ enum { PROP_PRINT_BACKGROUNDS, PROP_ENABLE_WEBAUDIO, PROP_ENABLE_WEBGL, + PROP_ALLOW_MODAL_DIALOGS, PROP_ZOOM_TEXT_ONLY, PROP_JAVASCRIPT_CAN_ACCESS_CLIPBOARD, PROP_MEDIA_PLAYBACK_REQUIRES_USER_GESTURE, @@ -216,6 +219,9 @@ static void webKitSettingsSetProperty(GObject* object, guint propId, const GValu case PROP_ENABLE_WEBGL: webkit_settings_set_enable_webgl(settings, g_value_get_boolean(value)); break; + case PROP_ALLOW_MODAL_DIALOGS: + webkit_settings_set_allow_modal_dialogs(settings, g_value_get_boolean(value)); + break; case PROP_ZOOM_TEXT_ONLY: webkit_settings_set_zoom_text_only(settings, g_value_get_boolean(value)); break; @@ -341,6 +347,9 @@ static void webKitSettingsGetProperty(GObject* object, guint propId, GValue* val case PROP_ENABLE_WEBGL: g_value_set_boolean(value, webkit_settings_get_enable_webgl(settings)); break; + case PROP_ALLOW_MODAL_DIALOGS: + g_value_set_boolean(value, webkit_settings_get_allow_modal_dialogs(settings)); + break; case PROP_ZOOM_TEXT_ONLY: g_value_set_boolean(value, webkit_settings_get_zoom_text_only(settings)); break; @@ -853,6 +862,24 @@ static void webkit_settings_class_init(WebKitSettingsClass* klass) readWriteConstructParamFlags)); /** + * WebKitSettings:allow-modal-dialogs: + * + * Determine whether it's allowed to create and run modal dialogs + * from a #WebKitWebView through JavaScript with + * <function>window.showModalDialog</function>. If it's set to + * %FALSE, the associated #WebKitWebView won't be able to create + * new modal dialogs, so not even the #WebKitWebView::create + * signal will be emitted. + */ + g_object_class_install_property(gObjectClass, + PROP_ALLOW_MODAL_DIALOGS, + g_param_spec_boolean("allow-modal-dialogs", + _("Allow modal dialogs"), + _("Whether it is possible to create modal dialogs"), + FALSE, + readWriteConstructParamFlags)); + + /** * WebKitSettings:zoom-text-only: * * Whether #WebKitWebView:zoom-level affects only the @@ -969,6 +996,7 @@ static void webkit_settings_init(WebKitSettings* settings) void webkitSettingsAttachSettingsToPage(WebKitSettings* settings, WKPageRef wkPage) { WKPageGroupSetPreferences(WKPageGetPageGroup(wkPage), settings->priv->preferences.get()); + WebKit::toImpl(wkPage)->setCanRunModal(settings->priv->allowModalDialogs); } /** @@ -2189,6 +2217,39 @@ void webkit_settings_set_enable_webgl(WebKitSettings* settings, gboolean enabled } /** + * webkit_settings_set_allow_modal_dialogs: + * @settings: a #WebKitSettings + * @allowed: Value to be set + * + * Set the #WebKitSettings:allow-modal-dialogs property. + */ +void webkit_settings_set_allow_modal_dialogs(WebKitSettings* settings, gboolean allowed) +{ + g_return_if_fail(WEBKIT_IS_SETTINGS(settings)); + + WebKitSettingsPrivate* priv = settings->priv; + if (priv->allowModalDialogs == allowed) + return; + + priv->allowModalDialogs = allowed; + g_object_notify(G_OBJECT(settings), "allow-modal-dialogs"); +} + +/** + * webkit_settings_get_allow_modal_dialogs: + * @settings: a #WebKitSettings + * + * Get the #WebKitSettings:allow-modal-dialogs property. + * + * Returns: %TRUE if it's allowed to create and run modal dialogs or %FALSE otherwise. + */ +gboolean webkit_settings_get_allow_modal_dialogs(WebKitSettings* settings) +{ + g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE); + return settings->priv->allowModalDialogs; +} + +/** * webkit_settings_set_zoom_text_only: * @settings: a #WebKitSettings * @zoom_text_only: Value to be set |