mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Allow negative values for letter-spacing and word-spacing. Inline Length parse functions.
Signed-off-by: Sam <sam@sam.uk.net> Use existing parse functions for any length parsing of letter-spacing and word-spacing. Signed-off-by: Sam <sam@sam.uk.net> Add letter-spacing test Signed-off-by: Sam <sam@sam.uk.net> Add tests for letter-spacing and word-spacing negative parsing. Signed-off-by: Sam <sam@sam.uk.net> Remove extra line. Signed-off-by: Sam <sam@sam.uk.net> Remove _ of _context. Signed-off-by: Sam <sam@sam.uk.net> Refactor tests to use new NoCalcLength Signed-off-by: Sam <sam@sam.uk.net> Remove unused import. Signed-off-by: Sam <sam@sam.uk.net> Remove un-needed use.
This commit is contained in:
parent
fb4f421c8b
commit
3682434828
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