summaryrefslogtreecommitdiff
path: root/www/firefox/files/patch-bug1073117
diff options
context:
space:
mode:
Diffstat (limited to 'www/firefox/files/patch-bug1073117')
-rw-r--r--www/firefox/files/patch-bug1073117728
1 files changed, 497 insertions, 231 deletions
diff --git a/www/firefox/files/patch-bug1073117 b/www/firefox/files/patch-bug1073117
index 756a64293b35..e9d86eceeff4 100644
--- a/www/firefox/files/patch-bug1073117
+++ b/www/firefox/files/patch-bug1073117
@@ -1,245 +1,511 @@
+diff --git widget/gtk/gtk2drawing.c widget/gtk/gtk2drawing.c
+index 34f22af..1b950ab 100644
+--- widget/gtk/gtk2drawing.c
++++ widget/gtk/gtk2drawing.c
+@@ -831,7 +831,7 @@ moz_gtk_get_focus_outline_size(gint* focus_h_width, gint* focus_v_width)
+ return MOZ_GTK_SUCCESS;
+ }
+
+-gint
++static gint
+ moz_gtk_widget_get_focus(GtkWidget* widget, gboolean* interior_focus,
+ gint* focus_width, gint* focus_pad)
+ {
+@@ -928,7 +928,7 @@ moz_gtk_splitter_get_metrics(gint orientation, gint* size)
+ return MOZ_GTK_SUCCESS;
+ }
+
+-gint
++static gint
+ moz_gtk_button_get_inner_border(GtkWidget* widget, GtkBorder* inner_border)
+ {
+ static const GtkBorder default_inner_border = { 1, 1, 1, 1 };
diff --git widget/gtk/gtk3drawing.c widget/gtk/gtk3drawing.c
-index e9e21b1..750140c 100644
+index 08a58d6..7fef6fa 100644
--- widget/gtk/gtk3drawing.c
+++ widget/gtk/gtk3drawing.c
-@@ -64,6 +64,7 @@ static GtkWidget* gScrolledWindowWidget;
+@@ -762,37 +762,17 @@ moz_gtk_radio_get_metrics(gint* indicator_size, gint* indicator_spacing)
+ gint
+ moz_gtk_get_focus_outline_size(gint* focus_h_width, gint* focus_v_width)
+ {
+- gboolean interior_focus;
+- gint focus_width = 0;
++ GtkBorder border;
++ GtkBorder padding;
++ GtkStyleContext *style;
- static style_prop_t style_prop_func;
- static gboolean have_arrow_scaling;
-+static gboolean checkbox_check_state;
- static gboolean is_initialized;
+ ensure_entry_widget();
+- gtk_widget_style_get(gEntryWidget,
+- "interior-focus", &interior_focus,
+- "focus-line-width", &focus_width,
+- NULL);
+- if (interior_focus) {
+- GtkBorder border;
+- GtkStyleContext *style = gtk_widget_get_style_context(gEntryWidget);
+- gtk_style_context_get_border(style, 0, &border);
+- *focus_h_width = border.left + focus_width;
+- *focus_v_width = border.top + focus_width;
+- } else {
+- *focus_h_width = focus_width;
+- *focus_v_width = focus_width;
+- }
+- return MOZ_GTK_SUCCESS;
+-}
+-
+-gint
+-moz_gtk_widget_get_focus(GtkWidget* widget, gboolean* interior_focus,
+- gint* focus_width, gint* focus_pad)
+-{
+- gtk_widget_style_get (widget,
+- "interior-focus", interior_focus,
+- "focus-line-width", focus_width,
+- "focus-padding", focus_pad,
+- NULL);
++ style = gtk_widget_get_style_context(gEntryWidget);
- #define ARROW_UP 0
-@@ -71,6 +72,10 @@ static gboolean is_initialized;
- #define ARROW_RIGHT G_PI_2
- #define ARROW_LEFT (G_PI+G_PI_2)
++ gtk_style_context_get_border(style, 0, &border);
++ gtk_style_context_get_padding(style, 0, &padding);
++ *focus_h_width = border.left + padding.left;
++ *focus_v_width = border.top + padding.top;
+ return MOZ_GTK_SUCCESS;
+ }
-+#if !GTK_CHECK_VERSION(3,14,0)
-+#define GTK_STATE_FLAG_CHECKED (1 << 11)
-+#endif
-+
- static GtkStateFlags
- GetStateFlagsFromGtkWidgetState(GtkWidgetState* state)
- {
-@@ -714,6 +719,11 @@ moz_gtk_init()
- is_initialized = TRUE;
- have_arrow_scaling = (gtk_major_version > 2 ||
- (gtk_major_version == 2 && gtk_minor_version >= 12));
-+ if (gtk_major_version > 3 ||
-+ (gtk_major_version == 3 && gtk_minor_version >= 14))
-+ checkbox_check_state = GTK_STATE_FLAG_CHECKED;
-+ else
-+ checkbox_check_state = GTK_STATE_FLAG_ACTIVE;
-
- /* Add style property to GtkEntry.
- * Adding the style property to the normal GtkEntry class means that it
-@@ -1004,10 +1014,10 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRectangle* rect,
- gtk_widget_set_sensitive(w, !state->disabled);
- gtk_widget_set_direction(w, direction);
+@@ -880,24 +860,6 @@ moz_gtk_splitter_get_metrics(gint orientation, gint* size)
+ return MOZ_GTK_SUCCESS;
+ }
+
+-gint
+-moz_gtk_button_get_inner_border(GtkWidget* widget, GtkBorder* inner_border)
+-{
+- static const GtkBorder default_inner_border = { 1, 1, 1, 1 };
+- GtkBorder *tmp_border;
+-
+- gtk_widget_style_get (widget, "inner-border", &tmp_border, NULL);
+-
+- if (tmp_border) {
+- *inner_border = *tmp_border;
+- gtk_border_free(tmp_border);
+- }
+- else
+- *inner_border = default_inner_border;
+-
+- return MOZ_GTK_SUCCESS;
+-}
+-
+ static gint
+ moz_gtk_button_paint(cairo_t *cr, GdkRectangle* rect,
+ GtkWidgetState* state,
+@@ -908,19 +870,8 @@ moz_gtk_button_paint(cairo_t *cr, GdkRectangle* rect,
+ GtkStyleContext* style = gtk_widget_get_style_context(widget);
+ gint x = rect->x, y=rect->y, width=rect->width, height=rect->height;
+
+- gboolean interior_focus;
+- gint focus_width, focus_pad;
+-
+- moz_gtk_widget_get_focus(widget, &interior_focus, &focus_width, &focus_pad);
+ gtk_widget_set_direction(widget, direction);
+-
+- if (!interior_focus && state->focused) {
+- x += focus_width + focus_pad;
+- y += focus_width + focus_pad;
+- width -= 2 * (focus_width + focus_pad);
+- height -= 2 * (focus_width + focus_pad);
+- }
+-
++
gtk_style_context_save(style);
--
-+
- if (isradio) {
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_RADIO);
-- gtk_style_context_set_state(style, selected ? GTK_STATE_FLAG_ACTIVE :
-+ gtk_style_context_set_state(style, selected ? checkbox_check_state :
- GTK_STATE_FLAG_NORMAL);
- gtk_render_option(style, cr, x, y, width, height);
- if (state->focused) {
-@@ -1025,7 +1035,7 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRectangle* rect,
- gtk_style_context_set_state(style, GTK_STATE_FLAG_INCONSISTENT);
- gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gCheckboxWidget), TRUE);
- } else if (selected) {
-- gtk_style_context_set_state(style, GTK_STATE_FLAG_ACTIVE);
-+ gtk_style_context_set_state(style, checkbox_check_state);
- } else {
- gtk_toggle_button_set_inconsistent(GTK_TOGGLE_BUTTON(gCheckboxWidget), FALSE);
- }
-@@ -2588,8 +2598,9 @@ moz_gtk_check_menu_item_paint(cairo_t *cr, GdkRectangle* rect,
- gtk_style_context_add_class(style, GTK_STYLE_CLASS_CHECK);
+ gtk_style_context_set_state(style, state_flags);
+
+@@ -953,20 +904,12 @@ moz_gtk_button_paint(cairo_t *cr, GdkRectangle* rect,
}
-- if (checked)
-- state_flags |= GTK_STATE_FLAG_ACTIVE;
-+ if (checked) {
-+ state_flags |= checkbox_check_state;
-+ }
-
- gtk_style_context_set_state(style, state_flags);
- gtk_style_context_get_padding(style, state_flags, &padding);
-diff --git widget/gtk/nsLookAndFeel.cpp widget/gtk/nsLookAndFeel.cpp
-index 3562cf2..ea4cc0e 100644
---- widget/gtk/nsLookAndFeel.cpp
-+++ widget/gtk/nsLookAndFeel.cpp
-@@ -38,7 +38,6 @@ nsLookAndFeel::nsLookAndFeel()
- mStyle(nullptr),
- #else
- mBackgroundStyle(nullptr),
-- mViewStyle(nullptr),
- mButtonStyle(nullptr),
- #endif
- mDefaultFontCached(false), mButtonFontCached(false),
-@@ -53,7 +52,6 @@ nsLookAndFeel::~nsLookAndFeel()
- g_object_unref(mStyle);
- #else
- g_object_unref(mBackgroundStyle);
-- g_object_unref(mViewStyle);
- g_object_unref(mButtonStyle);
- #endif
+ if (state->focused) {
+- if (interior_focus) {
+- GtkBorder border;
+- gtk_style_context_get_border(style, state_flags, &border);
+- x += border.left + focus_pad;
+- y += border.top + focus_pad;
+- width -= 2 * (border.left + focus_pad);
+- height -= 2 * (border.top + focus_pad);
+- } else {
+- x -= focus_width + focus_pad;
+- y -= focus_width + focus_pad;
+- width += 2 * (focus_width + focus_pad);
+- height += 2 * (focus_width + focus_pad);
+- }
+-
++ GtkBorder border;
++ gtk_style_context_get_border(style, state_flags, &border);
++ x += border.left;
++ y += border.top;
++ width -= (border.left + border.right);
++ height -= (border.top + border.bottom);
+ gtk_render_focus(style, cr, x, y, width, height);
+ }
+ gtk_style_context_restore(style);
+@@ -1056,33 +999,23 @@ calculate_button_inner_rect(GtkWidget* button, GdkRectangle* rect,
+ GtkTextDirection direction,
+ gboolean ignore_focus)
+ {
+- GtkBorder inner_border;
+- gboolean interior_focus;
+- gint focus_width, focus_pad;
+ GtkStyleContext* style;
+ GtkBorder border;
++ GtkBorder padding = {0, 0, 0, 0};
+
+ style = gtk_widget_get_style_context(button);
+
+ /* This mirrors gtkbutton's child positioning */
+- moz_gtk_button_get_inner_border(button, &inner_border);
+- moz_gtk_widget_get_focus(button, &interior_focus,
+- &focus_width, &focus_pad);
+-
+- if (ignore_focus)
+- focus_width = focus_pad = 0;
+-
+ gtk_style_context_get_border(style, 0, &border);
++ if (!ignore_focus)
++ gtk_style_context_get_padding(style, 0, &padding);
+
+- inner_rect->x = rect->x + border.left + focus_width + focus_pad;
+- inner_rect->x += direction == GTK_TEXT_DIR_LTR ?
+- inner_border.left : inner_border.right;
+- inner_rect->y = rect->y + inner_border.top + border.top +
+- focus_width + focus_pad;
+- inner_rect->width = MAX(1, rect->width - inner_border.left -
+- inner_border.right - (border.left + focus_pad + focus_width) * 2);
+- inner_rect->height = MAX(1, rect->height - inner_border.top -
+- inner_border.bottom - (border.top + focus_pad + focus_width) * 2);
++ inner_rect->x = rect->x + border.left + padding.left;
++ inner_rect->y = rect->y + padding.top + border.top;
++ inner_rect->width = MAX(1, rect->width - padding.left -
++ padding.right - border.left * 2);
++ inner_rect->height = MAX(1, rect->height - padding.top -
++ padding.bottom - border.top * 2);
+
+ return MOZ_GTK_SUCCESS;
}
-@@ -114,13 +112,19 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
- case eColorID_IMESelectedRawTextBackground:
- case eColorID_IMESelectedConvertedTextBackground:
- case eColorID__moz_dragtargetzone:
-- aColor = sMozWindowSelectedBackground;
-+ case eColorID__moz_cellhighlight:
-+ case eColorID__moz_html_cellhighlight:
-+ case eColorID_highlight: // preference selected item,
-+ aColor = sTextSelectedBackground;
- break;
- case eColorID_WidgetSelectForeground:
- case eColorID_TextSelectForeground:
- case eColorID_IMESelectedRawTextForeground:
- case eColorID_IMESelectedConvertedTextForeground:
-- aColor = sMozWindowSelectedText;
-+ case eColorID_highlighttext:
-+ case eColorID__moz_cellhighlighttext:
-+ case eColorID__moz_html_cellhighlighttext:
-+ aColor = sTextSelectedText;
- break;
- #endif
- case eColorID_Widget3DHighlight:
-@@ -238,19 +242,6 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
- GTK_STATE_FLAG_INSENSITIVE, &gdk_color);
- aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
- break;
-- case eColorID_highlight: // preference selected item,
-- // background of selected item
-- gtk_style_context_get_background_color(mViewStyle,
-- GTK_STATE_FLAG_SELECTED,
-- &gdk_color);
-- aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
-- break;
-- case eColorID_highlighttext:
-- // text of selected item
-- gtk_style_context_get_color(mViewStyle,
-- GTK_STATE_FLAG_SELECTED, &gdk_color);
-- aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
-- break;
- case eColorID_inactivecaption:
- // inactive window caption
- gtk_style_context_get_background_color(mBackgroundStyle,
-@@ -393,19 +384,6 @@ nsLookAndFeel::NativeGetColor(ColorID aID, nscolor& aColor)
- case eColorID__moz_buttonhovertext:
- aColor = sButtonHoverText;
- break;
-- case eColorID__moz_cellhighlight:
-- case eColorID__moz_html_cellhighlight:
-- gtk_style_context_get_background_color(mViewStyle,
-- GTK_STATE_FLAG_SELECTED,
-- &gdk_color);
-- aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
-- break;
-- case eColorID__moz_cellhighlighttext:
-- case eColorID__moz_html_cellhighlighttext:
-- gtk_style_context_get_color(mViewStyle,
-- GTK_STATE_FLAG_SELECTED, &gdk_color);
-- aColor = GDK_RGBA_TO_NS_RGBA(gdk_color);
-- break;
- #endif
- case eColorID__moz_menuhover:
- aColor = sMenuHover;
-@@ -967,7 +945,7 @@ nsLookAndFeel::Init()
- GtkStyleContext *style;
+@@ -1457,19 +1390,12 @@ moz_gtk_entry_paint(cairo_t *cr, GdkRectangle* rect,
+ {
+ gint x = rect->x, y = rect->y, width = rect->width, height = rect->height;
+ GtkStyleContext* style;
+- gboolean interior_focus;
+- gint focus_width;
+ int draw_focus_outline_only = state->depressed; // NS_THEME_FOCUS_OUTLINE
- // Gtk manages a screen's CSS in the settings object so we
-- // ask Gtk to create it explicitly. Otherwise we may end up
-+ // ask Gtk to create it explicitly. Otherwise we may end up
- // with wrong color theme, see Bug 972382
- (void)gtk_settings_get_for_screen(gdk_screen_get_default());
-
-@@ -977,9 +955,6 @@ nsLookAndFeel::Init()
- mBackgroundStyle = create_context(path);
- gtk_style_context_add_class(mBackgroundStyle, GTK_STYLE_CLASS_BACKGROUND);
-
-- mViewStyle = create_context(path);
-- gtk_style_context_add_class(mViewStyle, GTK_STYLE_CLASS_VIEW);
--
- mButtonStyle = create_context(path);
- gtk_style_context_add_class(mButtonStyle, GTK_STYLE_CLASS_BUTTON);
-
-@@ -992,11 +967,24 @@ nsLookAndFeel::Init()
- g_object_unref(style);
-
- // Text colors
-- gtk_style_context_get_background_color(mViewStyle, GTK_STATE_FLAG_NORMAL, &color);
-+ style = create_context(path);
-+ gtk_style_context_add_class(style, GTK_STYLE_CLASS_VIEW);
-+ gtk_style_context_get_background_color(style, GTK_STATE_FLAG_NORMAL, &color);
- sMozFieldBackground = GDK_RGBA_TO_NS_RGBA(color);
-- gtk_style_context_get_color(mViewStyle, GTK_STATE_FLAG_NORMAL, &color);
-+ gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
- sMozFieldText = GDK_RGBA_TO_NS_RGBA(color);
-
-+ // Selected text and background
-+ gtk_style_context_get_background_color(style,
-+ static_cast<GtkStateFlags>(GTK_STATE_FLAG_FOCUSED|GTK_STATE_FLAG_SELECTED),
-+ &color);
-+ sTextSelectedBackground = GDK_RGBA_TO_NS_RGBA(color);
-+ gtk_style_context_get_color(style,
-+ static_cast<GtkStateFlags>(GTK_STATE_FLAG_FOCUSED|GTK_STATE_FLAG_SELECTED),
-+ &color);
-+ sTextSelectedText = GDK_RGBA_TO_NS_RGBA(color);
-+ g_object_unref(style);
-+
- // Window colors
- style = create_context(path);
+ gtk_widget_set_direction(widget, direction);
+
+ style = gtk_widget_get_style_context(widget);
+
+- gtk_widget_style_get(widget,
+- "interior-focus", &interior_focus,
+- "focus-line-width", &focus_width,
+- NULL);
+-
+ if (draw_focus_outline_only) {
+ // Inflate the given 'rect' with the focus outline size.
+ gint h, v;
+@@ -1501,14 +1427,6 @@ moz_gtk_entry_paint(cairo_t *cr, GdkRectangle* rect,
+ /* This will get us the lit borders that focused textboxes enjoy on
+ * some themes. */
+ gtk_style_context_set_state(style, GTK_STATE_FLAG_FOCUSED);
+- if (!interior_focus) {
+- /* Indent the border a little bit if we have exterior focus
+- (this is what GTK does to draw native entries) */
+- x += focus_width;
+- y += focus_width;
+- width -= 2 * focus_width;
+- height -= 2 * focus_width;
+- }
+ }
+
+ if (state->disabled) {
+@@ -1520,11 +1438,6 @@ moz_gtk_entry_paint(cairo_t *cr, GdkRectangle* rect,
+ }
+ gtk_render_frame(style, cr, x, y, width, height);
+
+- if (state->focused && !state->disabled) {
+- if (!interior_focus) {
+- gtk_render_focus(style, cr, rect->x, rect->y, rect->width, rect->height);
+- }
+- }
+ gtk_style_context_restore(style);
+
+ return MOZ_GTK_SUCCESS;
+@@ -1829,8 +1742,6 @@ moz_gtk_container_paint(cairo_t *cr, GdkRectangle* rect,
+ GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state);
+ GtkStyleContext* style;
+ GtkWidget *widget;
+- gboolean interior_focus;
+- gint focus_width, focus_pad;
+
+ if (isradio) {
+ ensure_radiobutton_widget();
+@@ -1843,7 +1754,6 @@ moz_gtk_container_paint(cairo_t *cr, GdkRectangle* rect,
+
+ style = gtk_widget_get_style_context(widget);
gtk_style_context_save(style);
-@@ -1005,12 +993,6 @@ nsLookAndFeel::Init()
- sMozWindowBackground = GDK_RGBA_TO_NS_RGBA(color);
- gtk_style_context_get_color(style, GTK_STATE_FLAG_NORMAL, &color);
- sMozWindowText = GDK_RGBA_TO_NS_RGBA(color);
--
-- // Selected text and background
-- gtk_style_context_get_background_color(style, GTK_STATE_FLAG_SELECTED, &color);
-- sMozWindowSelectedBackground = GDK_RGBA_TO_NS_RGBA(color);
-- gtk_style_context_get_color(style, GTK_STATE_FLAG_SELECTED, &color);
-- sMozWindowSelectedText = GDK_RGBA_TO_NS_RGBA(color);
+- moz_gtk_widget_get_focus(widget, &interior_focus, &focus_width, &focus_pad);
+ gtk_style_context_set_state(style, state_flags);
+
+ /* this is for drawing a prelight box */
+@@ -1852,10 +1762,6 @@ moz_gtk_container_paint(cairo_t *cr, GdkRectangle* rect,
+ rect->x, rect->y, rect->width, rect->height);
+ }
+
+- if (state->focused && !interior_focus) {
+- gtk_render_focus(style, cr,
+- rect->x, rect->y, rect->width, rect->height);
+- }
gtk_style_context_restore(style);
+
+ return MOZ_GTK_SUCCESS;
+@@ -1868,7 +1774,6 @@ moz_gtk_toggle_label_paint(cairo_t *cr, GdkRectangle* rect,
+ {
+ GtkStyleContext *style;
+ GtkWidget *widget;
+- gboolean interior_focus;
+
+ if (!state->focused)
+ return MOZ_GTK_SUCCESS;
+@@ -1889,10 +1794,6 @@ moz_gtk_toggle_label_paint(cairo_t *cr, GdkRectangle* rect,
+ }
+ gtk_widget_set_direction(widget, direction);
+
+- gtk_widget_style_get(widget, "interior-focus", &interior_focus, NULL);
+- if (!interior_focus)
+- return MOZ_GTK_SUCCESS;
+-
+ gtk_style_context_set_state(style, GetStateFlagsFromGtkWidgetState(state));
+ gtk_render_focus(style, cr,
+ rect->x, rect->y, rect->width, rect->height);
+@@ -2690,26 +2591,18 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
+ switch (widget) {
+ case MOZ_GTK_BUTTON:
+ {
+- GtkBorder inner_border;
+- gboolean interior_focus;
+- gint focus_width, focus_pad;
+-
+ ensure_button_widget();
++ style = gtk_widget_get_style_context(gButtonWidget);
++
+ *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(gButtonWidget));
+
+ /* Don't add this padding in HTML, otherwise the buttons will
+ become too big and stuff the layout. */
+ if (!inhtml) {
+- moz_gtk_widget_get_focus(gButtonWidget, &interior_focus, &focus_width, &focus_pad);
+- moz_gtk_button_get_inner_border(gButtonWidget, &inner_border);
+- *left += focus_width + focus_pad + inner_border.left;
+- *right += focus_width + focus_pad + inner_border.right;
+- *top += focus_width + focus_pad + inner_border.top;
+- *bottom += focus_width + focus_pad + inner_border.bottom;
++ moz_gtk_add_style_padding(style, left, top, right, bottom);
+ }
+
+- moz_gtk_add_style_border(gtk_widget_get_style_context(gButtonWidget),
+- left, top, right, bottom);
++ moz_gtk_add_style_border(style, left, top, right, bottom);
+ return MOZ_GTK_SUCCESS;
+ }
+ case MOZ_GTK_ENTRY:
+@@ -2717,7 +2610,13 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
+ ensure_entry_widget();
+ style = gtk_widget_get_style_context(gEntryWidget);
+ moz_gtk_add_style_border(style, left, top, right, bottom);
+- moz_gtk_add_style_padding(style, left, top, right, bottom);
++
++ /* Use the document padding in HTML
++ and GTK style padding in XUL. */
++ if (!inhtml) {
++ moz_gtk_add_style_padding(style, left, top, right, bottom);
++ }
++
+ return MOZ_GTK_SUCCESS;
+ }
+ case MOZ_GTK_TREEVIEW:
+@@ -2737,23 +2636,15 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
+ * assigned.
+ * That is why the following code is the same as for MOZ_GTK_BUTTON.
+ * */
+-
+- GtkBorder inner_border;
+- gboolean interior_focus;
+- gint focus_width, focus_pad;
++ GtkStyleContext *style;
+
+ ensure_tree_header_cell_widget();
+ *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(gTreeHeaderCellWidget));
- // tooltip foreground and background
-@@ -1256,11 +1238,9 @@ nsLookAndFeel::RefreshImpl()
- mStyle = nullptr;
- #else
- g_object_unref(mBackgroundStyle);
-- g_object_unref(mViewStyle);
- g_object_unref(mButtonStyle);
-
- mBackgroundStyle = nullptr;
-- mViewStyle = nullptr;
- mButtonStyle = nullptr;
- #endif
-
-diff --git widget/gtk/nsLookAndFeel.h widget/gtk/nsLookAndFeel.h
-index aabbca6..7686cca 100644
---- widget/gtk/nsLookAndFeel.h
-+++ widget/gtk/nsLookAndFeel.h
-@@ -35,7 +35,6 @@ protected:
- struct _GtkStyle *mStyle;
- #else
- struct _GtkStyleContext *mBackgroundStyle;
-- struct _GtkStyleContext *mViewStyle;
- struct _GtkStyleContext *mButtonStyle;
- #endif
-
-@@ -75,8 +74,8 @@ protected:
- nscolor sMozFieldBackground;
- nscolor sMozWindowText;
- nscolor sMozWindowBackground;
-- nscolor sMozWindowSelectedText;
-- nscolor sMozWindowSelectedBackground;
-+ nscolor sTextSelectedText;
-+ nscolor sTextSelectedBackground;
- nscolor sMozScrollbar;
- char16_t sInvisibleCharacter;
- float sCaretRatio;
+- moz_gtk_widget_get_focus(gTreeHeaderCellWidget, &interior_focus, &focus_width, &focus_pad);
+- moz_gtk_button_get_inner_border(gTreeHeaderCellWidget, &inner_border);
+- *left += focus_width + focus_pad + inner_border.left;
+- *right += focus_width + focus_pad + inner_border.right;
+- *top += focus_width + focus_pad + inner_border.top;
+- *bottom += focus_width + focus_pad + inner_border.bottom;
+-
+- moz_gtk_add_style_border(gtk_widget_get_style_context(gTreeHeaderCellWidget),
+- left, top, right, bottom);
++ style = gtk_widget_get_style_context(gTreeHeaderCellWidget);
++
++ moz_gtk_add_style_border(style, left, top, right, bottom);
++ moz_gtk_add_style_padding(style, left, top, right, bottom);
+ return MOZ_GTK_SUCCESS;
+ }
+ case MOZ_GTK_TREE_HEADER_SORTARROW:
+@@ -2773,29 +2664,23 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
+ /* We need to account for the arrow on the dropdown, so text
+ * doesn't come too close to the arrow, or in some cases spill
+ * into the arrow. */
+- gboolean ignored_interior_focus, wide_separators;
+- gint focus_width, focus_pad, separator_width;
++ gboolean wide_separators;
++ gint separator_width;
+ GtkRequisition arrow_req;
+ GtkBorder border;
+
+ ensure_combo_box_widgets();
+
+- *left = gtk_container_get_border_width(GTK_CONTAINER(gComboBoxButtonWidget));
++ *left = *top = *right = *bottom =
++ gtk_container_get_border_width(GTK_CONTAINER(gComboBoxButtonWidget));
++
++ style = gtk_widget_get_style_context(gComboBoxButtonWidget);
+
+ if (!inhtml) {
+- moz_gtk_widget_get_focus(gComboBoxButtonWidget,
+- &ignored_interior_focus,
+- &focus_width, &focus_pad);
+- *left += focus_width + focus_pad;
++ moz_gtk_add_style_padding(style, left, top, right, bottom);
+ }
+
+- style = gtk_widget_get_style_context(gComboBoxButtonWidget);
+- gtk_style_context_get_border(style, 0, &border);
+-
+- *top = *left + border.top;
+- *left += border.left;
+-
+- *right = *left; *bottom = *top;
++ moz_gtk_add_style_border(style, left, top, right, bottom);
+
+ /* If there is no separator, don't try to count its width. */
+ separator_width = 0;
+@@ -2847,60 +2732,23 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
+ ensure_frame_widget();
+ w = gFrameWidget;
+ break;
+- case MOZ_GTK_CHECKBUTTON_LABEL:
+- case MOZ_GTK_RADIOBUTTON_LABEL:
+- {
+- gboolean interior_focus;
+- gint focus_width, focus_pad;
+-
+- /* If the focus is interior, then the label has a border of
+- (focus_width + focus_pad). */
+- if (widget == MOZ_GTK_CHECKBUTTON_LABEL) {
+- ensure_checkbox_widget();
+- moz_gtk_widget_get_focus(gCheckboxWidget, &interior_focus,
+- &focus_width, &focus_pad);
+- }
+- else {
+- ensure_radiobutton_widget();
+- moz_gtk_widget_get_focus(gRadiobuttonWidget, &interior_focus,
+- &focus_width, &focus_pad);
+- }
+-
+- if (interior_focus)
+- *left = *top = *right = *bottom = (focus_width + focus_pad);
+-
+- return MOZ_GTK_SUCCESS;
+- }
+-
+ case MOZ_GTK_CHECKBUTTON_CONTAINER:
+ case MOZ_GTK_RADIOBUTTON_CONTAINER:
+ {
+- gboolean interior_focus;
+- gint focus_width, focus_pad;
+-
+- /* If the focus is _not_ interior, then the container has a border
+- of (focus_width + focus_pad). */
+ if (widget == MOZ_GTK_CHECKBUTTON_CONTAINER) {
+ ensure_checkbox_widget();
+- moz_gtk_widget_get_focus(gCheckboxWidget, &interior_focus,
+- &focus_width, &focus_pad);
+ w = gCheckboxWidget;
+ } else {
+ ensure_radiobutton_widget();
+- moz_gtk_widget_get_focus(gRadiobuttonWidget, &interior_focus,
+- &focus_width, &focus_pad);
+ w = gRadiobuttonWidget;
+ }
++ style = gtk_widget_get_style_context(w);
+
+ *left = *top = *right = *bottom = gtk_container_get_border_width(GTK_CONTAINER(w));
+-
+- if (!interior_focus) {
+- *left += (focus_width + focus_pad);
+- *right += (focus_width + focus_pad);
+- *top += (focus_width + focus_pad);
+- *bottom += (focus_width + focus_pad);
+- }
+-
++ moz_gtk_add_style_border(style,
++ left, top, right, bottom);
++ moz_gtk_add_style_padding(style,
++ left, top, right, bottom);
+ return MOZ_GTK_SUCCESS;
+ }
+ case MOZ_GTK_MENUPOPUP:
+@@ -2927,6 +2775,8 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
+ return MOZ_GTK_SUCCESS;
+ }
+ /* These widgets have no borders, since they are not containers. */
++ case MOZ_GTK_CHECKBUTTON_LABEL:
++ case MOZ_GTK_RADIOBUTTON_LABEL:
+ case MOZ_GTK_SPLITTER_HORIZONTAL:
+ case MOZ_GTK_SPLITTER_VERTICAL:
+ case MOZ_GTK_CHECKBUTTON:
+diff --git widget/gtk/gtkdrawing.h widget/gtk/gtkdrawing.h
+index 1938e8f..5f71cfd 100644
+--- widget/gtk/gtkdrawing.h
++++ widget/gtk/gtkdrawing.h
+@@ -293,16 +293,6 @@ moz_gtk_checkbox_get_metrics(gint* indicator_size, gint* indicator_spacing);
+ gint
+ moz_gtk_radio_get_metrics(gint* indicator_size, gint* indicator_spacing);
+
+-/**
+- * Get the inner-border value for a GtkButton widget (button or tree header)
+- * widget: [IN] the widget to get the border value for
+- * inner_border: [OUT] the inner border
+- *
+- * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise
+- */
+-gint
+-moz_gtk_button_get_inner_border(GtkWidget* widget, GtkBorder* inner_border);
+-
+ /** Get the extra size for the focus ring for outline:auto.
+ * widget: [IN] the widget to get the focus metrics for
+ * focus_h_width: [OUT] the horizontal width
+@@ -313,19 +303,6 @@ moz_gtk_button_get_inner_border(GtkWidget* widget, GtkBorder* inner_border);
+ gint
+ moz_gtk_get_focus_outline_size(gint* focus_h_width, gint* focus_v_width);
+
+-/** Get the focus metrics for a treeheadercell, button, checkbox, or radio button.
+- * widget: [IN] the widget to get the focus metrics for
+- * interior_focus: [OUT] whether the focus is drawn around the
+- * label (TRUE) or around the whole container (FALSE)
+- * focus_width: [OUT] the width of the focus line
+- * focus_pad: [OUT] the padding between the focus line and children
+- *
+- * returns: MOZ_GTK_SUCCESS if there was no error, an error code otherwise
+- */
+-gint
+-moz_gtk_widget_get_focus(GtkWidget* widget, gboolean* interior_focus,
+- gint* focus_width, gint* focus_pad);
+-
+ /** Get the horizontal padding for the menuitem widget or checkmenuitem widget.
+ * horizontal_padding: [OUT] The left and right padding of the menuitem or checkmenuitem
+ *