Bug 1198613 - Use GTK style padding for dropdown boxes in HTML. r=karlt

This commit is contained in:
Andrew Comminos 2015-11-18 14:11:58 +13:00
parent b2a077a033
commit dbb88bb8df

View File

@ -1031,8 +1031,7 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRectangle* rect,
static gint
calculate_button_inner_rect(GtkWidget* button, GdkRectangle* rect,
GdkRectangle* inner_rect,
GtkTextDirection direction,
gboolean ignore_focus)
GtkTextDirection direction)
{
GtkStyleContext* style;
GtkBorder border;
@ -1042,8 +1041,7 @@ calculate_button_inner_rect(GtkWidget* button, GdkRectangle* rect,
/* This mirrors gtkbutton's child positioning */
gtk_style_context_get_border(style, 0, &border);
if (!ignore_focus)
gtk_style_context_get_padding(style, 0, &padding);
gtk_style_context_get_padding(style, 0, &padding);
inner_rect->x = rect->x + border.left + padding.left;
inner_rect->y = rect->y + padding.top + border.top;
@ -1647,7 +1645,7 @@ moz_gtk_treeview_expander_paint(cairo_t *cr, GdkRectangle* rect,
static gint
moz_gtk_combo_box_paint(cairo_t *cr, GdkRectangle* rect,
GtkWidgetState* state,
gboolean ishtml, GtkTextDirection direction)
GtkTextDirection direction)
{
GdkRectangle arrow_rect, real_arrow_rect;
gint arrow_size, separator_width;
@ -1663,7 +1661,7 @@ moz_gtk_combo_box_paint(cairo_t *cr, GdkRectangle* rect,
gComboBoxButtonWidget, direction);
calculate_button_inner_rect(gComboBoxButtonWidget,
rect, &arrow_rect, direction, ishtml);
rect, &arrow_rect, direction);
/* Now arrow_rect contains the inner rect ; we want to correct the width
* to what the arrow needs (see gtk_combo_box_size_allocate) */
gtk_widget_get_preferred_size(gComboBoxArrowWidget, NULL, &arrow_req);
@ -1773,7 +1771,7 @@ moz_gtk_combo_box_entry_button_paint(cairo_t *cr, GdkRectangle* rect,
gComboBoxEntryButtonWidget, direction);
calculate_button_inner_rect(gComboBoxEntryButtonWidget,
rect, &arrow_rect, direction, FALSE);
rect, &arrow_rect, direction);
if (state_flags & GTK_STATE_FLAG_ACTIVE) {
gtk_widget_style_get(gComboBoxEntryButtonWidget,
"child-displacement-x", &x_displacement,
@ -2785,10 +2783,7 @@ moz_gtk_get_widget_border(GtkThemeWidgetType widget, gint* left, gint* top,
style = gtk_widget_get_style_context(gComboBoxButtonWidget);
if (!inhtml) {
moz_gtk_add_style_padding(style, left, top, right, bottom);
}
moz_gtk_add_style_padding(style, left, top, right, bottom);
moz_gtk_add_style_border(style, left, top, right, bottom);
/* If there is no separator, don't try to count its width. */
@ -3269,8 +3264,7 @@ moz_gtk_widget_paint(GtkThemeWidgetType widget, cairo_t *cr,
gEntryWidget, direction);
break;
case MOZ_GTK_DROPDOWN:
return moz_gtk_combo_box_paint(cr, rect, state,
(gboolean) flags, direction);
return moz_gtk_combo_box_paint(cr, rect, state, direction);
break;
case MOZ_GTK_DROPDOWN_ARROW:
return moz_gtk_combo_box_entry_button_paint(cr, rect,