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_value_new_from_enum (PANGO_TYPE_STYLE,
442 pango_font_description_get_style (desc));
444 if (mask & PANGO_FONT_MASK_VARIANT)
446 values[2] = _gtk_css_value_new_from_enum (PANGO_TYPE_VARIANT,
447 pango_font_description_get_variant (desc));
449 if (mask & PANGO_FONT_MASK_WEIGHT)
451 values[3] = _gtk_css_value_new_from_enum (PANGO_TYPE_WEIGHT,
452 pango_font_description_get_weight (desc));
454 if (mask & PANGO_FONT_MASK_SIZE)
456 values[4] = _gtk_css_value_new_from_double ((double) pango_font_description_get_size (desc) / PANGO_SCALE);
459 pango_font_description_free (desc);
465 parse_background (GtkCssShorthandProperty *shorthand,
466 GtkCssValue **values,
467 GtkCssParser *parser,
475 if (values[0] == NULL &&
476 (_gtk_css_parser_has_prefix (parser, "none") ||
477 _gtk_css_image_can_parse (parser)))
481 if (_gtk_css_parser_try (parser, "none", TRUE))
485 image = _gtk_css_image_new_parse (parser, base);
490 values[0] = _gtk_css_value_new_take_image (image);
492 else if (values[1] == NULL &&
493 _gtk_css_parser_try_enum (parser, GTK_TYPE_CSS_BACKGROUND_REPEAT, &enum_value))
495 if (enum_value <= GTK_CSS_BACKGROUND_REPEAT_MASK)
499 if (_gtk_css_parser_try_enum (parser, GTK_TYPE_CSS_BACKGROUND_REPEAT, &vertical))
501 if (vertical >= GTK_CSS_BACKGROUND_REPEAT_MASK)
503 _gtk_css_parser_error (parser, "Not a valid 2nd value for border-repeat");
507 enum_value |= vertical << GTK_CSS_BACKGROUND_REPEAT_SHIFT;
510 enum_value |= enum_value << GTK_CSS_BACKGROUND_REPEAT_SHIFT;
513 values[1] = _gtk_css_value_new_from_enum (GTK_TYPE_CSS_BACKGROUND_REPEAT, enum_value);
515 else if ((values[2] == NULL || values[3] == NULL) &&
516 _gtk_css_parser_try_enum (parser, GTK_TYPE_CSS_AREA, &enum_value))
518 guint idx = values[2] == NULL ? 2 : 3;
519 values[idx] = _gtk_css_value_new_from_enum (GTK_TYPE_CSS_AREA, enum_value);
521 else if (values[4] == NULL)
523 GtkSymbolicColor *symbolic;
525 symbolic = _gtk_css_parser_read_symbolic_color (parser);
526 if (symbolic == NULL)
529 values[4] = _gtk_css_value_new_take_symbolic_color (symbolic);
533 /* We parsed everything and there's still stuff left?
534 * Pretend we didn't notice and let the normal code produce
535 * a 'junk at end of value' error */
539 while (!value_is_done_parsing (parser));
547 unpack_border (GtkCssShorthandProperty *shorthand,
548 GtkStyleProperties *props,
552 GValue v = G_VALUE_INIT;
553 GtkBorder *border = g_value_get_boxed (value);
555 g_value_init (&v, G_TYPE_INT);
557 g_value_set_int (&v, border->top);
558 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 0)), props, state, &v);
559 g_value_set_int (&v, border->right);
560 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 1)), props, state, &v);
561 g_value_set_int (&v, border->bottom);
562 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 2)), props, state, &v);
563 g_value_set_int (&v, border->left);
564 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, 3)), props, state, &v);
570 pack_border (GtkCssShorthandProperty *shorthand,
572 GtkStyleQueryFunc query_func,
575 GtkCssStyleProperty *prop;
579 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 0);
580 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
582 border.top = _gtk_css_value_get_int (v);
583 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 1);
584 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
586 border.right = _gtk_css_value_get_int (v);
587 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 2);
588 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
590 border.bottom = _gtk_css_value_get_int (v);
591 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 3);
592 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
594 border.left = _gtk_css_value_get_int (v);
596 g_value_init (value, GTK_TYPE_BORDER);
597 g_value_set_boxed (value, &border);
601 unpack_border_radius (GtkCssShorthandProperty *shorthand,
602 GtkStyleProperties *props,
606 GtkCssBorderCornerRadius border;
607 GValue v = G_VALUE_INIT;
610 _gtk_css_number_init (&border.horizontal, g_value_get_int (value), GTK_CSS_PX);
611 border.vertical = border.horizontal;
612 g_value_init (&v, GTK_TYPE_CSS_BORDER_CORNER_RADIUS);
613 g_value_set_boxed (&v, &border);
615 for (i = 0; i < 4; i++)
616 _gtk_style_property_assign (GTK_STYLE_PROPERTY (_gtk_css_shorthand_property_get_subproperty (shorthand, i)), props, state, &v);
622 pack_border_radius (GtkCssShorthandProperty *shorthand,
624 GtkStyleQueryFunc query_func,
627 const GtkCssBorderCornerRadius *top_left;
628 GtkCssStyleProperty *prop;
632 prop = GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("border-top-left-radius"));
633 v = (* query_func) (_gtk_css_style_property_get_id (prop), query_data);
636 top_left = _gtk_css_value_get_border_corner_radius (v);
638 i = top_left->horizontal.value;
641 g_value_init (value, G_TYPE_INT);
642 g_value_set_int (value, i);
646 unpack_font_description (GtkCssShorthandProperty *shorthand,
647 GtkStyleProperties *props,
651 GtkStyleProperty *prop;
652 PangoFontDescription *description;
654 GValue v = G_VALUE_INIT;
656 /* For backwards compat, we only unpack values that are indeed set.
657 * For strict CSS conformance we need to unpack all of them.
658 * Note that we do set all of them in the parse function, so it
659 * will not have effects when parsing CSS files. It will though
660 * for custom style providers.
663 description = g_value_get_boxed (value);
666 mask = pango_font_description_get_set_fields (description);
670 if (mask & PANGO_FONT_MASK_FAMILY)
672 GPtrArray *strv = g_ptr_array_new ();
674 g_ptr_array_add (strv, g_strdup (pango_font_description_get_family (description)));
675 g_ptr_array_add (strv, NULL);
676 g_value_init (&v, G_TYPE_STRV);
677 g_value_take_boxed (&v, g_ptr_array_free (strv, FALSE));
679 prop = _gtk_style_property_lookup ("font-family");
680 _gtk_style_property_assign (prop, props, state, &v);
684 if (mask & PANGO_FONT_MASK_STYLE)
686 g_value_init (&v, PANGO_TYPE_STYLE);
687 g_value_set_enum (&v, pango_font_description_get_style (description));
689 prop = _gtk_style_property_lookup ("font-style");
690 _gtk_style_property_assign (prop, props, state, &v);
694 if (mask & PANGO_FONT_MASK_VARIANT)
696 g_value_init (&v, PANGO_TYPE_VARIANT);
697 g_value_set_enum (&v, pango_font_description_get_variant (description));
699 prop = _gtk_style_property_lookup ("font-variant");
700 _gtk_style_property_assign (prop, props, state, &v);
704 if (mask & PANGO_FONT_MASK_WEIGHT)
706 g_value_init (&v, PANGO_TYPE_WEIGHT);
707 g_value_set_enum (&v, pango_font_description_get_weight (description));
709 prop = _gtk_style_property_lookup ("font-weight");
710 _gtk_style_property_assign (prop, props, state, &v);
714 if (mask & PANGO_FONT_MASK_SIZE)
716 g_value_init (&v, G_TYPE_DOUBLE);
717 g_value_set_double (&v, (double) pango_font_description_get_size (description) / PANGO_SCALE);
719 prop = _gtk_style_property_lookup ("font-size");
720 _gtk_style_property_assign (prop, props, state, &v);
726 pack_font_description (GtkCssShorthandProperty *shorthand,
728 GtkStyleQueryFunc query_func,
731 PangoFontDescription *description;
734 description = pango_font_description_new ();
736 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-family"))), query_data);
739 const char **families = _gtk_css_value_get_strv (v);
740 /* xxx: Can we set all the families here somehow? */
742 pango_font_description_set_family (description, families[0]);
745 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-size"))), query_data);
747 pango_font_description_set_size (description, round (_gtk_css_value_get_double (v) * PANGO_SCALE));
749 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-style"))), query_data);
751 pango_font_description_set_style (description, _gtk_css_value_get_pango_style (v));
753 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-variant"))), query_data);
755 pango_font_description_set_variant (description, _gtk_css_value_get_pango_variant (v));
757 v = (* query_func) (_gtk_css_style_property_get_id (GTK_CSS_STYLE_PROPERTY (_gtk_style_property_lookup ("font-weight"))), query_data);
759 pango_font_description_set_weight (description, _gtk_css_value_get_pango_weight (v));
761 g_value_init (value, PANGO_TYPE_FONT_DESCRIPTION);
762 g_value_take_boxed (value, description);
766 unpack_to_everything (GtkCssShorthandProperty *shorthand,
767 GtkStyleProperties *props,
771 GtkCssStyleProperty *prop;
774 n = _gtk_css_shorthand_property_get_n_subproperties (shorthand);
776 for (i = 0; i < n; i++)
778 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, i);
779 _gtk_style_property_assign (GTK_STYLE_PROPERTY (prop), props, state, value);
784 pack_first_element (GtkCssShorthandProperty *shorthand,
786 GtkStyleQueryFunc query_func,
789 GtkCssStyleProperty *prop;
791 /* NB: This is a fallback for properties that originally were
792 * not used as shorthand. We just pick the first subproperty
793 * as a representative.
794 * Lesson learned: Don't query the shorthand, query the
795 * real properties instead. */
796 prop = _gtk_css_shorthand_property_get_subproperty (shorthand, 0);
797 _gtk_style_property_query (GTK_STYLE_PROPERTY (prop),
804 _gtk_css_shorthand_property_register (const char *name,
806 const char **subproperties,
807 GtkCssShorthandPropertyParseFunc parse_func,
808 GtkCssShorthandPropertyAssignFunc assign_func,
809 GtkCssShorthandPropertyQueryFunc query_func)
811 GtkCssShorthandProperty *node;
813 node = g_object_new (GTK_TYPE_CSS_SHORTHAND_PROPERTY,
815 "value-type", value_type,
816 "subproperties", subproperties,
819 node->parse = parse_func;
820 node->assign = assign_func;
821 node->query = query_func;
825 _gtk_css_shorthand_property_init_properties (void)
827 /* The order is important here, be careful when changing it */
828 const char *font_subproperties[] = { "font-family", "font-style", "font-variant", "font-weight", "font-size", NULL };
829 const char *margin_subproperties[] = { "margin-top", "margin-right", "margin-bottom", "margin-left", NULL };
830 const char *padding_subproperties[] = { "padding-top", "padding-right", "padding-bottom", "padding-left", NULL };
831 const char *border_width_subproperties[] = { "border-top-width", "border-right-width", "border-bottom-width", "border-left-width", NULL };
832 const char *border_radius_subproperties[] = { "border-top-left-radius", "border-top-right-radius",
833 "border-bottom-right-radius", "border-bottom-left-radius", NULL };
834 const char *border_color_subproperties[] = { "border-top-color", "border-right-color", "border-bottom-color", "border-left-color", NULL };
835 const char *border_style_subproperties[] = { "border-top-style", "border-right-style", "border-bottom-style", "border-left-style", NULL };
836 const char *border_image_subproperties[] = { "border-image-source", "border-image-slice", "border-image-width", "border-image-repeat", NULL };
837 const char *border_top_subproperties[] = { "border-top-width", "border-top-style", "border-top-color", NULL };
838 const char *border_right_subproperties[] = { "border-right-width", "border-right-style", "border-right-color", NULL };
839 const char *border_bottom_subproperties[] = { "border-bottom-width", "border-bottom-style", "border-bottom-color", NULL };
840 const char *border_left_subproperties[] = { "border-left-width", "border-left-style", "border-left-color", NULL };
841 const char *border_subproperties[] = { "border-top-width", "border-right-width", "border-bottom-width", "border-left-width",
842 "border-top-style", "border-right-style", "border-bottom-style", "border-left-style",
843 "border-top-color", "border-right-color", "border-bottom-color", "border-left-color",
844 "border-image-source", "border-image-slice", "border-image-width", "border-image-repeat", NULL };
845 const char *outline_subproperties[] = { "outline-width", "outline-style", "outline-color", NULL };
846 const char *background_subproperties[] = { "background-image", "background-repeat", "background-clip", "background-origin",
847 "background-color", NULL };
849 _gtk_css_shorthand_property_register ("font",
850 PANGO_TYPE_FONT_DESCRIPTION,
853 unpack_font_description,
854 pack_font_description);
855 _gtk_css_shorthand_property_register ("margin",
857 margin_subproperties,
861 _gtk_css_shorthand_property_register ("padding",
863 padding_subproperties,
867 _gtk_css_shorthand_property_register ("border-width",
869 border_width_subproperties,
873 _gtk_css_shorthand_property_register ("border-radius",
875 border_radius_subproperties,
877 unpack_border_radius,
879 _gtk_css_shorthand_property_register ("border-color",
881 border_color_subproperties,
883 unpack_to_everything,
885 _gtk_css_shorthand_property_register ("border-style",
886 GTK_TYPE_BORDER_STYLE,
887 border_style_subproperties,
889 unpack_to_everything,
891 _gtk_css_shorthand_property_register ("border-image",
893 border_image_subproperties,
897 _gtk_css_shorthand_property_register ("border-top",
899 border_top_subproperties,
903 _gtk_css_shorthand_property_register ("border-right",
905 border_right_subproperties,
909 _gtk_css_shorthand_property_register ("border-bottom",
911 border_bottom_subproperties,
915 _gtk_css_shorthand_property_register ("border-left",
917 border_left_subproperties,
921 _gtk_css_shorthand_property_register ("border",
923 border_subproperties,
927 _gtk_css_shorthand_property_register ("outline",
929 outline_subproperties,
933 _gtk_css_shorthand_property_register ("background",
935 background_subproperties,