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

Changeset 181744 in webkit


Ignore:
Timestamp:
Mar 19, 2015, 3:24:50 AM (11 years ago)
Author:
Carlos Garcia Campos
Message:

[GTK] Scrollbars look bad with GTK+ 3.16
https://bugs.webkit.org/show_bug.cgi?id=140800

Reviewed by Sergio Villar Senin.

Take margin into account when rendering scrollbars. This fixes the
huge scrollbars rendered with GTK+ 3.16. We don't need to check
the GTK+ version because in previous versions the marging were 0,
so the same code just works.

  • platform/gtk/ScrollbarThemeGtk.cpp:

(WebCore::adjustRectAccordingToMargin):
(WebCore::ScrollbarThemeGtk::paintTrackBackground):
(WebCore::ScrollbarThemeGtk::paintThumb):

Location:
trunk/Source/WebCore
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Source/WebCore/ChangeLog

    r181736 r181744  
     12015-03-19  Carlos Garcia Campos  <cgarcia@igalia.com>
     2
     3        [GTK] Scrollbars look bad with GTK+ 3.16
     4        https://bugs.webkit.org/show_bug.cgi?id=140800
     5
     6        Reviewed by Sergio Villar Senin.
     7
     8        Take margin into account when rendering scrollbars. This fixes the
     9        huge scrollbars rendered with GTK+ 3.16. We don't need to check
     10        the GTK+ version because in previous versions the marging were 0,
     11        so the same code just works.
     12
     13        * platform/gtk/ScrollbarThemeGtk.cpp:
     14        (WebCore::adjustRectAccordingToMargin):
     15        (WebCore::ScrollbarThemeGtk::paintTrackBackground):
     16        (WebCore::ScrollbarThemeGtk::paintThumb):
     17
    1182015-03-19  Xabier Rodriguez Calvar <calvaris@igalia.com> and Youenn Fablet  <youenn.fablet@crf.canon.fr>
    219
  • trunk/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp

    r173110 r181744  
    279279}
    280280
     281static void adjustRectAccordingToMargin(GtkStyleContext* context, GtkStateFlags state, IntRect& rect)
     282{
     283    GtkBorder margin;
     284    gtk_style_context_get_margin(context, state, &margin);
     285    rect.move(margin.left, margin.right);
     286    rect.contract(margin.left + margin.right, margin.top + margin.bottom);
     287}
     288
    281289void ScrollbarThemeGtk::paintTrackBackground(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect)
    282290{
     
    294302    gtk_style_context_add_class(styleContext, GTK_STYLE_CLASS_TROUGH);
    295303
     304    adjustRectAccordingToMargin(styleContext, static_cast<GtkStateFlags>(0), fullScrollbarRect);
    296305    gtk_render_background(styleContext, context->platformContext()->cr(), fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height());
    297306    gtk_render_frame(styleContext, context->platformContext()->cr(), fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height());
     
    328337    gtk_style_context_set_state(styleContext, static_cast<GtkStateFlags>(flags));
    329338
    330     gtk_render_slider(styleContext, context->platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height(),
     339    IntRect thumbRect(rect);
     340    adjustRectAccordingToMargin(styleContext, static_cast<GtkStateFlags>(flags), thumbRect);
     341    gtk_render_slider(styleContext, context->platformContext()->cr(), thumbRect.x(), thumbRect.y(), thumbRect.width(), thumbRect.height(),
    331342        orientation == VerticalScrollbar ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL);
    332343
Note: See TracChangeset for help on using the changeset viewer.