2 * Copyright © 2011 Red Hat Inc.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library. If not, see <http://www.gnu.org/licenses/>.
17 * Authors: Benjamin Otte <otte@gnome.org>
22 #include "gtkcssshorthandpropertyprivate.h"
24 #include <cairo-gobject.h>
27 #include "gtkcssarrayvalueprivate.h"
28 #include "gtkcssbordervalueprivate.h"
29 #include "gtkcsscornervalueprivate.h"
30 #include "gtkcsseasevalueprivate.h"
31 #include "gtkcssenumvalueprivate.h"
32 #include "gtkcssimageprivate.h"
33 #include "gtkcssimagevalueprivate.h"
34 #include "gtkcssnumbervalueprivate.h"
35 #include "gtkcssrepeatvalueprivate.h"
36 #include "gtkcssstringvalueprivate.h"
37 #include "gtkcssstylefuncsprivate.h"
38 #include "gtkcssvalueprivate.h"
39 #include "gtkstylepropertiesprivate.h"
40 #include "gtksymboliccolorprivate.h"
41 #include "gtktypebuiltins.h"
43 /* this is in case round() is not provided by the compiler,
44 * such as in the case of C89 compilers, like MSVC
46 #include "fallback-c89.c"
51 value_is_done_parsing (GtkCssParser *parser)
53 return _gtk_css_parser_is_eof (parser) ||
54 _gtk_css_parser_begins_with (parser, ',') ||
55 _gtk_css_parser_begins_with (parser, ';') ||
56 _gtk_css_parser_begins_with (parser, '}');
60 parse_four_numbers (GtkCssShorthandProperty *shorthand,
63 GtkCssNumberParseFlags flags)
67 for (i = 0; i < 4; i++)
69 if (!_gtk_css_parser_has_number (parser))
72 values[i] = _gtk_css_number_value_parse (parser, flags);
73 if (values[i] == NULL)
79 _gtk_css_parser_error (parser, "Expected a length");
85 values[i] = _gtk_css_value_ref (values[(i - 1) >> 1]);
92 parse_margin (GtkCssShorthandProperty *shorthand,
97 return parse_four_numbers (shorthand,
100 GTK_CSS_NUMBER_AS_PIXELS
101 | GTK_CSS_PARSE_LENGTH);
105 parse_padding (GtkCssShorthandProperty *shorthand,
106 GtkCssValue **values,
107 GtkCssParser *parser,
110 return parse_four_numbers (shorthand,
113 GTK_CSS_POSITIVE_ONLY
114 | GTK_CSS_NUMBER_AS_PIXELS
115 | GTK_CSS_PARSE_LENGTH);
119 parse_border_width (GtkCssShorthandProperty *shorthand,
120 GtkCssValue **values,
121 GtkCssParser *parser,
124 return parse_four_numbers (shorthand,
127 GTK_CSS_POSITIVE_ONLY
128 | GTK_CSS_NUMBER_AS_PIXELS
129 | GTK_CSS_PARSE_LENGTH);
133 parse_border_radius (GtkCssShorthandProperty *shorthand,
134 GtkCssValue **values,
135 GtkCssParser *parser,
138 GtkCssValue *x[4] = { NULL, }, *y[4] = { NULL, };
141 for (i = 0; i < 4; i++)
143 if (!_gtk_css_parser_has_number (parser))
145 x[i] = _gtk_css_number_value_parse (parser,
146 GTK_CSS_POSITIVE_ONLY
147 | GTK_CSS_PARSE_PERCENT
148 | GTK_CSS_NUMBER_AS_PIXELS
149 | GTK_CSS_PARSE_LENGTH);
156 _gtk_css_parser_error (parser, "Expected a number");
160 /* The magic (i - 1) >> 1 below makes it take the correct value
161 * according to spec. Feel free to check the 4 cases */
163 x[i] = _gtk_css_value_ref (x[(i - 1) >> 1]);
165 if (_gtk_css_parser_try (parser, "/", TRUE))
167 for (i = 0; i < 4; i++)
169 if (!_gtk_css_parser_has_number (parser))
171 y[i] = _gtk_css_number_value_parse (parser,
172 GTK_CSS_POSITIVE_ONLY
173 | GTK_CSS_PARSE_PERCENT
174 | GTK_CSS_NUMBER_AS_PIXELS
175 | GTK_CSS_PARSE_LENGTH);
182 _gtk_css_parser_error (parser, "Expected a number");
187 y[i] = _gtk_css_value_ref (y[(i - 1) >> 1]);
191 for (i = 0; i < 4; i++)
192 y[i] = _gtk_css_value_ref (x[i]);
195 for (i = 0; i < 4; i++)
197 values[i] = _gtk_css_corner_value_new (x[i], y[i]);
203 for (i = 0; i < 4; i++)
206 _gtk_css_value_unref (x[i]);
208 _gtk_css_value_unref (y[i]);
214 parse_border_color (GtkCssShorthandProperty *shorthand,
215 GtkCssValue **values,
216 GtkCssParser *parser,
221 for (i = 0; i < 4; i++)
223 values[i] = _gtk_css_symbolic_value_new (parser);
224 if (values[i] == NULL)
227 if (value_is_done_parsing (parser))
231 for (i++; i < 4; i++)
233 values[i] = _gtk_css_value_ref (values[(i - 1) >> 1]);
240 parse_border_style (GtkCssShorthandProperty *shorthand,
241 GtkCssValue **values,
242 GtkCssParser *parser,
247 for (i = 0; i < 4; i++)
249 values[i] = _gtk_css_border_style_value_try_parse (parser);
250 if (values[i] == NULL)
256 _gtk_css_parser_error (parser, "Expected a border style");
261 values[i] = _gtk_css_value_ref (values[(i - 1) >> 1]);
267 parse_border_image (GtkCssShorthandProperty *shorthand,
268 GtkCssValue **values,
269 GtkCssParser *parser,
274 if (values[0] == NULL &&
275 (_gtk_css_parser_has_prefix (parser, "none") ||
276 _gtk_css_image_can_parse (parser)))
280 if (_gtk_css_parser_try (parser, "none", TRUE))
284 image = _gtk_css_image_new_parse (parser, base);
289 values[0] = _gtk_css_image_value_new (image);
291 else if (values[3] == NULL &&
292 (values[3] = _gtk_css_border_repeat_value_try_parse (parser)))
294 /* please move along */
296 else if (values[1] == NULL)
298 values[1] = _gtk_css_border_value_parse (parser,
299 GTK_CSS_PARSE_PERCENT
300 | GTK_CSS_PARSE_NUMBER
301 | GTK_CSS_POSITIVE_ONLY,
304 if (values[1] == NULL)
307 if (_gtk_css_parser_try (parser, "/", TRUE))
309 values[2] = _gtk_css_border_value_parse (parser,
310 GTK_CSS_PARSE_PERCENT
311 | GTK_CSS_PARSE_LENGTH
312 | GTK_CSS_PARSE_NUMBER
313 | GTK_CSS_POSITIVE_ONLY,
316 if (values[2] == NULL)
322 /* We parsed everything and there's still stuff left?
323 * Pretend we didn't notice and let the normal code produce
324 * a 'junk at end of value' error */
328 while (!value_is_done_parsing (parser));
334 parse_border_side (GtkCssShorthandProperty *shorthand,
335 GtkCssValue **values,
336 GtkCssParser *parser,
341 if (values[0] == NULL &&
342 _gtk_css_parser_has_number (parser))
344 values[0] = _gtk_css_number_value_parse (parser,
345 GTK_CSS_POSITIVE_ONLY
346 | GTK_CSS_NUMBER_AS_PIXELS
347 | GTK_CSS_PARSE_LENGTH);
348 if (values[0] == NULL)
351 else if (values[1] == NULL &&
352 (values[1] = _gtk_css_border_style_value_try_parse (parser)))
356 else if (values[2] == NULL)
358 values[2] = _gtk_css_symbolic_value_new (parser);
359 if (values[2] == NULL)
363 while (!value_is_done_parsing (parser));
369 parse_border (GtkCssShorthandProperty *shorthand,
370 GtkCssValue **values,
371 GtkCssParser *parser,
376 if (values[0] == NULL &&
377 _gtk_css_parser_has_number (parser))
379 values[0] = _gtk_css_number_value_parse (parser,
380 GTK_CSS_POSITIVE_ONLY
381 | GTK_CSS_NUMBER_AS_PIXELS
382 | GTK_CSS_PARSE_LENGTH);
383 if (values[0] == NULL)
385 values[1] = _gtk_css_value_ref (values[0]);
386 values[2] = _gtk_css_value_ref (values[0]);
387 values[3] = _gtk_css_value_ref (values[0]);
389 else if (values[4] == NULL &&
390 (values[4] = _gtk_css_border_style_value_try_parse (parser)))
392 values[5] = _gtk_css_value_ref (values[4]);
393 values[6] = _gtk_css_value_ref (values[4]);
394 values[7] = _gtk_css_value_ref (values[4]);
396 else if (!G_IS_VALUE (&values[8]))
398 values[8] = _gtk_css_symbolic_value_new (parser);
399 if (values[8] == NULL)
402 values[9] = _gtk_css_value_ref (values[8]);
403 values[10] = _gtk_css_value_ref (values[8]);
404 values[11] = _gtk_css_value_ref (values[8]);
408 /* We parsed everything and there's still stuff left?
409 * Pretend we didn't notice and let the normal code produce
410 * a 'junk at end of value' error */
414 while (!value_is_done_parsing (parser));
416 /* Note that border-image values are not set: according to the spec
417 they just need to be reset when using the border shorthand */
423 parse_font (GtkCssShorthandProperty *shorthand,
424 GtkCssValue **values,
425 GtkCssParser *parser,
428 PangoFontDescription *desc;
432 str = _gtk_css_parser_read_value (parser);
436 desc = pango_font_description_from_string (str);
439 mask = pango_font_description_get_set_fields (desc);
441 if (mask & PANGO_FONT_MASK_FAMILY)
443 values[0] = _gtk_css_array_value_new (_gtk_css_string_value_new (pango_font_description_get_family (desc)));
445 if (mask & PANGO_FONT_MASK_STYLE)
447 values[1] = _gtk_css_font_style_value_new (pango_font_description_get_style (desc));
449 if (mask & PANGO_FONT_MASK_VARIANT)
451 values[2] = _gtk_css_font_variant_value_new (pango_font_description_get_variant (desc));
453 if (mask & PANGO_FONT_MASK_WEIGHT)
455 values[3] = _gtk_css_font_weight_value_new (pango_font_description_get_weight (desc));
457 if (mask & PANGO_FONT_MASK_SIZE)
459 values[4] = _gtk_css_number_value_new ((double) pango_font_description_get_size (desc) / PANGO_SCALE, GTK_CSS_PX);
462 pango_font_description_free (desc);
468 parse_background (GtkCssShorthandProperty *shorthand,
469 GtkCssValue **values,
470 GtkCssParser *parser,
476 if (values[0] == NULL &&
477 (_gtk_css_parser_has_prefix (parser, "none") ||
478 _gtk_css_image_can_parse (parser)))
482 if (_gtk_css_parser_try (parser, "none", TRUE))
486 image = _gtk_css_image_new_parse (parser, base);
491 values[0] = _gtk_css_image_value_new (image);
493 else if (values[1] == NULL &&
494 (values[1] = _gtk_css_background_repeat_value_try_parse (parser)))
496 /* nothing to do here */
498 else if ((values[2] == NULL || values[3] == NULL) &&
499 (values[3] = _gtk_css_area_value_try_parse (parser)))
501 if (values[2] == NULL)
503 values[2] = values[3];
507 else if (values[4] == NULL)
509 values[4] = _gtk_css_symbolic_value_new (parser);
510 if (values[4] == NULL)
515 /* We parsed everything and there's still stuff left?
516 * Pretend we didn't notice and let the normal code produce
517 * a 'junk at end of value' error */
521 while (!value_is_done_parsing (parser));
527 parse_one_transition (GtkCssShorthandProperty *shorthand,
528 GtkCssValue **values,
529 GtkCssParser *parser,
535 if (values[2] == NULL &&
536 _gtk_css_parser_has_number (parser) && !_gtk_css_parser_begins_with (parser, '-'))
538 GtkCssValue *number = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_TIME);
543 if (values[1] == NULL)
548 else if (values[3] == NULL &&
549 _gtk_css_ease_value_can_parse (parser))
551 values[3] = _gtk_css_ease_value_parse (parser);
553 if (values[3] == NULL)
556 else if (values[0] == NULL)
558 values[0] = _gtk_css_ident_value_try_parse (parser);
559 if (values[0] == NULL)
561 _gtk_css_parser_error (parser, "Unknown value for property");
568 /* We parsed everything and there's still stuff left?
569 * Pretend we didn't notice and let the normal code produce
570 * a 'junk at end of value' error */
574 while (!value_is_done_parsing (parser));
580 parse_transition (GtkCssShorthandProperty *shorthand,
581 GtkCssValue **values,
582 GtkCssParser *parser,
585 GtkCssValue *step_values[4];
586 GPtrArray *arrays[4];
589 for (i = 0; i < 4; i++)
591 arrays[i] = g_ptr_array_new ();
592 step_values[i] = NULL;
596 if (!parse_one_transition (shorthand, step_values, parser, base))
598 for (i = 0; i < 4; i++)
600 g_ptr_array_set_free_func (arrays[i], (GDestroyNotify) _gtk_css_value_unref);
601 g_ptr_array_unref (arrays[i]);
606 for (i = 0; i < 4; i++)
608 if (step_values[i] == NULL)
610 GtkCssValue *initial = _gtk_css_style_property_get_initial_value (
611 _gtk_css_shorthand_property_get_subproperty (shorthand, i));
612 step_values[i] = _gtk_css_value_ref (_gtk_css_array_value_get_nth (initial, 0));
615 g_ptr_array_add (arrays[i], step_values[i]);
616 step_values[i] = NULL;
618 } while (_gtk_css_parser_try (parser, ",", TRUE));
620 for (i = 0; i < 4; i++)
622 values[i] = _gtk_css_array_value_new_from_array ((GtkCssValue **) arrays[i]->pdata, arrays[i]->len);
623 g_ptr_array_unref (arrays[i]);
632 unpack_border (GtkCssShorthandProperty *shorthand,
633 GtkStyleProperties *props,
637 GValue v = G_VALUE_INIT;
638 GtkBorder *border = g_value_get_boxed (value);
640 g_value_init (&v, G_TYPE_INT);
642 g_value_set_int (&v, border->top);
643 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 0)), props, state, &v);
644 g_value_set_int (&v, border->right);
645 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 1)), props, state, &v);
646 g_value_set_int (&v, border->bottom);
647 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 2)), props, state, &v);
648 g_value_set_int (&v, border->left);
649 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 3)), props, state, &v);
655 pack_border (GtkCssShorthandProperty *shorthand,
657 GtkStyleQueryFunc query_func,
660 GtkCssStyleProperty *prop;
664 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 0);
665 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
667 border.top = _gtk_css_value_get_int (v);
668 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 1);
669 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
671 border.right = _gtk_css_value_get_int (v);
672 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 2);
673 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
675 border.bottom = _gtk_css_value_get_int (v);
676 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 3);
677 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
679 border.left = _gtk_css_value_get_int (v);
681 g_value_init (value, GTK_TYPE_BORDER);
682 g_value_set_boxed (value, &border);
686 unpack_border_radius (GtkCssShorthandProperty *shorthand,
687 GtkStyleProperties *props,
691 GtkCssValue *css_value;
694 css_value = _gtk_css_corner_value_new (_gtk_css_number_value_new (g_value_get_int (value), GTK_CSS_PX),
695 _gtk_css_number_value_new (g_value_get_int (value), GTK_CSS_PX));
697 for (i = 0; i < 4; i++)
698 _gtk_style_properties_set_property_by_property (props,
699 _gtk_css_shorthand_property_get_subproperty (shorthand, i),
703 _gtk_css_value_unref (css_value);
707 pack_border_radius (GtkCssShorthandProperty *shorthand,
709 GtkStyleQueryFunc query_func,
712 GtkCssStyleProperty *prop;
716 prop = GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("border-top-left-radius"));
717 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
719 i = _gtk_css_corner_value_get_x (v, 100);
721 g_value_init (value, G_TYPE_INT);
722 g_value_set_int (value, i);
726 unpack_font_description (GtkCssShorthandProperty *shorthand,
727 GtkStyleProperties *props,
731 GtkStyleProperty *prop;
732 PangoFontDescription *description;
734 GValue v = G_VALUE_INIT;
736 /* For backwards compat, we only unpack values that are indeed set.
737 * For strict CSS conformance we need to unpack all of them.
738 * Note that we do set all of them in the parse function, so it
739 * will not have effects when parsing CSS files. It will though
740 * for custom style providers.
743 description = g_value_get_boxed (value);
746 mask = pango_font_description_get_set_fields (description);
750 if (mask & PANGO_FONT_MASK_FAMILY)
752 GPtrArray *strv = g_ptr_array_new ();
754 g_ptr_array_add (strv, g_strdup (pango_font_description_get_family (description)));
755 g_ptr_array_add (strv, NULL);
756 g_value_init (&v, G_TYPE_STRV);
757 g_value_take_boxed (&v, g_ptr_array_free (strv, FALSE));
759 prop = _gtk_style_property_lookup ("font-family");
760 _gtk_style_property_assign (prop, props, state, &v);
764 if (mask & PANGO_FONT_MASK_STYLE)
766 g_value_init (&v, PANGO_TYPE_STYLE);
767 g_value_set_enum (&v, pango_font_description_get_style (description));
769 prop = _gtk_style_property_lookup ("font-style");
770 _gtk_style_property_assign (prop, props, state, &v);
774 if (mask & PANGO_FONT_MASK_VARIANT)
776 g_value_init (&v, PANGO_TYPE_VARIANT);
777 g_value_set_enum (&v, pango_font_description_get_variant (description));
779 prop = _gtk_style_property_lookup ("font-variant");
780 _gtk_style_property_assign (prop, props, state, &v);
784 if (mask & PANGO_FONT_MASK_WEIGHT)
786 g_value_init (&v, PANGO_TYPE_WEIGHT);
787 g_value_set_enum (&v, pango_font_description_get_weight (description));
789 prop = _gtk_style_property_lookup ("font-weight");
790 _gtk_style_property_assign (prop, props, state, &v);
794 if (mask & PANGO_FONT_MASK_SIZE)
796 g_value_init (&v, G_TYPE_DOUBLE);
797 g_value_set_double (&v, (double) pango_font_description_get_size (description) / PANGO_SCALE);
799 prop = _gtk_style_property_lookup ("font-size");
800 _gtk_style_property_assign (prop, props, state, &v);
806 pack_font_description (GtkCssShorthandProperty *shorthand,
808 GtkStyleQueryFunc query_func,
811 PangoFontDescription *description;
814 description = pango_font_description_new ();
816 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-family"))), query_data);
819 /* xxx: Can we set all the families here somehow? */
820 pango_font_description_set_family (description, _gtk_css_string_value_get (_gtk_css_array_value_get_nth (v, 0)));
823 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-size"))), query_data);
825 pango_font_description_set_size (description, round (_gtk_css_number_value_get (v, 100) * PANGO_SCALE));
827 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-style"))), query_data);
829 pango_font_description_set_style (description, _gtk_css_font_style_value_get (v));
831 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-variant"))), query_data);
833 pango_font_description_set_variant (description, _gtk_css_font_variant_value_get (v));
835 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-weight"))), query_data);
837 pango_font_description_set_weight (description, _gtk_css_font_weight_value_get (v));
839 g_value_init (value, PANGO_TYPE_FONT_DESCRIPTION);
840 g_value_take_boxed (value, description);
844 unpack_to_everything (GtkCssShorthandProperty *shorthand,
845 GtkStyleProperties *props,
849 GtkCssStyleProperty *prop;
852 n = _gtk_css_shorthand_property_get_n_subproperties (shorthand);
854 for (i = 0; i < n; i++)
856 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, i);
857 _gtk_style_property_assign (GTK_STYLE_PROPERTY (prop), props, state, value);
862 pack_first_element (GtkCssShorthandProperty *shorthand,
864 GtkStyleQueryFunc query_func,
867 GtkCssStyleProperty *prop;
869 /* NB: This is a fallback for properties that originally were
870 * not used as shorthand. We just pick the first subproperty
871 * as a representative.
872 * Lesson learned: Don't query the shorthand, query the
873 * real properties instead. */
874 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 0);
875 _gtk_style_property_query (GTK_STYLE_PROPERTY (prop),
882 _gtk_css_shorthand_property_register (const char *name,
884 const char **subproperties,
885 GtkCssShorthandPropertyParseFunc parse_func,
886 GtkCssShorthandPropertyAssignFunc assign_func,
887 GtkCssShorthandPropertyQueryFunc query_func)
889 GtkCssShorthandProperty *node;
891 node = g_object_new (GTK_TYPE_CSS_SHORTHAND_PROPERTY,
893 "value-type", value_type,
894 "subproperties", subproperties,
897 node->parse = parse_func;
898 node->assign = assign_func;
899 node->query = query_func;
903 _gtk_css_shorthand_property_init_properties (void)
905 /* The order is important here, be careful when changing it */
906 const char *font_subproperties[] = { "font-family", "font-style", "font-variant", "font-weight", "font-size", NULL };
907 const char *margin_subproperties[] = { "margin-top", "margin-right", "margin-bottom", "margin-left", NULL };
908 const char *padding_subproperties[] = { "padding-top", "padding-right", "padding-bottom", "padding-left", NULL };
909 const char *border_width_subproperties[] = { "border-top-width", "border-right-width", "border-bottom-width", "border-left-width", NULL };
910 const char *border_radius_subproperties[] = { "border-top-left-radius", "border-top-right-radius",
911 "border-bottom-right-radius", "border-bottom-left-radius", NULL };
912 const char *border_color_subproperties[] = { "border-top-color", "border-right-color", "border-bottom-color", "border-left-color", NULL };
913 const char *border_style_subproperties[] = { "border-top-style", "border-right-style", "border-bottom-style", "border-left-style", NULL };
914 const char *border_image_subproperties[] = { "border-image-source", "border-image-slice", "border-image-width", "border-image-repeat", NULL };
915 const char *border_top_subproperties[] = { "border-top-width", "border-top-style", "border-top-color", NULL };
916 const char *border_right_subproperties[] = { "border-right-width", "border-right-style", "border-right-color", NULL };
917 const char *border_bottom_subproperties[] = { "border-bottom-width", "border-bottom-style", "border-bottom-color", NULL };
918 const char *border_left_subproperties[] = { "border-left-width", "border-left-style", "border-left-color", NULL };
919 const char *border_subproperties[] = { "border-top-width", "border-right-width", "border-bottom-width", "border-left-width",
920 "border-top-style", "border-right-style", "border-bottom-style", "border-left-style",
921 "border-top-color", "border-right-color", "border-bottom-color", "border-left-color",
922 "border-image-source", "border-image-slice", "border-image-width", "border-image-repeat", NULL };
923 const char *outline_subproperties[] = { "outline-width", "outline-style", "outline-color", NULL };
924 const char *background_subproperties[] = { "background-image", "background-repeat", "background-clip", "background-origin",
925 "background-color", NULL };
926 const char *transition_subproperties[] = { "transition-property", "transition-duration", "transition-delay", "transition-timing-function", NULL };
928 _gtk_css_shorthand_property_register ("font",
929 PANGO_TYPE_FONT_DESCRIPTION,
932 unpack_font_description,
933 pack_font_description);
934 _gtk_css_shorthand_property_register ("margin",
936 margin_subproperties,
940 _gtk_css_shorthand_property_register ("padding",
942 padding_subproperties,
946 _gtk_css_shorthand_property_register ("border-width",
948 border_width_subproperties,
952 _gtk_css_shorthand_property_register ("border-radius",
954 border_radius_subproperties,
956 unpack_border_radius,
958 _gtk_css_shorthand_property_register ("border-color",
960 border_color_subproperties,
962 unpack_to_everything,
964 _gtk_css_shorthand_property_register ("border-style",
965 GTK_TYPE_BORDER_STYLE,
966 border_style_subproperties,
968 unpack_to_everything,
970 _gtk_css_shorthand_property_register ("border-image",
972 border_image_subproperties,
976 _gtk_css_shorthand_property_register ("border-top",
978 border_top_subproperties,
982 _gtk_css_shorthand_property_register ("border-right",
984 border_right_subproperties,
988 _gtk_css_shorthand_property_register ("border-bottom",
990 border_bottom_subproperties,
994 _gtk_css_shorthand_property_register ("border-left",
996 border_left_subproperties,
1000 _gtk_css_shorthand_property_register ("border",
1002 border_subproperties,
1006 _gtk_css_shorthand_property_register ("outline",
1008 outline_subproperties,
1012 _gtk_css_shorthand_property_register ("background",
1014 background_subproperties,
1018 _gtk_css_shorthand_property_register ("transition",
1020 transition_subproperties,