forked from AuroraMiddleware/gtk
css: Implement "unset"
Quoting the spec: If the cascaded value of a property is the unset keyword, then if it is an inherited property, this is treated as inherit, and if it is not, this is treated as initial. Spec in question: http://dev.w3.org/csswg/css-cascade/ Also use unset in the reset-to-defaults.css we use to reset css in reftests.
This commit is contained in:
parent
f2258cb05c
commit
3a72e2fb24
@ -483,6 +483,7 @@ gtk_private_h_sources = \
|
||||
gtkcssstylepropertyprivate.h \
|
||||
gtkcsstransitionprivate.h \
|
||||
gtkcsstypedvalueprivate.h \
|
||||
gtkcssunsetvalueprivate.h \
|
||||
gtkcssvalueprivate.h \
|
||||
gtkcustompaperunixdialog.h \
|
||||
gtkdialogprivate.h \
|
||||
@ -731,6 +732,7 @@ gtk_base_c_sources = \
|
||||
gtkcssstylepropertyimpl.c \
|
||||
gtkcsstransition.c \
|
||||
gtkcsstypedvalue.c \
|
||||
gtkcssunsetvalue.c \
|
||||
gtkcssvalue.c \
|
||||
gtkcsstypes.c \
|
||||
gtkdialog.c \
|
||||
|
@ -97,3 +97,9 @@ _gtk_css_inherit_value_new (void)
|
||||
{
|
||||
return _gtk_css_value_ref (&inherit);
|
||||
}
|
||||
|
||||
GtkCssValue *
|
||||
_gtk_css_inherit_value_get (void)
|
||||
{
|
||||
return &inherit;
|
||||
}
|
||||
|
@ -25,6 +25,7 @@
|
||||
G_BEGIN_DECLS
|
||||
|
||||
GtkCssValue * _gtk_css_inherit_value_new (void);
|
||||
GtkCssValue * _gtk_css_inherit_value_get (void);
|
||||
|
||||
G_END_DECLS
|
||||
|
||||
|
@ -25,6 +25,7 @@
|
||||
#include "gtkcssinheritvalueprivate.h"
|
||||
#include "gtkcssinitialvalueprivate.h"
|
||||
#include "gtkcssstylefuncsprivate.h"
|
||||
#include "gtkcssunsetvalueprivate.h"
|
||||
#include "gtkintl.h"
|
||||
|
||||
enum {
|
||||
@ -118,6 +119,17 @@ gtk_css_shorthand_property_parse_value (GtkStyleProperty *property,
|
||||
data[i] = _gtk_css_inherit_value_new ();
|
||||
}
|
||||
}
|
||||
else if (_gtk_css_parser_try (parser, "unset", TRUE))
|
||||
{
|
||||
/* If the cascaded value of a property is the unset keyword,
|
||||
* then if it is an inherited property, this is treated as
|
||||
* inherit, and if it is not, this is treated as initial.
|
||||
*/
|
||||
for (i = 0; i < shorthand->subproperties->len; i++)
|
||||
{
|
||||
data[i] = _gtk_css_unset_value_new ();
|
||||
}
|
||||
}
|
||||
else if (!shorthand->parse (shorthand, data, parser))
|
||||
{
|
||||
for (i = 0; i < shorthand->subproperties->len; i++)
|
||||
|
@ -26,6 +26,7 @@
|
||||
#include "gtkcssinitialvalueprivate.h"
|
||||
#include "gtkcssstylefuncsprivate.h"
|
||||
#include "gtkcsstypesprivate.h"
|
||||
#include "gtkcssunsetvalueprivate.h"
|
||||
#include "gtkintl.h"
|
||||
#include "gtkprivatetypebuiltins.h"
|
||||
#include "gtkstylepropertiesprivate.h"
|
||||
@ -255,6 +256,14 @@ gtk_css_style_property_parse_value (GtkStyleProperty *property,
|
||||
*/
|
||||
return _gtk_css_inherit_value_new ();
|
||||
}
|
||||
else if (_gtk_css_parser_try (parser, "unset", TRUE))
|
||||
{
|
||||
/* If the cascaded value of a property is the unset keyword,
|
||||
* then if it is an inherited property, this is treated as
|
||||
* inherit, and if it is not, this is treated as initial.
|
||||
*/
|
||||
return _gtk_css_unset_value_new ();
|
||||
}
|
||||
|
||||
return (* style_property->parse_value) (style_property, parser);
|
||||
}
|
||||
|
@ -7,60 +7,60 @@
|
||||
*/
|
||||
|
||||
* {
|
||||
color: inherit;
|
||||
font-size: inherit;
|
||||
background-color: initial;
|
||||
font-family: inherit;
|
||||
font-style: inherit;
|
||||
font-variant: inherit;
|
||||
font-weight: inherit;
|
||||
text-shadow: inherit;
|
||||
icon-shadow: inherit;
|
||||
box-shadow: initial;
|
||||
margin-top: initial;
|
||||
margin-left: initial;
|
||||
margin-bottom: initial;
|
||||
margin-right: initial;
|
||||
padding-top: initial;
|
||||
padding-left: initial;
|
||||
padding-bottom: initial;
|
||||
padding-right: initial;
|
||||
border-top-style: initial;
|
||||
border-top-width: initial;
|
||||
border-left-style: initial;
|
||||
border-left-width: initial;
|
||||
border-bottom-style: initial;
|
||||
border-bottom-width: initial;
|
||||
border-right-style: initial;
|
||||
border-right-width: initial;
|
||||
border-top-left-radius: initial;
|
||||
border-top-right-radius: initial;
|
||||
border-bottom-right-radius: initial;
|
||||
border-bottom-left-radius: initial;
|
||||
outline-style: initial;
|
||||
outline-width: initial;
|
||||
outline-offset: initial;
|
||||
background-clip: initial;
|
||||
background-origin: initial;
|
||||
background-size: initial;
|
||||
background-position: initial;
|
||||
border-top-color: initial;
|
||||
border-right-color: initial;
|
||||
border-bottom-color: initial;
|
||||
border-left-color: initial;
|
||||
outline-color: initial;
|
||||
background-repeat: initial;
|
||||
background-image: initial;
|
||||
border-image-source: initial;
|
||||
border-image-repeat: initial;
|
||||
border-image-slice: initial;
|
||||
border-image-width: initial;
|
||||
transition-property: initial;
|
||||
transition-duration: initial;
|
||||
transition-timing-function: initial;
|
||||
transition-delay: initial;
|
||||
engine: initial;
|
||||
gtk-key-bindings: initial;
|
||||
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;
|
||||
|
||||
-GtkWidget-focus-line-width: 0;
|
||||
-GtkWidget-focus-padding: 0;
|
||||
|
Loading…
Reference in New Issue
Block a user