diff --git a/components/style/properties/data.py b/components/style/properties/data.py index 46cb724e11d..b8568292d28 100644 --- a/components/style/properties/data.py +++ b/components/style/properties/data.py @@ -653,7 +653,6 @@ def _remove_common_first_line_and_first_letter_properties(props, engine): props.remove("text-emphasis-style") props.remove("text-emphasis-color") props.remove("text-decoration-skip-ink") - props.remove("text-decoration-thickness") props.remove("text-underline-offset") props.remove("overflow-wrap") diff --git a/components/style/properties/longhands/text.mako.rs b/components/style/properties/longhands/text.mako.rs index a592e2f1290..9f0d3f38213 100644 --- a/components/style/properties/longhands/text.mako.rs +++ b/components/style/properties/longhands/text.mako.rs @@ -74,6 +74,7 @@ ${helpers.predefined_type( "LengthOrAuto", "computed::LengthOrAuto::auto()", engines="gecko", + initial_specified_value="specified::LengthOrAuto::auto()", animation_value_type="ComputedValue", gecko_pref="layout.css.text-decoration-thickness.enabled", spec="https://drafts.csswg.org/css-text-decor-4/#text-decoration-width-property" diff --git a/components/style/properties/shorthands/text.mako.rs b/components/style/properties/shorthands/text.mako.rs index 905512b08df..994d31c18b2 100644 --- a/components/style/properties/shorthands/text.mako.rs +++ b/components/style/properties/shorthands/text.mako.rs @@ -8,12 +8,13 @@ engines="gecko servo-2013" flags="SHORTHAND_IN_GETCS" sub_properties="text-decoration-line - ${' text-decoration-style text-decoration-color' if engine == 'gecko' else ''}" + ${' text-decoration-style text-decoration-color text-decoration-thickness' if engine == 'gecko' else ''}" spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration"> % if engine == "gecko": use crate::values::specified; - use crate::properties::longhands::{text_decoration_style, text_decoration_color}; + use crate::properties::longhands::{text_decoration_style, text_decoration_color, text_decoration_thickness}; + use crate::properties::{PropertyId, LonghandId}; % endif use crate::properties::longhands::text_decoration_line; @@ -22,11 +23,14 @@ input: &mut Parser<'i, 't>, ) -> Result> { % if engine == "gecko": - let (mut line, mut style, mut color, mut any) = (None, None, None, false); + let (mut line, mut style, mut color, mut thickness, mut any) = (None, None, None, None, false); % else: let (mut line, mut any) = (None, false); % endif + let text_decoration_thickness_enabled = + PropertyId::Longhand(LonghandId::TextDecorationThickness).enabled_for_all_content(); + loop { macro_rules! parse_component { ($value:ident, $module:ident) => ( @@ -45,6 +49,9 @@ % if engine == "gecko": parse_component!(style, text_decoration_style); parse_component!(color, text_decoration_color); + if text_decoration_thickness_enabled { + parse_component!(thickness, text_decoration_thickness); + } % endif break; @@ -60,6 +67,7 @@ % if engine == "gecko": text_decoration_style: unwrap_or_initial!(text_decoration_style, style), text_decoration_color: unwrap_or_initial!(text_decoration_color, color), + text_decoration_thickness: unwrap_or_initial!(text_decoration_thickness, thickness), % endif }) } @@ -78,6 +86,13 @@ dest.write_str(" ")?; self.text_decoration_color.to_css(dest)?; } + + if let Some(text_decoration_thickness) = self.text_decoration_thickness { + if !text_decoration_thickness.is_auto() { + dest.write_str(" ")?; + self.text_decoration_thickness.to_css(dest)?; + } + } % endif Ok(())