Commit Graph

31491 Commits

Author SHA1 Message Date
Benjamin Otte
6ef76f4a92 customproperty: Add our own query_value function
I'm about to change the CssStyleProperty one, so better copy things
here.
2012-04-17 08:59:13 +02:00
Benjamin Otte
c8e57d63ec cssstyelproperty: Rempove specified-type and computed-type props
This removes the necessity to keep a GType associated with style
properties and code can now make use of GtkCssValue completely.
2012-04-17 08:59:13 +02:00
Benjamin Otte
75a5f04352 styleproperty: Remove default parse function
... and assert every style property brings its own.
2012-04-17 08:59:13 +02:00
Benjamin Otte
a5d001b2ba stylepropertyimpl: Add remaining parse functions 2012-04-17 08:59:12 +02:00
Benjamin Otte
0fdc287339 styleproperty: Simplify compute_value function
The compute_value fallback path is only needed for custom properties,
the real style properties have custom compute functions if they need
them already.
2012-04-17 08:59:12 +02:00
Benjamin Otte
7fbc583b88 css: Move shadow parse/print/compute funcs
They don't belong in the style funcs, as those are for custom
properties, and the shadow type is private.
2012-04-17 08:59:12 +02:00
Benjamin Otte
dd144c2bad stylepropertyimpl: Add parse funcs for enums 2012-04-17 08:59:12 +02:00
Benjamin Otte
86a387f571 stylepropertyimpl: Add color parsing function
This is in preparation for removing the specified type and computed type
properties from GtkCssStyleProperty, which is in preparation for really
using GtkCssValue classes and not GTypes.
2012-04-17 08:59:12 +02:00
Benjamin Otte
b5fc484c99 customproperty: Don't rely on querying style property
This way, we can remove type madness from GtkCssStyleProperty later.
2012-04-17 08:59:12 +02:00
Benjamin Otte
bc9060a591 styleproperty: Make gtk_style_property_register() not be valist
Instead, make the caller create a GtkCssValue in advance.
2012-04-17 08:59:12 +02:00
Benjamin Otte
ffe50c3b67 cssvalue: Add _gtk_css_value_equal()
For now, we return FALSE for all default css values, so this is not very
useful.

I also think of this as an optimization equal, not a guaranteed equal,
because we don't even have a notion of what "equal" means.

