[gtk+/wip/css: 121/167] styleproperty: Change order for property registration
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+/wip/css: 121/167] styleproperty: Change order for property registration
- Date: Sun, 8 Jan 2012 21:33:02 +0000 (UTC)
commit a8e96fd48d2f01cb146ed5e5aeea0d41e16b01fd
Author: Benjamin Otte <otte redhat com>
Date: Tue Jan 3 03:37:13 2012 +0100
styleproperty: Change order for property registration
Some properties depend on other properties, handle those first.
gtk/gtkcssstylepropertyimpl.c | 24 ++++++++++++++----------
1 files changed, 14 insertions(+), 10 deletions(-)
---
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 74f7947..2d1ae65 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -410,9 +410,10 @@ _gtk_css_style_property_init_properties (void)
GtkCssBackgroundRepeat background_repeat = { GTK_CSS_BACKGROUND_REPEAT_STYLE_REPEAT };
GtkCssBorderImageRepeat border_image_repeat = { GTK_CSS_REPEAT_STYLE_STRETCH, GTK_CSS_REPEAT_STYLE_STRETCH };
- /* note that gtk_style_properties_register_property() calls this function,
- * so make sure we're sanely inited to avoid infloops */
-
+ /* Initialize "color" and "font-size" first,
+ * so that when computing values later they are
+ * done first. That way, 'currentColor' and font
+ * sizes in em can be looked up properly */
rgba_init (&rgba, 1, 1, 1, 1);
gtk_style_property_register ("color",
GDK_TYPE_RGBA,
@@ -421,6 +422,16 @@ _gtk_css_style_property_init_properties (void)
NULL,
NULL,
&rgba);
+ gtk_style_property_register ("font-size",
+ G_TYPE_DOUBLE,
+ GTK_STYLE_PROPERTY_INHERIT,
+ NULL,
+ NULL,
+ NULL,
+ 10.0);
+
+ /* properties that aren't referenced when computing values
+ * start here */
rgba_init (&rgba, 0, 0, 0, 0);
gtk_style_property_register ("background-color",
GDK_TYPE_RGBA,
@@ -459,13 +470,6 @@ _gtk_css_style_property_init_properties (void)
NULL,
NULL,
PANGO_WEIGHT_NORMAL);
- gtk_style_property_register ("font-size",
- G_TYPE_DOUBLE,
- GTK_STYLE_PROPERTY_INHERIT,
- NULL,
- NULL,
- NULL,
- 10.0);
gtk_style_property_register ("text-shadow",
GTK_TYPE_SHADOW,
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]