From dc933f311719141c9a95211bfe29718662e55c79 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Mon, 11 Feb 2019 10:59:49 +0000 Subject: [PATCH] Bug 1526736 - Rename MozLength to Size, and MaxLength to MaxSize. r=heycam MozLength is not a very descriptive name. If we're going to use it in both Gecko and Servo we may as well name it something more accurate. I would've chosen `ContentSize` per CSS2[1][2] if it wasn't a lie in presence of box-sizing. I don't have better ideas than `Size`, given that. [1]: https://drafts.csswg.org/css2/visudet.html#propdef-width [2]: https://drafts.csswg.org/css2/box.html#content-width Differential Revision: https://phabricator.services.mozilla.com/D19280 --HG-- extra : moz-landing-system : lando --- servo/components/style/gecko/values.rs | 34 +++--- .../components/style/properties/gecko.mako.rs | 4 +- .../properties/longhands/position.mako.rs | 81 +++++--------- .../style/properties/properties.mako.rs | 12 +-- .../components/style/values/computed/flex.rs | 13 +-- .../style/values/computed/length.rs | 38 +++++-- servo/components/style/values/computed/mod.rs | 2 +- .../style/values/generics/length.rs | 22 ++-- .../components/style/values/specified/flex.rs | 17 +-- .../style/values/specified/length.rs | 101 +++++++++--------- .../components/style/values/specified/mod.rs | 2 +- servo/ports/geckolib/glue.rs | 22 ++-- 12 files changed, 170 insertions(+), 178 deletions(-) diff --git a/servo/components/style/gecko/values.rs b/servo/components/style/gecko/values.rs index ac3495a7504d..33706f705378 100644 --- a/servo/components/style/gecko/values.rs +++ b/servo/components/style/gecko/values.rs @@ -14,7 +14,7 @@ use crate::media_queries::Device; use crate::values::computed::basic_shape::ShapeRadius as ComputedShapeRadius; use crate::values::computed::FlexBasis as ComputedFlexBasis; use crate::values::computed::{Angle, ExtremumLength, Length, LengthPercentage}; -use crate::values::computed::{MaxLength as ComputedMaxLength, MozLength as ComputedMozLength}; +use crate::values::computed::{MaxSize as ComputedMaxSize, Size as ComputedSize}; use crate::values::computed::{NonNegativeLengthPercentage, Percentage}; use crate::values::computed::{Number, NumberOrPercentage}; use crate::values::generics::basic_shape::ShapeRadius; @@ -22,7 +22,7 @@ use crate::values::generics::box_::Perspective; use crate::values::generics::flex::FlexBasis; use crate::values::generics::gecko::ScrollSnapPoint; use crate::values::generics::grid::{TrackBreadth, TrackKeyword}; -use crate::values::generics::length::{LengthPercentageOrAuto, MaxLength, MozLength}; +use crate::values::generics::length::{LengthPercentageOrAuto, MaxSize, Size}; use crate::values::generics::{CounterStyleOrNone, NonNegative}; use crate::values::{Auto, Either, None_, Normal}; use crate::Atom; @@ -91,7 +91,7 @@ impl GeckoStyleCoordConvertible for ComputedFlexBasis { } fn from_gecko_style_coord(coord: &T) -> Option { - if let Some(width) = ComputedMozLength::from_gecko_style_coord(coord) { + if let Some(width) = ComputedSize::from_gecko_style_coord(coord) { return Some(FlexBasis::Width(width)); } @@ -350,43 +350,43 @@ impl GeckoStyleCoordConvertible for ExtremumLength { } } -impl GeckoStyleCoordConvertible for ComputedMozLength { +impl GeckoStyleCoordConvertible for ComputedSize { fn to_gecko_style_coord(&self, coord: &mut T) { match *self { - MozLength::LengthPercentage(ref lpoa) => lpoa.to_gecko_style_coord(coord), - MozLength::Auto => coord.set_value(CoordDataValue::Auto), - MozLength::ExtremumLength(ref e) => e.to_gecko_style_coord(coord), + Size::LengthPercentage(ref lpoa) => lpoa.to_gecko_style_coord(coord), + Size::Auto => coord.set_value(CoordDataValue::Auto), + Size::ExtremumLength(ref e) => e.to_gecko_style_coord(coord), } } fn from_gecko_style_coord(coord: &T) -> Option { if let CoordDataValue::Auto = coord.as_value() { - return Some(MozLength::Auto); + return Some(Size::Auto); } if let Some(lp) = NonNegativeLengthPercentage::from_gecko_style_coord(coord) { - return Some(MozLength::LengthPercentage(lp)); + return Some(Size::LengthPercentage(lp)); } - ExtremumLength::from_gecko_style_coord(coord).map(MozLength::ExtremumLength) + ExtremumLength::from_gecko_style_coord(coord).map(Size::ExtremumLength) } } -impl GeckoStyleCoordConvertible for ComputedMaxLength { +impl GeckoStyleCoordConvertible for ComputedMaxSize { fn to_gecko_style_coord(&self, coord: &mut T) { match *self { - MaxLength::LengthPercentage(ref lpon) => lpon.to_gecko_style_coord(coord), - MaxLength::None => coord.set_value(CoordDataValue::None), - MaxLength::ExtremumLength(ref e) => e.to_gecko_style_coord(coord), + MaxSize::LengthPercentage(ref lpon) => lpon.to_gecko_style_coord(coord), + MaxSize::None => coord.set_value(CoordDataValue::None), + MaxSize::ExtremumLength(ref e) => e.to_gecko_style_coord(coord), } } fn from_gecko_style_coord(coord: &T) -> Option { if let CoordDataValue::None = coord.as_value() { - return Some(MaxLength::None); + return Some(MaxSize::None); } if let Some(lp) = NonNegativeLengthPercentage::from_gecko_style_coord(coord) { - return Some(MaxLength::LengthPercentage(lp)); + return Some(MaxSize::LengthPercentage(lp)); } - ExtremumLength::from_gecko_style_coord(coord).map(MaxLength::ExtremumLength) + ExtremumLength::from_gecko_style_coord(coord).map(MaxSize::ExtremumLength) } } diff --git a/servo/components/style/properties/gecko.mako.rs b/servo/components/style/properties/gecko.mako.rs index 297357446a27..6baae1d9063c 100644 --- a/servo/components/style/properties/gecko.mako.rs +++ b/servo/components/style/properties/gecko.mako.rs @@ -1390,8 +1390,8 @@ impl Clone for ${style_struct.gecko_struct_name} { "LengthOrNormal": impl_style_coord, "LengthPercentage": impl_simple, "LengthPercentageOrAuto": impl_style_coord, - "MaxLength": impl_style_coord, - "MozLength": impl_style_coord, + "MaxSize": impl_style_coord, + "Size": impl_style_coord, "MozScriptMinSize": impl_absolute_length, "MozScriptSizeMultiplier": impl_simple, "NonNegativeLengthPercentage": impl_simple, diff --git a/servo/components/style/properties/longhands/position.mako.rs b/servo/components/style/properties/longhands/position.mako.rs index 2a0f86d056a9..714de149b568 100644 --- a/servo/components/style/properties/longhands/position.mako.rs +++ b/servo/components/style/properties/longhands/position.mako.rs @@ -244,65 +244,40 @@ ${helpers.predefined_type( if logical: spec = "https://drafts.csswg.org/css-logical-props/#propdef-%s" %> - % if product == "gecko": - // width, height, block-size, inline-size - ${helpers.predefined_type( - size, - "MozLength", - "computed::MozLength::auto()", - logical=logical, - logical_group="size", - allow_quirks=not logical, - spec=spec % size, - animation_value_type="MozLength", - flags="GETCS_NEEDS_LAYOUT_FLUSH", - servo_restyle_damage="reflow", - )} - // min-width, min-height, min-block-size, min-inline-size, - ${helpers.predefined_type( - "min-%s" % size, - "MozLength", - "computed::MozLength::auto()", - logical=logical, - logical_group="min-size", - allow_quirks=not logical, - spec=spec % size, - animation_value_type="MozLength", - servo_restyle_damage="reflow", - )} - % else: - // servo versions (no keyword support) - ${helpers.predefined_type( - size, - "NonNegativeLengthPercentageOrAuto", - "computed::NonNegativeLengthPercentageOrAuto::auto()", - spec=spec % size, - logical_group="size", - allow_quirks=not logical, - animation_value_type="ComputedValue", logical = logical, - servo_restyle_damage="reflow", - )} - ${helpers.predefined_type( - "min-%s" % size, - "NonNegativeLengthPercentage", - "computed::NonNegativeLengthPercentage::zero()", - spec=spec % ("min-%s" % size), - logical_group="min-size", - animation_value_type="ComputedValue", - logical=logical, - allow_quirks=not logical, - servo_restyle_damage="reflow", - )} - % endif + // width, height, block-size, inline-size + ${helpers.predefined_type( + size, + "Size", + "computed::Size::auto()", + logical=logical, + logical_group="size", + allow_quirks=not logical, + spec=spec % size, + animation_value_type="Size", + flags="GETCS_NEEDS_LAYOUT_FLUSH", + servo_restyle_damage="reflow", + )} + // min-width, min-height, min-block-size, min-inline-size + ${helpers.predefined_type( + "min-%s" % size, + "Size", + "computed::Size::auto()", + logical=logical, + logical_group="min-size", + allow_quirks=not logical, + spec=spec % size, + animation_value_type="Size", + servo_restyle_damage="reflow", + )} ${helpers.predefined_type( "max-%s" % size, - "MaxLength", - "computed::MaxLength::none()", + "MaxSize", + "computed::MaxSize::none()", logical=logical, logical_group="max-size", allow_quirks=not logical, spec=spec % size, - animation_value_type="MaxLength", + animation_value_type="MaxSize", servo_restyle_damage="reflow", )} % endfor diff --git a/servo/components/style/properties/properties.mako.rs b/servo/components/style/properties/properties.mako.rs index 62d27922ccb1..d818306e96cc 100644 --- a/servo/components/style/properties/properties.mako.rs +++ b/servo/components/style/properties/properties.mako.rs @@ -3016,7 +3016,7 @@ impl ComputedValuesInner { /// Get the logical computed inline size. #[inline] - pub fn content_inline_size(&self) -> computed::NonNegativeLengthPercentageOrAuto { + pub fn content_inline_size(&self) -> computed::Size { let position_style = self.get_position(); if self.writing_mode.is_vertical() { position_style.height @@ -3027,35 +3027,35 @@ impl ComputedValuesInner { /// Get the logical computed block size. #[inline] - pub fn content_block_size(&self) -> computed::NonNegativeLengthPercentageOrAuto { + pub fn content_block_size(&self) -> computed::Size { let position_style = self.get_position(); if self.writing_mode.is_vertical() { position_style.width } else { position_style.height } } /// Get the logical computed min inline size. #[inline] - pub fn min_inline_size(&self) -> computed::NonNegativeLengthPercentage { + pub fn min_inline_size(&self) -> computed::Size { let position_style = self.get_position(); if self.writing_mode.is_vertical() { position_style.min_height } else { position_style.min_width } } /// Get the logical computed min block size. #[inline] - pub fn min_block_size(&self) -> computed::NonNegativeLengthPercentage { + pub fn min_block_size(&self) -> computed::Size { let position_style = self.get_position(); if self.writing_mode.is_vertical() { position_style.min_width } else { position_style.min_height } } /// Get the logical computed max inline size. #[inline] - pub fn max_inline_size(&self) -> computed::MaxLength { + pub fn max_inline_size(&self) -> computed::MaxSize { let position_style = self.get_position(); if self.writing_mode.is_vertical() { position_style.max_height } else { position_style.max_width } } /// Get the logical computed max block size. #[inline] - pub fn max_block_size(&self) -> computed::MaxLength { + pub fn max_block_size(&self) -> computed::MaxSize { let position_style = self.get_position(); if self.writing_mode.is_vertical() { position_style.max_width } else { position_style.max_height } } diff --git a/servo/components/style/values/computed/flex.rs b/servo/components/style/values/computed/flex.rs index a48d78007525..c0c2703732f4 100644 --- a/servo/components/style/values/computed/flex.rs +++ b/servo/components/style/values/computed/flex.rs @@ -4,23 +4,16 @@ //! Computed types for CSS values related to flexbox. +use crate::values::computed::Size; use crate::values::generics::flex::FlexBasis as GenericFlexBasis; -/// The `width` value type. -#[cfg(feature = "servo")] -pub type Width = crate::values::computed::NonNegativeLengthPercentageOrAuto; - -/// The `width` value type. -#[cfg(feature = "gecko")] -pub type Width = crate::values::computed::MozLength; - /// A computed value for the `flex-basis` property. -pub type FlexBasis = GenericFlexBasis; +pub type FlexBasis = GenericFlexBasis; impl FlexBasis { /// `auto` #[inline] pub fn auto() -> Self { - GenericFlexBasis::Width(Width::auto()) + GenericFlexBasis::Width(Size::auto()) } } diff --git a/servo/components/style/values/computed/length.rs b/servo/components/style/values/computed/length.rs index 313b4151d2bd..6cdf359d16a1 100644 --- a/servo/components/style/values/computed/length.rs +++ b/servo/components/style/values/computed/length.rs @@ -8,9 +8,7 @@ use super::{Context, Number, Percentage, ToComputedValue}; use crate::values::animated::ToAnimatedValue; use crate::values::distance::{ComputeSquaredDistance, SquaredDistance}; use crate::values::generics::length as generics; -use crate::values::generics::length::{ - MaxLength as GenericMaxLength, MozLength as GenericMozLength, -}; +use crate::values::generics::length::{MaxSize as GenericMaxSize, Size as GenericSize}; use crate::values::generics::transform::IsZeroLength; use crate::values::generics::NonNegative; use crate::values::specified::length::ViewportPercentageLength; @@ -580,12 +578,36 @@ impl NonNegativeLengthPercentage { } #[cfg(feature = "servo")] -impl MaxLength { +impl MaxSize { /// Convert the computed value into used value. + #[inline] pub fn to_used_value(&self, percentage_basis: Au) -> Option { match *self { - GenericMaxLength::None => None, - GenericMaxLength::LengthPercentage(ref lp) => Some(lp.to_used_value(percentage_basis)), + GenericMaxSize::None => None, + GenericMaxSize::LengthPercentage(ref lp) => Some(lp.to_used_value(percentage_basis)), + } + } +} + +impl Size { + /// Convert the computed value into used value. + #[inline] + #[cfg(feature = "servo")] + pub fn to_used_value(&self, percentage_basis: Au) -> Option { + match *self { + GenericSize::Auto => None, + GenericSize::LengthPercentage(ref lp) => Some(lp.to_used_value(percentage_basis)), + } + } + + /// Returns true if the computed value is absolute 0 or 0%. + #[inline] + pub fn is_definitely_zero(&self) -> bool { + match *self { + GenericSize::Auto => false, + GenericSize::LengthPercentage(ref lp) => lp.is_definitely_zero(), + #[cfg(feature = "gecko")] + GenericSize::ExtremumLength(..) => false, } } } @@ -821,7 +843,7 @@ pub enum ExtremumLength { } /// A computed value for `min-width`, `min-height`, `width` or `height` property. -pub type MozLength = GenericMozLength; +pub type Size = GenericSize; /// A computed value for `max-width` or `min-height` property. -pub type MaxLength = GenericMaxLength; +pub type MaxSize = GenericMaxSize; diff --git a/servo/components/style/values/computed/mod.rs b/servo/components/style/values/computed/mod.rs index ab8edd2b746a..8158e1a16d76 100644 --- a/servo/components/style/values/computed/mod.rs +++ b/servo/components/style/values/computed/mod.rs @@ -62,7 +62,7 @@ pub use self::gecko::ScrollSnapPoint; pub use self::image::{Gradient, GradientItem, Image, ImageLayer, LineDirection, MozImageRect}; pub use self::length::{CSSPixelLength, ExtremumLength, NonNegativeLength}; pub use self::length::{Length, LengthOrNumber, LengthPercentage}; -pub use self::length::{LengthPercentageOrAuto, MaxLength, MozLength}; +pub use self::length::{LengthPercentageOrAuto, MaxSize, Size}; pub use self::length::{NonNegativeLengthPercentage, NonNegativeLengthPercentageOrAuto}; #[cfg(feature = "gecko")] pub use self::list::ListStyleType; diff --git a/servo/components/style/values/generics/length.rs b/servo/components/style/values/generics/length.rs index 61be27e4fd2d..f55db4f52c54 100644 --- a/servo/components/style/values/generics/length.rs +++ b/servo/components/style/values/generics/length.rs @@ -5,6 +5,7 @@ //! Generic types for CSS values related to length. use crate::parser::{Parse, ParserContext}; +#[cfg(feature = "gecko")] use crate::values::computed::ExtremumLength; use cssparser::Parser; use style_traits::ParseError; @@ -76,7 +77,7 @@ impl Parse for LengthPercentageOrAuto /// A generic value for the `width`, `height`, `min-width`, or `min-height` property. /// -/// Unlike `max-width` or `max-height` properties, a MozLength can be `auto`, +/// Unlike `max-width` or `max-height` properties, a Size can be `auto`, /// and cannot be `none`. /// /// Note that it only accepts non-negative values. @@ -95,18 +96,25 @@ impl Parse for LengthPercentageOrAuto ToComputedValue, ToCss, )] -pub enum MozLength { +pub enum Size { LengthPercentage(LengthPercentage), Auto, + #[cfg(feature = "gecko")] #[animation(error)] ExtremumLength(ExtremumLength), } -impl MozLength { +impl Size { /// `auto` value. #[inline] pub fn auto() -> Self { - MozLength::Auto + Size::Auto + } + + /// Returns whether we're the auto value. + #[inline] + pub fn is_auto(&self) -> bool { + matches!(*self, Size::Auto) } } @@ -126,7 +134,7 @@ impl MozLength { ToComputedValue, ToCss, )] -pub enum MaxLength { +pub enum MaxSize { LengthPercentage(LengthPercentage), None, #[cfg(feature = "gecko")] @@ -134,10 +142,10 @@ pub enum MaxLength { ExtremumLength(ExtremumLength), } -impl MaxLength { +impl MaxSize { /// `none` value. #[inline] pub fn none() -> Self { - MaxLength::None + MaxSize::None } } diff --git a/servo/components/style/values/specified/flex.rs b/servo/components/style/values/specified/flex.rs index c0b587c5a790..a1131dbff5f4 100644 --- a/servo/components/style/values/specified/flex.rs +++ b/servo/components/style/values/specified/flex.rs @@ -6,26 +6,19 @@ use crate::parser::{Parse, ParserContext}; use crate::values::generics::flex::FlexBasis as GenericFlexBasis; +use crate::values::specified::Size; use cssparser::Parser; use style_traits::ParseError; -/// The `width` value type. -#[cfg(feature = "servo")] -pub type Width = crate::values::specified::NonNegativeLengthPercentageOrAuto; - -/// The `width` value type. -#[cfg(feature = "gecko")] -pub type Width = crate::values::specified::MozLength; - /// A specified value for the `flex-basis` property. -pub type FlexBasis = GenericFlexBasis; +pub type FlexBasis = GenericFlexBasis; impl Parse for FlexBasis { fn parse<'i, 't>( context: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result> { - if let Ok(width) = input.try(|i| Width::parse(context, i)) { + if let Ok(width) = input.try(|i| Size::parse(context, i)) { return Ok(GenericFlexBasis::Width(width)); } try_match_ident_ignore_ascii_case! { input, @@ -38,12 +31,12 @@ impl FlexBasis { /// `auto` #[inline] pub fn auto() -> Self { - GenericFlexBasis::Width(Width::auto()) + GenericFlexBasis::Width(Size::auto()) } /// `0%` #[inline] pub fn zero_percent() -> Self { - GenericFlexBasis::Width(Width::zero_percent()) + GenericFlexBasis::Width(Size::zero_percent()) } } diff --git a/servo/components/style/values/specified/length.rs b/servo/components/style/values/specified/length.rs index 9da179900787..597aa990f0ce 100644 --- a/servo/components/style/values/specified/length.rs +++ b/servo/components/style/values/specified/length.rs @@ -9,11 +9,9 @@ use super::{AllowQuirks, Number, Percentage, ToComputedValue}; use crate::font_metrics::FontMetricsQueryResult; use crate::parser::{Parse, ParserContext}; -use crate::values::computed::{self, CSSPixelLength, Context, ExtremumLength}; +use crate::values::computed::{self, CSSPixelLength, Context}; use crate::values::generics::length as generics; -use crate::values::generics::length::{ - MaxLength as GenericMaxLength, MozLength as GenericMozLength, -}; +use crate::values::generics::length::{MaxSize as GenericMaxSize, Size as GenericSize}; use crate::values::generics::transform::IsZeroLength; use crate::values::generics::NonNegative; use crate::values::specified::calc::CalcNode; @@ -1051,56 +1049,18 @@ impl LengthOrNumber { } /// A specified value for `min-width`, `min-height`, `width` or `height` property. -pub type MozLength = GenericMozLength; +pub type Size = GenericSize; -impl Parse for MozLength { +impl Parse for Size { fn parse<'i, 't>( context: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result> { - MozLength::parse_quirky(context, input, AllowQuirks::No) + Size::parse_quirky(context, input, AllowQuirks::No) } } -impl MozLength { - /// Parses, with quirks. - pub fn parse_quirky<'i, 't>( - context: &ParserContext, - input: &mut Parser<'i, 't>, - allow_quirks: AllowQuirks, - ) -> Result> { - if let Ok(l) = input.try(ExtremumLength::parse) { - return Ok(GenericMozLength::ExtremumLength(l)); - } - - if input.try(|i| i.expect_ident_matching("auto")).is_ok() { - return Ok(GenericMozLength::Auto); - } - - let length = NonNegativeLengthPercentage::parse_quirky(context, input, allow_quirks)?; - Ok(GenericMozLength::LengthPercentage(length)) - } - - /// Returns `0%`. - #[inline] - pub fn zero_percent() -> Self { - GenericMozLength::LengthPercentage(NonNegativeLengthPercentage::zero_percent()) - } -} - -/// A specified value for `max-width` or `max-height` property. -pub type MaxLength = GenericMaxLength; - -impl Parse for MaxLength { - fn parse<'i, 't>( - context: &ParserContext, - input: &mut Parser<'i, 't>, - ) -> Result> { - MaxLength::parse_quirky(context, input, AllowQuirks::No) - } -} - -impl MaxLength { +impl Size { /// Parses, with quirks. pub fn parse_quirky<'i, 't>( context: &ParserContext, @@ -1109,16 +1069,57 @@ impl MaxLength { ) -> Result> { #[cfg(feature = "gecko")] { - if let Ok(l) = input.try(ExtremumLength::parse) { - return Ok(GenericMaxLength::ExtremumLength(l)); + if let Ok(l) = input.try(computed::ExtremumLength::parse) { + return Ok(GenericSize::ExtremumLength(l)); + } + } + + if input.try(|i| i.expect_ident_matching("auto")).is_ok() { + return Ok(GenericSize::Auto); + } + + let length = NonNegativeLengthPercentage::parse_quirky(context, input, allow_quirks)?; + Ok(GenericSize::LengthPercentage(length)) + } + + /// Returns `0%`. + #[inline] + pub fn zero_percent() -> Self { + GenericSize::LengthPercentage(NonNegativeLengthPercentage::zero_percent()) + } +} + +/// A specified value for `max-width` or `max-height` property. +pub type MaxSize = GenericMaxSize; + +impl Parse for MaxSize { + fn parse<'i, 't>( + context: &ParserContext, + input: &mut Parser<'i, 't>, + ) -> Result> { + MaxSize::parse_quirky(context, input, AllowQuirks::No) + } +} + +impl MaxSize { + /// Parses, with quirks. + pub fn parse_quirky<'i, 't>( + context: &ParserContext, + input: &mut Parser<'i, 't>, + allow_quirks: AllowQuirks, + ) -> Result> { + #[cfg(feature = "gecko")] + { + if let Ok(l) = input.try(computed::ExtremumLength::parse) { + return Ok(GenericMaxSize::ExtremumLength(l)); } } if input.try(|i| i.expect_ident_matching("none")).is_ok() { - return Ok(GenericMaxLength::None); + return Ok(GenericMaxSize::None); } let length = NonNegativeLengthPercentage::parse_quirky(context, input, allow_quirks)?; - Ok(GenericMaxLength::LengthPercentage(length)) + Ok(GenericMaxSize::LengthPercentage(length)) } } diff --git a/servo/components/style/values/specified/mod.rs b/servo/components/style/values/specified/mod.rs index b37d2554c34a..a9582e90307d 100644 --- a/servo/components/style/values/specified/mod.rs +++ b/servo/components/style/values/specified/mod.rs @@ -59,7 +59,7 @@ pub use self::image::{GradientItem, GradientKind, Image, ImageLayer, MozImageRec pub use self::length::{AbsoluteLength, CalcLengthPercentage, CharacterWidth}; pub use self::length::{FontRelativeLength, Length, LengthOrNumber}; pub use self::length::{LengthPercentage, LengthPercentageOrAuto}; -pub use self::length::{MaxLength, MozLength}; +pub use self::length::{MaxSize, Size}; pub use self::length::{NoCalcLength, ViewportPercentageLength}; pub use self::length::{NonNegativeLengthPercentage, NonNegativeLengthPercentageOrAuto}; #[cfg(feature = "gecko")] diff --git a/servo/ports/geckolib/glue.rs b/servo/ports/geckolib/glue.rs index 7693c32f3bcc..fce989701e68 100644 --- a/servo/ports/geckolib/glue.rs +++ b/servo/ports/geckolib/glue.rs @@ -4434,7 +4434,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetPixelValue( ) { use style::properties::longhands::border_spacing::SpecifiedValue as BorderSpacing; use style::properties::{LonghandId, PropertyDeclaration}; - use style::values::generics::length::MozLength; + use style::values::generics::length::Size; use style::values::generics::NonNegative; use style::values::generics::length::LengthPercentageOrAuto; use style::values::specified::length::NonNegativeLengthPercentage; @@ -4447,8 +4447,8 @@ pub extern "C" fn Servo_DeclarationBlock_SetPixelValue( let lp = LengthPercentage::Length(nocalc); let lp_or_auto = LengthPercentageOrAuto::LengthPercentage(lp.clone()); let prop = match_wrap_declared! { long, - Height => MozLength::LengthPercentage(NonNegative(lp)), - Width => MozLength::LengthPercentage(NonNegative(lp)), + Height => Size::LengthPercentage(NonNegative(lp)), + Width => Size::LengthPercentage(NonNegative(lp)), BorderTopWidth => BorderSideWidth::Length(nocalc.into()), BorderRightWidth => BorderSideWidth::Length(nocalc.into()), BorderBottomWidth => BorderSideWidth::Length(nocalc.into()), @@ -4497,7 +4497,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetLengthValue( use style::properties::longhands::_moz_script_min_size::SpecifiedValue as MozScriptMinSize; use style::properties::{LonghandId, PropertyDeclaration}; use style::values::generics::NonNegative; - use style::values::generics::length::MozLength; + use style::values::generics::length::Size; use style::values::specified::length::NoCalcLength; use style::values::specified::length::{AbsoluteLength, FontRelativeLength}; use style::values::specified::length::LengthPercentage; @@ -4525,7 +4525,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetLengthValue( }; let prop = match_wrap_declared! { long, - Width => MozLength::LengthPercentage(NonNegative(LengthPercentage::Length(nocalc))), + Width => Size::LengthPercentage(NonNegative(LengthPercentage::Length(nocalc))), FontSize => LengthPercentage::from(nocalc).into(), MozScriptMinSize => MozScriptMinSize(nocalc), }; @@ -4565,7 +4565,7 @@ pub extern "C" fn Servo_DeclarationBlock_SetPercentValue( use style::properties::{LonghandId, PropertyDeclaration}; use style::values::computed::Percentage; use style::values::generics::NonNegative; - use style::values::generics::length::{MozLength, LengthPercentageOrAuto}; + use style::values::generics::length::{Size, LengthPercentageOrAuto}; use style::values::specified::length::LengthPercentage; let long = get_longhand_from_id!(property); @@ -4574,8 +4574,8 @@ pub extern "C" fn Servo_DeclarationBlock_SetPercentValue( let lp_or_auto = LengthPercentageOrAuto::LengthPercentage(lp.clone()); let prop = match_wrap_declared! { long, - Height => MozLength::LengthPercentage(NonNegative(lp)), - Width => MozLength::LengthPercentage(NonNegative(lp)), + Height => Size::LengthPercentage(NonNegative(lp)), + Width => Size::LengthPercentage(NonNegative(lp)), MarginTop => lp_or_auto, MarginRight => lp_or_auto, MarginBottom => lp_or_auto, @@ -4593,14 +4593,14 @@ pub extern "C" fn Servo_DeclarationBlock_SetAutoValue( property: nsCSSPropertyID, ) { use style::properties::{LonghandId, PropertyDeclaration}; - use style::values::generics::length::{LengthPercentageOrAuto, MozLength}; + use style::values::generics::length::{LengthPercentageOrAuto, Size}; let long = get_longhand_from_id!(property); let auto = LengthPercentageOrAuto::Auto; let prop = match_wrap_declared! { long, - Height => MozLength::auto(), - Width => MozLength::auto(), + Height => Size::auto(), + Width => Size::auto(), MarginTop => auto, MarginRight => auto, MarginBottom => auto,