Bug 1461203 - Use GetScrollbarMetrics() to access scrollbar metrics. r=jhorak, a=jcristau
authorMartin Stransky <stransky@redhat.com>
Thu, 17 May 2018 14:40:21 +0200
changeset 802216 efd762c4f413ba6df32feb49d0334a3853b20e75
parent 802215 33b018306051cf27cf27d89b3dcff6a1e7d8f6ec
child 802217 f14e73288315189505508c50698133add2d255e9
push id111850
push userbmo:tom@mozilla.com
push dateThu, 31 May 2018 16:41:37 +0000
reviewersjhorak, jcristau
bugs1461203
milestone60.0.2
Bug 1461203 - Use GetScrollbarMetrics() to access scrollbar metrics. r=jhorak, a=jcristau MozReview-Commit-ID: 3gnFNfxQJZi
widget/gtk/gtk3drawing.cpp
--- a/widget/gtk/gtk3drawing.cpp
+++ b/widget/gtk/gtk3drawing.cpp
@@ -851,26 +851,24 @@ moz_gtk_scrollbar_button_paint(cairo_t *
       // box occupies the full width of the "contents" gadget content box.
       InsetByMargin(&rect, style);
     } else {
         // Scrollbar button has to be inset by trough_border because its DOM
         // element is filling width of vertical scrollbar's track (or height
         // in case of horizontal scrollbars).
         GtkOrientation orientation = flags & MOZ_GTK_STEPPER_VERTICAL ?
             GTK_ORIENTATION_VERTICAL : GTK_ORIENTATION_HORIZONTAL;
-        const auto& metrics = sScrollbarMetrics[orientation];
-        if (!metrics.initialized) {
-            NS_WARNING("Didn't measure before drawing?");
-        }
+
+        const ScrollbarGTKMetrics* metrics = GetScrollbarMetrics(orientation);
         if (flags & MOZ_GTK_STEPPER_VERTICAL) {
-            rect.x += metrics.border.track.left;
-            rect.width = metrics.size.thumb.width;
+            rect.x += metrics->border.track.left;
+            rect.width = metrics->size.thumb.width;
         } else {
-            rect.y += metrics.border.track.top;
-            rect.height = metrics.size.thumb.height;
+            rect.y += metrics->border.track.top;
+            rect.height = metrics->size.thumb.height;
         }
     }
 
     gtk_render_background(style, cr, rect.x, rect.y, rect.width, rect.height);
     gtk_render_frame(style, cr, rect.x, rect.y, rect.width, rect.height);
 
     arrow_rect.width = rect.width / 2;
     arrow_rect.height = rect.height / 2;