cssparser: Add gtk_css_parser_consume_url()

Another slight renaming and semantics change.
This commit is contained in:
Benjamin Otte 2019-04-09 02:29:27 +02:00
parent acddc317da
commit 607502ef43
5 changed files with 13 additions and 11 deletions

View File

@ -245,12 +245,9 @@ gtk_css_image_recolor_parse_arg (GtkCssParser *parser,
switch (arg)
{
case 0:
self->file = _gtk_css_parser_read_url (parser);
self->file = gtk_css_parser_consume_url (parser);
if (self->file == NULL)
{
_gtk_css_parser_error (parser, "Expected a url here");
return 0;
}
return 0;
return 1;
case 1:

View File

@ -165,7 +165,7 @@ gtk_css_image_url_parse (GtkCssImage *image,
{
GtkCssImageUrl *url = GTK_CSS_IMAGE_URL (image);
url->file = _gtk_css_parser_read_url (parser);
url->file = gtk_css_parser_consume_url (parser);
if (url->file == NULL)
return FALSE;

View File

@ -1036,7 +1036,7 @@ _gtk_css_parser_try_hash_color (GtkCssParser *parser,
}
GFile *
_gtk_css_parser_read_url (GtkCssParser *parser)
gtk_css_parser_consume_url (GtkCssParser *parser)
{
gchar *path;
GFile *file;

View File

@ -98,6 +98,7 @@ gboolean _gtk_css_parser_try_hash_color (GtkCssParser *parser
char * gtk_css_parser_consume_ident (GtkCssParser *self);
char * gtk_css_parser_consume_string (GtkCssParser *self);
GFile * gtk_css_parser_consume_url (GtkCssParser *self);
gboolean gtk_css_parser_consume_number (GtkCssParser *self,
double *number);
gboolean gtk_css_parser_consume_integer (GtkCssParser *parser,
@ -113,7 +114,6 @@ gsize gtk_css_parser_consume_any (GtkCssParser *parser
gpointer user_data);
gboolean _gtk_css_parser_has_number (GtkCssParser *parser);
GFile * _gtk_css_parser_read_url (GtkCssParser *parser);
void _gtk_css_parser_skip_whitespace (GtkCssParser *parser);
void _gtk_css_parser_resync (GtkCssParser *parser,

View File

@ -787,12 +787,17 @@ parse_import (GtkCssScanner *scanner)
char *url;
url = gtk_css_parser_consume_string (scanner->parser);
file = gtk_css_parser_resolve_url (scanner->parser, url);
g_free (url);
if (url)
{
file = gtk_css_parser_resolve_url (scanner->parser, url);
g_free (url);
}
else
file = NULL;
}
else
{
file = _gtk_css_parser_read_url (scanner->parser);
file = gtk_css_parser_consume_url (scanner->parser);
}
if (file == NULL)