diff options
author | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-15 16:08:57 +0200 |
---|---|---|
committer | Simon Hausmann <simon.hausmann@digia.com> | 2012-10-15 16:08:57 +0200 |
commit | 5466563f4b5b6b86523e3f89bb7f77e5b5270c78 (patch) | |
tree | 8caccf7cd03a15207cde3ba282c88bf132482a91 /Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp | |
parent | 33b26980cb24288b5a9f2590ccf32a949281bb79 (diff) | |
download | qtwebkit-5466563f4b5b6b86523e3f89bb7f77e5b5270c78.tar.gz |
Imported WebKit commit 0dc6cd75e1d4836eaffbb520be96fac4847cc9d2 (http://svn.webkit.org/repository/webkit/trunk@131300)
WebKit update which introduces the QtWebKitWidgets module that contains the WK1
widgets based API. (In fact it renames QtWebKit to QtWebKitWidgets while we're
working on completing the entire split as part of
https://bugs.webkit.org/show_bug.cgi?id=99314
Diffstat (limited to 'Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp')
-rw-r--r-- | Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp | 58 |
1 files changed, 57 insertions, 1 deletions
diff --git a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp index c0a64162a..17d4c881b 100644 --- a/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp +++ b/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp @@ -34,6 +34,7 @@ #include "WebKitPrivate.h" #include "WebKitSettingsPrivate.h" #include "WebPageProxy.h" +#include "WebPreferences.h" #include <WebCore/UserAgentGtk.h> #include <glib/gi18n-lib.h> #include <wtf/text/CString.h> @@ -117,7 +118,8 @@ enum { PROP_DRAW_COMPOSITING_INDICATORS, PROP_ENABLE_SITE_SPECIFIC_QUIRKS, PROP_ENABLE_PAGE_CACHE, - PROP_USER_AGENT + PROP_USER_AGENT, + PROP_ENABLE_SMOOTH_SCROLLING }; static void webKitSettingsSetProperty(GObject* object, guint propId, const GValue* value, GParamSpec* paramSpec) @@ -251,6 +253,9 @@ static void webKitSettingsSetProperty(GObject* object, guint propId, const GValu case PROP_USER_AGENT: webkit_settings_set_user_agent(settings, g_value_get_string(value)); break; + case PROP_ENABLE_SMOOTH_SCROLLING: + webkit_settings_set_enable_smooth_scrolling(settings, g_value_get_boolean(value)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec); break; @@ -388,6 +393,9 @@ static void webKitSettingsGetProperty(GObject* object, guint propId, GValue* val case PROP_USER_AGENT: g_value_set_string(value, webkit_settings_get_user_agent(settings)); break; + case PROP_ENABLE_SMOOTH_SCROLLING: + g_value_set_boolean(value, webkit_settings_get_enable_smooth_scrolling(settings)); + break; default: G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec); break; @@ -1039,6 +1047,19 @@ static void webkit_settings_class_init(WebKitSettingsClass* klass) 0, // A null string forces the standard user agent. readWriteConstructParamFlags)); + /** + * WebKitSettings:enable-smooth-scrolling: + * + * Enable or disable smooth scrolling. + */ + g_object_class_install_property(gObjectClass, + PROP_ENABLE_SMOOTH_SCROLLING, + g_param_spec_boolean("enable-smooth-scrolling", + _("Enable smooth scrolling"), + _("Whether to enable smooth scrolling"), + FALSE, + readWriteConstructParamFlags)); + g_type_class_add_private(klass, sizeof(WebKitSettingsPrivate)); } @@ -2644,3 +2665,38 @@ void webkit_settings_set_user_agent_with_application_details(WebKitSettings* set CString newUserAgent = WebCore::standardUserAgent(String::fromUTF8(applicationName), String::fromUTF8(applicationVersion)).utf8(); webkit_settings_set_user_agent(settings, newUserAgent.data()); } + +/** + * webkit_settings_get_enable_smooth_scrolling: + * @settings: a #WebKitSettings + * + * Get the #WebKitSettings:enable-smooth-scrolling property. + * + * Returns: %TRUE if smooth scrolling is enabled or %FALSE otherwise. + */ +gboolean webkit_settings_get_enable_smooth_scrolling(WebKitSettings* settings) +{ + g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE); + + return WebKit::toImpl(settings->priv->preferences.get())->scrollAnimatorEnabled(); +} + +/** + * webkit_settings_set_enable_smooth_scrolling: + * @settings: a #WebKitSettings + * @enabled: Value to be set + * + * Set the #WebKitSettings:enable-smooth-scrolling property. + */ +void webkit_settings_set_enable_smooth_scrolling(WebKitSettings* settings, gboolean enabled) +{ + g_return_if_fail(WEBKIT_IS_SETTINGS(settings)); + + WebKitSettingsPrivate* priv = settings->priv; + bool currentValue = WebKit::toImpl(priv->preferences.get())->scrollAnimatorEnabled(); + if (currentValue == enabled) + return; + + WebKit::toImpl(priv->preferences.get())->setScrollAnimatorEnabled(enabled); + g_object_notify(G_OBJECT(settings), "enable-smooth-scrolling"); +} |