Commit Graph

47067 Commits

Author SHA1 Message Date
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
Benjamin Otte
567d9887f7 css: A token parse func for repeat values 2016-04-08 16:18:07 +02:00
Benjamin Otte
32d671cfd7 inspector: Move errors on EOF token to last token
That's wrong, but it makes sure we don't lose any error messages.
2016-04-08 16:18:07 +02:00
Benjamin Otte
fae4a14177 css: Add token parser for ease values
Also add a parser for functions to the token source.
2016-04-08 16:18:07 +02:00
Benjamin Otte
c0ee099aa1 css: Add a token parser for border values 2016-04-08 16:18:07 +02:00
Benjamin Otte
ab402e2400 css: Add token parser for corner radius value 2016-04-08 16:18:07 +02:00
Benjamin Otte
c5d5825cf0 css: Add token parser for palettes 2016-04-08 16:18:07 +02:00
Benjamin Otte
6c72e9423f css: add token parser for icontheme values 2016-04-08 16:18:07 +02:00
Benjamin Otte
73d69e353b css: Add token parser for array values 2016-04-08 16:18:07 +02:00
Benjamin Otte
e9bc9082a4 css: Convert enums to token parsing 2016-04-08 16:18:07 +02:00
Benjamin Otte
b9c77aadec css: Add token parsing for number values
This includes calc() and the win32 number values.

CSS properties using just <length>, <angle>, <time>, <percentage> or
<number> have been converted.
2016-04-08 16:18:05 +02:00
Benjamin Otte
974ca283ef css: Change the way we token parse longhands
- Move the default parse func to gtkcssstylepropertyimpl.c and use it
  there.
- Change the arguments in the prototype of the parse func so that we
  don't use trampolines anymore.
- Stop using a trampoline for color parsing.
2016-04-08 16:17:22 +02:00
Benjamin Otte
0a11e4d36b css: Add token parsing for colors
... and add infrastructure to use it to longhand properties.
2016-04-08 16:17:22 +02:00
Benjamin Otte
662065bdb1 css: Allow the css editor to take a CSS node
Use that to hilight the selectors that match that node.
2016-04-08 16:17:22 +02:00
Benjamin Otte
9c02a600b2 css: Add gtk_style_property_token_parse()
Slowly move the token parser into CSS value parsing.
2016-04-08 16:17:22 +02:00
Benjamin Otte
257273c439 inspector: Add style sheet parsing to CSS editor
This way, we can now keep backlogs to the style sheet objects from the
tokens. A simple use of that is included via syntax hilighting of CSS
properties.

Also, we now take the errors from the style sheet parsing and not from
the loading of the CSS provider. This is a bit of a regression for now,
as the style sheet parser does not emit very many errors yet.
2016-04-08 16:17:22 +02:00
Benjamin Otte
348052064a cssdeclaration: Store the style property
That way, we can error if a property name isn't valid.
2016-04-08 16:17:22 +02:00
Benjamin Otte
14e7c42200 css: Add a consumer object to consume_token()
This is to allow backreferences from code analysis frameworks.
2016-04-08 16:17:22 +02:00
Benjamin Otte
e64a143ff7 tokenizer: Emit token in error vfunc 2016-04-08 16:17:22 +02:00
Benjamin Otte
840d347d59 css: Add code to parse declarations
We don't parse the values yet.
2016-04-08 16:17:22 +02:00
Benjamin Otte
674ca8ae1c css: Add skeleton for new parsing infrastructure
This infrastructure will be based around the CSSOM and return a
GtkCssStyleSheet object as its result.

The initial intended use for this is as a syntax tree while editing in
the inspector, but we might even want to look into exporting the CSSOM
parts as public API at some point.
2016-04-08 16:17:21 +02:00
Benjamin Otte
25b2e2f3e5 inspector: Implement rudimentary syntax hilighting
We hilight comments in blue and strings in red. Go us!
2016-04-08 16:17:21 +02:00
Benjamin Otte
48b241833a inspector: Don't clear all tags when getting text 2016-04-08 16:17:21 +02:00
Benjamin Otte
460ad90379 gtk: Add an RB tree implementation for use in CSS code
Some tests included
2016-04-08 16:17:21 +02:00
Benjamin Otte
adeec6656c rbtree: Remove unused typedef 2016-04-08 16:17:21 +02:00
Benjamin Otte
78fd100ade css: Add GtkCssTokenizer
So far, it's known to successfully tokenize Adwaita's CSS.
2016-04-08 16:17:21 +02:00
Benjamin Otte
b1a8537314 theme: linear-gradient() needs 2 color-stops
So make sure our _solid() function gives it two.
2016-04-08 16:17:21 +02:00
Benjamin Otte
7a69ea89ca theme: Add _solid() function
The function creates a solid color image. Currently this is done with
linear-gradient().
2016-04-08 16:17:14 +02:00
Benjamin Otte
41195f6300 switch: An active switch is :checked
Fix an oversight that should have happened in the gadget refactoring:
An active switch should be :checked, just like togglebuttons,
checkbuttons, etc.
2016-03-23 18:14:57 +01:00
Christoph Reiter
3f077ec36f quartz: fix pixelated image surfaces in retina/hidpi mode
gtk+ currently depends on the scaling factor and the cairo device scale
of both the backend surfaces and image surfaces to be equal.

Until now we didn't apply a cairo device scale at all and depended on the
automatic scaling of CGContexts. This works when drawing with cairo but
fails in case of image surfaces, which get requested at a too small size.

To make the quartz backend behave more like the X11 one, set the cairo device
scale on the surface in gdk_quartz_ref_cairo_surface(). As this conflicts
with the default scaling done by CGContext (we would get double scaling)
undo the CGContext scaling using CGContextScaleCTM().

This patch is based on the following patches by Brion Vibber:
    https://bugzilla.gnome.org/show_bug.cgi?id=740199#c4
    https://bugs.freedesktop.org/show_bug.cgi?id=69796#c4

https://bugzilla.gnome.org/show_bug.cgi?id=763779
2016-03-23 16:27:10 +01:00
Stas Solovey
3a5848820c Updated Russian translation 2016-03-23 15:23:08 +00:00