Commit Graph

18 Commits

Author SHA1 Message Date
Matthias Clasen
5776d0dd99 css: Split styles into groups
Introduce refcounted structs for groups of related css properties,
and use them to store the style values. Both GtkCssStaticStyle and
GtkCssAnimatedStyle fill in the structs in GtkCssStyle, and we
can avoid vfuncs for value access, which should be much faster.
We can even start accessing style->core->color directly.
2020-01-29 11:07:32 +01:00
Benjamin Otte
170130f1d9 css: Add fast-path for parent selector matching
Add a fast path for parent selector matching that uses a bloom filter to
quickly discard selectors that can't possibly match.

Keep in mind that we match using a bloom filter, so we might
accidentally include too many selectors when hash/bucket collisions
occur.
That's not a correctness problem though, because we'll do a real check
afterwards.

The idea for this change is taken from browsers, in particular WebKit.
2020-01-28 02:17:03 +01:00
Benjamin Otte
aa7c5e96a6 css: Pass node through the lookup code
... instead of passing a matcher.

The matcher code is now local to the CssProvider/CssSelector machinery.
2020-01-28 02:17:02 +01:00
Matthias Clasen
b4e2df8fca Revert "css: Split style into groups"
This reverts commit 0df0de0b5d.
2020-01-25 23:49:17 -05:00
Matthias Clasen
0df0de0b5d css: Split style into groups 2020-01-25 23:47:02 -05:00
Matthias Clasen
789f6f3941 css: Avoid computing change too often
Most of the time when styles need to be recreated, the name and classes
of the css node haven't changed. In this case, the change value will not
change either, since we are computing change under the assumption that
name and classes are unchanged.

So don't recompute the change. This avoids the second match we do to
find the superset, cutting down the number of times we consult the
selector tree.
2020-01-16 17:03:51 -05:00
Matthias Clasen
3c50e5324f Change the signature of gtk_css_style_get_static_style
It is clearer if this function returns a GtkCssStaticStyle.
2020-01-16 14:06:14 -05:00
Benjamin Otte
83fb7a649f css: Merge GtkStyleProviderPrivate into GtkStyleProvider
This is just lots of renaming.

The interface remains private, so the public API does not change, apart
from removing the definition of the Interface object to avoid
subclassing.
2017-10-31 04:33:54 +01:00
Benjamin Otte
d75989a52b cssstyle: Don't store custom css properties
This makes custom CSS properties no longer configurable. But it avoids
crashes when loading custom themes, so that's a good thing.

Testcase included.

https://bugzilla.redhat.com/show_bug.cgi?id=1281234
2015-11-20 21:22:15 +01:00
Benjamin Otte
e95985da26 cssstyle: Remove unused optimization
After measuring it, I realized the optimization never triggers for
Adwaita and rarely ever triggers for simple themes. So it is not
useful to keep it around.
2015-03-18 15:23:31 +01:00
Benjamin Otte
1116914ea0 css: Move scale to GtkStyleProviderPrivate
This way, we can remove it as a separate argument from
gtk_css_value_compute() and allow computation to only depend on one
thing: the style provider.
2015-02-06 11:26:31 +01:00
Benjamin Otte
7281419341 css: Having a static style per screen isn't useful
Just have one static style for everything.
2015-02-04 18:36:10 +01:00
Benjamin Otte
27285f1f0f cssstyle: Have a default style
This way we can initialize the default style info with a style and
ddon't need to special case NULL everywhere.
2015-01-07 14:26:48 +01:00
Benjamin Otte
730f429168 cssstaticstyle: Handle relevant change
Relevant change is returned from style lookups, so keep is with the
object that holds those values.
2015-01-07 14:26:48 +01:00
Benjamin Otte
cd056adb2f cssstaticstyle: Move function
And with that move, GtkCssStaticStyle is immutable.
2015-01-07 14:26:47 +01:00
Benjamin Otte
8b823d7e13 cssstaticstyle: Move function
We want the new() return values to be immutable, so we have to move the
code that modifes them.
2015-01-07 14:26:47 +01:00
Benjamin Otte
b7be202089 stylecontext: Refactor update_properties()
It now always returns a new instance.
2015-01-07 14:26:47 +01:00
Benjamin Otte
ac215ffc8f cssstyle: Add GtkCssStaticStyle
For now, this is only an implementation detail of the animated style.

The idea is to use GtkCssStaticStyle as the result of CSS queries and
then put a GtkCssAnimatedStyle on top that manages the animations. The
neat thing about this is that you can cache the static values.
2015-01-07 14:26:47 +01:00