Fix servo build.

This commit is contained in:
Emilio Cobos Álvarez 2018-04-25 18:50:48 +02:00
parent 16ca8de6df
commit 54b444992d
No known key found for this signature in database
GPG key ID: 056B727BB9C1027C
13 changed files with 148 additions and 143 deletions

View file

@ -352,7 +352,7 @@ ${helpers.predefined_type("grid-template-areas",
${helpers.predefined_type("column-gap",
"length::NonNegativeLengthOrPercentageOrNormal",
"Either::Second(Normal)",
alias="grid-column-gap",
alias="grid-column-gap" if product == "gecko" else "",
extra_prefixes="moz",
servo_pref="layout.columns.enabled",
spec="https://drafts.csswg.org/css-align-3/#propdef-column-gap",
@ -364,7 +364,7 @@ ${helpers.predefined_type("row-gap",
"length::NonNegativeLengthOrPercentageOrNormal",
"Either::Second(Normal)",
alias="grid-row-gap",
servo_pref="layout.columns.enabled",
products="gecko",
spec="https://drafts.csswg.org/css-align-3/#propdef-row-gap",
animation_value_type="NonNegativeLengthOrPercentageOrNormal",
servo_restyle_damage = "reflow")}

View file

@ -2242,9 +2242,13 @@ pub mod style_structs {
pub fn compute_font_hash(&mut self) {
// Corresponds to the fields in
// `gfx::font_template::FontTemplateDescriptor`.
//
// FIXME(emilio): Where's font-style?
let mut hasher: FnvHasher = Default::default();
self.font_weight.hash(&mut hasher);
self.font_stretch.hash(&mut hasher);
// We hash the floating point number with four decimal
// places.
hasher.write_u64((self.font_weight.0 * 10000.).trunc() as u64);
hasher.write_u64(((self.font_stretch.0).0 * 10000.).trunc() as u64);
self.font_family.hash(&mut hasher);
self.hash = hasher.finish()
}

View file

@ -15,6 +15,7 @@ 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;
@ -122,16 +123,6 @@ 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 {
@ -841,6 +832,7 @@ impl ToComputedValue for specified::MozScriptLevel {
/// A wrapper over an `Angle`, that handles clamping to the appropriate range
/// for `font-style` animation.
#[derive(Clone, Copy, Debug, MallocSizeOf, PartialEq, ToCss)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub struct FontStyleAngle(pub Angle);
impl ToAnimatedValue for FontStyleAngle {
@ -878,7 +870,7 @@ impl FontStyle {
///
/// https://drafts.csswg.org/css-fonts-4/#valdef-font-style-oblique-angle
#[inline]
fn default_angle() -> FontStyleAngle {
pub fn default_angle() -> FontStyleAngle {
FontStyleAngle(Angle::Deg(specified::DEFAULT_FONT_STYLE_OBLIQUE_ANGLE_DEGREES))
}

View file

@ -238,6 +238,7 @@ impl ToCss for KeywordSize {
#[allow(missing_docs)]
#[derive(Animate, Clone, ComputeSquaredDistance, Copy, Debug, MallocSizeOf,
PartialEq, ToAnimatedValue, ToAnimatedZero)]
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
pub enum FontStyle<Angle> {
#[animation(error)]
Normal,