summaryrefslogtreecommitdiffstats
path: root/widget
diff options
context:
space:
mode:
Diffstat (limited to 'widget')
-rw-r--r--widget/gtk/gtk3drawing.cpp23
1 files changed, 20 insertions, 3 deletions
diff --git a/widget/gtk/gtk3drawing.cpp b/widget/gtk/gtk3drawing.cpp
index 4363391c9..351c7c654 100644
--- a/widget/gtk/gtk3drawing.cpp
+++ b/widget/gtk/gtk3drawing.cpp
@@ -2548,10 +2548,27 @@ moz_gtk_get_scalethumb_metrics(GtkOrientation orient, gint* thumb_length, gint*
MOZ_GTK_SCALE_THUMB_HORIZONTAL:
MOZ_GTK_SCALE_THUMB_VERTICAL;
GtkStyleContext* style = ClaimStyleContext(widget);
- gtk_style_context_get(style, gtk_style_context_get_state(style),
- "min-width", thumb_length,
- "min-height", thumb_height,
+ gint min_width, min_height;
+ GtkStateFlags state = gtk_style_context_get_state(style);
+ gtk_style_context_get(style, state,
+ "min-width", &min_width,
+ "min-height", &min_height,
nullptr);
+ GtkBorder margin;
+ gtk_style_context_get_margin(style, state, &margin);
+ gint margin_width = margin.left + margin.right;
+ gint margin_height = margin.top + margin.bottom;
+
+ // Negative margin of slider element also determines its minimal size
+ // so use bigger of those two values.
+ if (min_width < -margin_width)
+ min_width = -margin_width;
+ if (min_height < -margin_height)
+ min_height = -margin_height;
+
+ *thumb_length = min_width;
+ *thumb_height = min_height;
+
ReleaseStyleContext(style);
}