Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog (181744 => 181745)
--- releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog 2015-03-19 10:24:50 UTC (rev 181744)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/ChangeLog 2015-03-19 10:40:24 UTC (rev 181745)
@@ -1,3 +1,20 @@
+2015-03-19 Carlos Garcia Campos <[email protected]>
+
+ [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):
+
2015-03-17 Carlos Garcia Campos <[email protected]>
[GTK] Wrong transfer annotations used in GObject DOM bindings
Modified: releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp (181744 => 181745)
--- releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp 2015-03-19 10:24:50 UTC (rev 181744)
+++ releases/WebKitGTK/webkit-2.8/Source/WebCore/platform/gtk/ScrollbarThemeGtk.cpp 2015-03-19 10:40:24 UTC (rev 181745)
@@ -278,6 +278,14 @@
gtk_style_context_add_class(context, orientation == VerticalScrollbar ? GTK_STYLE_CLASS_VERTICAL : GTK_STYLE_CLASS_HORIZONTAL);
}
+static void adjustRectAccordingToMargin(GtkStyleContext* context, GtkStateFlags state, IntRect& rect)
+{
+ GtkBorder margin;
+ gtk_style_context_get_margin(context, state, &margin);
+ rect.move(margin.left, margin.right);
+ rect.contract(margin.left + margin.right, margin.top + margin.bottom);
+}
+
void ScrollbarThemeGtk::paintTrackBackground(GraphicsContext* context, ScrollbarThemeClient* scrollbar, const IntRect& rect)
{
// Paint the track background. If the trough-under-steppers property is true, this
@@ -293,6 +301,7 @@
applyScrollbarStyleContextClasses(styleContext, scrollbar->orientation());
gtk_style_context_add_class(styleContext, GTK_STYLE_CLASS_TROUGH);
+ adjustRectAccordingToMargin(styleContext, static_cast<GtkStateFlags>(0), fullScrollbarRect);
gtk_render_background(styleContext, context->platformContext()->cr(), fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height());
gtk_render_frame(styleContext, context->platformContext()->cr(), fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height());
@@ -327,7 +336,9 @@
flags |= GTK_STATE_FLAG_PRELIGHT;
gtk_style_context_set_state(styleContext, static_cast<GtkStateFlags>(flags));
- gtk_render_slider(styleContext, context->platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height(),
+ IntRect thumbRect(rect);
+ adjustRectAccordingToMargin(styleContext, static_cast<GtkStateFlags>(flags), thumbRect);
+ gtk_render_slider(styleContext, context->platformContext()->cr(), thumbRect.x(), thumbRect.y(), thumbRect.width(), thumbRect.height(),
orientation == VerticalScrollbar ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL);
gtk_style_context_restore(styleContext);