Prefer length and percentage for word spacing

This commit is contained in:
Ravi Shankar 2016-08-09 11:16:53 +05:30
parent 7ed9134e5a
commit a04028eede
15 changed files with 135 additions and 10 deletions

View file

@ -4,6 +4,7 @@
use app_units::Au;
use euclid::size::Size2D;
use ordered_float::NotNaN;
use properties::ComputedValues;
use std::fmt;
use super::LocalToCss;
@ -241,6 +242,15 @@ impl LengthOrPercentage {
Length(_) | Percentage(_) | Calc(_) => false
}
}
pub fn to_hash_key(&self) -> (Au, NotNaN<f32>) {
use self::LengthOrPercentage::*;
match *self {
Length(l) => (l, NotNaN::new(0.0).unwrap()),
Percentage(p) => (Au(0), NotNaN::new(p).unwrap()),
Calc(c) => (c.length(), NotNaN::new(c.percentage()).unwrap()),
}
}
}
impl fmt::Debug for LengthOrPercentage {