From 928bd0d1d280abf058057ce28b28b0c71033d538 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fernando=20Jim=C3=A9nez=20Moreno?= Date: Wed, 4 Mar 2020 11:33:07 +0100 Subject: [PATCH] Add support for text-decoration-color --- components/layout_2020/display_list/mod.rs | 14 +++++++++----- components/style/properties/longhands/text.mako.rs | 2 +- 2 files changed, 10 insertions(+), 6 deletions(-) diff --git a/components/layout_2020/display_list/mod.rs b/components/layout_2020/display_list/mod.rs index 404d09ddeec..a6d18bcb8ff 100644 --- a/components/layout_2020/display_list/mod.rs +++ b/components/layout_2020/display_list/mod.rs @@ -128,7 +128,6 @@ impl Fragment { common.hit_info = hit_info(&fragment.parent_style, fragment.tag, Cursor::Text); let color = fragment.parent_style.clone_color(); - let text_decorations = fragment .parent_style .get_inherited_text() @@ -140,14 +139,14 @@ impl Fragment { let mut rect = rect; rect.origin.y = rect.origin.y + font_metrics.ascent - font_metrics.underline_offset; rect.size.height = font_metrics.underline_size; - self.build_display_list_for_text_decoration(builder, &rect, color); + self.build_display_list_for_text_decoration(fragment, builder, &rect, color); } // Overline. if text_decorations.overline { let mut rect = rect; rect.size.height = font_metrics.underline_size; - self.build_display_list_for_text_decoration(builder, &rect, color); + self.build_display_list_for_text_decoration(fragment, builder, &rect, color); } // Text. @@ -166,24 +165,29 @@ impl Fragment { rect.origin.y = rect.origin.y + font_metrics.ascent - font_metrics.strikeout_offset; // XXX(ferjm) This does not work on MacOS #942 rect.size.height = font_metrics.strikeout_size; - self.build_display_list_for_text_decoration(builder, &rect, color); + self.build_display_list_for_text_decoration(fragment, builder, &rect, color); } } fn build_display_list_for_text_decoration( &self, + fragment: &TextFragment, builder: &mut DisplayListBuilder, rect: &PhysicalRect, color: cssparser::RGBA, ) { let rect = rect.to_webrender(); let wavy_line_thickness = (0.33 * rect.size.height).ceil(); + let text_decoration_color = fragment + .parent_style + .clone_text_decoration_color() + .to_rgba(color); builder.wr.push_line( &builder.common_properties(rect), &rect, wavy_line_thickness, wr::LineOrientation::Horizontal, - &rgba(color), + &rgba(text_decoration_color), wr::LineStyle::Solid, ); } diff --git a/components/style/properties/longhands/text.mako.rs b/components/style/properties/longhands/text.mako.rs index d80ee1eb10a..80b62b5478a 100644 --- a/components/style/properties/longhands/text.mako.rs +++ b/components/style/properties/longhands/text.mako.rs @@ -50,7 +50,7 @@ ${helpers.predefined_type( "text-decoration-color", "Color", "computed_value::T::currentcolor()", - engines="gecko", + engines="gecko servo-2020", initial_specified_value="specified::Color::currentcolor()", animation_value_type="AnimatedColor", ignored_when_colors_disabled=True,