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 "gtkcssenumvalueprivate.h"
28 #include "gtkcssimageprivate.h"
29 #include "gtkcssnumbervalueprivate.h"
30 #include "gtkcssstylefuncsprivate.h"
31 #include "gtkcsstypesprivate.h"
32 #include "gtkcssvalueprivate.h"
33 #include "gtkprivatetypebuiltins.h"
34 #include "gtkstylepropertiesprivate.h"
35 #include "gtksymboliccolorprivate.h"
36 #include "gtktypebuiltins.h"
38 /* this is in case round() is not provided by the compiler,
39 * such as in the case of C89 compilers, like MSVC
41 #include "fallback-c89.c"
46 value_is_done_parsing (GtkCssParser *parser)
48 return _gtk_css_parser_is_eof (parser) ||
49 _gtk_css_parser_begins_with (parser, ';') ||
50 _gtk_css_parser_begins_with (parser, '}');
54 parse_four_numbers (GtkCssShorthandProperty *shorthand,
57 GtkCssNumberParseFlags flags)
61 for (i = 0; i < 4; i++)
63 if (!_gtk_css_parser_has_number (parser))
66 values[i] = _gtk_css_number_value_parse (parser, flags);
67 if (values[i] == NULL)
73 _gtk_css_parser_error (parser, "Expected a length");
79 values[i] = _gtk_css_value_ref (values[(i - 1) >> 1]);
86 parse_margin (GtkCssShorthandProperty *shorthand,
91 return parse_four_numbers (shorthand,
94 GTK_CSS_NUMBER_AS_PIXELS
95 | GTK_CSS_PARSE_LENGTH);
99 parse_padding (GtkCssShorthandProperty *shorthand,
100 GtkCssValue **values,
101 GtkCssParser *parser,
104 return parse_four_numbers (shorthand,
107 GTK_CSS_POSITIVE_ONLY
108 | GTK_CSS_NUMBER_AS_PIXELS
109 | GTK_CSS_PARSE_LENGTH);
113 parse_border_width (GtkCssShorthandProperty *shorthand,
114 GtkCssValue **values,
115 GtkCssParser *parser,
118 return parse_four_numbers (shorthand,
121 GTK_CSS_POSITIVE_ONLY
122 | GTK_CSS_NUMBER_AS_PIXELS
123 | GTK_CSS_PARSE_LENGTH);
127 parse_border_radius (GtkCssShorthandProperty *shorthand,
128 GtkCssValue **values,
129 GtkCssParser *parser,
132 GtkCssBorderCornerRadius borders[4];
135 for (i = 0; i < G_N_ELEMENTS (borders); i++)
137 if (!_gtk_css_parser_has_number (parser))
139 if (!_gtk_css_parser_read_number (parser,
140 &borders[i].horizontal,
141 GTK_CSS_POSITIVE_ONLY
142 | GTK_CSS_PARSE_PERCENT
143 | GTK_CSS_NUMBER_AS_PIXELS
144 | GTK_CSS_PARSE_LENGTH))
150 _gtk_css_parser_error (parser, "Expected a number");
154 /* The magic (i - 1) >> 1 below makes it take the correct value
155 * according to spec. Feel free to check the 4 cases */
156 for (; i < G_N_ELEMENTS (borders); i++)
157 borders[i].horizontal = borders[(i - 1) >> 1].horizontal;
159 if (_gtk_css_parser_try (parser, "/", TRUE))
161 for (i = 0; i < G_N_ELEMENTS (borders); i++)
163 if (!_gtk_css_parser_has_number (parser))
165 if (!_gtk_css_parser_read_number (parser,
166 &borders[i].vertical,
167 GTK_CSS_POSITIVE_ONLY
168 | GTK_CSS_PARSE_PERCENT
169 | GTK_CSS_NUMBER_AS_PIXELS
170 | GTK_CSS_PARSE_LENGTH))
176 _gtk_css_parser_error (parser, "Expected a number");
180 for (; i < G_N_ELEMENTS (borders); i++)
181 borders[i].vertical = borders[(i - 1) >> 1].vertical;
186 for (i = 0; i < G_N_ELEMENTS (borders); i++)
187 borders[i].vertical = borders[i].horizontal;
190 for (i = 0; i < G_N_ELEMENTS (borders); i++)
192 values[i] = _gtk_css_value_new_from_border_corner_radius (&borders[i]);
199 parse_border_color (GtkCssShorthandProperty *shorthand,
200 GtkCssValue **values,
201 GtkCssParser *parser,
204 GtkSymbolicColor *symbolic;
207 for (i = 0; i < 4; i++)
209 if (_gtk_css_parser_try (parser, "currentcolor", TRUE))
211 symbolic = gtk_symbolic_color_ref (_gtk_symbolic_color_get_current_color ());
215 symbolic = _gtk_css_parser_read_symbolic_color (parser);
216 if (symbolic == NULL)
220 values[i] = _gtk_css_value_new_take_symbolic_color (symbolic);
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,
242 for (i = 0; i < 4; i++)
244 values[i] = _gtk_css_border_style_value_try_parse (parser);
245 if (values[i] == NULL)
251 _gtk_css_parser_error (parser, "Expected a border style");
256 values[i] = _gtk_css_value_ref (values[(i - 1) >> 1]);
262 parse_border_image (GtkCssShorthandProperty *shorthand,
263 GtkCssValue **values,
264 GtkCssParser *parser,
267 GValue value = G_VALUE_INIT;
270 if (_gtk_css_parser_try (parser, "none", TRUE))
274 image = _gtk_css_image_new_parse (parser, base);
278 values[0] = _gtk_css_value_new_take_image (image);
280 if (value_is_done_parsing (parser))
283 g_value_init (&value, GTK_TYPE_BORDER);
284 if (!_gtk_css_style_parse_value (&value, parser, base))
286 values[1] = _gtk_css_value_new_from_gvalue (&value);
287 g_value_unset (&value);
289 if (_gtk_css_parser_try (parser, "/", TRUE))
291 g_value_init (&value, GTK_TYPE_BORDER);
292 if (!_gtk_css_style_parse_value (&value, parser, base))
294 values[2] = _gtk_css_value_new_from_gvalue (&value);
295 g_value_unset (&value);
298 if (value_is_done_parsing (parser))
301 g_value_init (&value, GTK_TYPE_CSS_BORDER_IMAGE_REPEAT);
302 if (!_gtk_css_style_parse_value (&value, parser, base))
304 values[3] = _gtk_css_value_new_from_gvalue (&value);
305 g_value_unset (&value);
311 parse_border_side (GtkCssShorthandProperty *shorthand,
312 GtkCssValue **values,
313 GtkCssParser *parser,
318 if (values[0] == NULL &&
319 _gtk_css_parser_has_number (parser))
321 values[0] = _gtk_css_number_value_parse (parser,
322 GTK_CSS_POSITIVE_ONLY
323 | GTK_CSS_NUMBER_AS_PIXELS
324 | GTK_CSS_PARSE_LENGTH);
325 if (values[0] == NULL)
328 else if (values[1] == NULL &&
329 (values[1] = _gtk_css_border_style_value_try_parse (parser)))
333 else if (values[2] == NULL)
335 GtkSymbolicColor *symbolic;
337 symbolic = _gtk_css_parser_read_symbolic_color (parser);
338 if (symbolic == NULL)
341 values[2] = _gtk_css_value_new_take_symbolic_color (symbolic);
345 /* We parsed everything and there's still stuff left?
346 * Pretend we didn't notice and let the normal code produce
347 * a 'junk at end of value' error */
351 while (!value_is_done_parsing (parser));
357 parse_border (GtkCssShorthandProperty *shorthand,
358 GtkCssValue **values,
359 GtkCssParser *parser,
364 if (values[0] == NULL &&
365 _gtk_css_parser_has_number (parser))
367 values[0] = _gtk_css_number_value_parse (parser,
368 GTK_CSS_POSITIVE_ONLY
369 | GTK_CSS_NUMBER_AS_PIXELS
370 | GTK_CSS_PARSE_LENGTH);
371 if (values[0] == NULL)
373 values[1] = _gtk_css_value_ref (values[0]);
374 values[2] = _gtk_css_value_ref (values[0]);
375 values[3] = _gtk_css_value_ref (values[0]);
377 else if (values[4] == NULL &&
378 (values[4] = _gtk_css_border_style_value_try_parse (parser)))
380 values[5] = _gtk_css_value_ref (values[4]);
381 values[6] = _gtk_css_value_ref (values[4]);
382 values[7] = _gtk_css_value_ref (values[4]);
384 else if (!G_IS_VALUE (&values[8]))
386 GtkSymbolicColor *symbolic;
388 symbolic = _gtk_css_parser_read_symbolic_color (parser);
389 if (symbolic == NULL)
392 values[8] = _gtk_css_value_new_take_symbolic_color (symbolic);
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,
419 PangoFontDescription *desc;
423 str = _gtk_css_parser_read_value (parser);
427 desc = pango_font_description_from_string (str);
430 mask = pango_font_description_get_set_fields (desc);
432 if (mask & PANGO_FONT_MASK_FAMILY)
434 char **strv = g_new0 (char *, 2);
436 strv[0] = g_strdup (pango_font_description_get_family (desc));
437 values[0] = _gtk_css_value_new_take_strv (strv);
439 if (mask & PANGO_FONT_MASK_STYLE)
441 values[1] = _gtk_css_font_style_value_new (pango_font_description_get_style (desc));
443 if (mask & PANGO_FONT_MASK_VARIANT)
445 values[2] = _gtk_css_font_variant_value_new (pango_font_description_get_variant (desc));
447 if (mask & PANGO_FONT_MASK_WEIGHT)
449 values[3] = _gtk_css_font_weight_value_new (pango_font_description_get_weight (desc));
451 if (mask & PANGO_FONT_MASK_SIZE)
453 values[4] = _gtk_css_value_new_from_double ((double) pango_font_description_get_size (desc) / PANGO_SCALE);
456 pango_font_description_free (desc);
462 parse_background (GtkCssShorthandProperty *shorthand,
463 GtkCssValue **values,
464 GtkCssParser *parser,
472 if (values[0] == NULL &&
473 (_gtk_css_parser_has_prefix (parser, "none") ||
474 _gtk_css_image_can_parse (parser)))
478 if (_gtk_css_parser_try (parser, "none", TRUE))
482 image = _gtk_css_image_new_parse (parser, base);
487 values[0] = _gtk_css_value_new_take_image (image);
489 else if (values[1] == NULL &&
490 _gtk_css_parser_try_enum (parser, GTK_TYPE_CSS_BACKGROUND_REPEAT, &enum_value))
492 if (enum_value <= GTK_CSS_BACKGROUND_REPEAT_MASK)
496 if (_gtk_css_parser_try_enum (parser, GTK_TYPE_CSS_BACKGROUND_REPEAT, &vertical))
498 if (vertical >= GTK_CSS_BACKGROUND_REPEAT_MASK)
500 _gtk_css_parser_error (parser, "Not a valid 2nd value for border-repeat");
504 enum_value |= vertical << GTK_CSS_BACKGROUND_REPEAT_SHIFT;
507 enum_value |= enum_value << GTK_CSS_BACKGROUND_REPEAT_SHIFT;
510 values[1] = _gtk_css_value_new_from_enum (GTK_TYPE_CSS_BACKGROUND_REPEAT, enum_value);
512 else if ((values[2] == NULL || values[3] == NULL) &&
513 _gtk_css_parser_try_enum (parser, GTK_TYPE_CSS_AREA, &enum_value))
515 guint idx = values[2] == NULL ? 2 : 3;
516 values[idx] = _gtk_css_value_new_from_enum (GTK_TYPE_CSS_AREA, enum_value);
518 else if (values[4] == NULL)
520 GtkSymbolicColor *symbolic;
522 symbolic = _gtk_css_parser_read_symbolic_color (parser);
523 if (symbolic == NULL)
526 values[4] = _gtk_css_value_new_take_symbolic_color (symbolic);
530 /* We parsed everything and there's still stuff left?
531 * Pretend we didn't notice and let the normal code produce
532 * a 'junk at end of value' error */
536 while (!value_is_done_parsing (parser));
544 unpack_border (GtkCssShorthandProperty *shorthand,
545 GtkStyleProperties *props,
549 GValue v = G_VALUE_INIT;
550 GtkBorder *border = g_value_get_boxed (value);
552 g_value_init (&v, G_TYPE_INT);
554 g_value_set_int (&v, border->top);
555 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 0)), props, state, &v);
556 g_value_set_int (&v, border->right);
557 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 1)), props, state, &v);
558 g_value_set_int (&v, border->bottom);
559 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 2)), props, state, &v);
560 g_value_set_int (&v, border->left);
561 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 3)), props, state, &v);
567 pack_border (GtkCssShorthandProperty *shorthand,
569 GtkStyleQueryFunc query_func,
572 GtkCssStyleProperty *prop;
576 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 0);
577 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
579 border.top = _gtk_css_value_get_int (v);
580 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 1);
581 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
583 border.right = _gtk_css_value_get_int (v);
584 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 2);
585 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
587 border.bottom = _gtk_css_value_get_int (v);
588 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 3);
589 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
591 border.left = _gtk_css_value_get_int (v);
593 g_value_init (value, GTK_TYPE_BORDER);
594 g_value_set_boxed (value, &border);
598 unpack_border_radius (GtkCssShorthandProperty *shorthand,
599 GtkStyleProperties *props,
603 GtkCssBorderCornerRadius border;
604 GValue v = G_VALUE_INIT;
607 _gtk_css_number_init (&border.horizontal, g_value_get_int (value), GTK_CSS_PX);
608 border.vertical = border.horizontal;
609 g_value_init (&v, GTK_TYPE_CSS_BORDER_CORNER_RADIUS);
610 g_value_set_boxed (&v, &border);
612 for (i = 0; i < 4; i++)
613 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, i)), props, state, &v);
619 pack_border_radius (GtkCssShorthandProperty *shorthand,
621 GtkStyleQueryFunc query_func,
624 const GtkCssBorderCornerRadius *top_left;
625 GtkCssStyleProperty *prop;
629 prop = GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("border-top-left-radius"));
630 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
633 top_left = _gtk_css_value_get_border_corner_radius (v);
635 i = top_left->horizontal.value;
638 g_value_init (value, G_TYPE_INT);
639 g_value_set_int (value, i);
643 unpack_font_description (GtkCssShorthandProperty *shorthand,
644 GtkStyleProperties *props,
648 GtkStyleProperty *prop;
649 PangoFontDescription *description;
651 GValue v = G_VALUE_INIT;
653 /* For backwards compat, we only unpack values that are indeed set.
654 * For strict CSS conformance we need to unpack all of them.
655 * Note that we do set all of them in the parse function, so it
656 * will not have effects when parsing CSS files. It will though
657 * for custom style providers.
660 description = g_value_get_boxed (value);
663 mask = pango_font_description_get_set_fields (description);
667 if (mask & PANGO_FONT_MASK_FAMILY)
669 GPtrArray *strv = g_ptr_array_new ();
671 g_ptr_array_add (strv, g_strdup (pango_font_description_get_family (description)));
672 g_ptr_array_add (strv, NULL);
673 g_value_init (&v, G_TYPE_STRV);
674 g_value_take_boxed (&v, g_ptr_array_free (strv, FALSE));
676 prop = _gtk_style_property_lookup ("font-family");
677 _gtk_style_property_assign (prop, props, state, &v);
681 if (mask & PANGO_FONT_MASK_STYLE)
683 g_value_init (&v, PANGO_TYPE_STYLE);
684 g_value_set_enum (&v, pango_font_description_get_style (description));
686 prop = _gtk_style_property_lookup ("font-style");
687 _gtk_style_property_assign (prop, props, state, &v);
691 if (mask & PANGO_FONT_MASK_VARIANT)
693 g_value_init (&v, PANGO_TYPE_VARIANT);
694 g_value_set_enum (&v, pango_font_description_get_variant (description));
696 prop = _gtk_style_property_lookup ("font-variant");
697 _gtk_style_property_assign (prop, props, state, &v);
701 if (mask & PANGO_FONT_MASK_WEIGHT)
703 g_value_init (&v, PANGO_TYPE_WEIGHT);
704 g_value_set_enum (&v, pango_font_description_get_weight (description));
706 prop = _gtk_style_property_lookup ("font-weight");
707 _gtk_style_property_assign (prop, props, state, &v);
711 if (mask & PANGO_FONT_MASK_SIZE)
713 g_value_init (&v, G_TYPE_DOUBLE);
714 g_value_set_double (&v, (double) pango_font_description_get_size (description) / PANGO_SCALE);
716 prop = _gtk_style_property_lookup ("font-size");
717 _gtk_style_property_assign (prop, props, state, &v);
723 pack_font_description (GtkCssShorthandProperty *shorthand,
725 GtkStyleQueryFunc query_func,
728 PangoFontDescription *description;
731 description = pango_font_description_new ();
733 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-family"))), query_data);
736 const char **families = _gtk_css_value_get_strv (v);
737 /* xxx: Can we set all the families here somehow? */
739 pango_font_description_set_family (description, families[0]);
742 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-size"))), query_data);
744 pango_font_description_set_size (description, round (_gtk_css_value_get_double (v) * PANGO_SCALE));
746 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-style"))), query_data);
748 pango_font_description_set_style (description, _gtk_css_font_style_value_get (v));
750 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-variant"))), query_data);
752 pango_font_description_set_variant (description, _gtk_css_font_variant_value_get (v));
754 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-weight"))), query_data);
756 pango_font_description_set_weight (description, _gtk_css_font_weight_value_get (v));
758 g_value_init (value, PANGO_TYPE_FONT_DESCRIPTION);
759 g_value_take_boxed (value, description);
763 unpack_to_everything (GtkCssShorthandProperty *shorthand,
764 GtkStyleProperties *props,
768 GtkCssStyleProperty *prop;
771 n = _gtk_css_shorthand_property_get_n_subproperties (shorthand);
773 for (i = 0; i < n; i++)
775 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, i);
776 _gtk_style_property_assign (GTK_STYLE_PROPERTY (prop), props, state, value);
781 pack_first_element (GtkCssShorthandProperty *shorthand,
783 GtkStyleQueryFunc query_func,
786 GtkCssStyleProperty *prop;
788 /* NB: This is a fallback for properties that originally were
789 * not used as shorthand. We just pick the first subproperty
790 * as a representative.
791 * Lesson learned: Don't query the shorthand, query the
792 * real properties instead. */
793 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 0);
794 _gtk_style_property_query (GTK_STYLE_PROPERTY (prop),
801 _gtk_css_shorthand_property_register (const char *name,
803 const char **subproperties,
804 GtkCssShorthandPropertyParseFunc parse_func,
805 GtkCssShorthandPropertyAssignFunc assign_func,
806 GtkCssShorthandPropertyQueryFunc query_func)
808 GtkCssShorthandProperty *node;
810 node = g_object_new (GTK_TYPE_CSS_SHORTHAND_PROPERTY,
812 "value-type", value_type,
813 "subproperties", subproperties,
816 node->parse = parse_func;
817 node->assign = assign_func;
818 node->query = query_func;
822 _gtk_css_shorthand_property_init_properties (void)
824 /* The order is important here, be careful when changing it */
825 const char *font_subproperties[] = { "font-family", "font-style", "font-variant", "font-weight", "font-size", NULL };
826 const char *margin_subproperties[] = { "margin-top", "margin-right", "margin-bottom", "margin-left", NULL };
827 const char *padding_subproperties[] = { "padding-top", "padding-right", "padding-bottom", "padding-left", NULL };
828 const char *border_width_subproperties[] = { "border-top-width", "border-right-width", "border-bottom-width", "border-left-width", NULL };
829 const char *border_radius_subproperties[] = { "border-top-left-radius", "border-top-right-radius",
830 "border-bottom-right-radius", "border-bottom-left-radius", NULL };
831 const char *border_color_subproperties[] = { "border-top-color", "border-right-color", "border-bottom-color", "border-left-color", NULL };
832 const char *border_style_subproperties[] = { "border-top-style", "border-right-style", "border-bottom-style", "border-left-style", NULL };
833 const char *border_image_subproperties[] = { "border-image-source", "border-image-slice", "border-image-width", "border-image-repeat", NULL };
834 const char *border_top_subproperties[] = { "border-top-width", "border-top-style", "border-top-color", NULL };
835 const char *border_right_subproperties[] = { "border-right-width", "border-right-style", "border-right-color", NULL };
836 const char *border_bottom_subproperties[] = { "border-bottom-width", "border-bottom-style", "border-bottom-color", NULL };
837 const char *border_left_subproperties[] = { "border-left-width", "border-left-style", "border-left-color", NULL };
838 const char *border_subproperties[] = { "border-top-width", "border-right-width", "border-bottom-width", "border-left-width",
839 "border-top-style", "border-right-style", "border-bottom-style", "border-left-style",
840 "border-top-color", "border-right-color", "border-bottom-color", "border-left-color",
841 "border-image-source", "border-image-slice", "border-image-width", "border-image-repeat", NULL };
842 const char *outline_subproperties[] = { "outline-width", "outline-style", "outline-color", NULL };
843 const char *background_subproperties[] = { "background-image", "background-repeat", "background-clip", "background-origin",
844 "background-color", NULL };
846 _gtk_css_shorthand_property_register ("font",
847 PANGO_TYPE_FONT_DESCRIPTION,
850 unpack_font_description,
851 pack_font_description);
852 _gtk_css_shorthand_property_register ("margin",
854 margin_subproperties,
858 _gtk_css_shorthand_property_register ("padding",
860 padding_subproperties,
864 _gtk_css_shorthand_property_register ("border-width",
866 border_width_subproperties,
870 _gtk_css_shorthand_property_register ("border-radius",
872 border_radius_subproperties,
874 unpack_border_radius,
876 _gtk_css_shorthand_property_register ("border-color",
878 border_color_subproperties,
880 unpack_to_everything,
882 _gtk_css_shorthand_property_register ("border-style",
883 GTK_TYPE_BORDER_STYLE,
884 border_style_subproperties,
886 unpack_to_everything,
888 _gtk_css_shorthand_property_register ("border-image",
890 border_image_subproperties,
894 _gtk_css_shorthand_property_register ("border-top",
896 border_top_subproperties,
900 _gtk_css_shorthand_property_register ("border-right",
902 border_right_subproperties,
906 _gtk_css_shorthand_property_register ("border-bottom",
908 border_bottom_subproperties,
912 _gtk_css_shorthand_property_register ("border-left",
914 border_left_subproperties,
918 _gtk_css_shorthand_property_register ("border",
920 border_subproperties,
924 _gtk_css_shorthand_property_register ("outline",
926 outline_subproperties,
930 _gtk_css_shorthand_property_register ("background",
932 background_subproperties,