summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaolo Borelli <pborelli@gnome.org>2015-07-05 23:24:49 +0200
committerPaolo Borelli <pborelli@gnome.org>2015-07-05 23:31:20 +0200
commit4231331485e2c8b3c27a7bd54123188c104ee328 (patch)
tree17ba48034bb3f9ff31b9e91253b16dd9ae01bf8b
parent906e604c35cd94b50ad6048c604bd1ec8e36edbe (diff)
downloadgtk+-4231331485e2c8b3c27a7bd54123188c104ee328.tar.gz
css: add shorthand text-decoration propertywip/pbor/css-text-attributes
Note that for now we take into account only text-decoration-line and text-decoration-color
-rw-r--r--gtk/gtkcssshorthandpropertyimpl.c39
1 files changed, 39 insertions, 0 deletions
diff --git a/gtk/gtkcssshorthandpropertyimpl.c b/gtk/gtkcssshorthandpropertyimpl.c
index 9bc780dc6e..61afcc6946 100644
--- a/gtk/gtkcssshorthandpropertyimpl.c
+++ b/gtk/gtkcssshorthandpropertyimpl.c
@@ -824,6 +824,38 @@ parse_animation (GtkCssShorthandProperty *shorthand,
}
static gboolean
+parse_text_decoration (GtkCssShorthandProperty *shorthand,
+ GtkCssValue **values,
+ GtkCssParser *parser)
+{
+ do
+ {
+ if (values[0] == NULL &&
+ (values[0] = _gtk_css_text_decoration_line_value_try_parse (parser)))
+ {
+ if (values[0] == NULL)
+ return FALSE;
+ }
+ else if (values[1] == NULL)
+ {
+ values[1] = _gtk_css_color_value_parse (parser);
+ if (values[1] == NULL)
+ return FALSE;
+ }
+ else
+ {
+ /* We parsed and there's still stuff left?
+ * Pretend we didn't notice and let the normal code produce
+ * a 'junk at end of value' error */
+ break;
+ }
+ }
+ while (!value_is_done_parsing (parser));
+
+ return TRUE;
+}
+
+static gboolean
parse_all (GtkCssShorthandProperty *shorthand,
GtkCssValue **values,
GtkCssParser *parser)
@@ -1170,6 +1202,7 @@ _gtk_css_shorthand_property_init_properties (void)
const char *transition_subproperties[] = { "transition-property", "transition-duration", "transition-delay", "transition-timing-function", NULL };
const char *animation_subproperties[] = { "animation-name", "animation-iteration-count", "animation-duration", "animation-delay",
"animation-timing-function", "animation-direction", "animation-fill-mode", NULL };
+ const char *text_decoration_subproperties[] = { "text-decoration-line", "text-decoration-color", NULL };
const char **all_subproperties;
@@ -1281,6 +1314,12 @@ _gtk_css_shorthand_property_init_properties (void)
parse_animation,
NULL,
NULL);
+ _gtk_css_shorthand_property_register ("text-decoration",
+ G_TYPE_NONE,
+ text_decoration_subproperties,
+ parse_text_decoration,
+ NULL,
+ NULL);
all_subproperties = get_all_subproperties ();
_gtk_css_shorthand_property_register ("all",