Title: [184459] releases/WebKitGTK/webkit-2.4/Source/WebCore
Revision
184459
Author
[email protected]
Date
2015-05-18 04:24:16 -0700 (Mon, 18 May 2015)

Log Message

Merge r181744 - [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):

Modified Paths

Diff

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog (184458 => 184459)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog	2015-05-18 11:10:00 UTC (rev 184458)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/ChangeLog	2015-05-18 11:24:16 UTC (rev 184459)
@@ -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):
+
 2014-12-07  Youenn Fablet  <[email protected]>
 
         [Soup][Curl] HTTP header values should be treated as latin1, not UTF-8

Modified: releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/ScrollbarThemeGtk3.cpp (184458 => 184459)


--- releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/ScrollbarThemeGtk3.cpp	2015-05-18 11:10:00 UTC (rev 184458)
+++ releases/WebKitGTK/webkit-2.4/Source/WebCore/platform/gtk/ScrollbarThemeGtk3.cpp	2015-05-18 11:24:16 UTC (rev 184459)
@@ -72,6 +72,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
@@ -86,6 +94,7 @@
     applyScrollbarStyleContextClasses(m_context, scrollbar->orientation());
     gtk_style_context_add_class(m_context, GTK_STYLE_CLASS_TROUGH);
 
+    adjustRectAccordingToMargin(m_context, static_cast<GtkStateFlags>(0), fullScrollbarRect);
     gtk_render_background(m_context, context->platformContext()->cr(),
                           fullScrollbarRect.x(), fullScrollbarRect.y(), fullScrollbarRect.width(), fullScrollbarRect.height());
     gtk_render_frame(m_context, context->platformContext()->cr(),
@@ -120,8 +129,10 @@
         flags |= GTK_STATE_FLAG_PRELIGHT;
     gtk_style_context_set_state(m_context, static_cast<GtkStateFlags>(flags));
 
-    gtk_render_slider(m_context, context->platformContext()->cr(), rect.x(), rect.y(), rect.width(), rect.height(),
-                      orientation == VerticalScrollbar ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL);
+    IntRect thumbRect(rect);
+    adjustRectAccordingToMargin(m_context, static_cast<GtkStateFlags>(flags), thumbRect);
+    gtk_render_slider(m_context, context->platformContext()->cr(), thumbRect.x(), thumbRect.y(), thumbRect.width(), thumbRect.height(),
+        orientation == VerticalScrollbar ? GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL);
 
     gtk_style_context_restore(m_context);
 }
_______________________________________________
webkit-changes mailing list
[email protected]
https://lists.webkit.org/mailman/listinfo/webkit-changes

Reply via email to