Have shorthand parsing functions return values

Shorthands are responsible to set all its longhands to a proper value,
rather than returning None.

Fixes #15380.
This commit is contained in:
Xidorn Quan 2017-02-28 15:21:17 +11:00
parent 2e07ce7e84
commit f33b0b4ea3
18 changed files with 240 additions and 259 deletions

View file

@ -13,7 +13,6 @@
spec="https://drafts.csswg.org/css-text-decor/#propdef-text-decoration">
use cssparser::Color as CSSParserColor;
use properties::longhands::{text_decoration_color, text_decoration_line, text_decoration_style};
use values::specified::CSSColor;
pub fn parse_value(context: &ParserContext, input: &mut Parser) -> Result<Longhands, ()> {
let (mut color, mut line, mut style, mut any) = (None, None, None, false);
@ -41,10 +40,9 @@
}
Ok(Longhands {
text_decoration_color: color.or(Some(CSSColor { parsed: CSSParserColor::CurrentColor,
authored: None })),
text_decoration_line: line.or(Some(text_decoration_line::computed_value::none)),
text_decoration_style: style.or(Some(text_decoration_style::computed_value::T::solid)),
text_decoration_color: unwrap_or_initial!(text_decoration_color, color),
text_decoration_line: unwrap_or_initial!(text_decoration_line, line),
text_decoration_style: unwrap_or_initial!(text_decoration_style, style),
})
}