[gtk+/wip/matthiasc/node-dump] Compute initial values before comparing them
- From: Matthias Clasen <matthiasc src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/matthiasc/node-dump] Compute initial values before comparing them
- Date: Mon, 28 Dec 2015 21:49:31 +0000 (UTC)
commit d11cd20ad11438f04bbd727b18ee6c8f9a960d05
Author: Matthias Clasen <mclasen redhat com>
Date: Mon Dec 28 15:19:55 2015 -0500
Compute initial values before comparing them
This gets rid of most of the initial values that were still
printed out in the css style tests.
gtk/gtkcssnode.c | 25 ++++++++++++++++---------
1 files changed, 16 insertions(+), 9 deletions(-)
---
diff --git a/gtk/gtkcssnode.c b/gtk/gtkcssnode.c
index ca74721..7aa31a6 100644
--- a/gtk/gtkcssnode.c
+++ b/gtk/gtkcssnode.c
@@ -1617,7 +1617,6 @@ append_style (GtkCssNode *cssnode,
GtkCssValue *value;
GtkCssSection *section;
const char *name;
- char *str;
prop = _gtk_css_style_property_lookup_by_id (i);
name = _gtk_style_property_get_name (GTK_STYLE_PROPERTY (prop));
@@ -1625,23 +1624,31 @@ append_style (GtkCssNode *cssnode,
if (!(flags & GTK_STYLE_CONTEXT_PRINT_SHOW_INITIAL))
{
- GtkCssValue *initial;
+ GtkCssValue *initial, *computed;
+ GtkCssNode *parent_node;
+ GtkCssStyle *parent_style;
+ parent_node = gtk_css_node_get_parent (cssnode);
+ parent_style = parent_node ? gtk_css_node_get_style (parent_node) : NULL;
initial = _gtk_css_style_property_get_initial_value (prop);
- if (_gtk_css_value_equal (value, initial))
+ computed = _gtk_css_value_compute (initial,
+ i,
+ gtk_css_node_get_style_provider (cssnode),
+ style,
+ parent_style);
+ if (_gtk_css_value_equal (value, computed))
continue;
}
- str = _gtk_css_value_to_string (value);
- g_string_append_printf (string, "%*s%s: %s", indent, "", name, str);
- g_free (str);
+ g_string_append_printf (string, "%*s%s: ", indent, "", name);
+ _gtk_css_value_print (value, string);
section = gtk_css_style_get_section (style, i);
if (section)
{
- str = _gtk_css_section_to_string (section);
- g_string_append_printf (string, " (%s)", str);
- g_free (str);
+ g_string_append (string, " (");
+ _gtk_css_section_print (section, string);
+ g_string_append (string, ")");
}
g_string_append_c (string, '\n');
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]