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'
This commit is contained in:
Alexander Larsson 2011-11-24 18:38:53 +01:00
parent 91dcf4000b
commit c276f53796

View File

@ -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;
}
}
/**