[gtk+/css-fixes: 1/8] Make computed value of border-width 0 if border-style none



commit 36a623d523e587657db56e5763a44be85c894d4f
Author: Alexander Larsson <alexl redhat com>
Date:   Thu Nov 24 18:38:53 2011 +0100

    Make computed value of border-width 0 if border-style none
    
    From the css docs at http://www.w3.org/TR/CSS2/box.html:
    
        8.5.1 Border width: 'border-top-width', 'border-right-width', 'border-bottom-width',
        'border-left-width', and 'border-width'
    
        Computed value:  	absolute length; '0' if the border style is 'none' or 'hidden'

 gtk/gtkstylecontext.c |   22 +++++++++++++++++-----
 1 files changed, 17 insertions(+), 5 deletions(-)
---
diff --git a/gtk/gtkstylecontext.c b/gtk/gtkstylecontext.c
index b2993ec..82cec95 100644
--- a/gtk/gtkstylecontext.c
+++ b/gtk/gtkstylecontext.c
@@ -3347,6 +3347,7 @@ gtk_style_context_get_border (GtkStyleContext *context,
   GtkStyleContextPrivate *priv;
   StyleData *data;
   int top, left, bottom, right;
+  GtkBorderStyle border_style;
 
   g_return_if_fail (border != NULL);
   g_return_if_fail (GTK_IS_STYLE_CONTEXT (context));
@@ -3357,16 +3358,27 @@ gtk_style_context_get_border (GtkStyleContext *context,
   data = style_data_lookup (context);
   gtk_style_properties_get (data->store,
                             state,
+			    "border-style", &border_style,
+                            "border-top-width", &top,
                             "border-top-width", &top,
                             "border-left-width", &left,
                             "border-bottom-width", &bottom,
                             "border-right-width", &right,
                             NULL);
-
-  border->top = top;
-  border->left = left;
-  border->bottom = bottom;
-  border->right = right;
+  if (border_style == GTK_BORDER_STYLE_NONE)
+    {
+      border->top = 0;
+      border->left = 0;
+      border->bottom = 0;
+      border->right = 0;
+    }
+  else
+    {
+      border->top = top;
+      border->left = left;
+      border->bottom = bottom;
+      border->right = right;
+    }
 }
 
 /**



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