⚠ Archived content — this site is no longer maintained.   Current WebKit documentation is at docs.webkit.org.

Changeset 109229 in webkit


Ignore:
Timestamp:
Feb 29, 2012, 10:45:14 AM (15 years ago)
Author:
Carlos Garcia Campos
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):

Location:
trunk/Source/WebKit2
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebKit2/ChangeLog

    r109228 r109229  
     12012-02-29  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Add zoom-text-only setting to WebKit2 GTK+ API
     4        https://bugs.webkit.org/show_bug.cgi?id=75249
     5
     6        Reviewed by Gustavo Noronha Silva.
     7
     8        To set whether zoom level of web view should affect only the text
     9        or all page contents. It's disabled by default.
     10
     11        * UIProcess/API/gtk/WebKitSettings.cpp:
     12        (webKitSettingsSetProperty):
     13        (webKitSettingsGetProperty):
     14        (webkit_settings_class_init): Add WebKitSettings:zoom-text-only
     15        property.
     16        (webkit_settings_set_zoom_text_only): Set
     17        WebKitSettings:zoom-text-only.
     18        (webkit_settings_get_zoom_text_only): Get
     19        WebKitSettings:zoom-text-only.
     20        * UIProcess/API/gtk/WebKitSettings.h:
     21        * UIProcess/API/gtk/docs/webkit2gtk-sections.txt: Add new
     22        symbols.
     23        * UIProcess/API/gtk/tests/TestWebKitSettings.cpp:
     24        (testWebKitSettings):
     25
    1262012-02-29  Sergio Villar Senin  <svillar@igalia.com>
    227
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.cpp

    r108512 r109229  
    4747    CString pictographFontFamily;
    4848    CString defaultCharset;
     49    bool zoomTextOnly;
    4950};
    5051
    … …  
    104105    PROP_PRINT_BACKGROUNDS,
    105106    PROP_ENABLE_WEBAUDIO,
    106     PROP_ENABLE_WEBGL
     107    PROP_ENABLE_WEBGL,
     108    PROP_ZOOM_TEXT_ONLY
    107109};
    108110
    … …  
    211213        webkit_settings_set_enable_webgl(settings, g_value_get_boolean(value));
    212214        break;
     215    case PROP_ZOOM_TEXT_ONLY:
     216        webkit_settings_set_zoom_text_only(settings, g_value_get_boolean(value));
     217        break;
    213218    default:
    214219        G_OBJECT_WARN_INVALID_PROPERTY_ID(object, propId, paramSpec);
    … …  
    320325    case PROP_ENABLE_WEBGL:
    321326        g_value_set_boolean(value, webkit_settings_get_enable_webgl(settings));
     327        break;
     328    case PROP_ZOOM_TEXT_ONLY:
     329        g_value_set_boolean(value, webkit_settings_get_zoom_text_only(settings));
    322330        break;
    323331    default:
    … …  
    817825                                                         readWriteConstructParamFlags));
    818826
     827    /**
     828     * WebKitSettings:zoom-text-only:
     829     *
     830     * Whether #WebKitWebView:zoom-level affects only the
     831     * text of the page or all the contents. Other contents containing text
     832     * like form controls will be also affected by zoom factor when
     833     * this property is enabled.
     834     */
     835    g_object_class_install_property(gObjectClass,
     836                                    PROP_ZOOM_TEXT_ONLY,
     837                                    g_param_spec_boolean("zoom-text-only",
     838                                                         _("Zoom Text Only"),
     839                                                         _("Whether zoom level of web view changes only the text size"),
     840                                                         FALSE,
     841                                                         readWriteConstructParamFlags));
     842
    819843    g_type_class_add_private(klass, sizeof(WebKitSettingsPrivate));
    820844}
    … …  
    20742098    g_object_notify(G_OBJECT(settings), "enable-webgl");
    20752099}
     2100
     2101/**
     2102 * webkit_settings_set_zoom_text_only:
     2103 * @settings: a #WebKitSettings
     2104 * @zoom_text_only: Value to be set
     2105 *
     2106 * Set the #WebKitSettings:zoom-text-only property.
     2107 */
     2108void webkit_settings_set_zoom_text_only(WebKitSettings* settings, gboolean zoomTextOnly)
     2109{
     2110    g_return_if_fail(WEBKIT_IS_SETTINGS(settings));
     2111
     2112    WebKitSettingsPrivate* priv = settings->priv;
     2113    if (priv->zoomTextOnly == zoomTextOnly)
     2114        return;
     2115
     2116    priv->zoomTextOnly = zoomTextOnly;
     2117    g_object_notify(G_OBJECT(settings), "zoom-text-only");
     2118}
     2119
     2120/**
     2121 * webkit_settings_get_zoom_text_only:
     2122 * @settings: a #WebKitSettings
     2123 *
     2124 * Get the #WebKitSettings:zoom-text-only property.
     2125 *
     2126 * Returns: %TRUE If zoom level of the view should only affect the text
     2127 *    or %FALSE if all view contents should be scaled.
     2128 */
     2129gboolean webkit_settings_get_zoom_text_only(WebKitSettings* settings)
     2130{
     2131    g_return_val_if_fail(WEBKIT_IS_SETTINGS(settings), FALSE);
     2132
     2133    return settings->priv->zoomTextOnly;
     2134}
     2135
  • trunk/Source/WebKit2/UIProcess/API/gtk/WebKitSettings.h

    r108512 r109229  
    308308                                                                gboolean        enabled);
    309309
     310WEBKIT_API void
     311webkit_settings_set_zoom_text_only                             (WebKitSettings *settings,
     312                                                                gboolean        zoom_text_only);
     313
     314WEBKIT_API gboolean
     315webkit_settings_get_zoom_text_only                             (WebKitSettings *settings);
     316
    310317G_END_DECLS
    311318
  • trunk/Source/WebKit2/UIProcess/API/gtk/docs/webkit2gtk-sections.txt

    r109222 r109229  
    222222webkit_settings_get_enable_webgl
    223223webkit_settings_set_enable_webgl
     224webkit_settings_get_zoom_text_only
     225webkit_settings_set_zoom_text_only
    224226
    225227<SUBSECTION Standard>
  • trunk/Source/WebKit2/UIProcess/API/gtk/tests/TestWebKitSettings.cpp

    r108512 r109229  
    200200    g_assert(webkit_settings_get_enable_webgl(settings));
    201201
     202    // Zoom text only is disabled by default.
     203    g_assert(!webkit_settings_get_zoom_text_only(settings));
     204    webkit_settings_set_zoom_text_only(settings, TRUE);
     205    g_assert(webkit_settings_get_zoom_text_only(settings));
     206
    202207    g_object_unref(G_OBJECT(settings));
    203208}
Note: See TracChangeset for help on using the changeset viewer.