diff --git a/components/style/viewport.rs b/components/style/viewport.rs index 690c06fd377..2ddced848bb 100644 --- a/components/style/viewport.rs +++ b/components/style/viewport.rs @@ -287,33 +287,18 @@ impl<'a, 'b> DeclarationParser for ViewportRuleParser<'a, 'b> { }} } - match name { - n if n.eq_ignore_ascii_case("min-width") => - ok!(MinWidth(ViewportLength::parse)), - n if n.eq_ignore_ascii_case("max-width") => - ok!(MaxWidth(ViewportLength::parse)), - n if n.eq_ignore_ascii_case("width") => - ok!(shorthand -> [MinWidth, MaxWidth]), - - n if n.eq_ignore_ascii_case("min-height") => - ok!(MinHeight(ViewportLength::parse)), - n if n.eq_ignore_ascii_case("max-height") => - ok!(MaxHeight(ViewportLength::parse)), - n if n.eq_ignore_ascii_case("height") => - ok!(shorthand -> [MinHeight, MaxHeight]), - - n if n.eq_ignore_ascii_case("zoom") => - ok!(Zoom(Zoom::parse)), - n if n.eq_ignore_ascii_case("min-zoom") => - ok!(MinZoom(Zoom::parse)), - n if n.eq_ignore_ascii_case("max-zoom") => - ok!(MaxZoom(Zoom::parse)), - - n if n.eq_ignore_ascii_case("user-zoom") => - ok!(UserZoom(UserZoom::parse)), - n if n.eq_ignore_ascii_case("orientation") => - ok!(Orientation(Orientation::parse)), - + match_ignore_ascii_case! { name, + "min-width" => ok!(MinWidth(ViewportLength::parse)), + "max-width" => ok!(MaxWidth(ViewportLength::parse)), + "width" => ok!(shorthand -> [MinWidth, MaxWidth]), + "min-height" => ok!(MinHeight(ViewportLength::parse)), + "max-height" => ok!(MaxHeight(ViewportLength::parse)), + "height" => ok!(shorthand -> [MinHeight, MaxHeight]), + "zoom" => ok!(Zoom(Zoom::parse)), + "min-zoom" => ok!(MinZoom(Zoom::parse)), + "max-zoom" => ok!(MaxZoom(Zoom::parse)), + "user-zoom" => ok!(UserZoom(UserZoom::parse)), + "orientation" => ok!(Orientation(Orientation::parse)), _ => Err(()), } } diff --git a/tests/unit/style/viewport.rs b/tests/unit/style/viewport.rs index 2eaefcaff0e..dc15436af5e 100644 --- a/tests/unit/style/viewport.rs +++ b/tests/unit/style/viewport.rs @@ -8,7 +8,7 @@ use media_queries::CSSErrorReporterTest; use servo_config::prefs::{PREFS, PrefValue}; use servo_url::ServoUrl; use style::media_queries::{Device, MediaType}; -use style::parser::ParserContext; +use style::parser::{Parse, ParserContext}; use style::shared_lock::SharedRwLock; use style::stylesheets::{Stylesheet, Origin}; use style::values::specified::LengthOrPercentageOrAuto::{self, Auto}; @@ -294,7 +294,7 @@ fn constrain_viewport() { macro_rules! from_css { ($css:expr) => { - &ViewportRule::parse(&mut Parser::new($css), &context).unwrap() + &ViewportRule::parse(&context, &mut Parser::new($css)).unwrap() } }