style: Fixups for css-fonts-4 font-weight.

This commit is contained in:
Emilio Cobos Álvarez 2018-04-21 20:05:37 +02:00
parent 0f19c25706
commit 48de556f8c
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
10 changed files with 51 additions and 64 deletions

View file

@ -15,7 +15,6 @@ use gecko_bindings::sugar::refptr::RefPtr;
#[cfg(feature = "gecko")]
use malloc_size_of::{MallocSizeOf, MallocSizeOfOps};
use std::fmt::{self, Write};
#[cfg(feature = "gecko")]
use std::hash::{Hash, Hasher};
#[cfg(feature = "servo")]
use std::slice;
@ -123,6 +122,16 @@ impl FontWeight {
}
}
impl Hash for FontWeight {
fn hash<H>(&self, state: &mut H)
where
H: Hasher,
{
// We hash the floating point number with four decimal places.
state.write_u32((self.0 * 10000.).trunc() as u32)
}
}
impl FontSize {
/// The actual computed font size.
pub fn size(self) -> Au {