author | lochang <lochang@mozilla.com> |
Fri, 17 Nov 2017 14:20:42 +0800 | |
changeset 392405 | 37707fcd8a55a2dcb3a0fee5c032f87ec81d921c |
parent 392404 | 9faf8dcf5c6e22cd7de1f7e111417d84d30a8ec1 |
child 392406 | 130f10cfd1b5a4409a1da256478008dc07902ad3 |
push id | 32920 |
push user | nerli@mozilla.com |
push date | Fri, 17 Nov 2017 22:01:05 +0000 |
treeherder | mozilla-central@7ef46e350289 [default view] [failures only] |
perfherder | [talos] [build metrics] [platform microbench] (compared to previous push) |
reviewers | mats |
bugs | 1406268 |
milestone | 59.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
|
--- a/layout/reftests/forms/input/checkbox/gtk-theme-width-height-ref.html +++ b/layout/reftests/forms/input/checkbox/gtk-theme-width-height-ref.html @@ -6,17 +6,17 @@ <style> input { outline:1px solid black; } </style> </head> <body> -<div style="overflow:hidden; width:160px;"> +<div style="overflow:hidden; width:120px;"> <div style="float:left; width:799px; border:1px solid blue;"> <input type="checkbox" checked style="width:400px; visibility:hidden;"> <input type="checkbox" checked style="width:400px; height:100px; visibility:hidden;"> </div> </div> <input type="checkbox" checked style="width:400px;"><br>
--- a/layout/reftests/forms/input/checkbox/gtk-theme-width-height.html +++ b/layout/reftests/forms/input/checkbox/gtk-theme-width-height.html @@ -6,17 +6,17 @@ <style> input { outline:1px solid black; } </style> </head> <body> -<div style="overflow:hidden; width:160px;"> +<div style="overflow:hidden; width:120px;"> <div style="float:left; width:799px; border:1px solid blue;"> <input type="checkbox" checked style="width:400px; outline:none;"> <input type="checkbox" checked style="width:400px; height:100px; outline:none;"> </div> </div> <input type="checkbox" checked style="width:400px; height:1px;"><br> <input type="checkbox" checked style="width:1px; height:100px;"><br>
--- a/layout/reftests/forms/input/radio/gtk-theme-width-height-ref.html +++ b/layout/reftests/forms/input/radio/gtk-theme-width-height-ref.html @@ -6,17 +6,17 @@ <style> input { outline:1px solid black; } </style> </head> <body> -<div style="overflow:hidden; width:160px;"> +<div style="overflow:hidden; width:120px;"> <div style="float:left; width:799px; border:1px solid blue;"> <input type="radio" checked style="width:400px; visibility:hidden;"> <input type="radio" checked style="width:400px; height:100px; visibility:hidden;"> </div> </div> <input type="radio" checked style="width:400px;"><br>
--- a/layout/reftests/forms/input/radio/gtk-theme-width-height.html +++ b/layout/reftests/forms/input/radio/gtk-theme-width-height.html @@ -6,17 +6,17 @@ <style> input { outline:1px solid black; } </style> </head> <body> -<div style="overflow:hidden; width:160px;"> +<div style="overflow:hidden; width:120px;"> <div style="float:left; width:799px; border:1px solid blue;"> <input type="radio" checked style="width:400px; outline:none;"> <input type="radio" checked style="width:400px; height:100px; outline:none;"> </div> </div> <input type="radio" checked style="width:400px; height:1px;"><br> <input type="radio" checked style="width:1px; height:100px;"><br>
--- a/widget/gtk/gtk2drawing.c +++ b/widget/gtk/gtk2drawing.c @@ -1039,26 +1039,31 @@ moz_gtk_toggle_paint(GdkDrawable* drawab if (isradio) { moz_gtk_radio_get_metrics(&indicator_size, &indicator_spacing); w = gRadiobuttonWidget; } else { moz_gtk_checkbox_get_metrics(&indicator_size, &indicator_spacing); w = gCheckboxWidget; } - // XXX we should assert rect->height >= indicator_size too - // after bug 369581 is fixed. - MOZ_ASSERT(rect->width >= indicator_size, - "GetMinimumWidgetSize was ignored"); - - // Paint it center aligned in the rect. - x = rect->x + (rect->width - indicator_size) / 2; - y = rect->y + (rect->height - indicator_size) / 2; - width = indicator_size; - height = indicator_size; + // Clamp the rect and paint it center aligned in the rect. + x = rect->x; + y = rect->y; + width = rect->width; + height = rect->height; + + if (rect->width < rect->height) { + y = rect->y + (rect->height - rect->width) / 2; + height = rect->width; + } + + if (rect->height < rect->width) { + x = rect->x + (rect->width - rect->height) / 2; + width = rect->height; + } focus_x = x - indicator_spacing; focus_y = y - indicator_spacing; focus_width = width + 2 * indicator_spacing; focus_height = height + 2 * indicator_spacing; style = w->style; TSOffsetStyleGCs(style, x, y);
--- a/widget/gtk/gtk3drawing.cpp +++ b/widget/gtk/gtk3drawing.cpp @@ -387,26 +387,31 @@ moz_gtk_toggle_paint(cairo_t *cr, GdkRec gboolean isradio, GtkTextDirection direction) { GtkStateFlags state_flags = GetStateFlagsFromGtkWidgetState(state); gint x, y, width, height; GtkStyleContext *style; const ToggleGTKMetrics* metrics = GetToggleMetrics(isradio); - // XXX we should assert rect->height >= indicator_size too - // after bug 369581 is fixed. - MOZ_ASSERT(rect->width >= metrics->minSizeWithBorder.width, - "GetMinimumWidgetSize was ignored"); - - // Paint it center aligned in the rect. - width = metrics->minSizeWithBorder.width; - height = metrics->minSizeWithBorder.height; - x = rect->x + (rect->width - width) / 2; - y = rect->y + (rect->height - height) / 2; + // Clamp the rect and paint it center aligned in the rect. + x = rect->x; + y = rect->y; + width = rect->width; + height = rect->height; + + if (rect->width < rect->height) { + y = rect->y + (rect->height - rect->width) / 2; + height = rect->width; + } + + if (rect->height < rect->width) { + x = rect->x + (rect->width - rect->height) / 2; + width = rect->height; + } if (selected) state_flags = static_cast<GtkStateFlags>(state_flags|checkbox_check_state); if (inconsistent) state_flags = static_cast<GtkStateFlags>(state_flags|GTK_STATE_FLAG_INCONSISTENT); style = GetStyleContext(isradio ? MOZ_GTK_RADIOBUTTON : MOZ_GTK_CHECKBUTTON,