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,
96 return parse_four_numbers (shorthand,
99 GTK_CSS_NUMBER_AS_PIXELS
100 | GTK_CSS_PARSE_LENGTH);
104 parse_padding (GtkCssShorthandProperty *shorthand,
105 GtkCssValue **values,
106 GtkCssParser *parser)
108 return parse_four_numbers (shorthand,
111 GTK_CSS_POSITIVE_ONLY
112 | GTK_CSS_NUMBER_AS_PIXELS
113 | GTK_CSS_PARSE_LENGTH);
117 parse_border_width (GtkCssShorthandProperty *shorthand,
118 GtkCssValue **values,
119 GtkCssParser *parser)
121 return parse_four_numbers (shorthand,
124 GTK_CSS_POSITIVE_ONLY
125 | GTK_CSS_NUMBER_AS_PIXELS
126 | GTK_CSS_PARSE_LENGTH);
130 parse_border_radius (GtkCssShorthandProperty *shorthand,
131 GtkCssValue **values,
132 GtkCssParser *parser)
134 GtkCssValue *x[4] = { NULL, }, *y[4] = { NULL, };
137 for (i = 0; i < 4; i++)
139 if (!_gtk_css_parser_has_number (parser))
141 x[i] = _gtk_css_number_value_parse (parser,
142 GTK_CSS_POSITIVE_ONLY
143 | GTK_CSS_PARSE_PERCENT
144 | GTK_CSS_NUMBER_AS_PIXELS
145 | GTK_CSS_PARSE_LENGTH);
152 _gtk_css_parser_error (parser, "Expected a number");
156 /* The magic (i - 1) >> 1 below makes it take the correct value
157 * according to spec. Feel free to check the 4 cases */
159 x[i] = _gtk_css_value_ref (x[(i - 1) >> 1]);
161 if (_gtk_css_parser_try (parser, "/", TRUE))
163 for (i = 0; i < 4; i++)
165 if (!_gtk_css_parser_has_number (parser))
167 y[i] = _gtk_css_number_value_parse (parser,
168 GTK_CSS_POSITIVE_ONLY
169 | GTK_CSS_PARSE_PERCENT
170 | GTK_CSS_NUMBER_AS_PIXELS
171 | GTK_CSS_PARSE_LENGTH);
178 _gtk_css_parser_error (parser, "Expected a number");
183 y[i] = _gtk_css_value_ref (y[(i - 1) >> 1]);
187 for (i = 0; i < 4; i++)
188 y[i] = _gtk_css_value_ref (x[i]);
191 for (i = 0; i < 4; i++)
193 values[i] = _gtk_css_corner_value_new (x[i], y[i]);
199 for (i = 0; i < 4; i++)
202 _gtk_css_value_unref (x[i]);
204 _gtk_css_value_unref (y[i]);
210 parse_border_color (GtkCssShorthandProperty *shorthand,
211 GtkCssValue **values,
212 GtkCssParser *parser)
216 for (i = 0; i < 4; i++)
218 values[i] = _gtk_css_symbolic_value_new (parser);
219 if (values[i] == NULL)
222 if (value_is_done_parsing (parser))
226 for (i++; i < 4; i++)
228 values[i] = _gtk_css_value_ref (values[(i - 1) >> 1]);
235 parse_border_style (GtkCssShorthandProperty *shorthand,
236 GtkCssValue **values,
237 GtkCssParser *parser)
241 for (i = 0; i < 4; i++)
243 values[i] = _gtk_css_border_style_value_try_parse (parser);
244 if (values[i] == NULL)
250 _gtk_css_parser_error (parser, "Expected a border style");
255 values[i] = _gtk_css_value_ref (values[(i - 1) >> 1]);
261 parse_border_image (GtkCssShorthandProperty *shorthand,
262 GtkCssValue **values,
263 GtkCssParser *parser)
267 if (values[0] == NULL &&
268 (_gtk_css_parser_has_prefix (parser, "none") ||
269 _gtk_css_image_can_parse (parser)))
273 if (_gtk_css_parser_try (parser, "none", TRUE))
277 image = _gtk_css_image_new_parse (parser);
282 values[0] = _gtk_css_image_value_new (image);
284 else if (values[3] == NULL &&
285 (values[3] = _gtk_css_border_repeat_value_try_parse (parser)))
287 /* please move along */
289 else if (values[1] == NULL)
291 values[1] = _gtk_css_border_value_parse (parser,
292 GTK_CSS_PARSE_PERCENT
293 | GTK_CSS_PARSE_NUMBER
294 | GTK_CSS_POSITIVE_ONLY,
297 if (values[1] == NULL)
300 if (_gtk_css_parser_try (parser, "/", TRUE))
302 values[2] = _gtk_css_border_value_parse (parser,
303 GTK_CSS_PARSE_PERCENT
304 | GTK_CSS_PARSE_LENGTH
305 | GTK_CSS_PARSE_NUMBER
306 | GTK_CSS_POSITIVE_ONLY,
309 if (values[2] == NULL)
315 /* We parsed everything and there's still stuff left?
316 * Pretend we didn't notice and let the normal code produce
317 * a 'junk at end of value' error */
321 while (!value_is_done_parsing (parser));
327 parse_border_side (GtkCssShorthandProperty *shorthand,
328 GtkCssValue **values,
329 GtkCssParser *parser)
333 if (values[0] == NULL &&
334 _gtk_css_parser_has_number (parser))
336 values[0] = _gtk_css_number_value_parse (parser,
337 GTK_CSS_POSITIVE_ONLY
338 | GTK_CSS_NUMBER_AS_PIXELS
339 | GTK_CSS_PARSE_LENGTH);
340 if (values[0] == NULL)
343 else if (values[1] == NULL &&
344 (values[1] = _gtk_css_border_style_value_try_parse (parser)))
348 else if (values[2] == NULL)
350 values[2] = _gtk_css_symbolic_value_new (parser);
351 if (values[2] == NULL)
355 while (!value_is_done_parsing (parser));
361 parse_border (GtkCssShorthandProperty *shorthand,
362 GtkCssValue **values,
363 GtkCssParser *parser)
367 if (values[0] == NULL &&
368 _gtk_css_parser_has_number (parser))
370 values[0] = _gtk_css_number_value_parse (parser,
371 GTK_CSS_POSITIVE_ONLY
372 | GTK_CSS_NUMBER_AS_PIXELS
373 | GTK_CSS_PARSE_LENGTH);
374 if (values[0] == NULL)
376 values[1] = _gtk_css_value_ref (values[0]);
377 values[2] = _gtk_css_value_ref (values[0]);
378 values[3] = _gtk_css_value_ref (values[0]);
380 else if (values[4] == NULL &&
381 (values[4] = _gtk_css_border_style_value_try_parse (parser)))
383 values[5] = _gtk_css_value_ref (values[4]);
384 values[6] = _gtk_css_value_ref (values[4]);
385 values[7] = _gtk_css_value_ref (values[4]);
387 else if (!G_IS_VALUE (&values[8]))
389 values[8] = _gtk_css_symbolic_value_new (parser);
390 if (values[8] == NULL)
393 values[9] = _gtk_css_value_ref (values[8]);
394 values[10] = _gtk_css_value_ref (values[8]);
395 values[11] = _gtk_css_value_ref (values[8]);
399 /* We parsed everything and there's still stuff left?
400 * Pretend we didn't notice and let the normal code produce
401 * a 'junk at end of value' error */
405 while (!value_is_done_parsing (parser));
407 /* Note that border-image values are not set: according to the spec
408 they just need to be reset when using the border shorthand */
414 parse_font (GtkCssShorthandProperty *shorthand,
415 GtkCssValue **values,
416 GtkCssParser *parser)
418 PangoFontDescription *desc;
422 str = _gtk_css_parser_read_value (parser);
426 desc = pango_font_description_from_string (str);
429 mask = pango_font_description_get_set_fields (desc);
431 if (mask & PANGO_FONT_MASK_FAMILY)
433 values[0] = _gtk_css_array_value_new (_gtk_css_string_value_new (pango_font_description_get_family (desc)));
435 if (mask & PANGO_FONT_MASK_STYLE)
437 values[1] = _gtk_css_font_style_value_new (pango_font_description_get_style (desc));
439 if (mask & PANGO_FONT_MASK_VARIANT)
441 values[2] = _gtk_css_font_variant_value_new (pango_font_description_get_variant (desc));
443 if (mask & PANGO_FONT_MASK_WEIGHT)
445 values[3] = _gtk_css_font_weight_value_new (pango_font_description_get_weight (desc));
447 if (mask & PANGO_FONT_MASK_SIZE)
449 values[4] = _gtk_css_number_value_new ((double) pango_font_description_get_size (desc) / PANGO_SCALE, GTK_CSS_PX);
452 pango_font_description_free (desc);
458 parse_background (GtkCssShorthandProperty *shorthand,
459 GtkCssValue **values,
460 GtkCssParser *parser)
467 if (values[0] == NULL &&
468 (_gtk_css_parser_has_prefix (parser, "none") ||
469 _gtk_css_image_can_parse (parser)))
473 if (_gtk_css_parser_try (parser, "none", TRUE))
477 image = _gtk_css_image_new_parse (parser);
482 values[0] = _gtk_css_array_value_new (_gtk_css_image_value_new (image));
484 else if (values[1] == NULL &&
485 (value = _gtk_css_background_repeat_value_try_parse (parser)))
487 values[1] = _gtk_css_array_value_new (value);
490 else if ((values[2] == NULL || values[3] == NULL) &&
491 (value = _gtk_css_area_value_try_parse (parser)))
493 values[3] = _gtk_css_array_value_new (value);
495 if (values[2] == NULL)
497 values[2] = values[3];
502 else if (values[4] == NULL)
504 value = _gtk_css_symbolic_value_new (parser);
508 values[4] = _gtk_css_array_value_new (value);
513 /* We parsed everything and there's still stuff left?
514 * Pretend we didn't notice and let the normal code produce
515 * a 'junk at end of value' error */
519 while (!value_is_done_parsing (parser));
525 parse_one_transition (GtkCssShorthandProperty *shorthand,
526 GtkCssValue **values,
527 GtkCssParser *parser)
532 if (values[2] == NULL &&
533 _gtk_css_parser_has_number (parser) && !_gtk_css_parser_begins_with (parser, '-'))
535 GtkCssValue *number = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_TIME);
540 if (values[1] == NULL)
545 else if (values[3] == NULL &&
546 _gtk_css_ease_value_can_parse (parser))
548 values[3] = _gtk_css_ease_value_parse (parser);
550 if (values[3] == NULL)
553 else if (values[0] == NULL)
555 values[0] = _gtk_css_ident_value_try_parse (parser);
556 if (values[0] == NULL)
558 _gtk_css_parser_error (parser, "Unknown value for property");
565 /* We parsed everything and there's still stuff left?
566 * Pretend we didn't notice and let the normal code produce
567 * a 'junk at end of value' error */
571 while (!value_is_done_parsing (parser));
577 parse_transition (GtkCssShorthandProperty *shorthand,
578 GtkCssValue **values,
579 GtkCssParser *parser)
581 GtkCssValue *step_values[4];
582 GPtrArray *arrays[4];
585 for (i = 0; i < 4; i++)
587 arrays[i] = g_ptr_array_new ();
588 step_values[i] = NULL;
592 if (!parse_one_transition (shorthand, step_values, parser))
594 for (i = 0; i < 4; i++)
596 g_ptr_array_set_free_func (arrays[i], (GDestroyNotify) _gtk_css_value_unref);
597 g_ptr_array_unref (arrays[i]);
602 for (i = 0; i < 4; i++)
604 if (step_values[i] == NULL)
606 GtkCssValue *initial = _gtk_css_style_property_get_initial_value (
607 _gtk_css_shorthand_property_get_subproperty (shorthand, i));
608 step_values[i] = _gtk_css_value_ref (_gtk_css_array_value_get_nth (initial, 0));
611 g_ptr_array_add (arrays[i], step_values[i]);
612 step_values[i] = NULL;
614 } while (_gtk_css_parser_try (parser, ",", TRUE));
616 for (i = 0; i < 4; i++)
618 values[i] = _gtk_css_array_value_new_from_array ((GtkCssValue **) arrays[i]->pdata, arrays[i]->len);
619 g_ptr_array_unref (arrays[i]);
628 unpack_border (GtkCssShorthandProperty *shorthand,
629 GtkStyleProperties *props,
633 GValue v = G_VALUE_INIT;
634 GtkBorder *border = g_value_get_boxed (value);
636 g_value_init (&v, G_TYPE_INT);
638 g_value_set_int (&v, border->top);
639 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 0)), props, state, &v);
640 g_value_set_int (&v, border->right);
641 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 1)), props, state, &v);
642 g_value_set_int (&v, border->bottom);
643 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 2)), props, state, &v);
644 g_value_set_int (&v, border->left);
645 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 3)), props, state, &v);
651 pack_border (GtkCssShorthandProperty *shorthand,
653 GtkStyleQueryFunc query_func,
656 GtkCssStyleProperty *prop;
660 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 0);
661 _gtk_style_property_query (GTK_STYLE_PROPERTY (prop), &v, query_func, query_data);
662 border.top = g_value_get_int (&v);
665 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 1);
666 _gtk_style_property_query (GTK_STYLE_PROPERTY (prop), &v, query_func, query_data);
667 border.right = g_value_get_int (&v);
670 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 2);
671 _gtk_style_property_query (GTK_STYLE_PROPERTY (prop), &v, query_func, query_data);
672 border.bottom = g_value_get_int (&v);
675 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 3);
676 _gtk_style_property_query (GTK_STYLE_PROPERTY (prop), &v, query_func, query_data);
677 border.left = g_value_get_int (&v);
680 g_value_init (value, GTK_TYPE_BORDER);
681 g_value_set_boxed (value, &border);
685 unpack_border_radius (GtkCssShorthandProperty *shorthand,
686 GtkStyleProperties *props,
690 GtkCssValue *css_value;
693 css_value = _gtk_css_corner_value_new (_gtk_css_number_value_new (g_value_get_int (value), GTK_CSS_PX),
694 _gtk_css_number_value_new (g_value_get_int (value), GTK_CSS_PX));
696 for (i = 0; i < 4; i++)
697 _gtk_style_properties_set_property_by_property (props,
698 _gtk_css_shorthand_property_get_subproperty (shorthand, i),
702 _gtk_css_value_unref (css_value);
706 pack_border_radius (GtkCssShorthandProperty *shorthand,
708 GtkStyleQueryFunc query_func,
711 GtkCssStyleProperty *prop;
715 prop = GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("border-top-left-radius"));
716 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
718 i = _gtk_css_corner_value_get_x (v, 100);
720 g_value_init (value, G_TYPE_INT);
721 g_value_set_int (value, i);
725 unpack_font_description (GtkCssShorthandProperty *shorthand,
726 GtkStyleProperties *props,
730 GtkStyleProperty *prop;
731 PangoFontDescription *description;
733 GValue v = G_VALUE_INIT;
735 /* For backwards compat, we only unpack values that are indeed set.
736 * For strict CSS conformance we need to unpack all of them.
737 * Note that we do set all of them in the parse function, so it
738 * will not have effects when parsing CSS files. It will though
739 * for custom style providers.
742 description = g_value_get_boxed (value);
745 mask = pango_font_description_get_set_fields (description);
749 if (mask & PANGO_FONT_MASK_FAMILY)
751 GPtrArray *strv = g_ptr_array_new ();
753 g_ptr_array_add (strv, g_strdup (pango_font_description_get_family (description)));
754 g_ptr_array_add (strv, NULL);
755 g_value_init (&v, G_TYPE_STRV);
756 g_value_take_boxed (&v, g_ptr_array_free (strv, FALSE));
758 prop = _gtk_style_property_lookup ("font-family");
759 _gtk_style_property_assign (prop, props, state, &v);
763 if (mask & PANGO_FONT_MASK_STYLE)
765 g_value_init (&v, PANGO_TYPE_STYLE);
766 g_value_set_enum (&v, pango_font_description_get_style (description));
768 prop = _gtk_style_property_lookup ("font-style");
769 _gtk_style_property_assign (prop, props, state, &v);
773 if (mask & PANGO_FONT_MASK_VARIANT)
775 g_value_init (&v, PANGO_TYPE_VARIANT);
776 g_value_set_enum (&v, pango_font_description_get_variant (description));
778 prop = _gtk_style_property_lookup ("font-variant");
779 _gtk_style_property_assign (prop, props, state, &v);
783 if (mask & PANGO_FONT_MASK_WEIGHT)
785 g_value_init (&v, PANGO_TYPE_WEIGHT);
786 g_value_set_enum (&v, pango_font_description_get_weight (description));
788 prop = _gtk_style_property_lookup ("font-weight");
789 _gtk_style_property_assign (prop, props, state, &v);
793 if (mask & PANGO_FONT_MASK_SIZE)
795 g_value_init (&v, G_TYPE_DOUBLE);
796 g_value_set_double (&v, (double) pango_font_description_get_size (description) / PANGO_SCALE);
798 prop = _gtk_style_property_lookup ("font-size");
799 _gtk_style_property_assign (prop, props, state, &v);
805 pack_font_description (GtkCssShorthandProperty *shorthand,
807 GtkStyleQueryFunc query_func,
810 PangoFontDescription *description;
813 description = pango_font_description_new ();
815 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-family"))), query_data);
818 /* xxx: Can we set all the families here somehow? */
819 pango_font_description_set_family (description, _gtk_css_string_value_get (_gtk_css_array_value_get_nth (v, 0)));
822 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-size"))), query_data);
824 pango_font_description_set_size (description, round (_gtk_css_number_value_get (v, 100) * PANGO_SCALE));
826 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-style"))), query_data);
828 pango_font_description_set_style (description, _gtk_css_font_style_value_get (v));
830 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-variant"))), query_data);
832 pango_font_description_set_variant (description, _gtk_css_font_variant_value_get (v));
834 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-weight"))), query_data);
836 pango_font_description_set_weight (description, _gtk_css_font_weight_value_get (v));
838 g_value_init (value, PANGO_TYPE_FONT_DESCRIPTION);
839 g_value_take_boxed (value, description);
843 unpack_to_everything (GtkCssShorthandProperty *shorthand,
844 GtkStyleProperties *props,
848 GtkCssStyleProperty *prop;
851 n = _gtk_css_shorthand_property_get_n_subproperties (shorthand);
853 for (i = 0; i < n; i++)
855 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, i);
856 _gtk_style_property_assign (GTK_STYLE_PROPERTY (prop), props, state, value);
861 pack_first_element (GtkCssShorthandProperty *shorthand,
863 GtkStyleQueryFunc query_func,
866 GtkCssStyleProperty *prop;
868 /* NB: This is a fallback for properties that originally were
869 * not used as shorthand. We just pick the first subproperty
870 * as a representative.
871 * Lesson learned: Don't query the shorthand, query the
872 * real properties instead. */
873 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 0);
874 _gtk_style_property_query (GTK_STYLE_PROPERTY (prop),
881 _gtk_css_shorthand_property_register (const char *name,
883 const char **subproperties,
884 GtkCssShorthandPropertyParseFunc parse_func,
885 GtkCssShorthandPropertyAssignFunc assign_func,
886 GtkCssShorthandPropertyQueryFunc query_func)
888 GtkCssShorthandProperty *node;
890 node = g_object_new (GTK_TYPE_CSS_SHORTHAND_PROPERTY,
892 "value-type", value_type,
893 "subproperties", subproperties,
896 node->parse = parse_func;
897 node->assign = assign_func;
898 node->query = query_func;
902 _gtk_css_shorthand_property_init_properties (void)
904 /* The order is important here, be careful when changing it */
905 const char *font_subproperties[] = { "font-family", "font-style", "font-variant", "font-weight", "font-size", NULL };
906 const char *margin_subproperties[] = { "margin-top", "margin-right", "margin-bottom", "margin-left", NULL };
907 const char *padding_subproperties[] = { "padding-top", "padding-right", "padding-bottom", "padding-left", NULL };
908 const char *border_width_subproperties[] = { "border-top-width", "border-right-width", "border-bottom-width", "border-left-width", NULL };
909 const char *border_radius_subproperties[] = { "border-top-left-radius", "border-top-right-radius",
910 "border-bottom-right-radius", "border-bottom-left-radius", NULL };
911 const char *border_color_subproperties[] = { "border-top-color", "border-right-color", "border-bottom-color", "border-left-color", NULL };
912 const char *border_style_subproperties[] = { "border-top-style", "border-right-style", "border-bottom-style", "border-left-style", NULL };
913 const char *border_image_subproperties[] = { "border-image-source", "border-image-slice", "border-image-width", "border-image-repeat", NULL };
914 const char *border_top_subproperties[] = { "border-top-width", "border-top-style", "border-top-color", NULL };
915 const char *border_right_subproperties[] = { "border-right-width", "border-right-style", "border-right-color", NULL };
916 const char *border_bottom_subproperties[] = { "border-bottom-width", "border-bottom-style", "border-bottom-color", NULL };
917 const char *border_left_subproperties[] = { "border-left-width", "border-left-style", "border-left-color", NULL };
918 const char *border_subproperties[] = { "border-top-width", "border-right-width", "border-bottom-width", "border-left-width",
919 "border-top-style", "border-right-style", "border-bottom-style", "border-left-style",
920 "border-top-color", "border-right-color", "border-bottom-color", "border-left-color",
921 "border-image-source", "border-image-slice", "border-image-width", "border-image-repeat", NULL };
922 const char *outline_subproperties[] = { "outline-width", "outline-style", "outline-color", NULL };
923 const char *background_subproperties[] = { "background-image", "background-repeat", "background-clip", "background-origin",
924 "background-color", NULL };
925 const char *transition_subproperties[] = { "transition-property", "transition-duration", "transition-delay", "transition-timing-function", NULL };
927 _gtk_css_shorthand_property_register ("font",
928 PANGO_TYPE_FONT_DESCRIPTION,
931 unpack_font_description,
932 pack_font_description);
933 _gtk_css_shorthand_property_register ("margin",
935 margin_subproperties,
939 _gtk_css_shorthand_property_register ("padding",
941 padding_subproperties,
945 _gtk_css_shorthand_property_register ("border-width",
947 border_width_subproperties,
951 _gtk_css_shorthand_property_register ("border-radius",
953 border_radius_subproperties,
955 unpack_border_radius,
957 _gtk_css_shorthand_property_register ("border-color",
959 border_color_subproperties,
961 unpack_to_everything,
963 _gtk_css_shorthand_property_register ("border-style",
964 GTK_TYPE_BORDER_STYLE,
965 border_style_subproperties,
967 unpack_to_everything,
969 _gtk_css_shorthand_property_register ("border-image",
971 border_image_subproperties,
975 _gtk_css_shorthand_property_register ("border-top",
977 border_top_subproperties,
981 _gtk_css_shorthand_property_register ("border-right",
983 border_right_subproperties,
987 _gtk_css_shorthand_property_register ("border-bottom",
989 border_bottom_subproperties,
993 _gtk_css_shorthand_property_register ("border-left",
995 border_left_subproperties,
999 _gtk_css_shorthand_property_register ("border",
1001 border_subproperties,
1005 _gtk_css_shorthand_property_register ("outline",
1007 outline_subproperties,
1011 _gtk_css_shorthand_property_register ("background",
1013 background_subproperties,
1017 _gtk_css_shorthand_property_register ("transition",
1019 transition_subproperties,