Add PARSING_MODE_ALLOW_ALL_NUMERIC_VALUES to force to parse negative values.

As per SVG spec [1], we should also parse negative color components values for
SMIL, but currently Gecko does not support it either.

[1] https://www.w3.org/TR/SVG/implnote.html#RangeClamping
This commit is contained in:
Hiroyuki Ikezoe 2017-05-13 18:34:15 +09:00
parent b6b3187efa
commit 59dd93f849
3 changed files with 43 additions and 6 deletions

View file

@ -632,12 +632,20 @@ impl Number {
#[allow(missing_docs)]
pub fn parse_non_negative(context: &ParserContext, input: &mut Parser) -> Result<Number, ()> {
parse_number_with_clamping_mode(context, input, AllowedNumericType::NonNegative)
if context.parsing_mode.allows_all_numeric_values() {
parse_number(context, input)
} else {
parse_number_with_clamping_mode(context, input, AllowedNumericType::NonNegative)
}
}
#[allow(missing_docs)]
pub fn parse_at_least_one(context: &ParserContext, input: &mut Parser) -> Result<Number, ()> {
parse_number_with_clamping_mode(context, input, AllowedNumericType::AtLeastOne)
if context.parsing_mode.allows_all_numeric_values() {
parse_number(context, input)
} else {
parse_number_with_clamping_mode(context, input, AllowedNumericType::AtLeastOne)
}
}
}