For example, for background-repeat, "repeat, repeat" and "repeat"
are functionally equivalent. But the cssvalue has no idea that it's used
for background-repeat.
As a more complicated example, "repeat, no-repeat" and "repeat" are
equal to what one sees as long as there's only one image listed
background-image-source. But once you start transition'ing to an image
with 2 sources, it's different...
2012-04-17 08:59:12 +02:00
Benjamin Otte
3e601691d9 tests: Change expected errors to conform with output
This change isn't strictly correct, but I can't be bothered until we get
a tokenizer that can really differentiate between allowed values and
invalid syntax.
2012-04-17 08:59:12 +02:00
Benjamin Otte
b0e764000f cssparser: Use _gtk_css_parser_error_full() 2012-04-17 08:59:12 +02:00
Benjamin Otte
e7acdec220 cssparser: Add _gtk_css_parser_error_full() 2012-04-17 08:59:11 +02:00
Benjamin Otte
9b7640b898 styleproperty: Make _gtk_style_property_parse_value() return a CssValue
Also split out initial/inherit handling into a custom GtkCssValue class.
2012-04-17 08:59:11 +02:00
Benjamin Otte
718ceaec45 css: Remove _gtk_css_style_property_is_specified_type()
That check is going to be refactored away.
2012-04-17 08:59:11 +02:00
Benjamin Otte
04f5c8708a cssvalue: Add a CSS value for arrays
Make the value auto-cycle its child values, so it can be used for
background properties.
2012-04-17 08:59:11 +02:00
Benjamin Otte
df45983fcb cssvalue: Remove _gtk_css_value_new_take_gvalue()
Having two constructors from GValues complicates refactorings, so I'd
rather not have them.
2012-04-17 08:59:11 +02:00
Benjamin Otte
8e3e3d582f cssvalue: Get rid of unused functions 2012-04-17 08:59:11 +02:00
Benjamin Otte
5ac9ba714a styleproperty: Make _gtk_style_property_query() take a GValue
... and don't make it return a GtkCssValue. We want to use this for
compat with the old GValue APIs after all...
2012-04-17 08:59:11 +02:00
Benjamin Otte
58e4fdf911 styleproperty: Make print_func take a GtkCssValue
Also, constify GtkCssValue getters, so we can pass a const GtkCssValue
to the print_func.
2012-04-17 08:59:11 +02:00
Benjamin Otte
b728cfd3e8 cssvalue: Make the structure vtable-based
Don't use real classes, just a vtable.
2012-04-17 08:59:11 +02:00
Benjamin Otte
3cdb9c91ca styleproperty: Add support for equal_func 2012-04-17 08:59:11 +02:00
Benjamin Otte
d5a2392cc7 stylecontext: Don't clear cache when only state changes
This takes more memory, but changes to backdrop or active state are
quite expensive otherwise.
2012-04-17 08:59:11 +02:00
Benjamin Otte
44187ca3b5 cssmatcher: Use quarks for classes 2012-04-17 08:59:10 +02:00
Benjamin Otte
115c34498e styleproperty: Add a function to compare values for equality
and default to never compare them as equal.
2012-04-17 08:59:10 +02:00
Benjamin Otte
5bbf59b519 cssvalue: Constify a bunch of APIs 2012-04-17 08:59:10 +02:00
Benjamin Otte
4a12717e4d cssvalue: Remove unused functions 2012-04-17 08:59:10 +02:00
Benjamin Otte
585a1fae4f stylecontext: Really queue style changes
Instead of instantly applying a new style, just mark the context as
invalid. Only apply the new style at layout time.
2012-04-17 08:59:10 +02:00
Benjamin Otte
eb537b60f4 stylecontext: Optimize the common case of "style didn't change" 2012-04-17 08:59:10 +02:00
Benjamin Otte
ece9d2fd92 gtk: Make widget only invalidate widget positions
Instead of resetting them completely
2012-04-17 08:59:10 +02:00
Benjamin Otte
e7a984b337 window: Set parent context instead of just resetting style
Otherwise the inherit properties won't inherit properly.
2012-04-17 08:59:10 +02:00
Benjamin Otte
27c9352df3 widget: Replace reset_style() calls
... with finer grained _gtk_widget_invalidate_style_context() calls.
2012-04-17 08:59:10 +02:00
Benjamin Otte
969daec353 widget: Don't go via path when resetting style
Instead, invalidate the path when the style context changes. And
invalidate the style context directly.
2012-04-17 08:59:09 +02:00
Benjamin Otte
d589566f40 widget: Add _gtk_widget_invalidate_style_context()
This is supposed to replace gtk_widget_reset_style().
2012-04-17 08:59:09 +02:00
Benjamin Otte
48a8ca8bbe widget: Merge function into only caller 2012-04-17 08:59:09 +02:00
Benjamin Otte
257d961a01 widget: Clear broken widget path in constructor
... where it belongs instead of fiddling with it in get_path().
2012-04-17 08:59:09 +02:00
Benjamin Otte
198cf93f0f stylecontext: On failure, exit the loop, don't try again
Because we will fail again. And then we try again. And then we fail
again. Ad infinitum.
2012-04-17 08:59:09 +02:00
Benjamin Otte
15be680540 stylecontext: Invalidate when setting classes/state/regions
... and nobody has called style_context_save().
2012-04-17 08:59:09 +02:00
Benjamin Otte
44d49c900d stylecontext: Use _gtk_style_context_queue_invalidate() on self 2012-04-17 08:59:09 +02:00
Benjamin Otte
39ff874a11 stylecontext: Introduce _gtk_style_context_queue_invalidate()
This is for only queueing invalidations instead of doing a full
invalidation cycle.
2012-04-17 08:59:09 +02:00
Benjamin Otte
1a51ea3ea3 stylecontext: Keep track of children 2012-04-17 08:59:09 +02:00
Benjamin Otte
7f511f2b33 widget: Don't set widget path on style context
Instead, make the style context use the widget's path. Saves a bunch of
memory.
2012-04-17 08:59:09 +02:00
Benjamin Otte
e5ab48ac59 stylecontext: Notify widget directly of changes
This way, we don't need to g_signal_connect(), which saves a bunch of
memory and performance.
2012-04-17 08:59:08 +02:00
Benjamin Otte
1aa4a196dc stylecontext: Add setter for widget
... and actually set the widget on the style context. Note that this
function does not take a reference on the widget, which is a very good
reason to keep it private.
2012-04-17 08:59:08 +02:00
Benjamin Otte
102d10016f matcher: Add a superset matcher
This matcher always matches only on some relvant things and ignores the
rest. This allows you to match only on name and class, but ignore state
and parents/siblings for example.
2012-04-17 08:59:08 +02:00
Benjamin Otte
5f5bf27287 matcher: Add a matcher that matches anything
Lesson learned: Adwaita uses all possible selector types and all of
those for parents, too. But so far no siblings.
2012-04-17 08:59:08 +02:00
Benjamin Otte
d115441a57 reftests: Add a reftest for nth-child
Prime numbers are fun.
2012-04-17 08:59:08 +02:00
Benjamin Otte
cbe40f27e1 tests: Add a parsing test for nth-child()
Now that we support the an+b notation, make sure we really do.
Maybe my generating script went a bit overboard with the space
possibilities though...
2012-04-17 08:59:08 +02:00
Benjamin Otte
3bdde54aaf selector: Rewrite position tracking
We now track the position as a (type,a,b) tuple where the numbers make
up the an + b formula from CSS3 nth-child.

Also, the get_sibling() and get_sibling_index() vfuncs were replaced by
a has_position() vfunc. This is mostly so that the matcher can always
return TRUE. And I need that for the everything matcher.
2012-04-17 08:59:08 +02:00