mirror of
https://github.com/servo/servo.git
synced 2025-06-22 16:18:59 +01:00
style: Cleanup viewport rule parsing.
This commit is contained in:
parent
21eafebd37
commit
726f918b46
2 changed files with 14 additions and 29 deletions
|
@ -287,33 +287,18 @@ impl<'a, 'b> DeclarationParser for ViewportRuleParser<'a, 'b> {
|
||||||
}}
|
}}
|
||||||
}
|
}
|
||||||
|
|
||||||
match name {
|
match_ignore_ascii_case! { name,
|
||||||
n if n.eq_ignore_ascii_case("min-width") =>
|
"min-width" => ok!(MinWidth(ViewportLength::parse)),
|
||||||
ok!(MinWidth(ViewportLength::parse)),
|
"max-width" => ok!(MaxWidth(ViewportLength::parse)),
|
||||||
n if n.eq_ignore_ascii_case("max-width") =>
|
"width" => ok!(shorthand -> [MinWidth, MaxWidth]),
|
||||||
ok!(MaxWidth(ViewportLength::parse)),
|
"min-height" => ok!(MinHeight(ViewportLength::parse)),
|
||||||
n if n.eq_ignore_ascii_case("width") =>
|
"max-height" => ok!(MaxHeight(ViewportLength::parse)),
|
||||||
ok!(shorthand -> [MinWidth, MaxWidth]),
|
"height" => ok!(shorthand -> [MinHeight, MaxHeight]),
|
||||||
|
"zoom" => ok!(Zoom(Zoom::parse)),
|
||||||
n if n.eq_ignore_ascii_case("min-height") =>
|
"min-zoom" => ok!(MinZoom(Zoom::parse)),
|
||||||
ok!(MinHeight(ViewportLength::parse)),
|
"max-zoom" => ok!(MaxZoom(Zoom::parse)),
|
||||||
n if n.eq_ignore_ascii_case("max-height") =>
|
"user-zoom" => ok!(UserZoom(UserZoom::parse)),
|
||||||
ok!(MaxHeight(ViewportLength::parse)),
|
"orientation" => ok!(Orientation(Orientation::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)),
|
|
||||||
|
|
||||||
_ => Err(()),
|
_ => Err(()),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,7 +8,7 @@ use media_queries::CSSErrorReporterTest;
|
||||||
use servo_config::prefs::{PREFS, PrefValue};
|
use servo_config::prefs::{PREFS, PrefValue};
|
||||||
use servo_url::ServoUrl;
|
use servo_url::ServoUrl;
|
||||||
use style::media_queries::{Device, MediaType};
|
use style::media_queries::{Device, MediaType};
|
||||||
use style::parser::ParserContext;
|
use style::parser::{Parse, ParserContext};
|
||||||
use style::shared_lock::SharedRwLock;
|
use style::shared_lock::SharedRwLock;
|
||||||
use style::stylesheets::{Stylesheet, Origin};
|
use style::stylesheets::{Stylesheet, Origin};
|
||||||
use style::values::specified::LengthOrPercentageOrAuto::{self, Auto};
|
use style::values::specified::LengthOrPercentageOrAuto::{self, Auto};
|
||||||
|
@ -294,7 +294,7 @@ fn constrain_viewport() {
|
||||||
|
|
||||||
macro_rules! from_css {
|
macro_rules! from_css {
|
||||||
($css:expr) => {
|
($css:expr) => {
|
||||||
&ViewportRule::parse(&mut Parser::new($css), &context).unwrap()
|
&ViewportRule::parse(&context, &mut Parser::new($css)).unwrap()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue