diff options
author | Benjamin Otte <otte@redhat.com> | 2020-01-26 04:37:17 +0100 |
---|---|---|
committer | Benjamin Otte <otte@redhat.com> | 2020-01-28 02:17:03 +0100 |
commit | 170130f1d9c15e4274a24b9327fe01d36ad84290 (patch) | |
tree | 0a07692fba8a8b378ed08095480b7e5885fc3dd1 /gtk/gtkstyleprovider.c | |
parent | 6aac56e144e1088565db7d29591fc0bd9e3e509d (diff) | |
download | gtk+-170130f1d9c15e4274a24b9327fe01d36ad84290.tar.gz |
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.
Diffstat (limited to 'gtk/gtkstyleprovider.c')
-rw-r--r-- | gtk/gtkstyleprovider.c | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/gtk/gtkstyleprovider.c b/gtk/gtkstyleprovider.c index 6dd380b95c..4bcd241054 100644 --- a/gtk/gtkstyleprovider.c +++ b/gtk/gtkstyleprovider.c @@ -92,10 +92,11 @@ gtk_style_provider_get_keyframes (GtkStyleProvider *provider, } void -gtk_style_provider_lookup (GtkStyleProvider *provider, - GtkCssNode *node, - GtkCssLookup *lookup, - GtkCssChange *out_change) +gtk_style_provider_lookup (GtkStyleProvider *provider, + const GtkCountingBloomFilter *filter, + GtkCssNode *node, + GtkCssLookup *lookup, + GtkCssChange *out_change) { GtkStyleProviderInterface *iface; @@ -111,7 +112,7 @@ gtk_style_provider_lookup (GtkStyleProvider *provider, if (!iface->lookup) return; - iface->lookup (provider, node, lookup, out_change); + iface->lookup (provider, filter, node, lookup, out_change); } void |