mirror of
https://github.com/servo/servo.git
synced 2025-08-06 22:15:33 +01:00
Make transform perspective reject negative lengths.
Contains one test. Fixes: https://github.com/servo/servo/pull/16242#issuecomment-291639340
This commit is contained in:
parent
535d0e421a
commit
b62cdb92ec
2 changed files with 4 additions and 1 deletions
|
@ -1213,6 +1213,8 @@ ${helpers.predefined_type("scroll-snap-coordinate",
|
|||
///
|
||||
/// Part of CSS Transform Module Level 2 and defined at
|
||||
/// [§ 13.1. 3D Transform Function](https://drafts.csswg.org/css-transforms-2/#funcdef-perspective).
|
||||
///
|
||||
/// The value must be greater than or equal to zero.
|
||||
Perspective(specified::Length),
|
||||
}
|
||||
|
||||
|
@ -1535,7 +1537,7 @@ ${helpers.predefined_type("scroll-snap-coordinate",
|
|||
},
|
||||
"perspective" => {
|
||||
try!(input.parse_nested_block(|input| {
|
||||
let d = try!(specified::Length::parse(context, input));
|
||||
let d = try!(specified::Length::parse_non_negative(input));
|
||||
result.push(SpecifiedOperation::Perspective(d));
|
||||
Ok(())
|
||||
}))
|
||||
|
|
|
@ -33,4 +33,5 @@ fn test_transform_translate() {
|
|||
assert_roundtrip_with_context!(transform::parse, "translate(2px)");
|
||||
assert_roundtrip_with_context!(transform::parse, "translate(2px, 5px)");
|
||||
assert!(parse(transform::parse, "translate(2px foo)").is_err());
|
||||
assert!(parse(transform::parse, "perspective(-10px)").is_err());
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue