Auto merge of #15702 - shubDhond:master, r=upsuper

Invalid three value positions are no longer accepted

<!-- Please describe your changes on the following line: -->
- Position parse no longer accepts invalid three value positions

---
<!-- 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 #15488 .

<!-- Either: -->
- [X] There are tests for these changes OR

<!-- 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/15702)
<!-- Reviewable:end -->
This commit is contained in:
bors-servo 2017-03-04 03:11:44 -08:00 committed by GitHub
commit 8c4931f26f
3 changed files with 8 additions and 6 deletions

View file

@ -187,13 +187,11 @@ impl Parse for Position {
} else {
// Handle 3 value background position there are several options:
if let PositionCategory::LengthOrPercentage = category(&first) {
// "length keyword length"
Position::new(Some(first), Some(third), None, Some(second))
Err(())
} else {
if let PositionCategory::LengthOrPercentage = category(&second) {
if let PositionCategory::LengthOrPercentage = category(&third) {
// "keyword length length"
Position::new(Some(second), Some(third), Some(first), None)
Err(())
} else {
// "keyword length keyword"
Position::new(Some(second), None, Some(first), Some(third))