Title: [109229] trunk/Source/WebKit2
Revision
109229
Author
[email protected]
Date
2012-02-29 10:45:14 -0800 (Wed, 29 Feb 2012)

Log Message

[GTK] Add zoom-text-only setting to WebKit2 GTK+ API
https://bugs.webkit.org/show_bug.cgi?id=75249

Reviewed by Gustavo Noronha Silva.

To set whether zoom level of web view should affect only the text
or all page contents. It's disabled by default.

* UIProcess/API/gtk/WebKitSettings.cpp:
(webKitSettingsSetProperty):
(webKitSettingsGetProperty):
(webkit_settings_class_init): Add WebKitSettings:zoom-text-only
property.
(webkit_settings_set_zoom_text_only): Set
WebKitSettings:zoom-text-only.
(webkit_settings_get_zoom_text_only): Get
WebKitSettings:zoom-text-only.
* UIProcess/API/gtk/WebKitSettings.h:
* UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new
symbols.
* UIProcess/API/gtk/tests/TestWebKitSettings.cpp:
(testWebKitSettings):

Modified Paths

Diff

Modified: trunk/Source/WebKit2/ChangeLog (109228 => 109229)


--- trunk/Source/WebKit2/ChangeLog	2012-02-29 18:15:32 UTC (rev 109228)
+++ trunk/Source/WebKit2/ChangeLog	2012-02-29 18:45:14 UTC (rev 109229)
@@ -1,3 +1,28 @@
+2012-02-29  Carlos Garcia Campos  <[email protected]>
+
+        [GTK] Add zoom-text-only setting to WebKit2 GTK+ API
+        https://bugs.webkit.org/show_bug.cgi?id=75249
+
+        Reviewed by Gustavo Noronha Silva.
+
+        To set whether zoom level of web view should affect only the text
+        or all page contents. It's disabled by default.
+
+        * UIProcess/API/gtk/WebKitSettings.cpp:
+        (webKitSettingsSetProperty):
+        (webKitSettingsGetProperty):
+        (webkit_settings_class_init): Add WebKitSettings:zoom-text-only
+        property.
+        (webkit_settings_set_zoom_text_only): Set
+        WebKitSettings:zoom-text-only.
+        (webkit_settings_get_zoom_text_only): Get
+        WebKitSettings:zoom-text-only.
+        * UIProcess/API/gtk/WebKitSettings.h:
+        * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new
+        symbols.
+        * UIProcess/API/gtk/tests/TestWebKitSettings.cpp:
+        (testWebKitSettings):
+
 2012-02-29  Sergio Villar Senin  <[email protected]>
 
         DidFindString should be emitted even if FindOptionsShowOverlay is not enabled

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp (109228 => 109229)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp	2012-02-29 18:15:32 UTC (rev 109228)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp	2012-02-29 18:45:14 UTC (rev 109229)
@@ -46,6 +46,7 @@
     CString fantasyFontFamily;
     CString pictographFontFamily;
     CString defaultCharset;
+    bool zoomTextOnly;
 };
 
 /**
@@ -103,7 +104,8 @@
     PROP_ENABLE_FULLSCREEN,
     PROP_PRINT_BACKGROUNDS,
     PROP_ENABLE_WEBAUDIO,
-    PROP_ENABLE_WEBGL
+    PROP_ENABLE_WEBGL,
+    PROP_ZOOM_TEXT_ONLY
 };
 
 static void webKitSettingsSetProperty(GObject* object, guint propId, const GValue* value, GParamSpec* paramSpec)
@@ -210,6 +212,9 @@
     case PROP_ENABLE_WEBGL:
         webkit_settings_set_enable_webgl(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;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
         break;
@@ -320,6 +325,9 @@
     case PROP_ENABLE_WEBGL:
         g_value_set_boolean(value, webkit_settings_get_enable_webgl(settings));
         break;
+    case PROP_ZOOM_TEXT_ONLY:
+        g_value_set_boolean(value, webkit_settings_get_zoom_text_only(settings));
+        break;
     default:
         G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
         break;
@@ -816,6 +824,22 @@
                                                          FALSE,
                                                          readWriteConstructParamFlags));
 
+    /**
+     * WebKitSettings:zoom-text-only:
+     *
+     * Whether #WebKitWebView:zoom-level affects only the
+     * text of the page or all the contents. Other contents containing text
+     * like form controls will be also affected by zoom factor when
+     * this property is enabled.
+     */
+    g_object_class_install_property(gObjectClass,
+                                    PROP_ZOOM_TEXT_ONLY,
+                                    g_param_spec_boolean("zoom-text-only",
+                                                         _("Zoom Text Only"),
+                                                         _("Whether zoom level of web view changes only the text size"),
+                                                         FALSE,
+                                                         readWriteConstructParamFlags));
+
     g_type_class_add_private(klass, sizeof(WebKitSettingsPrivate));
 }
 
