forked from AuroraMiddleware/gtk
cssprovider: Don't lookup on empty css providers
This should not have a huge performance impact, but debugging is easier if we don't lookup in empty css providers.
This commit is contained in:
parent
514e60c1bb
commit
d8df197489
@ -527,6 +527,9 @@ gtk_css_style_provider_lookup (GtkStyleProvider *provider,
|
||||
int i;
|
||||
GPtrArray *tree_rules;
|
||||
|
||||
if (_gtk_css_selector_tree_is_empty (priv->tree))
|
||||
return;
|
||||
|
||||
tree_rules = _gtk_css_selector_tree_match_all (priv->tree, matcher);
|
||||
if (tree_rules)
|
||||
{
|
||||
|
@ -1885,6 +1885,12 @@ gtk_css_selector_tree_get_change (const GtkCssSelectorTree *tree,
|
||||
return change;
|
||||
}
|
||||
|
||||
gboolean
|
||||
_gtk_css_selector_tree_is_empty (const GtkCssSelectorTree *tree)
|
||||
{
|
||||
return tree == NULL;
|
||||
}
|
||||
|
||||
GtkCssChange
|
||||
_gtk_css_selector_tree_get_change_all (const GtkCssSelectorTree *tree,
|
||||
const GtkCssMatcher *matcher)
|
||||
|
@ -47,6 +47,8 @@ GtkCssChange _gtk_css_selector_tree_get_change_all (const GtkCssSelectorTree *
|
||||
const GtkCssMatcher *matcher);
|
||||
void _gtk_css_selector_tree_match_print (const GtkCssSelectorTree *tree,
|
||||
GString *str);
|
||||
gboolean _gtk_css_selector_tree_is_empty (const GtkCssSelectorTree *tree) G_GNUC_CONST;
|
||||
|
||||
|
||||
|
||||
GtkCssSelectorTreeBuilder *_gtk_css_selector_tree_builder_new (void);
|
||||
|
Loading…
Reference in New Issue
Block a user