mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Make AllowedLengthType.is_ok() returning true if parsing mode allows all numeric values.
Even if the type is NonNegative and the given value is a negative.
This commit is contained in:
parent
8bfed4cb3c
commit
7341574b66
3 changed files with 26 additions and 17 deletions
|
@ -204,6 +204,7 @@ macro_rules! __define_css_keyword_enum__actual {
|
|||
|
||||
/// Helper types for the handling of specified values.
|
||||
pub mod specified {
|
||||
use ParsingMode;
|
||||
use app_units::Au;
|
||||
use std::cmp;
|
||||
|
||||
|
@ -228,7 +229,10 @@ pub mod specified {
|
|||
impl AllowedLengthType {
|
||||
/// Whether value is valid for this allowed length type.
|
||||
#[inline]
|
||||
pub fn is_ok(&self, value: f32) -> bool {
|
||||
pub fn is_ok(&self, parsing_mode: ParsingMode, value: f32) -> bool {
|
||||
if parsing_mode.allows_all_numeric_values() {
|
||||
return true;
|
||||
}
|
||||
match *self {
|
||||
AllowedLengthType::All => true,
|
||||
AllowedLengthType::NonNegative => value >= 0.,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue