mirror of
https://github.com/servo/servo.git
synced 2025-08-06 14:10:11 +01:00
Auto merge of #15237 - samuknet:negative-letter-spacing-word-spacing, r=emilio
Allow negative values for letter-spacing and word-spacing. Inline Le… <!-- Please describe your changes on the following line: --> Allow negative values when parsing `letter-spacing` and `word-spacing`. Inline `parse_non_negative` in `Length`. --- <!-- 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 #15204 (github issue number if applicable). <!-- 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/15237) <!-- Reviewable:end -->
This commit is contained in:
commit
449147b8df
5 changed files with 28 additions and 11 deletions
|
@ -335,11 +335,11 @@ ${helpers.single_keyword("text-align-last",
|
|||
}
|
||||
}
|
||||
|
||||
pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
|
||||
pub fn parse(context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
|
||||
if input.try(|input| input.expect_ident_matching("normal")).is_ok() {
|
||||
Ok(SpecifiedValue::Normal)
|
||||
} else {
|
||||
specified::Length::parse_non_negative(input).map(SpecifiedValue::Specified)
|
||||
specified::Length::parse(context, input).map(SpecifiedValue::Specified)
|
||||
}
|
||||
}
|
||||
</%helpers:longhand>
|
||||
|
@ -416,11 +416,11 @@ ${helpers.single_keyword("text-align-last",
|
|||
}
|
||||
}
|
||||
|
||||
pub fn parse(_context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
|
||||
pub fn parse(context: &ParserContext, input: &mut Parser) -> Result<SpecifiedValue, ()> {
|
||||
if input.try(|input| input.expect_ident_matching("normal")).is_ok() {
|
||||
Ok(SpecifiedValue::Normal)
|
||||
} else {
|
||||
specified::LengthOrPercentage::parse_non_negative(input)
|
||||
specified::LengthOrPercentage::parse(context, input)
|
||||
.map(SpecifiedValue::Specified)
|
||||
}
|
||||
}
|
||||
|
|
|
@ -463,6 +463,7 @@ impl Length {
|
|||
}
|
||||
|
||||
/// Parse a non-negative length
|
||||
#[inline]
|
||||
pub fn parse_non_negative(input: &mut Parser) -> Result<Length, ()> {
|
||||
Length::parse_internal(input, AllowedNumericType::NonNegative)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue