[gtk+/wip/multiple-backgrounds: 1/14] styleproperty: make background-clip and background-area array properties



commit 101d399186830160e5b14f048a0bdc2ea9797c77
Author: Cosimo Cecchi <cosimoc gnome org>
Date:   Thu May 10 10:25:33 2012 -0400

    styleproperty: make background-clip and background-area array properties
    
    Right now just make them arrays, but don't consider values after the
    first.

 gtk/gtkcssstylepropertyimpl.c |   14 ++++++++++----
 gtk/gtkthemingbackground.c    |    8 ++++----
 2 files changed, 14 insertions(+), 8 deletions(-)
---
diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c
index 0a642f0..cde6ee5 100644
--- a/gtk/gtkcssstylepropertyimpl.c
+++ b/gtk/gtkcssstylepropertyimpl.c
@@ -412,8 +412,7 @@ assign_border_style (GtkCssStyleProperty *property,
 }
 
 static GtkCssValue *
-parse_css_area (GtkCssStyleProperty *property,
-                GtkCssParser        *parser)
+parse_css_area_one (GtkCssParser *parser)
 {
   GtkCssValue *value = _gtk_css_area_value_try_parse (parser);
   
@@ -424,6 +423,13 @@ parse_css_area (GtkCssStyleProperty *property,
 }
 
 static GtkCssValue *
+parse_css_area (GtkCssStyleProperty *property,
+                GtkCssParser        *parser)
+{
+  return _gtk_css_array_value_parse (parser, parse_css_area_one, FALSE);
+}
+
+static GtkCssValue *
 bindings_value_parse_one (GtkCssParser *parser)
 {
   char *name;
@@ -1253,7 +1259,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
-                                          _gtk_css_area_value_new (GTK_CSS_AREA_BORDER_BOX));
+                                          _gtk_css_array_value_new (_gtk_css_area_value_new (GTK_CSS_AREA_BORDER_BOX)));
   gtk_css_style_property_register        ("background-origin",
                                           GTK_CSS_PROPERTY_BACKGROUND_ORIGIN,
                                           G_TYPE_NONE,
@@ -1263,7 +1269,7 @@ _gtk_css_style_property_init_properties (void)
                                           NULL,
                                           NULL,
                                           NULL,
-                                          _gtk_css_area_value_new (GTK_CSS_AREA_PADDING_BOX));
+                                          _gtk_css_array_value_new (_gtk_css_area_value_new (GTK_CSS_AREA_PADDING_BOX)));
   gtk_css_style_property_register        ("background-size",
                                           GTK_CSS_PROPERTY_BACKGROUND_SIZE,
                                           G_TYPE_NONE,
diff --git a/gtk/gtkthemingbackground.c b/gtk/gtkthemingbackground.c
index 158ac32..4c7e44b 100644
--- a/gtk/gtkthemingbackground.c
+++ b/gtk/gtkthemingbackground.c
@@ -57,10 +57,9 @@ _gtk_theming_background_apply_window_background (GtkThemingBackground *bg,
 static void
 _gtk_theming_background_apply_origin (GtkThemingBackground *bg)
 {
-  GtkCssArea origin;
   cairo_rectangle_t image_rect;
-
-  origin = _gtk_css_area_value_get (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_ORIGIN));
+  GtkCssValue *value = _gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_ORIGIN);
+  GtkCssArea origin = _gtk_css_area_value_get (_gtk_css_array_value_get_nth (value, 0));
 
   /* The default size of the background image depends on the
      background-origin value as this affects the top left
@@ -95,7 +94,8 @@ _gtk_theming_background_apply_origin (GtkThemingBackground *bg)
 static void
 _gtk_theming_background_apply_clip (GtkThemingBackground *bg)
 {
-  GtkCssArea clip = _gtk_css_area_value_get (_gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_CLIP));
+  GtkCssValue *value = _gtk_style_context_peek_property (bg->context, GTK_CSS_PROPERTY_BACKGROUND_CLIP);
+  GtkCssArea clip = _gtk_css_area_value_get (_gtk_css_array_value_get_nth (value, 0));
 
   if (clip == GTK_CSS_AREA_PADDING_BOX)
     {



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]