Changeset 196364 in webkit


Ignore:
Timestamp:
Feb 9, 2016 10:58:44 PM (8 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] Toggle buttons are blurry with GTK+ 3.19
https://bugs.webkit.org/show_bug.cgi?id=154007

Reviewed by Michael Catanzaro.

Use min-width/min-height style properties when GTK+ >= 3.19.7 to
get the size of toggle buttons.

  • rendering/RenderThemeGtk.cpp:

(WebCore::setToggleSize):
(WebCore::paintToggle):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r196360 r196364  
     12016-02-09  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Toggle buttons are blurry with GTK+ 3.19
     4        https://bugs.webkit.org/show_bug.cgi?id=154007
     5
     6        Reviewed by Michael Catanzaro.
     7
     8        Use min-width/min-height style properties when GTK+ >= 3.19.7 to
     9        get the size of toggle buttons.
     10
     11        * rendering/RenderThemeGtk.cpp:
     12        (WebCore::setToggleSize):
     13        (WebCore::paintToggle):
     14
    1152016-02-09  Aakash Jain  <aakash_jain@apple.com>
    216
  • trunk/Source/WebCore/rendering/RenderThemeGtk.cpp

    r196171 r196364  
    544544    gint indicatorSize;
    545545    gtk_style_context_get_style(context.get(), "indicator-size", &indicatorSize, nullptr);
     546    IntSize minSize(indicatorSize, indicatorSize);
     547
     548#if GTK_CHECK_VERSION(3, 19, 7)
     549    GRefPtr<GtkStyleContext> childContext = createStyleContext(themePart == CheckButton ? CheckButtonCheck : RadioButtonRadio, context.get());
     550    gint minWidth, minHeight;
     551    gtk_style_context_get(childContext.get(), gtk_style_context_get_state(childContext.get()), "min-width", &minWidth, "min-height", &minHeight, nullptr);
     552    if (minWidth)
     553        minSize.setWidth(minWidth);
     554    if (minHeight)
     555        minSize.setHeight(minHeight);
     556#endif
    546557
    547558    if (style.width().isIntrinsicOrAuto())
    548         style.setWidth(Length(indicatorSize, Fixed));
     559        style.setWidth(Length(minSize.width(), Fixed));
    549560
    550561    if (style.height().isAuto())
    551         style.setHeight(Length(indicatorSize, Fixed));
     562        style.setHeight(Length(minSize.height(), Fixed));
    552563}
    553564
     
    581592    gint indicatorSize;
    582593    gtk_style_context_get_style(context.get(), "indicator-size", &indicatorSize, nullptr);
     594    IntSize minSize(indicatorSize, indicatorSize);
     595
     596#if GTK_CHECK_VERSION(3, 19, 7)
     597    gint minWidth, minHeight;
     598    gtk_style_context_get(context.get(), gtk_style_context_get_state(context.get()), "min-width", &minWidth, "min-height", &minHeight, nullptr);
     599    if (minWidth)
     600        minSize.setWidth(minWidth);
     601    if (minHeight)
     602        minSize.setHeight(minHeight);
     603#endif
     604
    583605    IntRect rect(fullRect);
    584     if (rect.width() > indicatorSize) {
    585         rect.inflateX(-(rect.width() - indicatorSize) / 2);
    586         rect.setWidth(indicatorSize); // In case rect.width() was equal to indicatorSize + 1.
    587     }
    588 
    589     if (rect.height() > indicatorSize) {
    590         rect.inflateY(-(rect.height() - indicatorSize) / 2);
    591         rect.setHeight(indicatorSize); // In case rect.height() was equal to indicatorSize + 1.
     606    if (rect.width() > minSize.width()) {
     607        rect.inflateX(-(rect.width() - minSize.width()) / 2);
     608        rect.setWidth(minSize.width()); // In case rect.width() was equal to minSize.width() + 1.
     609    }
     610
     611    if (rect.height() > minSize.height()) {
     612        rect.inflateY(-(rect.height() - minSize.height()) / 2);
     613        rect.setHeight(minSize.height()); // In case rect.height() was equal to minSize.height() + 1.
    592614    }
    593615
Note: See TracChangeset for help on using the changeset viewer.