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

@ -115,14 +115,14 @@ fn webkit_text_stroke_shorthand_should_parse_properly() {
let mut parser = Parser::new("thin red");
let result = _webkit_text_stroke::parse_value(&context, &mut parser).unwrap();
assert_eq!(result._webkit_text_stroke_color.unwrap(), parse_longhand!(_webkit_text_stroke_color, "red"));
assert_eq!(result._webkit_text_stroke_width.unwrap(), parse_longhand!(_webkit_text_stroke_width, "thin"));
assert_eq!(result._webkit_text_stroke_color, parse_longhand!(_webkit_text_stroke_color, "red"));
assert_eq!(result._webkit_text_stroke_width, parse_longhand!(_webkit_text_stroke_width, "thin"));
// ensure its no longer sensitive to order
let mut parser = Parser::new("red thin");
let result = _webkit_text_stroke::parse_value(&context, &mut parser).unwrap();
assert_eq!(result._webkit_text_stroke_color.unwrap(), parse_longhand!(_webkit_text_stroke_color, "red"));
assert_eq!(result._webkit_text_stroke_width.unwrap(), parse_longhand!(_webkit_text_stroke_width, "thin"));
assert_eq!(result._webkit_text_stroke_color, parse_longhand!(_webkit_text_stroke_color, "red"));
assert_eq!(result._webkit_text_stroke_width, parse_longhand!(_webkit_text_stroke_width, "thin"));
}
#[test]