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 "gtkcssimagevalueprivate.h"
30 #include "gtkcssnumbervalueprivate.h"
31 #include "gtkcssstylefuncsprivate.h"
32 #include "gtkcsstypesprivate.h"
33 #include "gtkcssvalueprivate.h"
34 #include "gtkprivatetypebuiltins.h"
35 #include "gtkstylepropertiesprivate.h"
36 #include "gtksymboliccolorprivate.h"
37 #include "gtktypebuiltins.h"
39 /* this is in case round() is not provided by the compiler,
40 * such as in the case of C89 compilers, like MSVC
42 #include "fallback-c89.c"
47 value_is_done_parsing (GtkCssParser *parser)
49 return _gtk_css_parser_is_eof (parser) ||
50 _gtk_css_parser_begins_with (parser, ';') ||
51 _gtk_css_parser_begins_with (parser, '}');
55 parse_four_numbers (GtkCssShorthandProperty *shorthand,
58 GtkCssNumberParseFlags flags)
62 for (i = 0; i < 4; i++)
64 if (!_gtk_css_parser_has_number (parser))
67 values[i] = _gtk_css_number_value_parse (parser, flags);
68 if (values[i] == NULL)
74 _gtk_css_parser_error (parser, "Expected a length");
80 values[i] = _gtk_css_value_ref (values[(i - 1) >> 1]);
87 parse_margin (GtkCssShorthandProperty *shorthand,
92 return parse_four_numbers (shorthand,
95 GTK_CSS_NUMBER_AS_PIXELS
96 | GTK_CSS_PARSE_LENGTH);
100 parse_padding (GtkCssShorthandProperty *shorthand,
101 GtkCssValue **values,
102 GtkCssParser *parser,
105 return parse_four_numbers (shorthand,
108 GTK_CSS_POSITIVE_ONLY
109 | GTK_CSS_NUMBER_AS_PIXELS
110 | GTK_CSS_PARSE_LENGTH);
114 parse_border_width (GtkCssShorthandProperty *shorthand,
115 GtkCssValue **values,
116 GtkCssParser *parser,
119 return parse_four_numbers (shorthand,
122 GTK_CSS_POSITIVE_ONLY
123 | GTK_CSS_NUMBER_AS_PIXELS
124 | GTK_CSS_PARSE_LENGTH);
128 parse_border_radius (GtkCssShorthandProperty *shorthand,
129 GtkCssValue **values,
130 GtkCssParser *parser,
133 GtkCssBorderCornerRadius borders[4];
136 for (i = 0; i < G_N_ELEMENTS (borders); i++)
138 if (!_gtk_css_parser_has_number (parser))
140 if (!_gtk_css_parser_read_number (parser,
141 &borders[i].horizontal,
142 GTK_CSS_POSITIVE_ONLY
143 | GTK_CSS_PARSE_PERCENT
144 | GTK_CSS_NUMBER_AS_PIXELS
145 | GTK_CSS_PARSE_LENGTH))
151 _gtk_css_parser_error (parser, "Expected a number");
155 /* The magic (i - 1) >> 1 below makes it take the correct value
156 * according to spec. Feel free to check the 4 cases */
157 for (; i < G_N_ELEMENTS (borders); i++)
158 borders[i].horizontal = borders[(i - 1) >> 1].horizontal;
160 if (_gtk_css_parser_try (parser, "/", TRUE))
162 for (i = 0; i < G_N_ELEMENTS (borders); i++)
164 if (!_gtk_css_parser_has_number (parser))
166 if (!_gtk_css_parser_read_number (parser,
167 &borders[i].vertical,
168 GTK_CSS_POSITIVE_ONLY
169 | GTK_CSS_PARSE_PERCENT
170 | GTK_CSS_NUMBER_AS_PIXELS
171 | GTK_CSS_PARSE_LENGTH))
177 _gtk_css_parser_error (parser, "Expected a number");
181 for (; i < G_N_ELEMENTS (borders); i++)
182 borders[i].vertical = borders[(i - 1) >> 1].vertical;
187 for (i = 0; i < G_N_ELEMENTS (borders); i++)
188 borders[i].vertical = borders[i].horizontal;
191 for (i = 0; i < G_N_ELEMENTS (borders); i++)
193 values[i] = _gtk_css_value_new_from_border_corner_radius (&borders[i]);
200 parse_border_color (GtkCssShorthandProperty *shorthand,
201 GtkCssValue **values,
202 GtkCssParser *parser,
205 GtkSymbolicColor *symbolic;
208 for (i = 0; i < 4; i++)
210 if (_gtk_css_parser_try (parser, "currentcolor", TRUE))
212 symbolic = gtk_symbolic_color_ref (_gtk_symbolic_color_get_current_color ());
216 symbolic = _gtk_css_parser_read_symbolic_color (parser);
217 if (symbolic == NULL)
221 values[i] = _gtk_css_value_new_take_symbolic_color (symbolic);
223 if (value_is_done_parsing (parser))
227 for (i++; i < 4; i++)
229 values[i] = _gtk_css_value_ref (values[(i - 1) >> 1]);
236 parse_border_style (GtkCssShorthandProperty *shorthand,
237 GtkCssValue **values,
238 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,
268 GValue value = G_VALUE_INIT;
271 if (_gtk_css_parser_try (parser, "none", TRUE))
275 image = _gtk_css_image_new_parse (parser, base);
279 values[0] = _gtk_css_image_value_new (image);
281 if (value_is_done_parsing (parser))
284 g_value_init (&value, GTK_TYPE_BORDER);
285 if (!_gtk_css_style_parse_value (&value, parser, base))
287 values[1] = _gtk_css_value_new_from_gvalue (&value);
288 g_value_unset (&value);
290 if (_gtk_css_parser_try (parser, "/", TRUE))
292 g_value_init (&value, GTK_TYPE_BORDER);
293 if (!_gtk_css_style_parse_value (&value, parser, base))
295 values[2] = _gtk_css_value_new_from_gvalue (&value);
296 g_value_unset (&value);
299 if (value_is_done_parsing (parser))
302 g_value_init (&value, GTK_TYPE_CSS_BORDER_IMAGE_REPEAT);
303 if (!_gtk_css_style_parse_value (&value, parser, base))
305 values[3] = _gtk_css_value_new_from_gvalue (&value);
306 g_value_unset (&value);
312 parse_border_side (GtkCssShorthandProperty *shorthand,
313 GtkCssValue **values,
314 GtkCssParser *parser,
319 if (values[0] == NULL &&
320 _gtk_css_parser_has_number (parser))
322 values[0] = _gtk_css_number_value_parse (parser,
323 GTK_CSS_POSITIVE_ONLY
324 | GTK_CSS_NUMBER_AS_PIXELS
325 | GTK_CSS_PARSE_LENGTH);
326 if (values[0] == NULL)
329 else if (values[1] == NULL &&
330 (values[1] = _gtk_css_border_style_value_try_parse (parser)))
334 else if (values[2] == NULL)
336 GtkSymbolicColor *symbolic;
338 symbolic = _gtk_css_parser_read_symbolic_color (parser);
339 if (symbolic == NULL)
342 values[2] = _gtk_css_value_new_take_symbolic_color (symbolic);
346 /* We parsed everything and there's still stuff left?
347 * Pretend we didn't notice and let the normal code produce
348 * a 'junk at end of value' error */
352 while (!value_is_done_parsing (parser));
358 parse_border (GtkCssShorthandProperty *shorthand,
359 GtkCssValue **values,
360 GtkCssParser *parser,
365 if (values[0] == NULL &&
366 _gtk_css_parser_has_number (parser))
368 values[0] = _gtk_css_number_value_parse (parser,
369 GTK_CSS_POSITIVE_ONLY
370 | GTK_CSS_NUMBER_AS_PIXELS
371 | GTK_CSS_PARSE_LENGTH);
372 if (values[0] == NULL)
374 values[1] = _gtk_css_value_ref (values[0]);
375 values[2] = _gtk_css_value_ref (values[0]);
376 values[3] = _gtk_css_value_ref (values[0]);
378 else if (values[4] == NULL &&
379 (values[4] = _gtk_css_border_style_value_try_parse (parser)))
381 values[5] = _gtk_css_value_ref (values[4]);
382 values[6] = _gtk_css_value_ref (values[4]);
383 values[7] = _gtk_css_value_ref (values[4]);
385 else if (!G_IS_VALUE (&values[8]))
387 GtkSymbolicColor *symbolic;
389 symbolic = _gtk_css_parser_read_symbolic_color (parser);
390 if (symbolic == NULL)
393 values[8] = _gtk_css_value_new_take_symbolic_color (symbolic);
394 values[9] = _gtk_css_value_ref (values[8]);
395 values[10] = _gtk_css_value_ref (values[8]);
396 values[11] = _gtk_css_value_ref (values[8]);
400 /* We parsed everything and there's still stuff left?
401 * Pretend we didn't notice and let the normal code produce
402 * a 'junk at end of value' error */
406 while (!value_is_done_parsing (parser));
408 /* Note that border-image values are not set: according to the spec
409 they just need to be reset when using the border shorthand */
415 parse_font (GtkCssShorthandProperty *shorthand,
416 GtkCssValue **values,
417 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 char **strv = g_new0 (char *, 2);
437 strv[0] = g_strdup (pango_font_description_get_family (desc));
438 values[0] = _gtk_css_value_new_take_strv (strv);
440 if (mask & PANGO_FONT_MASK_STYLE)
442 values[1] = _gtk_css_font_style_value_new (pango_font_description_get_style (desc));
444 if (mask & PANGO_FONT_MASK_VARIANT)
446 values[2] = _gtk_css_font_variant_value_new (pango_font_description_get_variant (desc));
448 if (mask & PANGO_FONT_MASK_WEIGHT)
450 values[3] = _gtk_css_font_weight_value_new (pango_font_description_get_weight (desc));
452 if (mask & PANGO_FONT_MASK_SIZE)
454 values[4] = _gtk_css_value_new_from_double ((double) pango_font_description_get_size (desc) / PANGO_SCALE);
457 pango_font_description_free (desc);
463 parse_background (GtkCssShorthandProperty *shorthand,
464 GtkCssValue **values,
465 GtkCssParser *parser,
473 if (values[0] == NULL &&
474 (_gtk_css_parser_has_prefix (parser, "none") ||
475 _gtk_css_image_can_parse (parser)))
479 if (_gtk_css_parser_try (parser, "none", TRUE))
483 image = _gtk_css_image_new_parse (parser, base);
488 values[0] = _gtk_css_image_value_new (image);
490 else if (values[1] == NULL &&
491 _gtk_css_parser_try_enum (parser, GTK_TYPE_CSS_BACKGROUND_REPEAT, &enum_value))
493 if (enum_value <= GTK_CSS_BACKGROUND_REPEAT_MASK)
497 if (_gtk_css_parser_try_enum (parser, GTK_TYPE_CSS_BACKGROUND_REPEAT, &vertical))
499 if (vertical >= GTK_CSS_BACKGROUND_REPEAT_MASK)
501 _gtk_css_parser_error (parser, "Not a valid 2nd value for border-repeat");
505 enum_value |= vertical << GTK_CSS_BACKGROUND_REPEAT_SHIFT;
508 enum_value |= enum_value << GTK_CSS_BACKGROUND_REPEAT_SHIFT;
511 values[1] = _gtk_css_value_new_from_enum (GTK_TYPE_CSS_BACKGROUND_REPEAT, enum_value);
513 else if ((values[2] == NULL || values[3] == NULL) &&
514 (values[3] = _gtk_css_area_value_try_parse (parser)))
516 if (values[2] == NULL)
518 values[2] = values[3];
522 else if (values[4] == NULL)
524 GtkSymbolicColor *symbolic;
526 symbolic = _gtk_css_parser_read_symbolic_color (parser);
527 if (symbolic == NULL)
530 values[4] = _gtk_css_value_new_take_symbolic_color (symbolic);
534 /* We parsed everything and there's still stuff left?
535 * Pretend we didn't notice and let the normal code produce
536 * a 'junk at end of value' error */
540 while (!value_is_done_parsing (parser));
548 unpack_border (GtkCssShorthandProperty *shorthand,
549 GtkStyleProperties *props,
553 GValue v = G_VALUE_INIT;
554 GtkBorder *border = g_value_get_boxed (value);
556 g_value_init (&v, G_TYPE_INT);
558 g_value_set_int (&v, border->top);
559 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 0)), props, state, &v);
560 g_value_set_int (&v, border->right);
561 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 1)), props, state, &v);
562 g_value_set_int (&v, border->bottom);
563 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 2)), props, state, &v);
564 g_value_set_int (&v, border->left);
565 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 3)), props, state, &v);
571 pack_border (GtkCssShorthandProperty *shorthand,
573 GtkStyleQueryFunc query_func,
576 GtkCssStyleProperty *prop;
580 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 0);
581 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
583 border.top = _gtk_css_value_get_int (v);
584 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 1);
585 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
587 border.right = _gtk_css_value_get_int (v);
588 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 2);
589 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
591 border.bottom = _gtk_css_value_get_int (v);
592 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 3);
593 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
595 border.left = _gtk_css_value_get_int (v);
597 g_value_init (value, GTK_TYPE_BORDER);
598 g_value_set_boxed (value, &border);
602 unpack_border_radius (GtkCssShorthandProperty *shorthand,
603 GtkStyleProperties *props,
607 GtkCssBorderCornerRadius border;
608 GValue v = G_VALUE_INIT;
611 _gtk_css_number_init (&border.horizontal, g_value_get_int (value), GTK_CSS_PX);
612 border.vertical = border.horizontal;
613 g_value_init (&v, GTK_TYPE_CSS_BORDER_CORNER_RADIUS);
614 g_value_set_boxed (&v, &border);
616 for (i = 0; i < 4; i++)
617 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, i)), props, state, &v);
623 pack_border_radius (GtkCssShorthandProperty *shorthand,
625 GtkStyleQueryFunc query_func,
628 const GtkCssBorderCornerRadius *top_left;
629 GtkCssStyleProperty *prop;
633 prop = GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("border-top-left-radius"));
634 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
637 top_left = _gtk_css_value_get_border_corner_radius (v);
639 i = top_left->horizontal.value;
642 g_value_init (value, G_TYPE_INT);
643 g_value_set_int (value, i);
647 unpack_font_description (GtkCssShorthandProperty *shorthand,
648 GtkStyleProperties *props,
652 GtkStyleProperty *prop;
653 PangoFontDescription *description;
655 GValue v = G_VALUE_INIT;
657 /* For backwards compat, we only unpack values that are indeed set.
658 * For strict CSS conformance we need to unpack all of them.
659 * Note that we do set all of them in the parse function, so it
660 * will not have effects when parsing CSS files. It will though
661 * for custom style providers.
664 description = g_value_get_boxed (value);
667 mask = pango_font_description_get_set_fields (description);
671 if (mask & PANGO_FONT_MASK_FAMILY)
673 GPtrArray *strv = g_ptr_array_new ();
675 g_ptr_array_add (strv, g_strdup (pango_font_description_get_family (description)));
676 g_ptr_array_add (strv, NULL);
677 g_value_init (&v, G_TYPE_STRV);
678 g_value_take_boxed (&v, g_ptr_array_free (strv, FALSE));
680 prop = _gtk_style_property_lookup ("font-family");
681 _gtk_style_property_assign (prop, props, state, &v);
685 if (mask & PANGO_FONT_MASK_STYLE)
687 g_value_init (&v, PANGO_TYPE_STYLE);
688 g_value_set_enum (&v, pango_font_description_get_style (description));
690 prop = _gtk_style_property_lookup ("font-style");
691 _gtk_style_property_assign (prop, props, state, &v);
695 if (mask & PANGO_FONT_MASK_VARIANT)
697 g_value_init (&v, PANGO_TYPE_VARIANT);
698 g_value_set_enum (&v, pango_font_description_get_variant (description));
700 prop = _gtk_style_property_lookup ("font-variant");
701 _gtk_style_property_assign (prop, props, state, &v);
705 if (mask & PANGO_FONT_MASK_WEIGHT)
707 g_value_init (&v, PANGO_TYPE_WEIGHT);
708 g_value_set_enum (&v, pango_font_description_get_weight (description));
710 prop = _gtk_style_property_lookup ("font-weight");
711 _gtk_style_property_assign (prop, props, state, &v);
715 if (mask & PANGO_FONT_MASK_SIZE)
717 g_value_init (&v, G_TYPE_DOUBLE);
718 g_value_set_double (&v, (double) pango_font_description_get_size (description) / PANGO_SCALE);
720 prop = _gtk_style_property_lookup ("font-size");
721 _gtk_style_property_assign (prop, props, state, &v);
727 pack_font_description (GtkCssShorthandProperty *shorthand,
729 GtkStyleQueryFunc query_func,
732 PangoFontDescription *description;
735 description = pango_font_description_new ();
737 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-family"))), query_data);
740 const char **families = _gtk_css_value_get_strv (v);
741 /* xxx: Can we set all the families here somehow? */
743 pango_font_description_set_family (description, families[0]);
746 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-size"))), query_data);
748 pango_font_description_set_size (description, round (_gtk_css_value_get_double (v) * PANGO_SCALE));
750 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-style"))), query_data);
752 pango_font_description_set_style (description, _gtk_css_font_style_value_get (v));
754 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-variant"))), query_data);
756 pango_font_description_set_variant (description, _gtk_css_font_variant_value_get (v));
758 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-weight"))), query_data);
760 pango_font_description_set_weight (description, _gtk_css_font_weight_value_get (v));
762 g_value_init (value, PANGO_TYPE_FONT_DESCRIPTION);
763 g_value_take_boxed (value, description);
767 unpack_to_everything (GtkCssShorthandProperty *shorthand,
768 GtkStyleProperties *props,
772 GtkCssStyleProperty *prop;
775 n = _gtk_css_shorthand_property_get_n_subproperties (shorthand);
777 for (i = 0; i < n; i++)
779 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, i);
780 _gtk_style_property_assign (GTK_STYLE_PROPERTY (prop), props, state, value);
785 pack_first_element (GtkCssShorthandProperty *shorthand,
787 GtkStyleQueryFunc query_func,
790 GtkCssStyleProperty *prop;
792 /* NB: This is a fallback for properties that originally were
793 * not used as shorthand. We just pick the first subproperty
794 * as a representative.
795 * Lesson learned: Don't query the shorthand, query the
796 * real properties instead. */
797 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 0);
798 _gtk_style_property_query (GTK_STYLE_PROPERTY (prop),
805 _gtk_css_shorthand_property_register (const char *name,
807 const char **subproperties,
808 GtkCssShorthandPropertyParseFunc parse_func,
809 GtkCssShorthandPropertyAssignFunc assign_func,
810 GtkCssShorthandPropertyQueryFunc query_func)
812 GtkCssShorthandProperty *node;
814 node = g_object_new (GTK_TYPE_CSS_SHORTHAND_PROPERTY,
816 "value-type", value_type,
817 "subproperties", subproperties,
820 node->parse = parse_func;
821 node->assign = assign_func;
822 node->query = query_func;
826 _gtk_css_shorthand_property_init_properties (void)
828 /* The order is important here, be careful when changing it */
829 const char *font_subproperties[] = { "font-family", "font-style", "font-variant", "font-weight", "font-size", NULL };
830 const char *margin_subproperties[] = { "margin-top", "margin-right", "margin-bottom", "margin-left", NULL };
831 const char *padding_subproperties[] = { "padding-top", "padding-right", "padding-bottom", "padding-left", NULL };
832 const char *border_width_subproperties[] = { "border-top-width", "border-right-width", "border-bottom-width", "border-left-width", NULL };
833 const char *border_radius_subproperties[] = { "border-top-left-radius", "border-top-right-radius",
834 "border-bottom-right-radius", "border-bottom-left-radius", NULL };
835 const char *border_color_subproperties[] = { "border-top-color", "border-right-color", "border-bottom-color", "border-left-color", NULL };
836 const char *border_style_subproperties[] = { "border-top-style", "border-right-style", "border-bottom-style", "border-left-style", NULL };
837 const char *border_image_subproperties[] = { "border-image-source", "border-image-slice", "border-image-width", "border-image-repeat", NULL };
838 const char *border_top_subproperties[] = { "border-top-width", "border-top-style", "border-top-color", NULL };
839 const char *border_right_subproperties[] = { "border-right-width", "border-right-style", "border-right-color", NULL };
840 const char *border_bottom_subproperties[] = { "border-bottom-width", "border-bottom-style", "border-bottom-color", NULL };
841 const char *border_left_subproperties[] = { "border-left-width", "border-left-style", "border-left-color", NULL };
842 const char *border_subproperties[] = { "border-top-width", "border-right-width", "border-bottom-width", "border-left-width",
843 "border-top-style", "border-right-style", "border-bottom-style", "border-left-style",
844 "border-top-color", "border-right-color", "border-bottom-color", "border-left-color",
845 "border-image-source", "border-image-slice", "border-image-width", "border-image-repeat", NULL };
846 const char *outline_subproperties[] = { "outline-width", "outline-style", "outline-color", NULL };
847 const char *background_subproperties[] = { "background-image", "background-repeat", "background-clip", "background-origin",
848 "background-color", NULL };
850 _gtk_css_shorthand_property_register ("font",
851 PANGO_TYPE_FONT_DESCRIPTION,
854 unpack_font_description,
855 pack_font_description);
856 _gtk_css_shorthand_property_register ("margin",
858 margin_subproperties,
862 _gtk_css_shorthand_property_register ("padding",
864 padding_subproperties,
868 _gtk_css_shorthand_property_register ("border-width",
870 border_width_subproperties,
874 _gtk_css_shorthand_property_register ("border-radius",
876 border_radius_subproperties,
878 unpack_border_radius,
880 _gtk_css_shorthand_property_register ("border-color",
882 border_color_subproperties,
884 unpack_to_everything,
886 _gtk_css_shorthand_property_register ("border-style",
887 GTK_TYPE_BORDER_STYLE,
888 border_style_subproperties,
890 unpack_to_everything,
892 _gtk_css_shorthand_property_register ("border-image",
894 border_image_subproperties,
898 _gtk_css_shorthand_property_register ("border-top",
900 border_top_subproperties,
904 _gtk_css_shorthand_property_register ("border-right",
906 border_right_subproperties,
910 _gtk_css_shorthand_property_register ("border-bottom",
912 border_bottom_subproperties,
916 _gtk_css_shorthand_property_register ("border-left",
918 border_left_subproperties,
922 _gtk_css_shorthand_property_register ("border",
924 border_subproperties,
928 _gtk_css_shorthand_property_register ("outline",
930 outline_subproperties,
934 _gtk_css_shorthand_property_register ("background",
936 background_subproperties,