Skip to content

Commit

Permalink
Don't require mask-mode to follow mask-image
Browse files Browse the repository at this point in the history
  • Loading branch information
upsuper committed Feb 5, 2017
1 parent cd63f1b commit 920b0ee
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 9 deletions.
6 changes: 1 addition & 5 deletions components/style/properties/shorthand/mask.mako.rs
Expand Up @@ -49,10 +49,6 @@
if let Ok(value) = input.try(|input| mask_image::single_value
::parse(context, input)) {
image = Some(value);

// Parse mask mode, if applicable.
mode = input.try(|input| mask_mode::single_value::parse(context, input)).ok();

continue
}
}
Expand All @@ -70,7 +66,7 @@
continue
}
}
% for name in "repeat origin clip composite".split():
% for name in "repeat origin clip composite mode".split():
if ${name}.is_none() {
if let Ok(value) = input.try(|input| mask_${name}::single_value
::parse(context, input)) {
Expand Down
8 changes: 4 additions & 4 deletions tests/unit/style/parsing/mask.rs
Expand Up @@ -107,12 +107,12 @@ fn mask_shorthand_should_parse_origin_and_clip_correctly() {
}

#[test]
fn mask_shorthand_should_not_parse_when_mode_specified_but_image_not() {
fn mask_shorthand_should_parse_mode_everywhere() {
let url = ServoUrl::parse("http://localhost").unwrap();
let context = ParserContext::new(Origin::Author, &url, Box::new(CSSErrorReporterTest));
let mut parser = Parser::new("luminance 7px 4px repeat-x padding");
assert!(mask::parse_value(&context, &mut parser).is_err());
let mut parser = Parser::new("luminance 7px 4px repeat-x padding-box");
assert!(mask::parse_value(&context, &mut parser).is_ok());

let mut parser = Parser::new("alpha");
assert!(mask::parse_value(&context, &mut parser).is_err());
assert!(mask::parse_value(&context, &mut parser).is_ok());
}

0 comments on commit 920b0ee

Please sign in to comment.