diff --git a/components/style/values/computed/length.rs b/components/style/values/computed/length.rs index ece797dd224..e5548629903 100644 --- a/components/style/values/computed/length.rs +++ b/components/style/values/computed/length.rs @@ -36,9 +36,6 @@ impl ToComputedValue for specified::NoCalcLength { length.to_computed_value(context.viewport_size_for_viewport_unit_resolution()), specified::NoCalcLength::ServoCharacterWidth(length) => length.to_computed_value(context.style().get_font().clone_font_size().size()), - #[cfg(feature = "gecko")] - specified::NoCalcLength::Physical(length) => - length.to_computed_value(context), } } diff --git a/components/style/values/specified/calc.rs b/components/style/values/specified/calc.rs index 295e9488f61..00857b733ca 100644 --- a/components/style/values/specified/calc.rs +++ b/components/style/values/specified/calc.rs @@ -77,8 +77,6 @@ pub struct CalcLengthOrPercentage { pub ch: Option, pub rem: Option, pub percentage: Option, - #[cfg(feature = "gecko")] - pub mozmm: Option, } impl ToCss for CalcLengthOrPercentage { @@ -142,14 +140,7 @@ impl ToCss for CalcLengthOrPercentage { serialize!(ch); serialize_abs!(Cm); serialize!(em, ex); - serialize_abs!(In); - - #[cfg(feature = "gecko")] - { - serialize!(mozmm); - } - - serialize_abs!(Mm, Pc, Pt, Px, Q); + serialize_abs!(In, Mm, Pc, Pt, Px, Q); serialize!(rem, vh, vmax, vmin, vw); dest.write_str(")") @@ -398,16 +389,6 @@ impl CalcNode { } } NoCalcLength::ServoCharacterWidth(..) => unreachable!(), - #[cfg(feature = "gecko")] - NoCalcLength::Physical(physical) => { - use values::specified::length::PhysicalLength; - - match physical { - PhysicalLength::Mozmm(mozmm) => { - ret.mozmm = Some(ret.mozmm.unwrap_or(0.) + mozmm * factor); - } - } - } } } CalcNode::Sub(ref a, ref b) => { diff --git a/components/style/values/specified/length.rs b/components/style/values/specified/length.rs index 1cacd0b1791..6a74ab33ad1 100644 --- a/components/style/values/specified/length.rs +++ b/components/style/values/specified/length.rs @@ -359,60 +359,6 @@ impl Add for AbsoluteLength { } } -/// Represents a physical length based on DPI. -/// -/// FIXME(emilio): Unship (https://bugzilla.mozilla.org/show_bug.cgi?id=1416564) -#[derive(Clone, Copy, Debug, PartialEq, ToCss)] -#[derive(MallocSizeOf)] -pub enum PhysicalLength { - /// A physical length in millimetres. - #[css(dimension)] - Mozmm(CSSFloat), -} - -impl PhysicalLength { - /// Checks whether the length value is zero. - pub fn is_zero(&self) -> bool { - match *self { - PhysicalLength::Mozmm(v) => v == 0., - } - } - - /// Computes the given character width. - #[cfg(feature = "gecko")] - pub fn to_computed_value(&self, context: &Context) -> CSSPixelLength { - use gecko_bindings::bindings; - use std::f32; - - // Same as Gecko - const INCH_PER_MM: f32 = 1. / 25.4; - - let au_per_physical_inch = unsafe { - bindings::Gecko_GetAppUnitsPerPhysicalInch(context.device().pres_context()) as f32 - }; - - let px_per_physical_inch = au_per_physical_inch / AU_PER_PX; - - let mm = match *self { - PhysicalLength::Mozmm(v) => v, - }; - - let pixel = mm * px_per_physical_inch * INCH_PER_MM; - CSSPixelLength::new(pixel.min(f32::MAX).max(f32::MIN)) - } -} - -impl Mul for PhysicalLength { - type Output = Self ; - - #[inline] - fn mul(self, scalar: CSSFloat) -> Self { - match self { - PhysicalLength::Mozmm(v) => PhysicalLength::Mozmm(v * scalar), - } - } -} - /// A `` without taking `calc` expressions into account /// /// @@ -439,10 +385,6 @@ pub enum NoCalcLength { /// `Stylist::synthesize_rules_for_legacy_attributes()`. #[css(function)] ServoCharacterWidth(CharacterWidth), - - /// A physical length (mozmm) based on DPI - #[cfg(feature = "gecko")] - Physical(PhysicalLength), } impl Mul for NoCalcLength { @@ -455,8 +397,6 @@ impl Mul for NoCalcLength { NoCalcLength::FontRelative(v) => NoCalcLength::FontRelative(v * scalar), NoCalcLength::ViewportPercentage(v) => NoCalcLength::ViewportPercentage(v * scalar), NoCalcLength::ServoCharacterWidth(_) => panic!("Can't multiply ServoCharacterWidth!"), - #[cfg(feature = "gecko")] - NoCalcLength::Physical(v) => NoCalcLength::Physical(v * scalar), } } } @@ -504,8 +444,6 @@ impl NoCalcLength { } Ok(NoCalcLength::ViewportPercentage(ViewportPercentageLength::Vmax(value))) }, - #[cfg(feature = "gecko")] - "mozmm" => Ok(NoCalcLength::Physical(PhysicalLength::Mozmm(value))), _ => Err(()) } } @@ -521,8 +459,6 @@ impl NoCalcLength { pub fn is_zero(&self) -> bool { match *self { NoCalcLength::Absolute(length) => length.is_zero(), - #[cfg(feature = "gecko")] - NoCalcLength::Physical(length) => length.is_zero(), _ => false } } diff --git a/components/style_derive/to_css.rs b/components/style_derive/to_css.rs index 59cc4f4236b..76f8239bcb4 100644 --- a/components/style_derive/to_css.rs +++ b/components/style_derive/to_css.rs @@ -59,11 +59,6 @@ pub fn derive(input: DeriveInput) -> Tokens { }; if variant_attrs.dimension { - // FIXME(emilio): Remove when bug 1416564 lands. - if identifier == "-mozmm" { - identifier = "mozmm".into(); - } - expr = quote! { #expr?; ::std::fmt::Write::write_str(dest, #identifier) diff --git a/ports/geckolib/glue.rs b/ports/geckolib/glue.rs index 8865a0d183e..a8b777d6f86 100644 --- a/ports/geckolib/glue.rs +++ b/ports/geckolib/glue.rs @@ -3163,7 +3163,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetLengthValue( use style::properties::longhands::_moz_script_min_size::SpecifiedValue as MozScriptMinSize; use style::properties::longhands::width::SpecifiedValue as Width; use style::values::specified::MozLength; - use style::values::specified::length::{AbsoluteLength, FontRelativeLength, PhysicalLength}; + use style::values::specified::length::{AbsoluteLength, FontRelativeLength}; use style::values::specified::length::{LengthOrPercentage, NoCalcLength}; let long = get_longhand_from_id!(property); @@ -3174,7 +3174,6 @@ pub extern "C" fn Servo_DeclarationBlock_SetLengthValue( structs::nsCSSUnit::eCSSUnit_Inch => NoCalcLength::Absolute(AbsoluteLength::In(value)), structs::nsCSSUnit::eCSSUnit_Centimeter => NoCalcLength::Absolute(AbsoluteLength::Cm(value)), structs::nsCSSUnit::eCSSUnit_Millimeter => NoCalcLength::Absolute(AbsoluteLength::Mm(value)), - structs::nsCSSUnit::eCSSUnit_PhysicalMillimeter => NoCalcLength::Physical(PhysicalLength::Mozmm(value)), structs::nsCSSUnit::eCSSUnit_Point => NoCalcLength::Absolute(AbsoluteLength::Pt(value)), structs::nsCSSUnit::eCSSUnit_Pica => NoCalcLength::Absolute(AbsoluteLength::Pc(value)), structs::nsCSSUnit::eCSSUnit_Quarter => NoCalcLength::Absolute(AbsoluteLength::Q(value)),