mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-09 18:30:08 +00:00
css: Remove crashy resource:// optimization
Using gdk_texture_new_from_resource() is not valid here because we are not sure if the given resource is valid. Plus, the previous optimization is no longer relevant, because we are not using gdk_pixbuf_new_from_resource() anymore - which was what this optimization was about before it was ported to GdkTexture. Test attached.
This commit is contained in:
parent
49d06736a5
commit
41696b0c57
@ -47,21 +47,7 @@ gtk_css_image_url_load_image (GtkCssImageUrl *url,
|
||||
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"))
|
||||
{
|
||||
char *uri = g_file_get_uri (url->file);
|
||||
char *resource_path = g_uri_unescape_string (uri + strlen ("resource://"), NULL);
|
||||
|
||||
texture = gdk_texture_new_from_resource (resource_path);
|
||||
|
||||
g_free (resource_path);
|
||||
g_free (uri);
|
||||
}
|
||||
else
|
||||
{
|
||||
texture = gdk_texture_new_from_file (url->file, &local_error);
|
||||
}
|
||||
texture = gdk_texture_new_from_file (url->file, &local_error);
|
||||
|
||||
if (texture == NULL)
|
||||
{
|
||||
|
@ -449,6 +449,8 @@ test_data = [
|
||||
'radial-positions.errors',
|
||||
'radial-positions.ref.css',
|
||||
'radial.ref.css',
|
||||
'resource-url.css',
|
||||
'resource-url.ref.css',
|
||||
'rotate3d-crash.css',
|
||||
'rotate3d-crash.errors',
|
||||
'rotate3d-crash.ref.css',
|
||||
|
3
testsuite/css/parser/resource-url.css
Normal file
3
testsuite/css/parser/resource-url.css
Normal file
@ -0,0 +1,3 @@
|
||||
window { background-image: url("resource://"); }
|
||||
|
||||
button { background-image: url("resource://doesnotexist.jpg"); }
|
7
testsuite/css/parser/resource-url.ref.css
Normal file
7
testsuite/css/parser/resource-url.ref.css
Normal file
@ -0,0 +1,7 @@
|
||||
window {
|
||||
background-image: none /* invalid image */;
|
||||
}
|
||||
|
||||
button {
|
||||
background-image: none /* invalid image */;
|
||||
}
|
Loading…
Reference in New Issue
Block a user