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.
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.
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.
- 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.
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.
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.
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#c4https://bugs.freedesktop.org/show_bug.cgi?id=69796#c4https://bugzilla.gnome.org/show_bug.cgi?id=763779