diff options
author | Benjamin Otte <otte@redhat.com> | 2012-10-26 23:36:39 +0200 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2012-10-31 11:09:10 +0100 |
commit | 67302c5ee03e1b6b045b429b0083751519125e9a (patch) | |
tree | b20e703af6d8403eebe7538cff94cedb643d3066 /gtk/gtkcssbgsizevalue.c | |
parent | 16677bb85ad78ac57776a679abaa69e3d1fc22b9 (diff) | |
download | gtk+-67302c5ee03e1b6b045b429b0083751519125e9a.tar.gz |
cssvalue: Compute "background-size: 0 0" properly
Previously a computed value of 0 was treated as "auto", which is wrong.
Diffstat (limited to 'gtk/gtkcssbgsizevalue.c')
-rw-r--r-- | gtk/gtkcssbgsizevalue.c | 37 |
1 files changed, 27 insertions, 10 deletions
diff --git a/gtk/gtkcssbgsizevalue.c b/gtk/gtkcssbgsizevalue.c index 01db83d34f..a34b3c10d4 100644 --- a/gtk/gtkcssbgsizevalue.c +++ b/gtk/gtkcssbgsizevalue.c @@ -261,16 +261,33 @@ _gtk_css_bg_size_value_compute_size (const GtkCssValue *value, g_return_if_fail (value->class == >K_CSS_VALUE_BG_SIZE); if (value->contain || value->cover) - gtk_css_bg_size_compute_size_for_cover_contain (value->cover, - image, - area_width, area_height, - out_width, out_height); + { + gtk_css_bg_size_compute_size_for_cover_contain (value->cover, + image, + area_width, area_height, + out_width, out_height); + } else - _gtk_css_image_get_concrete_size (image, - /* note: 0 does the right thing here for 'auto' */ - value->x ? _gtk_css_number_value_get (value->x, area_width) : 0, - value->y ? _gtk_css_number_value_get (value->y, area_height) : 0, - area_width, area_height, - out_width, out_height); + { + double x, y; + + /* note: 0 does the right thing later for 'auto' */ + x = value->x ? _gtk_css_number_value_get (value->x, area_width) : 0; + y = value->y ? _gtk_css_number_value_get (value->y, area_height) : 0; + + if ((x <= 0 && value->x) || + (y <= 0 && value->y)) + { + *out_width = 0; + *out_height = 0; + } + else + { + _gtk_css_image_get_concrete_size (image, + x, y, + area_width, area_height, + out_width, out_height); + } + } } |