Commit Graph

9 Commits

Author SHA1 Message Date
Benjamin Otte
0886ade182 cssparser: Make gsk_renderer_consume_url() return a string
We don't want to return a GFile because GFile can't handle can't deal
with data: urls.
That makes the code a bit more complicated that doesn't deal with those
URLs, but it makes the other code actually work.

GtkCssImageUrl also now decodes data urls immediately instead of only at
the first load. So don't use data urls if you care about performance.
2019-05-12 17:28:19 +02:00
Benjamin Otte
b76d5bda37 cssparser: Don't allow commit_token() on block EOF
When we're at the end of a block and gtk_css_parser_get_token() returns
NULL, gtk_css_parser_commit_token() still consumed the next token.

It does not anymore.

This does not affect the CSS parser, but it exposes issues with the
render parser, which previously just consumed too many closing } tokens
in the past.
2019-05-12 17:28:19 +02:00
Benjamin Otte
3c6aa84e44 cssparser: Add gtk_css_parser_has_number() 2019-05-05 07:18:39 +02:00
Benjamin Otte
79238b0d8f cssparser: Add error functions that take locations
... and use them to report better error locations for the warning when
blocks aren't terminated properly.
2019-04-12 19:34:28 +02:00
Benjamin Otte
76826cfa2f cssparser: Pass in error locations explicitly
And for the quick function, use the start/end location of the current
token.
2019-04-12 19:34:28 +02:00
Benjamin Otte
37671d2bd0 cssprovider: Redo error emission
Emit all errors via the parser, don't try to have a custom error
handling machinery.

The only exception is the initial file load error - we need to do that
one directly, because there is no parser.
2019-04-12 19:34:28 +02:00
Benjamin Otte
a475d72d47 cssparser: Improve location APIs
1. Export multiple locations
2. Return the location instead of passing one in
2019-04-12 19:34:28 +02:00
Benjamin Otte
e0a01ba174 css: Redo for new parser
This commit is still way too big, but I couldn't make it smaller.

It transitions the old CSS parser to the new parser. CSS parsing is now
tokenized, everything else is probably still buggy.
2019-04-12 19:34:28 +02:00
Benjamin Otte
f3db19d694 Resurrect the CSS parser from the tokenizer branch
So far that parser is unused.
2019-04-12 19:34:28 +02:00