mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
Auto merge of #16157 - n0max:perspective_parse_non_negative, r=emilio
Parse perspective property as non negative and add tests <!-- 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 #15449 (github issue number if applicable). <!-- Either: --> - [X] There are tests for these changes <!-- 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/16157) <!-- Reviewable:end -->
This commit is contained in:
commit
b783cacc54
4 changed files with 50 additions and 0 deletions
|
@ -1778,6 +1778,7 @@ ${helpers.single_keyword("resize",
|
|||
${helpers.predefined_type("perspective",
|
||||
"LengthOrNone",
|
||||
"Either::Second(None_)",
|
||||
"parse_non_negative_length",
|
||||
gecko_ffi_name="mChildPerspective",
|
||||
spec="https://drafts.csswg.org/css-transforms/#perspective",
|
||||
extra_prefixes="moz webkit",
|
||||
|
|
|
@ -466,6 +466,17 @@ impl Parse for Length {
|
|||
}
|
||||
}
|
||||
|
||||
impl Either<Length, None_> {
|
||||
/// Parse a non-negative length or none
|
||||
#[inline]
|
||||
pub fn parse_non_negative_length(context: &ParserContext, input: &mut Parser) -> Result<Self, ()> {
|
||||
if input.try(|input| None_::parse(context, input)).is_ok() {
|
||||
return Ok(Either::Second(None_));
|
||||
}
|
||||
Length::parse_non_negative(input).map(Either::First)
|
||||
}
|
||||
}
|
||||
|
||||
impl Either<Length, Normal> {
|
||||
#[inline]
|
||||
#[allow(missing_docs)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue