mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #15539 - AdmiralCoco:reject_outofrange_transition_values, r=emilio
Add rejection of out-of-range values for single-timing-functions <!-- Please describe your changes on the following line: --> This PR fixes #15344, checking for the `cubic-bezier p1x/p2x` and `steps` first value after parsing. There are unit tests that check for parsing of invalid values - I was not sure if there was a more suitable place, so I created a file (name subject to change). Q: I found this [test suite](https://github.com/servo/servo/blob/master/tests/unit/style/properties/serialization.rs#L592), and noticed that the `p2x` value is out of range, but the test does not fail - is this because there is no check when calling the function itself? Thanks! --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix #15344 <!-- Either: --> - [X] There are tests for these changes <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15539) <!-- Reviewable:end -->
This commit is contained in:
commit
f3bacf84f4
4 changed files with 46 additions and 8 deletions
|
@ -594,6 +594,10 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
|
|||
p2y = try!(specified::parse_number(input));
|
||||
Ok(())
|
||||
}));
|
||||
if p1x < 0.0 || p1x > 1.0 || p2x < 0.0 || p2x > 1.0 {
|
||||
return Err(())
|
||||
}
|
||||
|
||||
let (p1, p2) = (Point2D::new(p1x, p1y), Point2D::new(p2x, p2y));
|
||||
Ok(SpecifiedValue::CubicBezier(p1, p2))
|
||||
},
|
||||
|
@ -601,6 +605,10 @@ ${helpers.single_keyword("overflow-x", "visible hidden scroll auto",
|
|||
let (mut step_count, mut start_end) = (0, StartEnd::End);
|
||||
try!(input.parse_nested_block(|input| {
|
||||
step_count = try!(specified::parse_integer(input));
|
||||
if step_count < 1 {
|
||||
return Err(())
|
||||
}
|
||||
|
||||
if input.try(|input| input.expect_comma()).is_ok() {
|
||||
start_end = try!(match_ignore_ascii_case! {
|
||||
try!(input.expect_ident()),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue