Rename LengthParsingMode to ParsingMode and LengthParsingMode::SVG to PasingMode::AllowUnitlessLength.

We need another flag that represents allow-negative-number for SMIL, so
this enum will also comprise the another parsing mode that allows negative number.
This commit is contained in:
Hiroyuki Ikezoe 2017-05-13 18:33:14 +09:00
parent b80d4acef4
commit fcc50ea421
23 changed files with 85 additions and 85 deletions

View file

@ -630,7 +630,7 @@ impl Length {
Token::Dimension(ref value, ref unit) if num_context.is_ok(value.value) =>
Length::parse_dimension(context, value.value, unit),
Token::Number(ref value) if num_context.is_ok(value.value) => {
if value.value != 0. && !context.length_parsing_mode.allows_unitless_lengths() &&
if value.value != 0. && !context.parsing_mode.allows_unitless_lengths() &&
!allow_quirks.allowed(context.quirks_mode) {
return Err(())
}
@ -972,7 +972,7 @@ impl LengthOrPercentageOrAuto {
Token::Percentage(ref value) if num_context.is_ok(value.unit_value) =>
Ok(LengthOrPercentageOrAuto::Percentage(Percentage(value.unit_value))),
Token::Number(ref value) if num_context.is_ok(value.value) => {
if value.value != 0. && !context.length_parsing_mode.allows_unitless_lengths() &&
if value.value != 0. && !context.parsing_mode.allows_unitless_lengths() &&
!allow_quirks.allowed(context.quirks_mode) {
return Err(())
}
@ -1080,7 +1080,7 @@ impl LengthOrPercentageOrNone {
Token::Percentage(ref value) if num_context.is_ok(value.unit_value) =>
Ok(LengthOrPercentageOrNone::Percentage(Percentage(value.unit_value))),
Token::Number(value) if num_context.is_ok(value.value) => {
if value.value != 0. && !context.length_parsing_mode.allows_unitless_lengths() &&
if value.value != 0. && !context.parsing_mode.allows_unitless_lengths() &&
!allow_quirks.allowed(context.quirks_mode) {
return Err(())
}