mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Fixups for css-fonts-4 font-weight.
This commit is contained in:
parent
0f19c25706
commit
48de556f8c
10 changed files with 51 additions and 64 deletions
|
@ -27,7 +27,8 @@ use style_traits::{StyleParseErrorKind, ToCss};
|
|||
use style_traits::values::SequenceWriter;
|
||||
use values::computed::font::FamilyName;
|
||||
#[cfg(feature = "gecko")]
|
||||
use values::specified::font::{AbsoluteFontWeight, SpecifiedFontFeatureSettings, SpecifiedFontVariationSettings};
|
||||
use values::specified::font::{SpecifiedFontFeatureSettings, SpecifiedFontVariationSettings};
|
||||
use values::specified::font::AbsoluteFontWeight;
|
||||
use values::specified::url::SpecifiedUrl;
|
||||
|
||||
/// A source for a font-face rule.
|
||||
|
|
|
@ -15,8 +15,8 @@ use properties::longhands::font_language_override;
|
|||
use std::str;
|
||||
use values::computed::font::FamilyName;
|
||||
use values::generics::font::FontTag;
|
||||
use values::specified::font::AbsoluteFontWeight;
|
||||
use values::specified::font::{SpecifiedFontFeatureSettings, SpecifiedFontVariationSettings};
|
||||
use values::specified::font::AbsoluteFontWeight;
|
||||
|
||||
impl<'a> ToNsCssValue for &'a FamilyName {
|
||||
fn convert(self, nscssvalue: &mut nsCSSValue) {
|
||||
|
|
|
@ -2243,7 +2243,7 @@ pub mod style_structs {
|
|||
// Corresponds to the fields in
|
||||
// `gfx::font_template::FontTemplateDescriptor`.
|
||||
let mut hasher: FnvHasher = Default::default();
|
||||
hasher.write_u16(self.font_weight.0);
|
||||
self.font_weight.hash(&mut hasher);
|
||||
self.font_stretch.hash(&mut hasher);
|
||||
self.font_family.hash(&mut hasher);
|
||||
self.hash = hasher.finish()
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue