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 "gtkcssbgsizevalueprivate.h"
29 #include "gtkcssbordervalueprivate.h"
30 #include "gtkcsscornervalueprivate.h"
31 #include "gtkcsseasevalueprivate.h"
32 #include "gtkcssenumvalueprivate.h"
33 #include "gtkcssimageprivate.h"
34 #include "gtkcssimagevalueprivate.h"
35 #include "gtkcssnumbervalueprivate.h"
36 #include "gtkcsspositionvalueprivate.h"
37 #include "gtkcssrepeatvalueprivate.h"
38 #include "gtkcssstringvalueprivate.h"
39 #include "gtkcssstylefuncsprivate.h"
40 #include "gtkcssvalueprivate.h"
41 #include "gtkstylepropertiesprivate.h"
42 #include "gtksymboliccolorprivate.h"
43 #include "gtktypebuiltins.h"
45 /* this is in case round() is not provided by the compiler,
46 * such as in the case of C89 compilers, like MSVC
48 #include "fallback-c89.c"
53 value_is_done_parsing (GtkCssParser *parser)
55 return _gtk_css_parser_is_eof (parser) ||
56 _gtk_css_parser_begins_with (parser, ',') ||
57 _gtk_css_parser_begins_with (parser, ';') ||
58 _gtk_css_parser_begins_with (parser, '}');
62 parse_four_numbers (GtkCssShorthandProperty *shorthand,
65 GtkCssNumberParseFlags flags)
69 for (i = 0; i < 4; i++)
71 if (!_gtk_css_parser_has_number (parser))
74 values[i] = _gtk_css_number_value_parse (parser, flags);
75 if (values[i] == NULL)
81 _gtk_css_parser_error (parser, "Expected a length");
87 values[i] = _gtk_css_value_ref (values[(i - 1) >> 1]);
94 parse_margin (GtkCssShorthandProperty *shorthand,
98 return parse_four_numbers (shorthand,
101 GTK_CSS_NUMBER_AS_PIXELS
102 | GTK_CSS_PARSE_LENGTH);
106 parse_padding (GtkCssShorthandProperty *shorthand,
107 GtkCssValue **values,
108 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)
123 return parse_four_numbers (shorthand,
126 GTK_CSS_POSITIVE_ONLY
127 | GTK_CSS_NUMBER_AS_PIXELS
128 | GTK_CSS_PARSE_LENGTH);
132 parse_border_radius (GtkCssShorthandProperty *shorthand,
133 GtkCssValue **values,
134 GtkCssParser *parser)
136 GtkCssValue *x[4] = { NULL, }, *y[4] = { NULL, };
139 for (i = 0; i < 4; i++)
141 if (!_gtk_css_parser_has_number (parser))
143 x[i] = _gtk_css_number_value_parse (parser,
144 GTK_CSS_POSITIVE_ONLY
145 | GTK_CSS_PARSE_PERCENT
146 | GTK_CSS_NUMBER_AS_PIXELS
147 | GTK_CSS_PARSE_LENGTH);
154 _gtk_css_parser_error (parser, "Expected a number");
158 /* The magic (i - 1) >> 1 below makes it take the correct value
159 * according to spec. Feel free to check the 4 cases */
161 x[i] = _gtk_css_value_ref (x[(i - 1) >> 1]);
163 if (_gtk_css_parser_try (parser, "/", TRUE))
165 for (i = 0; i < 4; i++)
167 if (!_gtk_css_parser_has_number (parser))
169 y[i] = _gtk_css_number_value_parse (parser,
170 GTK_CSS_POSITIVE_ONLY
171 | GTK_CSS_PARSE_PERCENT
172 | GTK_CSS_NUMBER_AS_PIXELS
173 | GTK_CSS_PARSE_LENGTH);
180 _gtk_css_parser_error (parser, "Expected a number");
185 y[i] = _gtk_css_value_ref (y[(i - 1) >> 1]);
189 for (i = 0; i < 4; i++)
190 y[i] = _gtk_css_value_ref (x[i]);
193 for (i = 0; i < 4; i++)
195 values[i] = _gtk_css_corner_value_new (x[i], y[i]);
201 for (i = 0; i < 4; i++)
204 _gtk_css_value_unref (x[i]);
206 _gtk_css_value_unref (y[i]);
212 parse_border_color (GtkCssShorthandProperty *shorthand,
213 GtkCssValue **values,
214 GtkCssParser *parser)
218 for (i = 0; i < 4; i++)
220 values[i] = _gtk_css_symbolic_value_new (parser);
221 if (values[i] == NULL)
224 if (value_is_done_parsing (parser))
228 for (i++; i < 4; i++)
230 values[i] = _gtk_css_value_ref (values[(i - 1) >> 1]);
237 parse_border_style (GtkCssShorthandProperty *shorthand,
238 GtkCssValue **values,
239 GtkCssParser *parser)
243 for (i = 0; i < 4; i++)
245 values[i] = _gtk_css_border_style_value_try_parse (parser);
246 if (values[i] == NULL)
252 _gtk_css_parser_error (parser, "Expected a border style");
257 values[i] = _gtk_css_value_ref (values[(i - 1) >> 1]);
263 parse_border_image (GtkCssShorthandProperty *shorthand,
264 GtkCssValue **values,
265 GtkCssParser *parser)
269 if (values[0] == NULL &&
270 (_gtk_css_parser_has_prefix (parser, "none") ||
271 _gtk_css_image_can_parse (parser)))
275 if (_gtk_css_parser_try (parser, "none", TRUE))
279 image = _gtk_css_image_new_parse (parser);
284 values[0] = _gtk_css_image_value_new (image);
286 else if (values[3] == NULL &&
287 (values[3] = _gtk_css_border_repeat_value_try_parse (parser)))
289 /* please move along */
291 else if (values[1] == NULL)
293 values[1] = _gtk_css_border_value_parse (parser,
294 GTK_CSS_PARSE_PERCENT
295 | GTK_CSS_PARSE_NUMBER
296 | GTK_CSS_POSITIVE_ONLY,
299 if (values[1] == NULL)
302 if (_gtk_css_parser_try (parser, "/", TRUE))
304 values[2] = _gtk_css_border_value_parse (parser,
305 GTK_CSS_PARSE_PERCENT
306 | GTK_CSS_PARSE_LENGTH
307 | GTK_CSS_PARSE_NUMBER
308 | GTK_CSS_POSITIVE_ONLY,
311 if (values[2] == NULL)
317 /* We parsed everything and there's still stuff left?
318 * Pretend we didn't notice and let the normal code produce
319 * a 'junk at end of value' error */
323 while (!value_is_done_parsing (parser));
329 parse_border_side (GtkCssShorthandProperty *shorthand,
330 GtkCssValue **values,
331 GtkCssParser *parser)
335 if (values[0] == NULL &&
336 _gtk_css_parser_has_number (parser))
338 values[0] = _gtk_css_number_value_parse (parser,
339 GTK_CSS_POSITIVE_ONLY
340 | GTK_CSS_NUMBER_AS_PIXELS
341 | GTK_CSS_PARSE_LENGTH);
342 if (values[0] == NULL)
345 else if (values[1] == NULL &&
346 (values[1] = _gtk_css_border_style_value_try_parse (parser)))
350 else if (values[2] == NULL)
352 values[2] = _gtk_css_symbolic_value_new (parser);
353 if (values[2] == NULL)
357 while (!value_is_done_parsing (parser));
363 parse_border (GtkCssShorthandProperty *shorthand,
364 GtkCssValue **values,
365 GtkCssParser *parser)
369 if (values[0] == NULL &&
370 _gtk_css_parser_has_number (parser))
372 values[0] = _gtk_css_number_value_parse (parser,
373 GTK_CSS_POSITIVE_ONLY
374 | GTK_CSS_NUMBER_AS_PIXELS
375 | GTK_CSS_PARSE_LENGTH);
376 if (values[0] == NULL)
378 values[1] = _gtk_css_value_ref (values[0]);
379 values[2] = _gtk_css_value_ref (values[0]);
380 values[3] = _gtk_css_value_ref (values[0]);
382 else if (values[4] == NULL &&
383 (values[4] = _gtk_css_border_style_value_try_parse (parser)))
385 values[5] = _gtk_css_value_ref (values[4]);
386 values[6] = _gtk_css_value_ref (values[4]);
387 values[7] = _gtk_css_value_ref (values[4]);
389 else if (!G_IS_VALUE (&values[8]))
391 values[8] = _gtk_css_symbolic_value_new (parser);
392 if (values[8] == NULL)
395 values[9] = _gtk_css_value_ref (values[8]);
396 values[10] = _gtk_css_value_ref (values[8]);
397 values[11] = _gtk_css_value_ref (values[8]);
401 /* We parsed everything and there's still stuff left?
402 * Pretend we didn't notice and let the normal code produce
403 * a 'junk at end of value' error */
407 while (!value_is_done_parsing (parser));
409 /* Note that border-image values are not set: according to the spec
410 they just need to be reset when using the border shorthand */
416 parse_font (GtkCssShorthandProperty *shorthand,
417 GtkCssValue **values,
418 GtkCssParser *parser)
420 PangoFontDescription *desc;
424 str = _gtk_css_parser_read_value (parser);
428 desc = pango_font_description_from_string (str);
431 mask = pango_font_description_get_set_fields (desc);
433 if (mask & PANGO_FONT_MASK_FAMILY)
435 values[0] = _gtk_css_array_value_new (_gtk_css_string_value_new (pango_font_description_get_family (desc)));
437 if (mask & PANGO_FONT_MASK_STYLE)
439 values[1] = _gtk_css_font_style_value_new (pango_font_description_get_style (desc));
441 if (mask & PANGO_FONT_MASK_VARIANT)
443 values[2] = _gtk_css_font_variant_value_new (pango_font_description_get_variant (desc));
445 if (mask & PANGO_FONT_MASK_WEIGHT)
447 values[3] = _gtk_css_font_weight_value_new (pango_font_description_get_weight (desc));
449 if (mask & PANGO_FONT_MASK_SIZE)
451 values[4] = _gtk_css_number_value_new ((double) pango_font_description_get_size (desc) / PANGO_SCALE, GTK_CSS_PX);
454 pango_font_description_free (desc);
460 parse_background (GtkCssShorthandProperty *shorthand,
461 GtkCssValue **values,
462 GtkCssParser *parser)
469 if (values[0] == NULL &&
470 (_gtk_css_parser_has_prefix (parser, "none") ||
471 _gtk_css_image_can_parse (parser)))
475 if (_gtk_css_parser_try (parser, "none", TRUE))
479 image = _gtk_css_image_new_parse (parser);
484 values[0] = _gtk_css_array_value_new (_gtk_css_image_value_new (image));
486 else if (values[3] == NULL &&
487 (value = _gtk_css_background_repeat_value_try_parse (parser)))
489 values[3] = _gtk_css_array_value_new (value);
492 else if ((values[4] == NULL || values[5] == NULL) &&
493 (value = _gtk_css_area_value_try_parse (parser)))
495 values[5] = _gtk_css_array_value_new (value);
497 if (values[4] == NULL)
499 values[4] = values[5];
504 else if (values[6] == NULL)
506 value = _gtk_css_symbolic_value_new (parser);
510 values[6] = _gtk_css_array_value_new (value);
513 else if (values[1] == NULL &&
514 (value = _gtk_css_position_value_parse (parser)))
516 values[1] = _gtk_css_array_value_new (value);
519 if (_gtk_css_parser_try (parser, "/", TRUE) &&
520 (value = _gtk_css_bg_size_value_parse (parser)))
522 values[2] = _gtk_css_array_value_new (value);
528 /* We parsed everything and there's still stuff left?
529 * Pretend we didn't notice and let the normal code produce
530 * a 'junk at end of value' error */
534 while (!value_is_done_parsing (parser));
540 parse_one_transition (GtkCssShorthandProperty *shorthand,
541 GtkCssValue **values,
542 GtkCssParser *parser)
547 if (values[2] == NULL &&
548 _gtk_css_parser_has_number (parser) && !_gtk_css_parser_begins_with (parser, '-'))
550 GtkCssValue *number = _gtk_css_number_value_parse (parser, GTK_CSS_PARSE_TIME);
555 if (values[1] == NULL)
560 else if (values[3] == NULL &&
561 _gtk_css_ease_value_can_parse (parser))
563 values[3] = _gtk_css_ease_value_parse (parser);
565 if (values[3] == NULL)
568 else if (values[0] == NULL)
570 values[0] = _gtk_css_ident_value_try_parse (parser);
571 if (values[0] == NULL)
573 _gtk_css_parser_error (parser, "Unknown value for property");
580 /* We parsed everything and there's still stuff left?
581 * Pretend we didn't notice and let the normal code produce
582 * a 'junk at end of value' error */
586 while (!value_is_done_parsing (parser));
592 parse_transition (GtkCssShorthandProperty *shorthand,
593 GtkCssValue **values,
594 GtkCssParser *parser)
596 GtkCssValue *step_values[4];
597 GPtrArray *arrays[4];
600 for (i = 0; i < 4; i++)
602 arrays[i] = g_ptr_array_new ();
603 step_values[i] = NULL;
607 if (!parse_one_transition (shorthand, step_values, parser))
609 for (i = 0; i < 4; i++)
611 g_ptr_array_set_free_func (arrays[i], (GDestroyNotify) _gtk_css_value_unref);
612 g_ptr_array_unref (arrays[i]);
617 for (i = 0; i < 4; i++)
619 if (step_values[i] == NULL)
621 GtkCssValue *initial = _gtk_css_style_property_get_initial_value (
622 _gtk_css_shorthand_property_get_subproperty (shorthand, i));
623 step_values[i] = _gtk_css_value_ref (_gtk_css_array_value_get_nth (initial, 0));
626 g_ptr_array_add (arrays[i], step_values[i]);
627 step_values[i] = NULL;
629 } while (_gtk_css_parser_try (parser, ",", TRUE));
631 for (i = 0; i < 4; i++)
633 values[i] = _gtk_css_array_value_new_from_array ((GtkCssValue **) arrays[i]->pdata, arrays[i]->len);
634 g_ptr_array_unref (arrays[i]);
643 unpack_border (GtkCssShorthandProperty *shorthand,
644 GtkStyleProperties *props,
648 GValue v = G_VALUE_INIT;
649 GtkBorder *border = g_value_get_boxed (value);
651 g_value_init (&v, G_TYPE_INT);
653 g_value_set_int (&v, border->top);
654 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 0)), props, state, &v);
655 g_value_set_int (&v, border->right);
656 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 1)), props, state, &v);
657 g_value_set_int (&v, border->bottom);
658 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 2)), props, state, &v);
659 g_value_set_int (&v, border->left);
660 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 3)), props, state, &v);
666 pack_border (GtkCssShorthandProperty *shorthand,
668 GtkStyleQueryFunc query_func,
671 GtkCssStyleProperty *prop;
675 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 0);
676 _gtk_style_property_query (GTK_STYLE_PROPERTY (prop), &v, query_func, query_data);
677 border.top = g_value_get_int (&v);
680 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 1);
681 _gtk_style_property_query (GTK_STYLE_PROPERTY (prop), &v, query_func, query_data);
682 border.right = g_value_get_int (&v);
685 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 2);
686 _gtk_style_property_query (GTK_STYLE_PROPERTY (prop), &v, query_func, query_data);
687 border.bottom = g_value_get_int (&v);
690 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 3);
691 _gtk_style_property_query (GTK_STYLE_PROPERTY (prop), &v, query_func, query_data);
692 border.left = g_value_get_int (&v);
695 g_value_init (value, GTK_TYPE_BORDER);
696 g_value_set_boxed (value, &border);
700 unpack_border_radius (GtkCssShorthandProperty *shorthand,
701 GtkStyleProperties *props,
705 GtkCssValue *css_value;
708 css_value = _gtk_css_corner_value_new (_gtk_css_number_value_new (g_value_get_int (value), GTK_CSS_PX),
709 _gtk_css_number_value_new (g_value_get_int (value), GTK_CSS_PX));
711 for (i = 0; i < 4; i++)
712 _gtk_style_properties_set_property_by_property (props,
713 _gtk_css_shorthand_property_get_subproperty (shorthand, i),
717 _gtk_css_value_unref (css_value);
721 pack_border_radius (GtkCssShorthandProperty *shorthand,
723 GtkStyleQueryFunc query_func,
726 GtkCssStyleProperty *prop;
730 prop = GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("border-top-left-radius"));
731 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
733 i = _gtk_css_corner_value_get_x (v, 100);
735 g_value_init (value, G_TYPE_INT);
736 g_value_set_int (value, i);
740 unpack_font_description (GtkCssShorthandProperty *shorthand,
741 GtkStyleProperties *props,
745 GtkStyleProperty *prop;
746 PangoFontDescription *description;
748 GValue v = G_VALUE_INIT;
750 /* For backwards compat, we only unpack values that are indeed set.
751 * For strict CSS conformance we need to unpack all of them.
752 * Note that we do set all of them in the parse function, so it
753 * will not have effects when parsing CSS files. It will though
754 * for custom style providers.
757 description = g_value_get_boxed (value);
760 mask = pango_font_description_get_set_fields (description);
764 if (mask & PANGO_FONT_MASK_FAMILY)
766 GPtrArray *strv = g_ptr_array_new ();
768 g_ptr_array_add (strv, g_strdup (pango_font_description_get_family (description)));
769 g_ptr_array_add (strv, NULL);
770 g_value_init (&v, G_TYPE_STRV);
771 g_value_take_boxed (&v, g_ptr_array_free (strv, FALSE));
773 prop = _gtk_style_property_lookup ("font-family");
774 _gtk_style_property_assign (prop, props, state, &v);
778 if (mask & PANGO_FONT_MASK_STYLE)
780 g_value_init (&v, PANGO_TYPE_STYLE);
781 g_value_set_enum (&v, pango_font_description_get_style (description));
783 prop = _gtk_style_property_lookup ("font-style");
784 _gtk_style_property_assign (prop, props, state, &v);
788 if (mask & PANGO_FONT_MASK_VARIANT)
790 g_value_init (&v, PANGO_TYPE_VARIANT);
791 g_value_set_enum (&v, pango_font_description_get_variant (description));
793 prop = _gtk_style_property_lookup ("font-variant");
794 _gtk_style_property_assign (prop, props, state, &v);
798 if (mask & PANGO_FONT_MASK_WEIGHT)
800 g_value_init (&v, PANGO_TYPE_WEIGHT);
801 g_value_set_enum (&v, pango_font_description_get_weight (description));
803 prop = _gtk_style_property_lookup ("font-weight");
804 _gtk_style_property_assign (prop, props, state, &v);
808 if (mask & PANGO_FONT_MASK_SIZE)
810 g_value_init (&v, G_TYPE_DOUBLE);
811 g_value_set_double (&v, (double) pango_font_description_get_size (description) / PANGO_SCALE);
813 prop = _gtk_style_property_lookup ("font-size");
814 _gtk_style_property_assign (prop, props, state, &v);
820 pack_font_description (GtkCssShorthandProperty *shorthand,
822 GtkStyleQueryFunc query_func,
825 PangoFontDescription *description;
828 description = pango_font_description_new ();
830 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-family"))), query_data);
833 /* xxx: Can we set all the families here somehow? */
834 pango_font_description_set_family (description, _gtk_css_string_value_get (_gtk_css_array_value_get_nth (v, 0)));
837 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-size"))), query_data);
839 pango_font_description_set_size (description, round (_gtk_css_number_value_get (v, 100) * PANGO_SCALE));
841 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-style"))), query_data);
843 pango_font_description_set_style (description, _gtk_css_font_style_value_get (v));
845 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-variant"))), query_data);
847 pango_font_description_set_variant (description, _gtk_css_font_variant_value_get (v));
849 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-weight"))), query_data);
851 pango_font_description_set_weight (description, _gtk_css_font_weight_value_get (v));
853 g_value_init (value, PANGO_TYPE_FONT_DESCRIPTION);
854 g_value_take_boxed (value, description);
858 unpack_to_everything (GtkCssShorthandProperty *shorthand,
859 GtkStyleProperties *props,
863 GtkCssStyleProperty *prop;
866 n = _gtk_css_shorthand_property_get_n_subproperties (shorthand);
868 for (i = 0; i < n; i++)
870 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, i);
871 _gtk_style_property_assign (GTK_STYLE_PROPERTY (prop), props, state, value);
876 pack_first_element (GtkCssShorthandProperty *shorthand,
878 GtkStyleQueryFunc query_func,
881 GtkCssStyleProperty *prop;
883 /* NB: This is a fallback for properties that originally were
884 * not used as shorthand. We just pick the first subproperty
885 * as a representative.
886 * Lesson learned: Don't query the shorthand, query the
887 * real properties instead. */
888 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 0);
889 _gtk_style_property_query (GTK_STYLE_PROPERTY (prop),
896 _gtk_css_shorthand_property_register (const char *name,
898 const char **subproperties,
899 GtkCssShorthandPropertyParseFunc parse_func,
900 GtkCssShorthandPropertyAssignFunc assign_func,
901 GtkCssShorthandPropertyQueryFunc query_func)
903 GtkCssShorthandProperty *node;
905 node = g_object_new (GTK_TYPE_CSS_SHORTHAND_PROPERTY,
907 "value-type", value_type,
908 "subproperties", subproperties,
911 node->parse = parse_func;
912 node->assign = assign_func;
913 node->query = query_func;
917 _gtk_css_shorthand_property_init_properties (void)
919 /* The order is important here, be careful when changing it */
920 const char *font_subproperties[] = { "font-family", "font-style", "font-variant", "font-weight", "font-size", NULL };
921 const char *margin_subproperties[] = { "margin-top", "margin-right", "margin-bottom", "margin-left", NULL };
922 const char *padding_subproperties[] = { "padding-top", "padding-right", "padding-bottom", "padding-left", NULL };
923 const char *border_width_subproperties[] = { "border-top-width", "border-right-width", "border-bottom-width", "border-left-width", NULL };
924 const char *border_radius_subproperties[] = { "border-top-left-radius", "border-top-right-radius",
925 "border-bottom-right-radius", "border-bottom-left-radius", NULL };
926 const char *border_color_subproperties[] = { "border-top-color", "border-right-color", "border-bottom-color", "border-left-color", NULL };
927 const char *border_style_subproperties[] = { "border-top-style", "border-right-style", "border-bottom-style", "border-left-style", NULL };
928 const char *border_image_subproperties[] = { "border-image-source", "border-image-slice", "border-image-width", "border-image-repeat", NULL };
929 const char *border_top_subproperties[] = { "border-top-width", "border-top-style", "border-top-color", NULL };
930 const char *border_right_subproperties[] = { "border-right-width", "border-right-style", "border-right-color", NULL };
931 const char *border_bottom_subproperties[] = { "border-bottom-width", "border-bottom-style", "border-bottom-color", NULL };
932 const char *border_left_subproperties[] = { "border-left-width", "border-left-style", "border-left-color", NULL };
933 const char *border_subproperties[] = { "border-top-width", "border-right-width", "border-bottom-width", "border-left-width",
934 "border-top-style", "border-right-style", "border-bottom-style", "border-left-style",
935 "border-top-color", "border-right-color", "border-bottom-color", "border-left-color",
936 "border-image-source", "border-image-slice", "border-image-width", "border-image-repeat", NULL };
937 const char *outline_subproperties[] = { "outline-width", "outline-style", "outline-color", NULL };
938 const char *background_subproperties[] = { "background-image", "background-position", "background-size", "background-repeat", "background-clip", "background-origin",
939 "background-color", NULL };
940 const char *transition_subproperties[] = { "transition-property", "transition-duration", "transition-delay", "transition-timing-function", NULL };
942 _gtk_css_shorthand_property_register ("font",
943 PANGO_TYPE_FONT_DESCRIPTION,
946 unpack_font_description,
947 pack_font_description);
948 _gtk_css_shorthand_property_register ("margin",
950 margin_subproperties,
954 _gtk_css_shorthand_property_register ("padding",
956 padding_subproperties,
960 _gtk_css_shorthand_property_register ("border-width",
962 border_width_subproperties,
966 _gtk_css_shorthand_property_register ("border-radius",
968 border_radius_subproperties,
970 unpack_border_radius,
972 _gtk_css_shorthand_property_register ("border-color",
974 border_color_subproperties,
976 unpack_to_everything,
978 _gtk_css_shorthand_property_register ("border-style",
979 GTK_TYPE_BORDER_STYLE,
980 border_style_subproperties,
982 unpack_to_everything,
984 _gtk_css_shorthand_property_register ("border-image",
986 border_image_subproperties,
990 _gtk_css_shorthand_property_register ("border-top",
992 border_top_subproperties,
996 _gtk_css_shorthand_property_register ("border-right",
998 border_right_subproperties,
1002 _gtk_css_shorthand_property_register ("border-bottom",
1004 border_bottom_subproperties,
1008 _gtk_css_shorthand_property_register ("border-left",
1010 border_left_subproperties,
1014 _gtk_css_shorthand_property_register ("border",
1016 border_subproperties,
1020 _gtk_css_shorthand_property_register ("outline",
1022 outline_subproperties,
1026 _gtk_css_shorthand_property_register ("background",
1028 background_subproperties,
1032 _gtk_css_shorthand_property_register ("transition",
1034 transition_subproperties,