cssimage: Fallback images have no aspect ratio

The aspect ratio for fallback image was incorrectly set to 1.

Reftest is included.
This commit is contained in:
Benjamin Otte 2017-01-13 01:43:07 +01:00
parent a06b1ea1ba
commit e5e5beafa5
5 changed files with 34 additions and 1 deletions

View File

@ -56,7 +56,7 @@ gtk_css_image_fallback_get_aspect_ratio (GtkCssImage *image)
GtkCssImageFallback *fallback = GTK_CSS_IMAGE_FALLBACK (image); GtkCssImageFallback *fallback = GTK_CSS_IMAGE_FALLBACK (image);
if (fallback->used < 0) if (fallback->used < 0)
return 1; return 0;
return _gtk_css_image_get_aspect_ratio (fallback->images[fallback->used]); return _gtk_css_image_get_aspect_ratio (fallback->images[fallback->used]);
} }

View File

@ -201,6 +201,9 @@ testdata = \
css-image-aspect-ratio.css \ css-image-aspect-ratio.css \
css-image-aspect-ratio.ui \ css-image-aspect-ratio.ui \
css-image-aspect-ratio.ref.ui \ css-image-aspect-ratio.ref.ui \
css-image-color-aspect-ratio.css \
css-image-color-aspect-ratio.ui \
css-image-color-aspect-ratio.ref.ui \
css-match-class.css \ css-match-class.css \
css-match-class.ref.ui \ css-match-class.ref.ui \
css-match-class.ui \ css-match-class.ui \

View File

@ -0,0 +1,9 @@
window {
background-color: blue;
background-image: image(red);
background-repeat: no-repeat;
}
#reference {
background: red;
}

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window1">
<property name="width_request">20</property>
<property name="height_request">10</property>
<property name="can_focus">False</property>
<property name="type">popup</property>
<property name="name">reference</property>
</object>
</interface>

View File

@ -0,0 +1,10 @@
<?xml version="1.0" encoding="UTF-8"?>
<interface>
<!-- interface-requires gtk+ 3.0 -->
<object class="GtkWindow" id="window1">
<property name="width_request">20</property>
<property name="height_request">10</property>
<property name="can_focus">False</property>
<property name="type">popup</property>
</object>
</interface>