mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Auto merge of #14347 - jcdyer:cdyer/len-parsing, r=Wafflespeanut
Only allow border-image-outset to use non-negative numbers. Restricts border-image-outline to only allow positive values. Fixes #14295 --- <!-- 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 #14295. <!-- Either: --> - [x] There are tests for these changes OR - [ ] These changes do not require tests because _____ <!-- 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/14347) <!-- Reviewable:end -->
This commit is contained in:
commit
210b1be1d0
3 changed files with 34 additions and 6 deletions
|
@ -1009,3 +1009,13 @@ impl Parse for LengthOrPercentageOrAutoOrContent {
|
|||
}
|
||||
|
||||
pub type LengthOrNumber = Either<Length, Number>;
|
||||
|
||||
impl LengthOrNumber {
|
||||
pub fn parse_non_negative(input: &mut Parser) -> Result<Self, ()> {
|
||||
if let Ok(v) = input.try(|i| Length::parse_non_negative(i)) {
|
||||
Ok(Either::First(v))
|
||||
} else {
|
||||
Number::parse_non_negative(input).map(Either::Second)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue