[gtk+] css: Implement "all" shorthand
- From: Benjamin Otte <otte src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gtk+] css: Implement "all" shorthand
- Date: Sun, 11 May 2014 01:24:22 +0000 (UTC)
commit 0e462f0d2d03631a2ad7d38ef7dfc4292de5f9c7
Author: Benjamin Otte <otte redhat com>
Date: Sun May 11 03:22:06 2014 +0200
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.
gtk/gtkcssshorthandpropertyimpl.c | 39 +++++++++++++++++++++
testsuite/reftests/reset-to-defaults.css | 55 +-----------------------------
2 files changed, 40 insertions(+), 54 deletions(-)
---
diff --git a/gtk/gtkcssshorthandpropertyimpl.c b/gtk/gtkcssshorthandpropertyimpl.c
index 15cd359..2d2faf8 100644
--- a/gtk/gtkcssshorthandpropertyimpl.c
+++ b/gtk/gtkcssshorthandpropertyimpl.c
@@ -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);
}
diff --git a/testsuite/reftests/reset-to-defaults.css b/testsuite/reftests/reset-to-defaults.css
index 8654a5b..2e72b3d 100644
--- a/testsuite/reftests/reset-to-defaults.css
+++ b/testsuite/reftests/reset-to-defaults.css
@@ -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;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]