Bug 1624436 - Don't include GTK widget padding in outline: auto size. r=karlt,stransky
authorEmilio Cobos Álvarez <emilio@crisal.io>
Thu, 26 Mar 2020 10:23:39 +0000
changeset 520484 ee0d41c18c40e8364705ff6609442c7895a4ec17
parent 520483 57e989c8a37cbe84810e37dce41331a77847bd66
child 520485 e3fe601c9f615fadf19f416f84c16f417c07ccb7
push id37252
push usermalexandru@mozilla.com
push dateThu, 26 Mar 2020 15:34:27 +0000
treeherdermozilla-central@31360ced8ff8 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskarlt, stransky
bugs1624436
milestone76.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1624436 - Don't include GTK widget padding in outline: auto size. r=karlt,stransky To paint outline: auto, we paint the focused border of a GTK_ENTRY_PAINT. We're also adding the padding of the entry, and that's wrong and causes undesirable padding that looks bogus. Differential Revision: https://phabricator.services.mozilla.com/D68191
widget/gtk/gtk3drawing.cpp
widget/gtk/gtkdrawing.h
--- a/widget/gtk/gtk3drawing.cpp
+++ b/widget/gtk/gtk3drawing.cpp
@@ -238,23 +238,20 @@ void moz_gtk_refresh() {
   /* This will destroy all of our widgets */
   ResetWidgetCache();
 }
 
 static gint moz_gtk_get_focus_outline_size(GtkStyleContext* style,
                                            gint* focus_h_width,
                                            gint* focus_v_width) {
   GtkBorder border;
-  GtkBorder padding;
   gtk_style_context_get_border(style, gtk_style_context_get_state(style),
                                &border);
-  gtk_style_context_get_padding(style, gtk_style_context_get_state(style),
-                                &padding);
-  *focus_h_width = border.left + padding.left;
-  *focus_v_width = border.top + padding.top;
+  *focus_h_width = border.left;
+  *focus_v_width = border.top;
   return MOZ_GTK_SUCCESS;
 }
 
 gint moz_gtk_get_focus_outline_size(gint* focus_h_width, gint* focus_v_width) {
   GtkStyleContext* style = GetStyleContext(MOZ_GTK_ENTRY);
   moz_gtk_get_focus_outline_size(style, focus_h_width, focus_v_width);
   return MOZ_GTK_SUCCESS;
 }
--- a/widget/gtk/gtkdrawing.h
+++ b/widget/gtk/gtkdrawing.h
@@ -439,18 +439,17 @@ const ToggleGTKMetrics* GetToggleMetrics
  * indicator_size:     [OUT] the indicator size
  * indicator_spacing:  [OUT] the spacing between the indicator and its
  *                     container
  *
  * returns:    MOZ_GTK_SUCCESS if there was no error, an error code otherwise
  */
 gint moz_gtk_radio_get_metrics(gint* indicator_size, gint* indicator_spacing);
 
-/** Get the extra size for the focus ring for outline:auto.
- * widget:             [IN]  the widget to get the focus metrics for
+/** Returns the size of the focus ring for outline:auto.
  * focus_h_width:      [OUT] the horizontal width
  * focus_v_width:      [OUT] the vertical width
  *
  * returns:    MOZ_GTK_SUCCESS
  */
 gint moz_gtk_get_focus_outline_size(gint* focus_h_width, gint* focus_v_width);
 
 /** Get the horizontal padding for the menuitem widget or checkmenuitem widget.