diff options
-rw-r--r-- | components/layout_2020/display_list/conversions.rs | 14 | ||||
-rw-r--r-- | components/layout_2020/display_list/mod.rs | 9 | ||||
-rw-r--r-- | components/style/properties/longhands/text.mako.rs | 2 |
3 files changed, 22 insertions, 3 deletions
diff --git a/components/layout_2020/display_list/conversions.rs b/components/layout_2020/display_list/conversions.rs index 410797796dd..0b6dff8506c 100644 --- a/components/layout_2020/display_list/conversions.rs +++ b/components/layout_2020/display_list/conversions.rs @@ -4,6 +4,7 @@ use crate::geom::{PhysicalPoint, PhysicalRect, PhysicalSides, PhysicalSize}; use style::computed_values::mix_blend_mode::T as ComputedMixBlendMode; +use style::computed_values::text_decoration_style::T as ComputedTextDecorationStyle; use style::computed_values::transform_style::T as ComputedTransformStyle; use style::values::computed::Filter as ComputedFilter; use style::values::computed::Length; @@ -100,3 +101,16 @@ impl ToWebRender for PhysicalSides<Length> { ) } } + +impl ToWebRender for ComputedTextDecorationStyle { + type Type = webrender_api::LineStyle; + fn to_webrender(&self) -> Self::Type { + match *self { + ComputedTextDecorationStyle::Solid => wr::LineStyle::Solid, + ComputedTextDecorationStyle::Dotted => wr::LineStyle::Dotted, + ComputedTextDecorationStyle::Dashed => wr::LineStyle::Dashed, + ComputedTextDecorationStyle::Wavy => wr::LineStyle::Wavy, + _ => wr::LineStyle::Solid, + } + } +} diff --git a/components/layout_2020/display_list/mod.rs b/components/layout_2020/display_list/mod.rs index a6d18bcb8ff..f85d0308d72 100644 --- a/components/layout_2020/display_list/mod.rs +++ b/components/layout_2020/display_list/mod.rs @@ -13,9 +13,9 @@ use gfx::text::glyph::GlyphStore; use mitochondria::OnceCell; use net_traits::image_cache::UsePlaceholder; use std::sync::Arc; +use style::computed_values::text_decoration_style::T as ComputedTextDecorationStyle; use style::dom::OpaqueNode; use style::properties::ComputedValues; - use style::values::computed::{BorderStyle, Length, LengthPercentage}; use style::values::specified::ui::CursorKind; use webrender_api::{self as wr, units}; @@ -182,14 +182,19 @@ impl Fragment { .parent_style .clone_text_decoration_color() .to_rgba(color); + let text_decoration_style = fragment.parent_style.clone_text_decoration_style(); + if text_decoration_style == ComputedTextDecorationStyle::MozNone { + return; + } builder.wr.push_line( &builder.common_properties(rect), &rect, wavy_line_thickness, wr::LineOrientation::Horizontal, &rgba(text_decoration_color), - wr::LineStyle::Solid, + text_decoration_style.to_webrender(), ); + // XXX(ferjm) support text-decoration-style: double } } diff --git a/components/style/properties/longhands/text.mako.rs b/components/style/properties/longhands/text.mako.rs index 80b62b5478a..1912bc28e3b 100644 --- a/components/style/properties/longhands/text.mako.rs +++ b/components/style/properties/longhands/text.mako.rs @@ -41,7 +41,7 @@ ${helpers.predefined_type( ${helpers.single_keyword( "text-decoration-style", "solid double dotted dashed wavy -moz-none", - engines="gecko", + engines="gecko servo-2020", animation_value_type="discrete", spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration-style", )} |