Auto merge of #16829 - hiikezoe:disallow-negative-duration, r=emilio

Disallow negative duration for animation and transition

<!-- Please describe your changes on the following line: -->

---
<!-- 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 #15343

<!-- Either: -->
- [X] There are tests for these changes written by @simon-whitehead . Thank you!

<!-- Also, please make sure that "Allow edits from maintainers" checkbox is checked, so that we can help you if you get stuck somewhere along the way.-->

<!-- 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/16829)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-05-13 15:12:15 -05:00 committed by GitHub
commit 4613c0382a
6 changed files with 51 additions and 31 deletions

View file

@ -105,6 +105,7 @@ mod selectors;
mod supports;
mod text;
mod text_overflow;
mod transition_duration;
mod transition_property;
mod transition_timing_function;
mod ui;

View file

@ -0,0 +1,17 @@
/* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
use parsing::parse;
use style::properties::longhands::transition_duration;
#[test]
fn test_positive_transition_duration() {
assert!(parse(transition_duration::parse, "5s").is_ok());
assert!(parse(transition_duration::parse, "0s").is_ok());
}
#[test]
fn test_negative_transition_duration() {
assert!(parse(transition_duration::parse, "-5s").is_err());
}

View file

@ -1,8 +0,0 @@
[transition-duration-001.htm]
type: testharness
[parse '-5s']
expected: FAIL
[parse '-500ms']
expected: FAIL

View file

@ -1,8 +0,0 @@
[transition-duration-001.htm]
type: testharness
[parse '-5s']
expected: FAIL
[parse '-500ms']
expected: FAIL