style: added text-decoration-thickness to the text-decoration shorthands.

Differential Revision: https://phabricator.services.mozilla.com/D40335
This commit is contained in:
Charlie Marlow 2019-08-07 17:42:15 +00:00 committed by Emilio Cobos Álvarez
parent 29f6db4d16
commit ad1d028e40
No known key found for this signature in database
GPG key ID: E1152D0994E4BF8A
3 changed files with 19 additions and 4 deletions

View file

@ -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")

View file

@ -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"

View file

@ -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<Longhands, ParseError<'i>> {
% 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(())