mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-12-26 13:41:07 +00:00
css: Add gtk_css_parser_has_url()
This function wasn't needed so far so I didn't add it. The next commits will use it. I made has_url() return TRUE for the BAD_URL token, even though a BAD_URL is not a valid URL. But parsing code will almost always want to treat these tokesn the same way it would treat otherwise bad urls, so returning TRUE here makes it go own the right error path in calling code.
This commit is contained in:
parent
4e00384830
commit
976c5077b9
@ -957,6 +957,14 @@ gtk_css_parser_parse_url_arg (GtkCssParser *parser,
|
||||
return 1;
|
||||
}
|
||||
|
||||
gboolean
|
||||
gtk_css_parser_has_url (GtkCssParser *self)
|
||||
{
|
||||
return gtk_css_parser_has_token (self, GTK_CSS_TOKEN_URL)
|
||||
|| gtk_css_parser_has_token (self, GTK_CSS_TOKEN_BAD_URL)
|
||||
|| gtk_css_parser_has_function (self, "url");
|
||||
}
|
||||
|
||||
/**
|
||||
* gtk_css_parser_consume_url:
|
||||
* @self: a `GtkCssParser`
|
||||
|
@ -116,6 +116,7 @@ gboolean gtk_css_parser_has_token (GtkCssParser
|
||||
GtkCssTokenType token_type);
|
||||
gboolean gtk_css_parser_has_ident (GtkCssParser *self,
|
||||
const char *ident);
|
||||
gboolean gtk_css_parser_has_url (GtkCssParser *self);
|
||||
gboolean gtk_css_parser_has_number (GtkCssParser *self);
|
||||
gboolean gtk_css_parser_has_integer (GtkCssParser *self);
|
||||
gboolean gtk_css_parser_has_function (GtkCssParser *self,
|
||||
|
Loading…
Reference in New Issue
Block a user