Commit Graph

26 Commits

Author SHA1 Message Date
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
be4d42507c style cascade: Remove some pointless casts
The casts and checks in gtkstylecascade.c are leftovers
from when we had GtkStyleProviderPrivate, and no longer
serve any purpose.
2020-01-19 15:56:54 -05:00
Philip Withnall
13f4d639fd gtkstyleprovider: Rename -gtk-style-changed signal to have a valid name
Signal names must start with a letter. They can’t start with a hyphen.

It was originally added in commit 74f4c6f6bd with no given reason
for why the signal name was chosen as it was.

Signed-off-by: Philip Withnall <withnall@endlessm.com>
2019-11-12 19:51:33 +00: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
Timm Bäder
e36ddfec17 Remove all widget style property code 2017-07-19 21:27:14 -04:00
Chun-wei Fan
51444b7909 gtk/gtkstylecascade.c: Fix formatting
My previous patch on this file did not take into the account of the
formatting, sorry!
2016-06-30 18:00:47 +08:00
Chun-wei Fan
5f525839da gtk/gtkstylecascade.c: Declare variables at beginning of block 2016-06-27 11:58:42 +08:00
Philip Chimento
76bacfde6e style cascade: Allow cascades with more ancestors
Previously a style cascade's parent could not have a parent itself. That
represented the two levels at which you could add a style provider: at
the screen level, with gtk_style_context_add_provider_for_screen(), and
at the style context level, with gtk_style_context_add_provider().

This commit changes no functionality, but this change will be necessary
for adding style providers in the future that apply to a subtree of the
widget tree. It relaxes the requirement that a style cascade's parent
must not have a parent, since in the future a style context may be
affected by any number of parent widgets' style contexts.

https://bugzilla.gnome.org/show_bug.cgi?id=751409
2016-06-19 19:47:05 -04:00
Matthias Clasen
a9b80a6391 style cascade: Replace g_return by gtk_internal_return 2015-09-12 11:29:37 -04:00
Matthias Clasen
0f92a43e10 Move GtkWidgetPrivate to gtkwidgetprivate.h
This lets us use inlined getters for members in there,
avoiding the type checks in the public getters.
2015-09-07 02:40:22 -04: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
9209c4ea41 stylecontext: Store the scale value in the cascade
This is in preparation for the next commits.
2015-02-06 11:26:31 +01:00
Benjamin Otte
b49c7c3421 styleprovider: Fold get_change() vfunc into lookup() 2014-12-10 03:49:40 +01:00
Benjamin Otte
f2d4b07f4b stylecascade: Remove function
Inline it.
2014-02-20 02:10:07 +01:00
Benjamin Otte
6de50aa7d9 settings: Store style cascade in settings object
This ensures that the initialization for the CSS theme happens when the
style cascade gets queried.

https://bugzilla.redhat.com/show_bug.cgi?id=1064922
https://bugzilla.mozilla.org/show_bug.cgi?id=972382
2014-02-20 02:10:07 +01:00
Benjamin Otte
3ff7f1fd43 style: Add _gtk_style_provider_private_get_settings()
This gives a GtkSettings object for resolving system-dependant things -
like the default font family and font size.
No code does this yet, but we have an API.

Only GtkSettings implements this.
2012-12-01 01:24:12 +01:00
Benjamin Otte
42dc0ea0fd styleprovider: Change function prototype
Make _gtk_style_provider_private_get_color() return a GtkCssValue (a
GtkCssColorValue to be exact) instead of GtkSymbolicColor.

With this, the symbolic color usage inside GTK is minimized.
2012-11-25 02:45:10 +01:00
Benjamin Otte
932794e105 styleprovider: Remove (broken) implementations of get_style
The implementations were broken and get_style() is deprecated and
documented to return NULL now.
2012-11-24 21:12:00 +01:00
Benjamin Otte
324ff12553 stylecascade: Remove get_icon_factory() implementation
It was redundant.
2012-11-24 21:12:00 +01:00
Matthias Clasen
e0f2492ce8 Avoid an unintented export
GtkStyleCascade is entirely private, so don't leak any symbols.
2012-09-18 13:54:22 -04:00
Benjamin Otte
e6c951a303 styleprovider: Add query function for keyframes 2012-09-17 20:39:11 +02:00
Benjamin Otte
6443baadb9 styleprovider: Make all implementors emit the new signal
... and listen to it in the cases where they use other style providers.
2012-04-17 08:59:21 +02:00
Benjamin Otte
8dbe8c8349 syleprovider: Add a vfunc to get the changes
This way we can check what changes are even interesting for our matcher.
2012-04-17 08:59:08 +02:00
Benjamin Otte
a94b85d375 css: Make the style provider take a matcher as an input argument 2012-04-17 08:59:07 +02:00
Benjamin Otte
a2ded8b72a styleprovider: Add a custom object for a list of style providers
This way, we don't have to do magic inside GtkStyleContext, but have a
real API.
As a cute bonus, this object implements GtkStyleProvider itself. So we
can just pretend there's only one provider.
2012-04-17 08:59:07 +02:00