mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Normalize NaN to zero as a result of calc().
Differential Revision: https://phabricator.services.mozilla.com/D104563
This commit is contained in:
parent
20f5e14bf8
commit
db03b2cf8e
4 changed files with 25 additions and 6 deletions
|
@ -35,6 +35,17 @@ pub mod specified;
|
|||
/// A CSS float value.
|
||||
pub type CSSFloat = f32;
|
||||
|
||||
/// Normalizes a float value to zero after a set of operations that might turn
|
||||
/// it into NaN.
|
||||
#[inline]
|
||||
pub fn normalize(v: CSSFloat) -> CSSFloat {
|
||||
if v.is_nan() {
|
||||
0.0
|
||||
} else {
|
||||
v
|
||||
}
|
||||
}
|
||||
|
||||
/// A CSS integer value.
|
||||
pub type CSSInteger = i32;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue