Commit a57e6731 authored by Paolo Borelli's avatar Paolo Borelli

css: support text-decoration-color

parent 77658b76
...@@ -1104,6 +1104,16 @@ _gtk_css_style_property_init_properties (void) ...@@ -1104,6 +1104,16 @@ _gtk_css_style_property_init_properties (void)
NULL, NULL,
_gtk_css_text_decoration_line_value_new (GTK_CSS_TEXT_DECORATION_LINE_NONE)); _gtk_css_text_decoration_line_value_new (GTK_CSS_TEXT_DECORATION_LINE_NONE));
gtk_css_style_property_register ("text-decoration-color",
GTK_CSS_PROPERTY_TEXT_DECORATION_COLOR,
G_TYPE_NONE,
GTK_STYLE_PROPERTY_ANIMATED,
GTK_CSS_AFFECTS_TEXT | GTK_CSS_AFFECTS_TEXT_ATTRS,
color_parse,
NULL,
NULL,
_gtk_css_color_value_new_current_color ());
gtk_css_style_property_register ("text-shadow", gtk_css_style_property_register ("text-shadow",
GTK_CSS_PROPERTY_TEXT_SHADOW, GTK_CSS_PROPERTY_TEXT_SHADOW,
G_TYPE_NONE, G_TYPE_NONE,
......
...@@ -120,6 +120,7 @@ enum { /*< skip >*/ ...@@ -120,6 +120,7 @@ enum { /*< skip >*/
GTK_CSS_PROPERTY_FONT_STRETCH, GTK_CSS_PROPERTY_FONT_STRETCH,
GTK_CSS_PROPERTY_LETTER_SPACING, GTK_CSS_PROPERTY_LETTER_SPACING,
GTK_CSS_PROPERTY_TEXT_DECORATION_LINE, GTK_CSS_PROPERTY_TEXT_DECORATION_LINE,
GTK_CSS_PROPERTY_TEXT_DECORATION_COLOR,
GTK_CSS_PROPERTY_TEXT_SHADOW, GTK_CSS_PROPERTY_TEXT_SHADOW,
GTK_CSS_PROPERTY_BOX_SHADOW, GTK_CSS_PROPERTY_BOX_SHADOW,
GTK_CSS_PROPERTY_MARGIN_TOP, GTK_CSS_PROPERTY_MARGIN_TOP,
......
...@@ -3164,18 +3164,30 @@ _gtk_style_context_get_pango_attributes (GtkStyleContext *context) ...@@ -3164,18 +3164,30 @@ _gtk_style_context_get_pango_attributes (GtkStyleContext *context)
{ {
PangoAttrList *attrs = NULL; PangoAttrList *attrs = NULL;
GtkTextDecorationLine decoration_line; GtkTextDecorationLine decoration_line;
const GdkRGBA *color;
const GdkRGBA *decoration_color;
gint letter_spacing; gint letter_spacing;
/* text-decoration */ /* text-decoration */
decoration_line = _gtk_css_text_decoration_line_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_TEXT_DECORATION_LINE)); decoration_line = _gtk_css_text_decoration_line_value_get (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_TEXT_DECORATION_LINE));
color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_COLOR));
decoration_color = _gtk_css_rgba_value_get_rgba (_gtk_style_context_peek_property (context, GTK_CSS_PROPERTY_TEXT_DECORATION_COLOR));
switch (decoration_line) switch (decoration_line)
{ {
case GTK_CSS_TEXT_DECORATION_LINE_UNDERLINE: case GTK_CSS_TEXT_DECORATION_LINE_UNDERLINE:
attrs = add_pango_attr (attrs, pango_attr_underline_new (PANGO_UNDERLINE_SINGLE)); attrs = add_pango_attr (attrs, pango_attr_underline_new (PANGO_UNDERLINE_SINGLE));
if (!gdk_rgba_equal(color, decoration_color))
attrs = add_pango_attr (attrs, pango_attr_underline_color_new (decoration_color->red * 65535. + 0.5,
decoration_color->green * 65535. + 0.5,
decoration_color->blue * 65535. + 0.5));
break; break;
case GTK_CSS_TEXT_DECORATION_LINE_LINE_THROUGH: case GTK_CSS_TEXT_DECORATION_LINE_LINE_THROUGH:
attrs = add_pango_attr (attrs, pango_attr_strikethrough_new (TRUE)); attrs = add_pango_attr (attrs, pango_attr_strikethrough_new (TRUE));
if (!gdk_rgba_equal(color, decoration_color))
attrs = add_pango_attr (attrs, pango_attr_strikethrough_color_new (decoration_color->red * 65535. + 0.5,
decoration_color->green * 65535. + 0.5,
decoration_color->blue * 65535. + 0.5));
break; break;
case GTK_CSS_TEXT_DECORATION_LINE_NONE: case GTK_CSS_TEXT_DECORATION_LINE_NONE:
default: default:
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment