From e8cbbedbb25bfee7f8a3dc987ab2d5d3db290246 Mon Sep 17 00:00:00 2001 From: Cosimo Cecchi Date: Thu, 1 May 2014 18:11:23 +0200 Subject: [PATCH] css: add properties for outline-radius Both a shorthand and individual properties. This is not officially part of the CSS standard, but there's precedence for it at least in Mozilla: https://developer.mozilla.org/en-US/docs/Web/CSS/-moz-outline-radius --- gtk/gtkcssarrayvalue.c | 4 ++++ gtk/gtkcssshorthandpropertyimpl.c | 8 +++++++ gtk/gtkcssstylepropertyimpl.c | 37 +++++++++++++++++++++++++++++++ gtk/gtkcsstypesprivate.h | 4 ++++ 4 files changed, 53 insertions(+) diff --git a/gtk/gtkcssarrayvalue.c b/gtk/gtkcssarrayvalue.c index a221bf6c57..3491fb887d 100644 --- a/gtk/gtkcssarrayvalue.c +++ b/gtk/gtkcssarrayvalue.c @@ -277,6 +277,10 @@ gtk_css_value_array_transition (GtkCssValue *start, case GTK_CSS_PROPERTY_OUTLINE_STYLE: case GTK_CSS_PROPERTY_OUTLINE_WIDTH: case GTK_CSS_PROPERTY_OUTLINE_OFFSET: + case GTK_CSS_PROPERTY_OUTLINE_TOP_LEFT_RADIUS: + case GTK_CSS_PROPERTY_OUTLINE_TOP_RIGHT_RADIUS: + case GTK_CSS_PROPERTY_OUTLINE_BOTTOM_RIGHT_RADIUS: + case GTK_CSS_PROPERTY_OUTLINE_BOTTOM_LEFT_RADIUS: case GTK_CSS_PROPERTY_BORDER_TOP_COLOR: case GTK_CSS_PROPERTY_BORDER_RIGHT_COLOR: case GTK_CSS_PROPERTY_BORDER_BOTTOM_COLOR: diff --git a/gtk/gtkcssshorthandpropertyimpl.c b/gtk/gtkcssshorthandpropertyimpl.c index b01494b7da..15cd359676 100644 --- a/gtk/gtkcssshorthandpropertyimpl.c +++ b/gtk/gtkcssshorthandpropertyimpl.c @@ -1111,6 +1111,8 @@ _gtk_css_shorthand_property_init_properties (void) "border-top-color", "border-right-color", "border-bottom-color", "border-left-color", "border-image-source", "border-image-slice", "border-image-width", "border-image-repeat", NULL }; const char *outline_subproperties[] = { "outline-width", "outline-style", "outline-color", NULL }; + const char *outline_radius_subproperties[] = { "outline-top-left-radius", "outline-top-right-radius", + "outline-bottom-right-radius", "outline-bottom-left-radius", NULL }; const char *background_subproperties[] = { "background-image", "background-position", "background-size", "background-repeat", "background-clip", "background-origin", "background-color", NULL }; const char *transition_subproperties[] = { "transition-property", "transition-duration", "transition-delay", "transition-timing-function", NULL }; @@ -1195,6 +1197,12 @@ _gtk_css_shorthand_property_init_properties (void) parse_border, NULL, NULL); + _gtk_css_shorthand_property_register ("outline-radius", + G_TYPE_INT, + outline_radius_subproperties, + parse_border_radius, + unpack_border_radius, + pack_border_radius); _gtk_css_shorthand_property_register ("outline", G_TYPE_NONE, outline_subproperties, diff --git a/gtk/gtkcssstylepropertyimpl.c b/gtk/gtkcssstylepropertyimpl.c index 3ff3d76692..745a69e93b 100644 --- a/gtk/gtkcssstylepropertyimpl.c +++ b/gtk/gtkcssstylepropertyimpl.c @@ -1169,6 +1169,43 @@ _gtk_css_style_property_init_properties (void) assign_length_from_int, _gtk_css_number_value_new (0.0, GTK_CSS_PX)); + gtk_css_style_property_register ("outline-top-left-radius", + GTK_CSS_PROPERTY_OUTLINE_TOP_LEFT_RADIUS, + G_TYPE_NONE, + GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE, + border_corner_radius_value_parse, + NULL, + NULL, + _gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX), + _gtk_css_number_value_new (0, GTK_CSS_PX))); + gtk_css_style_property_register ("outline-top-right-radius", + GTK_CSS_PROPERTY_OUTLINE_TOP_RIGHT_RADIUS, + G_TYPE_NONE, + GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE, + border_corner_radius_value_parse, + NULL, + NULL, + _gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX), + _gtk_css_number_value_new (0, GTK_CSS_PX))); + gtk_css_style_property_register ("outline-bottom-right-radius", + GTK_CSS_PROPERTY_OUTLINE_BOTTOM_RIGHT_RADIUS, + G_TYPE_NONE, + GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE, + border_corner_radius_value_parse, + NULL, + NULL, + _gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX), + _gtk_css_number_value_new (0, GTK_CSS_PX))); + gtk_css_style_property_register ("outline-bottom-left-radius", + GTK_CSS_PROPERTY_OUTLINE_BOTTOM_LEFT_RADIUS, + G_TYPE_NONE, + GTK_STYLE_PROPERTY_ANIMATED | GTK_STYLE_PROPERTY_NO_RESIZE, + border_corner_radius_value_parse, + NULL, + NULL, + _gtk_css_corner_value_new (_gtk_css_number_value_new (0, GTK_CSS_PX), + _gtk_css_number_value_new (0, GTK_CSS_PX))); + gtk_css_style_property_register ("background-clip", GTK_CSS_PROPERTY_BACKGROUND_CLIP, G_TYPE_NONE, diff --git a/gtk/gtkcsstypesprivate.h b/gtk/gtkcsstypesprivate.h index 72511d9654..a6bf49a33d 100644 --- a/gtk/gtkcsstypesprivate.h +++ b/gtk/gtkcsstypesprivate.h @@ -105,6 +105,10 @@ enum { /*< skip >*/ GTK_CSS_PROPERTY_OUTLINE_STYLE, GTK_CSS_PROPERTY_OUTLINE_WIDTH, GTK_CSS_PROPERTY_OUTLINE_OFFSET, + GTK_CSS_PROPERTY_OUTLINE_TOP_LEFT_RADIUS, + GTK_CSS_PROPERTY_OUTLINE_TOP_RIGHT_RADIUS, + GTK_CSS_PROPERTY_OUTLINE_BOTTOM_RIGHT_RADIUS, + GTK_CSS_PROPERTY_OUTLINE_BOTTOM_LEFT_RADIUS, GTK_CSS_PROPERTY_BACKGROUND_CLIP, GTK_CSS_PROPERTY_BACKGROUND_ORIGIN, GTK_CSS_PROPERTY_BACKGROUND_SIZE,