mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
AllowedNumericType.is_ok() takes ParingMode as well.
And it returns true if ParsingMode.allows_all_numeric_values is true regardless of AllowedNumericType itself.
This commit is contained in:
parent
7341574b66
commit
6c5915068a
3 changed files with 27 additions and 22 deletions
|
@ -265,7 +265,10 @@ pub mod specified {
|
|||
impl AllowedNumericType {
|
||||
/// Whether the value fits the rules of this numeric type.
|
||||
#[inline]
|
||||
pub fn is_ok(&self, val: f32) -> bool {
|
||||
pub fn is_ok(&self, parsing_mode: ParsingMode, val: f32) -> bool {
|
||||
if parsing_mode.allows_all_numeric_values() {
|
||||
return true;
|
||||
}
|
||||
match *self {
|
||||
AllowedNumericType::All => true,
|
||||
AllowedNumericType::NonNegative => val >= 0.0,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue