Bug 1335705 - For Gtk > 3.20 determine scale trough size from trough CSS node and also add border/padding/margin, r=karlt
authorMartin Stransky <stransky@redhat.com>
Wed, 22 Feb 2017 11:56:28 +0100
changeset 373726 41a156cf149e667f172f93c7492b466cfbb20565
parent 373725 9bbe2c180655a60ec5e5c94791200c3fca37435e
child 373727 87ca04c38b8c470b77c389f82f417f33ce69d2fb
push id10863
push userjlorenzo@mozilla.com
push dateMon, 06 Mar 2017 23:02:23 +0000
treeherdermozilla-aurora@0931190cd725 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt
bugs1335705
milestone54.0a1
Bug 1335705 - For Gtk > 3.20 determine scale trough size from trough CSS node and also add border/padding/margin, r=karlt MozReview-Commit-ID: BhS9xkagvMp
widget/gtk/gtk3drawing.cpp
--- a/widget/gtk/gtk3drawing.cpp
+++ b/widget/gtk/gtk3drawing.cpp
@@ -2501,42 +2501,40 @@ moz_gtk_get_entry_min_height(gint* heigh
     *height += (border.top + border.bottom + padding.top + padding.bottom);
     ReleaseStyleContext(style);
 }
 
 void
 moz_gtk_get_scale_metrics(GtkOrientation orient, gint* scale_width,
                           gint* scale_height)
 {
-  WidgetNodeType widget = (orient == GTK_ORIENTATION_HORIZONTAL) ?
-                           MOZ_GTK_SCALE_HORIZONTAL :
-                           MOZ_GTK_SCALE_VERTICAL;
+  if (gtk_check_version(3, 20, 0) != nullptr) {
+      WidgetNodeType widget = (orient == GTK_ORIENTATION_HORIZONTAL) ?
+                               MOZ_GTK_SCALE_HORIZONTAL :
+                               MOZ_GTK_SCALE_VERTICAL;
 
-  if (gtk_check_version(3, 20, 0) != nullptr) {
       gint thumb_length, thumb_height, trough_border;
       moz_gtk_get_scalethumb_metrics(orient, &thumb_length, &thumb_height);
 
       GtkStyleContext* style = ClaimStyleContext(widget);
       gtk_style_context_get_style(style, "trough-border", &trough_border, NULL);
 
       if (orient == GTK_ORIENTATION_HORIZONTAL) {
           *scale_width = thumb_length + trough_border * 2;
           *scale_height = thumb_height + trough_border * 2;
       } else {
           *scale_width = thumb_height + trough_border * 2;
           *scale_height = thumb_length + trough_border * 2;
       }
       ReleaseStyleContext(style);
   } else {
-      GtkStyleContext* style = ClaimStyleContext(widget);
-      gtk_style_context_get(style, gtk_style_context_get_state(style),
-                            "min-width", scale_width,
-                            "min-height", scale_height,
-                            nullptr);
-      ReleaseStyleContext(style);
+      WidgetNodeType widget = (orient == GTK_ORIENTATION_HORIZONTAL) ?
+                               MOZ_GTK_SCALE_TROUGH_HORIZONTAL :
+                               MOZ_GTK_SCALE_TROUGH_VERTICAL;
+      moz_gtk_get_widget_min_size(widget, scale_width, scale_height);
   }
 }
 
 gint
 moz_gtk_get_scalethumb_metrics(GtkOrientation orient, gint* thumb_length, gint* thumb_height)
 {
 
   if (gtk_check_version(3, 20, 0) != nullptr) {