Benjamin Otte
62b2f979e5
csstokenizer: Collect error, don't just emit it
...
This again is part of the quest to make it possible to "undo" reading
a token.
2016-04-08 16:18:32 +02:00
Benjamin Otte
c6951488f9
csstokenizer: Refactor to add GtkCssTokenReader
...
This new internal struct is now used to read the next token. This allows
keeping the current info in the tokenizer.
Technically, we could now reset a parse if we wanted to. So far we don't
want to.
2016-04-08 16:18:32 +02:00
Benjamin Otte
935141b915
csstokenizer: Export GtkCssLocation
...
And change the tokenizer API to return the location instead of having
multiple functions returning all of the members of the location struct.
And because surprisingly the new Location struct is exactly the same
struct as what is used in the CssEditor (how could that happen?!), use
it there, too.
2016-04-08 16:18:32 +02:00
Benjamin Otte
947f3ea5ec
csstokenizer: Introduce GtkCssLocation
2016-04-08 16:18:32 +02:00
Benjamin Otte
7ca4ef7b0c
cssease: Optimize with Newton's method
...
Idea stolen from Webkit's implementation.
2016-04-08 16:18:32 +02:00
Benjamin Otte
3659741414
cssease: Refactor code
...
Makes it a bit easier to read and prepares it for the next commit.
2016-04-08 16:18:32 +02:00
Benjamin Otte
02f31d7133
cssimage: Move fallback token parser to -gtk-gradient()
...
Every other image type has a real token parser now.
2016-04-08 16:18:32 +02:00
Benjamin Otte
58aa294970
cssimage: Make the win32 image parser have a token parser
2016-04-08 16:18:32 +02:00
Benjamin Otte
55e3a1927d
css: Add gtk_css_token_source_consume_integer()
...
And make sure the integer parsing functions call it.
2016-04-08 16:18:32 +02:00
Benjamin Otte
b00e9f629c
win32 theme: Fix functions to not have spaces
...
CSS doesn't allow that (although GTK's CSS parser did so far not
complain).
2016-04-08 16:18:32 +02:00
Benjamin Otte
f54cf9d9d4
cssimage: Add token parser for image() images
2016-04-08 16:18:32 +02:00
Benjamin Otte
e351cbc83f
cssimage: Add token parser for cross-fade()
2016-04-08 16:18:32 +02:00
Benjamin Otte
f4fba248ad
cssimage: Add token parser for -gtk-recolor() images
2016-04-08 16:18:32 +02:00
Benjamin Otte
27bbfe9d80
cssimage: Add a token parser for radial gradients
2016-04-08 16:18:32 +02:00
Benjamin Otte
63b1e50835
cssimage: Add token parser for builtin images
2016-04-08 16:18:32 +02:00
Benjamin Otte
87eeb1bdfb
cssimage: Add token parser for linear-gradient
...
This requires refactoring of gtk_css_token_source_consume_function() to
allow a single call to the parse_args function to consume multiple
arguments.
Because the first argument to linear-gradient() is the optional
direction, we need to indicate that we skipped it. So the parse
function returns 2 in that case. This way we can set the minimum required
arguments to 3, while still allowing
linear-gradient(red, blue);
which is equivalent to
linear-gradient(to bottom, red, blue);
2016-04-08 16:18:31 +02:00
Benjamin Otte
fabc1f633d
cssprovider: Add a way to load a provider from a stylesheet
...
Use that way in the CSS editor.
2016-04-08 16:18:31 +02:00
Benjamin Otte
01b320f563
css: Functions don't accept spaces before ( anymore
...
So fix the testcaes that use them.
And in particular, fix -gtk-gradient() using spaces everywhere.
2016-04-08 16:18:31 +02:00
Benjamin Otte
ca5075c26d
css: Split integer tokens into ones with sign and ones without
...
And with that newfound power, fix the an+b parser.
I hate that part of the spec.
2016-04-08 16:18:31 +02:00
Benjamin Otte
9c12d01ba3
cssimportrule: Add recursion check
2016-04-08 16:18:31 +02:00
Benjamin Otte
9d07be0238
css: Parse widget styles with token parser
2016-04-08 16:18:31 +02:00
Benjamin Otte
f36217dda6
cssdeclaration: Propertify
2016-04-08 16:18:31 +02:00
Benjamin Otte
0f9526578a
cssdeclaration: Turn into abstract base class
...
This is in preparation for allowing to parse style properties like
-GtkWidget-focus-width.
2016-04-08 16:18:31 +02:00
Benjamin Otte
afe70c4568
cssimportrule: Actually import the style sheet
...
Also add code to the inspector's ruleview to display rules of imported
style sheets.
2016-04-08 16:18:31 +02:00
Benjamin Otte
eb86a5fb3f
stylesheet: Add properties
...
... and turn it into the API demanded by the CSSOM. That is, don't allow
reloading in the stylesheet, demand that new ones are created and the
token source be provided at construction.
2016-04-08 16:18:31 +02:00
Benjamin Otte
ca1c46c170
csskeyframes: Allow constructing from KeyframesRule
...
This requires a bunch of API being added to the rules.
2016-04-08 16:18:31 +02:00
Benjamin Otte
23c729459f
menu: Clip children to view window
...
Don't overdraw the arrow allocations.
https://bugzilla.gnome.org/show_bug.cgi?id=764118
2016-04-08 16:18:31 +02:00
Benjamin Otte
7a36b5df90
cssdefinecolorrule: Rework parser
...
Actually store the values that get parsed. And change the parsing code
to construct the rule in advance so that it can be set as the consumer
while parsing.
2016-04-08 16:18:31 +02:00
Benjamin Otte
69506210a2
css: Add token parser for keyframes rule
2016-04-08 16:18:31 +02:00
Benjamin Otte
0fbdcc3cd1
inspector: Add a ruleview
...
This widget lists all the rules in the current CSS. For now it lives
next to the css editor widget.
2016-04-08 16:18:30 +02:00
Benjamin Otte
ff7f62b3ca
cssstyledeclaration: Make declarations queryable
2016-04-08 16:18:30 +02:00
Benjamin Otte
b3ee232880
cssstylesheet: Store the file we loaded from
2016-04-08 16:18:30 +02:00
Benjamin Otte
768cdf8a55
cssrule: Add properties
...
... and actually store the style sheet and parent rule.
2016-04-08 16:18:30 +02:00
Benjamin Otte
b2c070551b
cssdeclaration: Add API to query name + value
2016-04-08 16:18:30 +02:00
Benjamin Otte
e1444d0d35
inspector: Allow horizontal scrolling in the css editor
...
Otherwise, when pasting Adwaita's CSS into it, it expands to be larger
than my screen...
2016-04-08 16:18:30 +02:00
Benjamin Otte
33b2684c29
css: Add a token aprser for define-color
2016-04-08 16:18:30 +02:00
Benjamin Otte
16dff3909b
css: Add token parser for @import
2016-04-08 16:18:30 +02:00
Benjamin Otte
920a88512b
css: Move blocks handling to the token sources that need it
...
They need different ways of handling blocks, so they better do it
themselves instead of having a generic way that always gets it wrong.
2016-04-08 16:18:30 +02:00
Benjamin Otte
fcf65bf8a4
cssimage: Add token parser for -gtk-scaled
2016-04-08 16:18:30 +02:00
Benjamin Otte
a39d1a620f
cssimage: Add a token parser for icontheme images
2016-04-08 16:18:30 +02:00
Benjamin Otte
ae248b3443
cssimage: Add token parser for url() images
...
This requires adding location information to GtkCssTokenSource, so that
we can resolve relative URLs.
2016-04-08 16:18:30 +02:00
Benjamin Otte
28babd269b
css: Move fallback parser to GtkCssImage
...
Now that all CSS values can be parsed by the token parser, no fallback
parsing code is necessary anymore.
However, the images can't be parsed by the token parser yet, so the
fallback code moved there.
Also remove the property argiument from the token parsing vfunc in
GtkCssStyleProperty. It was unused and just caused a lot of casting.
2016-04-08 16:18:30 +02:00
Benjamin Otte
fef9fe68d0
css: Add a token parser for transform values
2016-04-08 16:18:30 +02:00
Benjamin Otte
945bddf120
css: Add gtk_css_token_source_consume_number()
...
This is totally so we can parse
color: rgb(calc(255 * 0.3), calc(255 * 0.6), calc(255 * 0.3));
which Webkit totally can, but Firefox and IE totally can't.
And GTK has to be at least the 2nd best CSS engine in the world.
2016-04-08 16:18:30 +02:00
Benjamin Otte
87d3bb5799
css: Add a token parser for engine values
2016-04-08 16:18:29 +02:00
Benjamin Otte
19d88eca1f
css: Add token parser for font-size property
2016-04-08 16:18:29 +02:00
Benjamin Otte
2e05b896de
css: Add token parser for bgsize values
2016-04-08 16:18:29 +02:00
Benjamin Otte
c767617d54
css: Add token parse for position values
...
And implement that parser completely. Now that we have calc(), this
actually works.
2016-04-08 16:18:29 +02:00
Benjamin Otte
90e423b34d
css: Consume whitespace tokens automatically
...
Exception: The selector parsing code uses the peek_token() vfunc to
actually get the real tokens, whitepsace included.
2016-04-08 16:18:27 +02:00
Benjamin Otte
d7c8885852
css: Add token parsers for shadows
...
This also introduces the new idea of check_token() functions. These
functions check if a given function might be the initial token in
parsing a certain value. Implementations for numbers and colors are
included.
2016-04-08 16:18:07 +02:00