forked from AuroraMiddleware/gtk
Merge branch 'matthiasc/for-master' into 'master'
Matthiasc/for master See merge request GNOME/gtk!1348
This commit is contained in:
commit
16654eeef4
@ -229,6 +229,7 @@ gtk_color_button_class_init (GtkColorButtonClass *klass)
|
||||
GTK_PARAM_READWRITE|G_PARAM_EXPLICIT_NOTIFY));
|
||||
|
||||
gtk_widget_class_set_layout_manager_type (widget_class, GTK_TYPE_BIN_LAYOUT);
|
||||
gtk_widget_class_set_css_name (widget_class, "colorbutton");
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -978,15 +978,55 @@ gtk_css_provider_postprocess (GtkCssProvider *css_provider)
|
||||
|
||||
ruleset = &g_array_index (priv->rulesets, GtkCssRuleset, i);
|
||||
|
||||
|
||||
_gtk_css_selector_tree_builder_add (builder,
|
||||
ruleset->selector,
|
||||
&ruleset->selector_match,
|
||||
ruleset);
|
||||
}
|
||||
|
||||
#if 0
|
||||
{
|
||||
GString *str = g_string_new ("");
|
||||
g_string_append_printf (str, "%d rules\n", priv->rulesets->len);
|
||||
|
||||
for (i = 0; i < priv->rulesets->len; i++)
|
||||
{
|
||||
GtkCssRuleset *ruleset;
|
||||
|
||||
ruleset = &g_array_index (priv->rulesets, GtkCssRuleset, i);
|
||||
|
||||
_gtk_css_selector_print (ruleset->selector, str);
|
||||
g_string_append (str, "\n");
|
||||
}
|
||||
|
||||
g_print ("%s\n", str->str);
|
||||
g_string_free (str, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
priv->tree = _gtk_css_selector_tree_builder_build (builder);
|
||||
_gtk_css_selector_tree_builder_free (builder);
|
||||
|
||||
#ifdef PRINT_SELECTORS
|
||||
{
|
||||
GString *str = g_string_new ("");
|
||||
|
||||
for (i = 0; i < priv->rulesets->len; i++)
|
||||
{
|
||||
GtkCssRuleset *ruleset;
|
||||
|
||||
ruleset = &g_array_index (priv->rulesets, GtkCssRuleset, i);
|
||||
|
||||
_gtk_css_selector_print (ruleset->selector, str);
|
||||
g_string_append (str, "\n");
|
||||
}
|
||||
|
||||
g_print ("%s\n", str->str);
|
||||
g_string_free (str, TRUE);
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifndef VERIFY_TREE
|
||||
for (i = 0; i < priv->rulesets->len; i++)
|
||||
{
|
||||
|
@ -124,6 +124,7 @@ struct _GtkCssSelectorTree
|
||||
gint32 previous_offset;
|
||||
gint32 sibling_offset;
|
||||
gint32 matches_offset; /* pointers that we return as matches if selector matches */
|
||||
guint64 match_count;
|
||||
};
|
||||
|
||||
static gboolean
|
||||
@ -1857,6 +1858,8 @@ gtk_css_selector_tree_match_foreach (const GtkCssSelector *selector,
|
||||
const GtkCssSelectorTree *tree = (const GtkCssSelectorTree *) selector;
|
||||
const GtkCssSelectorTree *prev;
|
||||
|
||||
((GtkCssSelectorTree *)tree)->match_count++;
|
||||
|
||||
if (!gtk_css_selector_match (selector, matcher))
|
||||
return FALSE;
|
||||
|
||||
@ -1978,7 +1981,6 @@ _gtk_css_selector_tree_print (const GtkCssSelectorTree *tree, GString *str, char
|
||||
{
|
||||
gboolean first = TRUE;
|
||||
int len, i;
|
||||
gpointer *matches;
|
||||
|
||||
for (; tree != NULL; tree = gtk_css_selector_tree_get_sibling (tree), first = FALSE)
|
||||
{
|
||||
@ -2002,16 +2004,8 @@ _gtk_css_selector_tree_print (const GtkCssSelectorTree *tree, GString *str, char
|
||||
|
||||
len = str->len;
|
||||
tree->selector.class->print (&tree->selector, str);
|
||||
matches = gtk_css_selector_tree_get_matches (tree);
|
||||
if (matches)
|
||||
{
|
||||
int n;
|
||||
for (n = 0; matches[n] != NULL; n++) ;
|
||||
if (n == 1)
|
||||
g_string_append (str, " (1 match)");
|
||||
else
|
||||
g_string_append_printf (str, " (%d matches)", n);
|
||||
}
|
||||
if (tree->match_count)
|
||||
g_string_append_printf (str, " (%ld hits)", tree->match_count);
|
||||
len = str->len - len;
|
||||
|
||||
if (gtk_css_selector_tree_get_previous (tree))
|
||||
@ -2032,6 +2026,24 @@ _gtk_css_selector_tree_print (const GtkCssSelectorTree *tree, GString *str, char
|
||||
g_string_append (str, "\n");
|
||||
}
|
||||
}
|
||||
|
||||
static GSList *trees;
|
||||
|
||||
static void print_atexit (void)
|
||||
{
|
||||
GSList *l;
|
||||
|
||||
for (l = trees; l; l = l->next)
|
||||
{
|
||||
const GtkCssSelectorTree *tree = l->data;
|
||||
|
||||
GString *s = g_string_new ("");
|
||||
_gtk_css_selector_tree_print (tree, s, "");
|
||||
g_print ("%s", s->str);
|
||||
g_string_free (s, TRUE);
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
void
|
||||
@ -2159,6 +2171,7 @@ subdivide_infos (GByteArray *array, GList *infos, gint32 parent_offset)
|
||||
tree = alloc_tree (array, &tree_offset);
|
||||
tree->parent_offset = parent_offset;
|
||||
tree->selector = max_selector;
|
||||
tree->match_count = 0;
|
||||
|
||||
exact_matches = NULL;
|
||||
for (l = infos; l != NULL; l = l->next)
|
||||
@ -2298,12 +2311,9 @@ _gtk_css_selector_tree_builder_build (GtkCssSelectorTreeBuilder *builder)
|
||||
}
|
||||
|
||||
#ifdef PRINT_TREE
|
||||
{
|
||||
GString *s = g_string_new ("");
|
||||
_gtk_css_selector_tree_print (tree, s, "");
|
||||
g_print ("%s", s->str);
|
||||
g_string_free (s, TRUE);
|
||||
}
|
||||
if (trees == NULL)
|
||||
atexit (print_atexit);
|
||||
trees = g_slist_append (trees, tree);
|
||||
#endif
|
||||
|
||||
return tree;
|
||||
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -49,7 +49,7 @@ endif
|
||||
if get_option ('profiler')
|
||||
|
||||
test('performance-adwaita', test_performance,
|
||||
args: [ '--mark', 'style',
|
||||
args: [ '--mark', 'css validation',
|
||||
'--name', 'performance-adwaita',
|
||||
'--output', join_paths(meson.current_build_dir(), 'output'),
|
||||
join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ],
|
||||
@ -58,7 +58,7 @@ if get_option ('profiler')
|
||||
suite: [ 'css' ])
|
||||
|
||||
test('performance-empty', test_performance,
|
||||
args: [ '--mark', 'style',
|
||||
args: [ '--mark', 'css validation',
|
||||
'--name', 'performance-empty',
|
||||
'--output', join_paths(meson.current_build_dir(), 'output'),
|
||||
join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ],
|
||||
|
@ -189,7 +189,7 @@ endif
|
||||
if get_option ('profiler')
|
||||
|
||||
test('performance-layout', test_performance,
|
||||
args: [ '--mark', 'layout', join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ],
|
||||
args: [ '--mark', 'size allocation', join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ],
|
||||
env: [ 'GTK_THEME=Empty',
|
||||
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir) ],
|
||||
suite: [ 'css' ])
|
||||
@ -199,7 +199,7 @@ endif
|
||||
if get_option ('profiler')
|
||||
|
||||
test('performance-snapshot', test_performance,
|
||||
args: [ '--mark', 'snapshot', join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ],
|
||||
args: [ '--mark', 'widget snapshot', join_paths(meson.current_build_dir(), '../../demos/widget-factory/gtk4-widget-factory') ],
|
||||
env: [ 'GTK_THEME=Empty',
|
||||
'GSETTINGS_SCHEMA_DIR=@0@'.format(gtk_schema_build_dir) ],
|
||||
suite: [ 'css' ])
|
||||
|
Loading…
Reference in New Issue
Block a user