mirror of
https://github.com/servo/servo.git
synced 2025-08-03 20:50:07 +01:00
style: Rename AlignJustifyContent to ContentDistribution.
align-content and justify-content will have different types in a second. MozReview-Commit-ID: 5JDeR5kXZNP
This commit is contained in:
parent
da56bdecc6
commit
d4a44de928
6 changed files with 24 additions and 24 deletions
|
@ -69,8 +69,8 @@ ${helpers.single_keyword("flex-wrap", "nowrap wrap wrap-reverse",
|
||||||
animation_value_type="discrete")}
|
animation_value_type="discrete")}
|
||||||
% else:
|
% else:
|
||||||
${helpers.predefined_type(name="justify-content",
|
${helpers.predefined_type(name="justify-content",
|
||||||
type="AlignJustifyContent",
|
type="ContentDistribution",
|
||||||
initial_value="specified::AlignJustifyContent::normal()",
|
initial_value="specified::ContentDistribution::normal()",
|
||||||
spec="https://drafts.csswg.org/css-align/#propdef-justify-content",
|
spec="https://drafts.csswg.org/css-align/#propdef-justify-content",
|
||||||
extra_prefixes="webkit",
|
extra_prefixes="webkit",
|
||||||
animation_value_type="discrete")}
|
animation_value_type="discrete")}
|
||||||
|
@ -90,8 +90,8 @@ ${helpers.single_keyword("flex-wrap", "nowrap wrap wrap-reverse",
|
||||||
animation_value_type="discrete")}
|
animation_value_type="discrete")}
|
||||||
% else:
|
% else:
|
||||||
${helpers.predefined_type(name="align-content",
|
${helpers.predefined_type(name="align-content",
|
||||||
type="AlignJustifyContent",
|
type="ContentDistribution",
|
||||||
initial_value="specified::AlignJustifyContent::normal()",
|
initial_value="specified::ContentDistribution::normal()",
|
||||||
spec="https://drafts.csswg.org/css-align/#propdef-align-content",
|
spec="https://drafts.csswg.org/css-align/#propdef-align-content",
|
||||||
extra_prefixes="webkit",
|
extra_prefixes="webkit",
|
||||||
animation_value_type="discrete")}
|
animation_value_type="discrete")}
|
||||||
|
|
|
@ -615,18 +615,18 @@
|
||||||
<%helpers:shorthand name="place-content" sub_properties="align-content justify-content"
|
<%helpers:shorthand name="place-content" sub_properties="align-content justify-content"
|
||||||
spec="https://drafts.csswg.org/css-align/#propdef-place-content"
|
spec="https://drafts.csswg.org/css-align/#propdef-place-content"
|
||||||
products="gecko">
|
products="gecko">
|
||||||
use values::specified::align::{AlignJustifyContent, FallbackAllowed};
|
use values::specified::align::{ContentDistribution, FallbackAllowed};
|
||||||
|
|
||||||
pub fn parse_value<'i, 't>(
|
pub fn parse_value<'i, 't>(
|
||||||
_: &ParserContext,
|
_: &ParserContext,
|
||||||
input: &mut Parser<'i, 't>,
|
input: &mut Parser<'i, 't>,
|
||||||
) -> Result<Longhands, ParseError<'i>> {
|
) -> Result<Longhands, ParseError<'i>> {
|
||||||
let align = AlignJustifyContent::parse_with_fallback(input, FallbackAllowed::No)?;
|
let align = ContentDistribution::parse_with_fallback(input, FallbackAllowed::No)?;
|
||||||
if align.has_extra_flags() {
|
if align.has_extra_flags() {
|
||||||
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
|
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
|
||||||
}
|
}
|
||||||
let justify =
|
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);
|
.unwrap_or(align);
|
||||||
if justify.has_extra_flags() {
|
if justify.has_extra_flags() {
|
||||||
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
|
return Err(input.new_custom_error(StyleParseErrorKind::UnspecifiedError));
|
||||||
|
|
|
@ -11,7 +11,7 @@ use style_traits::{CssWriter, ToCss};
|
||||||
use values::computed::{Context, ToComputedValue};
|
use values::computed::{Context, ToComputedValue};
|
||||||
use values::specified;
|
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.
|
/// The computed value for the `justify-items` property.
|
||||||
///
|
///
|
||||||
|
|
|
@ -32,7 +32,7 @@ use super::specified;
|
||||||
pub use app_units::Au;
|
pub use app_units::Au;
|
||||||
pub use properties::animated_properties::TransitionProperty;
|
pub use properties::animated_properties::TransitionProperty;
|
||||||
#[cfg(feature = "gecko")]
|
#[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::angle::Angle;
|
||||||
pub use self::background::{BackgroundSize, BackgroundRepeat};
|
pub use self::background::{BackgroundSize, BackgroundRepeat};
|
||||||
pub use self::border::{BorderImageSlice, BorderImageWidth, BorderImageSideWidth};
|
pub use self::border::{BorderImageSlice, BorderImageWidth, BorderImageSideWidth};
|
||||||
|
|
|
@ -117,7 +117,7 @@ const ALIGN_ALL_SHIFT: u32 = structs::NS_STYLE_ALIGN_ALL_SHIFT;
|
||||||
/// <https://drafts.csswg.org/css-align/#content-distribution>
|
/// <https://drafts.csswg.org/css-align/#content-distribution>
|
||||||
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue)]
|
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, PartialEq, ToComputedValue)]
|
||||||
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
|
||||||
pub struct AlignJustifyContent {
|
pub struct ContentDistribution {
|
||||||
primary: AlignFlags,
|
primary: AlignFlags,
|
||||||
fallback: AlignFlags,
|
fallback: AlignFlags,
|
||||||
}
|
}
|
||||||
|
@ -136,7 +136,7 @@ pub enum FallbackAllowed {
|
||||||
No,
|
No,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl AlignJustifyContent {
|
impl ContentDistribution {
|
||||||
/// The initial value 'normal'
|
/// The initial value 'normal'
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn normal() -> Self {
|
pub fn normal() -> Self {
|
||||||
|
@ -184,32 +184,32 @@ impl AlignJustifyContent {
|
||||||
) -> Result<Self, ParseError<'i>> {
|
) -> Result<Self, ParseError<'i>> {
|
||||||
// normal | <baseline-position>
|
// normal | <baseline-position>
|
||||||
if let Ok(value) = input.try(|input| parse_normal_or_baseline(input)) {
|
if let Ok(value) = input.try(|input| parse_normal_or_baseline(input)) {
|
||||||
return Ok(AlignJustifyContent::new(value))
|
return Ok(ContentDistribution::new(value))
|
||||||
}
|
}
|
||||||
|
|
||||||
// <content-distribution> followed by optional <*-position>
|
// <content-distribution> followed by optional <*-position>
|
||||||
if let Ok(value) = input.try(|input| parse_content_distribution(input)) {
|
if let Ok(value) = input.try(|input| parse_content_distribution(input)) {
|
||||||
if fallback_allowed == FallbackAllowed::Yes {
|
if fallback_allowed == FallbackAllowed::Yes {
|
||||||
if let Ok(fallback) = input.try(|input| parse_overflow_content_position(input)) {
|
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 <content-distribution>
|
// <*-position> followed by optional <content-distribution>
|
||||||
let fallback = parse_overflow_content_position(input)?;
|
let fallback = parse_overflow_content_position(input)?;
|
||||||
if fallback_allowed == FallbackAllowed::Yes {
|
if fallback_allowed == FallbackAllowed::Yes {
|
||||||
if let Ok(value) = input.try(|input| parse_content_distribution(input)) {
|
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<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
fn to_css<W>(&self, dest: &mut CssWriter<W>) -> fmt::Result
|
||||||
where
|
where
|
||||||
W: Write,
|
W: Write,
|
||||||
|
@ -227,7 +227,7 @@ impl ToCss for AlignJustifyContent {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
impl Parse for AlignJustifyContent {
|
impl Parse for ContentDistribution {
|
||||||
// normal | <baseline-position> |
|
// normal | <baseline-position> |
|
||||||
// [ <content-distribution> || [ <overflow-position>? && <content-position> ] ]
|
// [ <content-distribution> || [ <overflow-position>? && <content-position> ] ]
|
||||||
fn parse<'i, 't>(_: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
fn parse<'i, 't>(_: &ParserContext, input: &mut Parser<'i, 't>) -> Result<Self, ParseError<'i>> {
|
||||||
|
@ -352,19 +352,19 @@ impl Parse for JustifyItems {
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
impl From<u16> for AlignJustifyContent {
|
impl From<u16> for ContentDistribution {
|
||||||
fn from(bits: u16) -> AlignJustifyContent {
|
fn from(bits: u16) -> ContentDistribution {
|
||||||
let primary =
|
let primary =
|
||||||
AlignFlags::from_bits_truncate((bits & ALIGN_ALL_BITS) as u8);
|
AlignFlags::from_bits_truncate((bits & ALIGN_ALL_BITS) as u8);
|
||||||
let fallback =
|
let fallback =
|
||||||
AlignFlags::from_bits_truncate((bits >> ALIGN_ALL_SHIFT) as u8);
|
AlignFlags::from_bits_truncate((bits >> ALIGN_ALL_SHIFT) as u8);
|
||||||
AlignJustifyContent::with_fallback(primary, fallback)
|
ContentDistribution::with_fallback(primary, fallback)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#[cfg(feature = "gecko")]
|
#[cfg(feature = "gecko")]
|
||||||
impl From<AlignJustifyContent> for u16 {
|
impl From<ContentDistribution> for u16 {
|
||||||
fn from(v: AlignJustifyContent) -> u16 {
|
fn from(v: ContentDistribution) -> u16 {
|
||||||
v.primary().bits() as u16 |
|
v.primary().bits() as u16 |
|
||||||
((v.fallback().bits() as u16) << ALIGN_ALL_SHIFT)
|
((v.fallback().bits() as u16) << ALIGN_ALL_SHIFT)
|
||||||
}
|
}
|
||||||
|
|
|
@ -26,7 +26,7 @@ use values::specified::calc::CalcNode;
|
||||||
pub use properties::animated_properties::TransitionProperty;
|
pub use properties::animated_properties::TransitionProperty;
|
||||||
pub use self::angle::Angle;
|
pub use self::angle::Angle;
|
||||||
#[cfg(feature = "gecko")]
|
#[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::background::{BackgroundRepeat, BackgroundSize};
|
||||||
pub use self::border::{BorderCornerRadius, BorderImageSlice, BorderImageWidth};
|
pub use self::border::{BorderCornerRadius, BorderImageSlice, BorderImageWidth};
|
||||||
pub use self::border::{BorderImageSideWidth, BorderRadius, BorderSideWidth, BorderSpacing};
|
pub use self::border::{BorderImageSideWidth, BorderRadius, BorderSideWidth, BorderSpacing};
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue