Changeset 80555 in webkit


Ignore:
Timestamp:
Mar 8, 2011 2:04:13 AM (13 years ago)
Author:
Carlos Garcia Campos
Message:

2011-03-08 Carlos Garcia Campos <cgarcia@igalia.com>

Reviewed by Martin Robinson.

[GTK] Do not set juntion sides on scrollbar stepper buttons
https://bugs.webkit.org/show_bug.cgi?id=55868

Fixes rendering of steppers for themes using rounded stepper
buttons on scrollbars like Adwaita.

  • platform/gtk/ScrollbarThemeGtk3.cpp: (WebCore::ScrollbarThemeGtk::paintButton):
Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r80554 r80555  
     12011-03-08  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        Reviewed by Martin Robinson.
     4
     5        [GTK] Do not set juntion sides on scrollbar stepper buttons
     6        https://bugs.webkit.org/show_bug.cgi?id=55868
     7
     8        Fixes rendering of steppers for themes using rounded stepper
     9        buttons on scrollbars like Adwaita.
     10
     11        * platform/gtk/ScrollbarThemeGtk3.cpp:
     12        (WebCore::ScrollbarThemeGtk::paintButton):
     13
    1142011-03-08  Carlos Garcia Campos  <cgarcia@igalia.com>
    215
  • trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk3.cpp

    r80554 r80555  
    136136    gtk_style_context_set_state(m_context, static_cast<GtkStateFlags>(flags));
    137137
    138     guint sides = gtk_style_context_get_junction_sides(m_context);
    139     if (scrollbar->orientation() == VerticalScrollbar)
    140         sides &= ~(GTK_JUNCTION_TOP | GTK_JUNCTION_BOTTOM);
    141     else
    142         sides &= ~(GTK_JUNCTION_LEFT | GTK_JUNCTION_RIGHT);
    143 
    144     switch (part) {
    145     case BackButtonStartPart:
    146         sides |= (scrollbar->orientation() == VerticalScrollbar) ? GTK_JUNCTION_BOTTOM : GTK_JUNCTION_RIGHT;
    147         break;
    148     case BackButtonEndPart:
    149     case ForwardButtonEndPart:
    150         sides |= (scrollbar->orientation() == VerticalScrollbar) ?
    151                 GTK_JUNCTION_TOP | GTK_JUNCTION_BOTTOM : GTK_JUNCTION_RIGHT | GTK_JUNCTION_LEFT;
    152         break;
    153     case ForwardButtonStartPart:
    154         sides |= (scrollbar->orientation() == VerticalScrollbar) ? GTK_JUNCTION_TOP : GTK_JUNCTION_LEFT;
    155         break;
    156     default:
    157         ASSERT_NOT_REACHED();
    158     }
    159     gtk_style_context_set_junction_sides(m_context, static_cast<GtkJunctionSides>(sides));
    160138    gtk_style_context_add_class(m_context, GTK_STYLE_CLASS_BUTTON);
    161 
    162139    gtk_render_background(m_context, context->platformContext(), rect.x(), rect.y(), rect.width(), rect.height());
    163140    gtk_render_frame(m_context, context->platformContext(), rect.x(), rect.y(), rect.width(), rect.height());
     
    166143    gtk_style_context_get_style(m_context, "arrow-scaling", &arrowScaling, NULL);
    167144
    168     IntSize arrowSize = rect.size();
    169     arrowSize.scale(arrowScaling);
    170     FloatPoint arrowPoint(rect.x() + (rect.width() - arrowSize.width()) / 2,
    171                           rect.y() + (rect.height() - arrowSize.height()) / 2);
     145    double arrowSize = std::min(rect.width(), rect.height()) * arrowScaling;
     146    FloatPoint arrowPoint(rect.x() + (rect.width() - arrowSize) / 2,
     147                          rect.y() + (rect.height() - arrowSize) / 2);
    172148
    173149    if (flags & GTK_STATE_FLAG_ACTIVE) {
     
    180156    }
    181157
    182     gdouble angle, size;
     158    gdouble angle;
    183159    if (scrollbar->orientation() == VerticalScrollbar) {
    184         size = arrowSize.width();
    185160        angle = (part == ForwardButtonEndPart || part == ForwardButtonStartPart) ? G_PI : 0;
    186161    } else {
    187         size = arrowSize.height();
    188162        angle = (part == ForwardButtonEndPart || part == ForwardButtonStartPart) ? G_PI / 2 : 3 * (G_PI / 2);
    189163    }
    190164
    191     gtk_render_arrow(m_context, context->platformContext(), angle, arrowPoint.x(), arrowPoint.y(), size);
     165    gtk_render_arrow(m_context, context->platformContext(), angle, arrowPoint.x(), arrowPoint.y(), arrowSize);
    192166
    193167    gtk_style_context_restore(m_context);
Note: See TracChangeset for help on using the changeset viewer.