Backed out changeset db84a68eaaec (bug 1343802)

This commit is contained in:
Sebastian Hengst 2017-03-27 17:59:48 +02:00
Родитель 8cd9268ada
Коммит 18de691a0f
2 изменённых файлов: 6 добавлений и 44 удалений

Просмотреть файл

@ -39,9 +39,6 @@ static gint
moz_gtk_menu_item_paint(WidgetNodeType widget, cairo_t *cr, GdkRectangle* rect,
GtkWidgetState* state, GtkTextDirection direction);
static GtkBorder
GetMarginBorderPadding(GtkStyleContext* aStyle);
// GetStateFlagsFromGtkWidgetState() can be safely used for the specific
// GtkWidgets that set both prelight and active flags. For other widgets,
// either the GtkStateFlags or Gecko's GtkWidgetState need to be carefully
@ -654,37 +651,12 @@ moz_gtk_draw_styled_frame(GtkStyleContext* style, cairo_t *cr,
static gint
moz_gtk_scrollbar_trough_paint(WidgetNodeType widget,
cairo_t *cr, const GdkRectangle* aRect,
cairo_t *cr, const GdkRectangle* rect,
GtkWidgetState* state,
GtkTextDirection direction)
{
GdkRectangle rect = *aRect;
GtkStyleContext* style;
if (gtk_get_minor_version() >= 20) {
WidgetNodeType thumb = widget == MOZ_GTK_SCROLLBAR_TROUGH_VERTICAL ?
MOZ_GTK_SCROLLBAR_THUMB_VERTICAL :
MOZ_GTK_SCROLLBAR_THUMB_HORIZONTAL;
MozGtkSize thumbSize = GetMinMarginBox(thumb);
style = ClaimStyleContext(widget, direction);
MozGtkSize trackSize = GetMinContentBox(style);
trackSize.Include(thumbSize);
trackSize += GetMarginBorderPadding(style);
// Gecko's trough |aRect| fills available breadth, but GTK's trough is
// centered in the contents_gadget. The centering here round left
// and up, like gtk_box_gadget_allocate_child().
if (widget == MOZ_GTK_SCROLLBAR_TROUGH_VERTICAL) {
rect.x += (rect.width - trackSize.width)/2;
rect.width = trackSize.width;
} else {
rect.y += (rect.height - trackSize.height)/2;
rect.height = trackSize.height;
}
} else {
style = ClaimStyleContext(widget, direction);
}
moz_gtk_draw_styled_frame(style, cr, &rect, state->focused);
GtkStyleContext* style = ClaimStyleContext(widget, direction);
moz_gtk_draw_styled_frame(style, cr, rect, state->focused);
ReleaseStyleContext(style);
return MOZ_GTK_SUCCESS;

Просмотреть файл

@ -46,21 +46,11 @@ struct MozGtkSize {
gint width;
gint height;
MozGtkSize& operator+=(const GtkBorder& aBorder)
{
width += aBorder.left + aBorder.right;
height += aBorder.top + aBorder.bottom;
return *this;
}
MozGtkSize operator+(const GtkBorder& aBorder) const
{
MozGtkSize result = *this;
return result += aBorder;
}
void Include(MozGtkSize aOther)
{
width = std::max(width, aOther.width);
height = std::max(height, aOther.height);
gint resultWidth = width + aBorder.left + aBorder.right;
gint resultHeight = height + aBorder.top + aBorder.bottom;
return {resultWidth, resultHeight};
}
void Rotate()
{