diff --git a/components/style/properties/longhand/position.mako.rs b/components/style/properties/longhand/position.mako.rs index cb666a27f38..e3b2dc0cd2c 100644 --- a/components/style/properties/longhand/position.mako.rs +++ b/components/style/properties/longhand/position.mako.rs @@ -69,8 +69,8 @@ ${helpers.single_keyword("flex-wrap", "nowrap wrap wrap-reverse", animation_value_type="discrete")} % else: ${helpers.predefined_type(name="justify-content", - type="AlignJustifyContent", - initial_value="specified::AlignJustifyContent::normal()", + type="ContentDistribution", + initial_value="specified::ContentDistribution::normal()", spec="https://drafts.csswg.org/css-align/#propdef-justify-content", extra_prefixes="webkit", animation_value_type="discrete")} @@ -90,8 +90,8 @@ ${helpers.single_keyword("flex-wrap", "nowrap wrap wrap-reverse", animation_value_type="discrete")} % else: ${helpers.predefined_type(name="align-content", - type="AlignJustifyContent", - initial_value="specified::AlignJustifyContent::normal()", + type="ContentDistribution", + initial_value="specified::ContentDistribution::normal()", spec="https://drafts.csswg.org/css-align/#propdef-align-content", extra_prefixes="webkit", animation_value_type="discrete")} diff --git a/components/style/properties/shorthand/position.mako.rs b/components/style/properties/shorthand/position.mako.rs index 95a4c183e20..2f5aba1b2b2 100644 --- a/components/style/properties/shorthand/position.mako.rs +++ b/components/style/properties/shorthand/position.mako.rs @@ -615,18 +615,18 @@ <%helpers:shorthand name="place-content" sub_properties="align-content justify-content" spec="https://drafts.csswg.org/css-align/#propdef-place-content" products="gecko"> - use values::specified::align::{AlignJustifyContent, FallbackAllowed}; + use values::specified::align::{ContentDistribution, FallbackAllowed}; pub fn parse_value<'i, 't>( _: &ParserContext, input: &mut Parser<'i, 't>, ) -> Result> { - let align = AlignJustifyContent::parse_with_fallback(input, FallbackAllowed::No)?; + let align = ContentDistribution::parse_with_fallback(input, FallbackAllowed::No)?; if align.has_extra_flags() { return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)); } let justify = - input.try(|input| AlignJustifyContent::parse_with_fallback(input, FallbackAllowed::No)) + input.try(|input| ContentDistribution::parse_with_fallback(input, FallbackAllowed::No)) .unwrap_or(align); if justify.has_extra_flags() { return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError)); diff --git a/components/style/values/computed/align.rs b/components/style/values/computed/align.rs index 85f8f70cb25..54e7fd38bde 100644 --- a/components/style/values/computed/align.rs +++ b/components/style/values/computed/align.rs @@ -11,7 +11,7 @@ use style_traits::{CssWriter, ToCss}; use values::computed::{Context, ToComputedValue}; use values::specified; -pub use super::specified::{AlignItems, AlignJustifyContent, AlignJustifySelf}; +pub use super::specified::{AlignItems, ContentDistribution, AlignJustifySelf}; /// The computed value for the `justify-items` property. /// diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index a559f4fbe87..ae903dc5b89 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -32,7 +32,7 @@ use super::specified; pub use app_units::Au; pub use properties::animated_properties::TransitionProperty; #[cfg(feature = "gecko")] -pub use self::align::{AlignItems, AlignJustifyContent, AlignJustifySelf, JustifyItems}; +pub use self::align::{AlignItems, ContentDistribution, AlignJustifySelf, JustifyItems}; pub use self::angle::Angle; pub use self::background::{BackgroundSize, BackgroundRepeat}; pub use self::border::{BorderImageSlice, BorderImageWidth, BorderImageSideWidth}; diff --git a/components/style/values/specified/align.rs b/components/style/values/specified/align.rs index 77a290dbe2a..62aefb5d546 100644 --- a/components/style/values/specified/align.rs +++ b/components/style/values/specified/align.rs @@ -117,7 +117,7 @@ const ALIGN_ALL_SHIFT: u32 = structs::NS_STYLE_ALIGN_ALL_SHIFT; /// #[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue)] #[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -pub struct AlignJustifyContent { +pub struct ContentDistribution { primary: AlignFlags, fallback: AlignFlags, } @@ -136,7 +136,7 @@ pub enum FallbackAllowed { No, } -impl AlignJustifyContent { +impl ContentDistribution { /// The initial value 'normal' #[inline] pub fn normal() -> Self { @@ -184,32 +184,32 @@ impl AlignJustifyContent { ) -> Result> { // normal | if let Ok(value) = input.try(|input| parse_normal_or_baseline(input)) { - return Ok(AlignJustifyContent::new(value)) + return Ok(ContentDistribution::new(value)) } // followed by optional <*-position> if let Ok(value) = input.try(|input| parse_content_distribution(input)) { if fallback_allowed == FallbackAllowed::Yes { if let Ok(fallback) = input.try(|input| parse_overflow_content_position(input)) { - return Ok(AlignJustifyContent::with_fallback(value, fallback)) + return Ok(ContentDistribution::with_fallback(value, fallback)) } } - return Ok(AlignJustifyContent::new(value)) + return Ok(ContentDistribution::new(value)) } // <*-position> followed by optional let fallback = parse_overflow_content_position(input)?; if fallback_allowed == FallbackAllowed::Yes { if let Ok(value) = input.try(|input| parse_content_distribution(input)) { - return Ok(AlignJustifyContent::with_fallback(value, fallback)) + return Ok(ContentDistribution::with_fallback(value, fallback)) } } - Ok(AlignJustifyContent::new(fallback)) + Ok(ContentDistribution::new(fallback)) } } -impl ToCss for AlignJustifyContent { +impl ToCss for ContentDistribution { fn to_css(&self, dest: &mut CssWriter) -> fmt::Result where W: Write, @@ -227,7 +227,7 @@ impl ToCss for AlignJustifyContent { } -impl Parse for AlignJustifyContent { +impl Parse for ContentDistribution { // normal | | // [ || [ ? && ] ] fn parse<'i, 't>(_: &ParserContext, input: &mut Parser<'i, 't>) -> Result> { @@ -352,19 +352,19 @@ impl Parse for JustifyItems { } #[cfg(feature = "gecko")] -impl From for AlignJustifyContent { - fn from(bits: u16) -> AlignJustifyContent { +impl From for ContentDistribution { + fn from(bits: u16) -> ContentDistribution { let primary = AlignFlags::from_bits_truncate((bits & ALIGN_ALL_BITS) as u8); let fallback = AlignFlags::from_bits_truncate((bits >> ALIGN_ALL_SHIFT) as u8); - AlignJustifyContent::with_fallback(primary, fallback) + ContentDistribution::with_fallback(primary, fallback) } } #[cfg(feature = "gecko")] -impl From for u16 { - fn from(v: AlignJustifyContent) -> u16 { +impl From for u16 { + fn from(v: ContentDistribution) -> u16 { v.primary().bits() as u16 | ((v.fallback().bits() as u16) << ALIGN_ALL_SHIFT) } diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index 4a0ae8f9cbf..237fe5834f1 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -26,7 +26,7 @@ use values::specified::calc::CalcNode; pub use properties::animated_properties::TransitionProperty; pub use self::angle::Angle; #[cfg(feature = "gecko")] -pub use self::align::{AlignItems, AlignJustifyContent, AlignJustifySelf, JustifyItems}; +pub use self::align::{AlignItems, ContentDistribution, AlignJustifySelf, JustifyItems}; pub use self::background::{BackgroundRepeat, BackgroundSize}; pub use self::border::{BorderCornerRadius, BorderImageSlice, BorderImageWidth}; pub use self::border::{BorderImageSideWidth, BorderRadius, BorderSideWidth, BorderSpacing};