@@ -2073,3 +2097,39 @@
     WKPreferencesSetWebGLEnabled(priv->preferences.get(), enabled);
     g_object_notify(G_OBJECT(settings), "enable-webgl");
 }
+
+/**
+ * webkit_settings_set_zoom_text_only:
+ * @settings: a #WebKitSettings
+ * @zoom_text_only: Value to be set
+ *
+ * Set the #WebKitSettings:zoom-text-only property.
+ */
+void webkit_settings_set_zoom_text_only(WebKitSettings* settings, gboolean zoomTextOnly)
+{
+    g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
+
+    WebKitSettingsPrivate* priv = settings->priv;
+    if (priv->zoomTextOnly == zoomTextOnly)
+        return;
+
+    priv->zoomTextOnly = zoomTextOnly;
+    g_object_notify(G_OBJECT(settings), "zoom-text-only");
+}
+
+/**
+ * webkit_settings_get_zoom_text_only:
+ * @settings: a #WebKitSettings
+ *
+ * Get the #WebKitSettings:zoom-text-only property.
+ *
+ * Returns: %TRUE If zoom level of the view should only affect the text
+ *    or %FALSE if all view contents should be scaled.
+ */
+gboolean webkit_settings_get_zoom_text_only(WebKitSettings* settings)
+{
+    g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
+
+    return settings->priv->zoomTextOnly;
+}
+

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h (109228 => 109229)


--- trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h	2012-02-29 18:15:32 UTC (rev 109228)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h	2012-02-29 18:45:14 UTC (rev 109229)
@@ -307,6 +307,13 @@
 webkit_settings_set_enable_webgl                               (WebKitSettings *settings,
                                                                 gboolean        enabled);
 
+WEBKIT_API void
+webkit_settings_set_zoom_text_only                             (WebKitSettings *settings,
+                                                                gboolean        zoom_text_only);
+
+WEBKIT_API gboolean
+webkit_settings_get_zoom_text_only                             (WebKitSettings *settings);
+
 G_END_DECLS
 
 #endif /* WebKitSettings_h */

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt (109228 => 109229)


--- trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt	2012-02-29 18:15:32 UTC (rev 109228)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt	2012-02-29 18:45:14 UTC (rev 109229)
@@ -221,6 +221,8 @@
 webkit_settings_set_enable_webaudio
 webkit_settings_get_enable_webgl
 webkit_settings_set_enable_webgl
+webkit_settings_get_zoom_text_only
+webkit_settings_set_zoom_text_only
 
 <SUBSECTION Standard>
 WebKitSettingsClass

Modified: trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp (109228 => 109229)


--- trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp	2012-02-29 18:15:32 UTC (rev 109228)
+++ trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp	2012-02-29 18:45:14 UTC (rev 109229)
@@ -199,6 +199,11 @@
     webkit_settings_set_enable_webgl(settings, TRUE);
     g_assert(webkit_settings_get_enable_webgl(settings));
 
+    // Zoom text only is disabled by default.
+    g_assert(!webkit_settings_get_zoom_text_only(settings));
+    webkit_settings_set_zoom_text_only(settings, TRUE);
+    g_assert(webkit_settings_get_zoom_text_only(settings));
+
     g_object_unref(G_OBJECT(settings));
 }
 
_______________________________________________
webkit-changes mailing list
[email protected]
http://lists.webkit.org/mailman/listinfo.cgi/webkit-changes

Reply via email to