Commit Graph

11 Commits

Author SHA1 Message Date
Benjamin Otte
1454ba15ba css: Huge refactoring to avoid computing wrong values
Here's the shortest description of the bug I can come up with:
When computing values, we have 3 kinds of dependencies:
(1) other properties ("currentColor" or em values)
(2) inherited properties ("inherit")
(3) generic things from the theme (@keyframes or @define-color)
Previously, we passed the GtkStyleContext as an argument, because it
provided these 3 things using:
(1) _gtk_style_context_peek_property()
(2) _gtk_style_context_peek_property(gtk_style_context_get_parent())
(3) context->priv->cascade

However, this makes it impossible to lookup values other than the ones
accessible via _gtk_style_context_peek_property(). And this is exactly
what we are doing in gtk_style_context_update_cache(). So when the cache
updates encountered case (1), they were looking up the values from the
wrong style data.

So this large patch essentially does nothing but replace the
context argument in all compute functions with new arguments for the 3
cases above:
(1) values
(2) parent_values
(3) provider

We apparently have a lot of computing code.
2012-09-28 18:27:49 +02:00
Benjamin Otte
0185e323db cssvalue: Add animation enum properties 2012-09-17 20:39:11 +02:00
Benjamin Otte
e3fc081c5d cssvalue: Pass property ID to transition function
This is to allow animating arrays properly. I'm not really thrilled
about this solution (we leak propertys into the values again...), but
it's the best I can come up with - I prefer it to having N different
array types...
2012-09-03 12:54:14 +02:00
Benjamin Otte
0e2f35ed88 css: Introduce dependencies for value computations
When values are computed, they might depend on various other values and
we need to track this so we can update the values when those other
values change. This is the first step in making that happen.

This patch does not do any dependency tracking at all, instead it uses
GTK_CSS_DEPENDS_ON_EVERYTHING as a sort of FIXME.
2012-08-28 15:42:23 +02:00
Benjamin Otte
9b4ed66218 css: Pass property_id to compute function
This is a reorganization of how value computing should be done.
Previously the GtkCssStyleProperty.compute vfunc was supposed to take
care of special cases when it needed those for computation. However,
this proved to be very complicated in cases where values were nested and
only the last value (of a common type) needed to be special cased.

A common example for this was the fallback handling for unresolvable
colors.

Now, we pass the property's ID along with all compute functions so we
can do the special casing where it's necessary.
Note that no actual changes happen in this commit. This will happen in
follow-ups.
2012-08-28 15:40:56 +02:00
Benjamin Otte
9b953829fb css: Introduce _gtk_css_value_compute()
This commit is essentially a large reorganization. Instead of all value
subtypes having their own compute function, there is the general
_gtk_css_value_compute() function that then calls a vfunc on the
subtype.
2012-08-28 15:40:56 +02:00
Matthias Clasen
f8a7810397 Deal with non-multiple-of-100 font weights
We should not run into an assertion so easily.
2012-06-01 16:15:16 -04:00
Benjamin Otte
1a9dfab825 cssvalue: Add _gtk_css_value_transition()
Returns a value that transitions between start and end or %NULL if the
values cannot be transitioned.

So far, all implementations but numbers and rgba return NULL.
2012-04-17 08:59:15 +02:00
Benjamin Otte
4ba9be5b97 cssvalue: Add GtkCssArea to the enum values
... and get rid of its GType.

This makes it non-queryable using gtk_style_context_get() but it used to
be a private struct anyway.
2012-04-17 08:59:15 +02:00
Benjamin Otte
d63b11e56b cssvalue: Add enum values for the pango enums
And fix the parser to conform to the CSS spec while at it.
2012-04-17 08:59:14 +02:00
Benjamin Otte
b65d17dda8 cssvalue: Make border styles be their own value
... and add them via gtkcssenumvalue.[ch] which will be used for all
enums.
2012-04-17 08:59:14 +02:00