picture: Return natural size 0 for size 0

It was returning the full natural size (same as -1) due to default value
handling in the code below.

Tests have been updated to match this output.
This commit is contained in:
Ivan Molodetskikh 2021-11-19 16:26:07 +03:00 committed by Benjamin Otte
parent 348e34f221
commit 7ef54e9c53
4 changed files with 5 additions and 4 deletions

View File

@ -178,7 +178,8 @@ gtk_picture_measure (GtkWidget *widget,
double min_width, min_height, nat_width, nat_height;
double default_size;
if (self->paintable == NULL)
/* for_size = 0 below is treated as -1, but we want to return zeros. */
if (self->paintable == NULL || for_size == 0)
{
*minimum = 0;
*natural = 0;

View File

@ -11,5 +11,5 @@ picture {
background-image: image(lime);
background-repeat: no-repeat;
background-position: center;
background-size: 150px 150px;
background-size: 100px 100px;
}

View File

@ -11,5 +11,5 @@ picture {
background-image: image(lime);
background-repeat: no-repeat;
background-position: center;
background-size: 200px 200px;
background-size: 100px 100px;
}

View File

@ -11,5 +11,5 @@ picture {
background-image: image(lime);
background-repeat: no-repeat;
background-position: center;
background-size: 300px 300px;
background-size: 100px 100px;
}