[gtk+] cssvalue: Compute "background-size: 0 0" properly
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] cssvalue: Compute "background-size: 0 0" properly
- Date: Wed, 31 Oct 2012 10:57:37 +0000 (UTC)
commit 67302c5ee03e1b6b045b429b0083751519125e9a
Author: Benjamin Otte <otte redhat com>
Date: Fri Oct 26 23:36:39 2012 +0200
cssvalue: Compute "background-size: 0 0" properly
Previously a computed value of 0 was treated as "auto", which is wrong.
gtk/gtkcssbgsizevalue.c | 37 +++++++++++++++++++++++++++----------
1 files changed, 27 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkcssbgsizevalue.c b/gtk/gtkcssbgsizevalue.c
index 01db83d..a34b3c1 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);
+ }
+ }
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]