mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 21:51:08 +00:00
css parser: Small optimization
Avoid creating a GFile until it is needed.
This commit is contained in:
parent
e570eb4f86
commit
ed3b73871f
@ -85,10 +85,7 @@ gtk_css_parser_new (GtkCssTokenizer *tokenizer,
|
||||
self->ref_count = 1;
|
||||
self->tokenizer = gtk_css_tokenizer_ref (tokenizer);
|
||||
if (file)
|
||||
{
|
||||
self->file = g_object_ref (file);
|
||||
self->directory = g_file_get_parent (file);
|
||||
}
|
||||
self->file = g_object_ref (file);
|
||||
|
||||
self->error_func = error_func;
|
||||
self->user_data = user_data;
|
||||
@ -207,7 +204,12 @@ gtk_css_parser_resolve_url (GtkCssParser *self,
|
||||
}
|
||||
|
||||
if (self->directory == NULL)
|
||||
return NULL;
|
||||
{
|
||||
if (self->file)
|
||||
self->directory = g_file_get_parent (self->file);
|
||||
if (self->directory == NULL)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return g_file_resolve_relative_path (self->directory, url);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user