Merge branch 'cherry-pick-ac8c4245' into 'gtk-4-4'
css: Don't throw warnings on broken URL in image css See merge request GNOME/gtk!4098
This commit is contained in:
@@ -42,6 +42,12 @@ gtk_css_image_url_load_image (GtkCssImageUrl *url,
|
||||
if (url->loaded_image)
|
||||
return url->loaded_image;
|
||||
|
||||
if (url->file == NULL)
|
||||
{
|
||||
url->loaded_image = gtk_css_image_invalid_new ();
|
||||
return url->loaded_image;
|
||||
}
|
||||
|
||||
/* We special case resources here so we can use gdk_texture_new_from_resource. */
|
||||
if (g_file_has_uri_scheme (url->file, "resource"))
|
||||
{
|
||||
@@ -148,6 +154,10 @@ gtk_css_image_url_equal (GtkCssImage *image1,
|
||||
{
|
||||
GtkCssImageUrl *url1 = GTK_CSS_IMAGE_URL (image1);
|
||||
GtkCssImageUrl *url2 = GTK_CSS_IMAGE_URL (image2);
|
||||
|
||||
/* FIXME: We don't save data: urls, so we can't compare them here */
|
||||
if (url1->file == NULL || url2->file == NULL)
|
||||
return FALSE;
|
||||
|
||||
return g_file_equal (url1->file, url2->file);
|
||||
}
|
||||
|
||||
4
testsuite/reftests/css-image-broken-url.css
Normal file
4
testsuite/reftests/css-image-broken-url.css
Normal file
@@ -0,0 +1,4 @@
|
||||
#test {
|
||||
/* The url should fail as early as possible */
|
||||
background-image: url('data::::');
|
||||
}
|
||||
8
testsuite/reftests/css-image-broken-url.ref.ui
Normal file
8
testsuite/reftests/css-image-broken-url.ref.ui
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="width_request">10</property>
|
||||
<property name="height_request">10</property>
|
||||
<property name="decorated">0</property>
|
||||
</object>
|
||||
</interface>
|
||||
9
testsuite/reftests/css-image-broken-url.ui
Normal file
9
testsuite/reftests/css-image-broken-url.ui
Normal file
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<interface>
|
||||
<object class="GtkWindow" id="window1">
|
||||
<property name="width_request">10</property>
|
||||
<property name="height_request">10</property>
|
||||
<property name="decorated">0</property>
|
||||
<property name="name">test</property>
|
||||
</object>
|
||||
</interface>
|
||||
@@ -191,6 +191,9 @@ testdata = [
|
||||
'css-image-aspect-ratio.css',
|
||||
'css-image-aspect-ratio.ui',
|
||||
'css-image-aspect-ratio.ref.ui',
|
||||
'css-image-broken-url.css',
|
||||
'css-image-broken-url.ref.ui',
|
||||
'css-image-broken-url.ui',
|
||||
'css-image-color-aspect-ratio.css',
|
||||
'css-image-color-aspect-ratio.ui',
|
||||
'css-image-color-aspect-ratio.ref.ui',
|
||||
|
||||
Reference in New Issue
Block a user