forked from AuroraMiddleware/gtk
css: Implement "all" shorthand
Here's the spec: http://dev.w3.org/csswg/css-cascade/#all-shorthand Also use it in the reset-to-defaults CSS where a bunch of properties had been missing.
This commit is contained in:
parent
3a72e2fb24
commit
0e462f0d2d
@ -813,6 +813,15 @@ parse_animation (GtkCssShorthandProperty *shorthand,
|
||||
return TRUE;
|
||||
}
|
||||
|
||||
static gboolean
|
||||
parse_all (GtkCssShorthandProperty *shorthand,
|
||||
GtkCssValue **values,
|
||||
GtkCssParser *parser)
|
||||
{
|
||||
_gtk_css_parser_error (parser, "The 'all' property can only be set to 'initial', 'inherit' or 'unset'");
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
/*** PACKING ***/
|
||||
|
||||
static void
|
||||
@ -1089,6 +1098,25 @@ _gtk_css_shorthand_property_register (const char *name,
|
||||
node->query = query_func;
|
||||
}
|
||||
|
||||
/* NB: return value is transfer: container */
|
||||
static const char **
|
||||
get_all_subproperties (void)
|
||||
{
|
||||
const char **properties;
|
||||
guint i, n;
|
||||
|
||||
n = _gtk_css_style_property_get_n_properties ();
|
||||
properties = g_new (const char *, n + 1);
|
||||
properties[n] = NULL;
|
||||
|
||||
for (i = 0; i < n; i++)
|
||||
{
|
||||
properties[i] = _gtk_style_property_get_name (GTK_STYLE_PROPERTY (_gtk_css_style_property_lookup_by_id (i)));
|
||||
}
|
||||
|
||||
return properties;
|
||||
}
|
||||
|
||||
void
|
||||
_gtk_css_shorthand_property_init_properties (void)
|
||||
{
|
||||
@ -1119,6 +1147,8 @@ _gtk_css_shorthand_property_init_properties (void)
|
||||
const char *animation_subproperties[] = { "animation-name", "animation-iteration-count", "animation-duration", "animation-delay",
|
||||
"animation-timing-function", "animation-direction", "animation-fill-mode", NULL };
|
||||
|
||||
const char **all_subproperties;
|
||||
|
||||
_gtk_css_shorthand_property_register ("font",
|
||||
PANGO_TYPE_FONT_DESCRIPTION,
|
||||
font_subproperties,
|
||||
@ -1227,4 +1257,13 @@ _gtk_css_shorthand_property_init_properties (void)
|
||||
parse_animation,
|
||||
NULL,
|
||||
NULL);
|
||||
|
||||
all_subproperties = get_all_subproperties ();
|
||||
_gtk_css_shorthand_property_register ("all",
|
||||
G_TYPE_NONE,
|
||||
all_subproperties,
|
||||
parse_all,
|
||||
NULL,
|
||||
NULL);
|
||||
g_free (all_subproperties);
|
||||
}
|
||||
|
@ -7,60 +7,7 @@
|
||||
*/
|
||||
|
||||
* {
|
||||
color: unset;
|
||||
font-size: unset;
|
||||
background-color: unset;
|
||||
font-family: unset;
|
||||
font-style: unset;
|
||||
font-variant: unset;
|
||||
font-weight: unset;
|
||||
text-shadow: unset;
|
||||
icon-shadow: unset;
|
||||
box-shadow: unset;
|
||||
margin-top: unset;
|
||||
margin-left: unset;
|
||||
margin-bottom: unset;
|
||||
margin-right: unset;
|
||||
padding-top: unset;
|
||||
padding-left: unset;
|
||||
padding-bottom: unset;
|
||||
padding-right: unset;
|
||||
border-top-style: unset;
|
||||
border-top-width: unset;
|
||||
border-left-style: unset;
|
||||
border-left-width: unset;
|
||||
border-bottom-style: unset;
|
||||
border-bottom-width: unset;
|
||||
border-right-style: unset;
|
||||
border-right-width: unset;
|
||||
border-top-left-radius: unset;
|
||||
border-top-right-radius: unset;
|
||||
border-bottom-right-radius: unset;
|
||||
border-bottom-left-radius: unset;
|
||||
outline-style: unset;
|
||||
outline-width: unset;
|
||||
outline-offset: unset;
|
||||
background-clip: unset;
|
||||
background-origin: unset;
|
||||
background-size: unset;
|
||||
background-position: unset;
|
||||
border-top-color: unset;
|
||||
border-right-color: unset;
|
||||
border-bottom-color: unset;
|
||||
border-left-color: unset;
|
||||
outline-color: unset;
|
||||
background-repeat: unset;
|
||||
background-image: unset;
|
||||
border-image-source: unset;
|
||||
border-image-repeat: unset;
|
||||
border-image-slice: unset;
|
||||
border-image-width: unset;
|
||||
transition-property: unset;
|
||||
transition-duration: unset;
|
||||
transition-timing-function: unset;
|
||||
transition-delay: unset;
|
||||
engine: unset;
|
||||
gtk-key-bindings: unset;
|
||||
all: unset;
|
||||
|
||||
-GtkWidget-focus-line-width: 0;
|
||||
-GtkWidget-focus-padding: 0;
|
||||
|
Loading…
Reference in New Issue
Block a user