Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
206 changes: 61 additions & 145 deletions style/properties/longhands/position.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,127 +75,59 @@ ${helpers.single_keyword(
affects="layout",
)}

% if engine in "servo":
// FIXME: Update Servo to support the same Syntax as Gecko.
${helpers.single_keyword(
"justify-content",
"start flex-start stretch end flex-end center space-between space-around space-evenly",
engines="servo",
servo_pref="layout.flexbox.enabled",
extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-align/#propdef-justify-content",
animation_value_type="discrete",
servo_restyle_damage = "reflow",
affects="layout",
)}
% endif
% if engine == "gecko":
${helpers.predefined_type(
"justify-content",
"JustifyContent",
"specified::JustifyContent(specified::ContentDistribution::normal())",
engines="gecko",
spec="https://drafts.csswg.org/css-align/#propdef-justify-content",
extra_prefixes="webkit",
animation_value_type="discrete",
servo_restyle_damage="reflow",
affects="layout",
)}

${helpers.predefined_type(
"justify-tracks",
"JustifyTracks",
"specified::JustifyTracks::default()",
engines="gecko",
gecko_pref="layout.css.grid-template-masonry-value.enabled",
animation_value_type="discrete",
servo_restyle_damage="reflow",
spec="https://github.com/w3c/csswg-drafts/issues/4650",
affects="layout",
)}
% endif

% if engine == "servo":
// FIXME: Update Servo to support the same Syntax as Gecko.
${helpers.single_keyword(
"align-content",
"stretch start flex-start end flex-end center space-between space-around space-evenly",
engines="servo",
servo_pref="layout.flexbox.enabled",
extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-align/#propdef-align-content",
animation_value_type="discrete",
servo_restyle_damage="reflow",
affects="layout",
)}
${helpers.predefined_type(
"justify-content",
"JustifyContent",
"specified::JustifyContent(specified::ContentDistribution::normal())",
engines="gecko servo",
spec="https://drafts.csswg.org/css-align/#propdef-justify-content",
extra_prefixes="webkit",
animation_value_type="discrete",
servo_restyle_damage="reflow",
affects="layout",
)}

${helpers.single_keyword(
"align-items",
"stretch flex-start flex-end center baseline",
engines="servo",
servo_pref="layout.flexbox.enabled",
extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-flexbox/#align-items-property",
animation_value_type="discrete",
servo_restyle_damage="reflow",
affects="layout",
)}
% endif
% if engine == "gecko":
${helpers.predefined_type(
"align-content",
"AlignContent",
"specified::AlignContent(specified::ContentDistribution::normal())",
engines="gecko",
spec="https://drafts.csswg.org/css-align/#propdef-align-content",
extra_prefixes="webkit",
animation_value_type="discrete",
servo_restyle_damage="reflow",
affects="layout",
)}
${helpers.predefined_type(
"align-content",
"AlignContent",
"specified::AlignContent(specified::ContentDistribution::normal())",
engines="gecko servo",
spec="https://drafts.csswg.org/css-align/#propdef-align-content",
extra_prefixes="webkit",
animation_value_type="discrete",
servo_restyle_damage="reflow",
affects="layout",
)}

${helpers.predefined_type(
"align-tracks",
"AlignTracks",
"specified::AlignTracks::default()",
engines="gecko",
gecko_pref="layout.css.grid-template-masonry-value.enabled",
animation_value_type="discrete",
servo_restyle_damage="reflow",
spec="https://github.com/w3c/csswg-drafts/issues/4650",
affects="layout",
)}
${helpers.predefined_type(
"align-items",
"AlignItems",
"specified::AlignItems::normal()",
engines="gecko servo",
spec="https://drafts.csswg.org/css-align/#propdef-align-items",
extra_prefixes="webkit",
animation_value_type="discrete",
servo_restyle_damage="reflow",
affects="layout",
)}

${helpers.predefined_type(
"align-items",
"AlignItems",
"specified::AlignItems::normal()",
engines="gecko",
spec="https://drafts.csswg.org/css-align/#propdef-align-items",
extra_prefixes="webkit",
animation_value_type="discrete",
servo_restyle_damage="reflow",
affects="layout",
)}
${helpers.predefined_type(
"justify-items",
"JustifyItems",
"computed::JustifyItems::legacy()",
engines="gecko servo",
spec="https://drafts.csswg.org/css-align/#propdef-justify-items",
animation_value_type="discrete",
affects="layout",
)}

${helpers.predefined_type(
"justify-items",
"JustifyItems",
"computed::JustifyItems::legacy()",
engines="gecko",
spec="https://drafts.csswg.org/css-align/#propdef-justify-items",
animation_value_type="discrete",
affects="layout",
)}
% endif

// Flex item properties
${helpers.predefined_type(
"flex-grow",
"NonNegativeNumber",
"From::from(0.0)",
engines="gecko servo",
servo_pref="layout.flexbox.enabled",
spec="https://drafts.csswg.org/css-flexbox/#flex-grow-property",
extra_prefixes="webkit",
animation_value_type="NonNegativeNumber",
Expand All @@ -217,42 +149,26 @@ ${helpers.predefined_type(
)}

// https://drafts.csswg.org/css-align/#align-self-property
% if engine == "servo":
// FIXME: Update Servo to support the same syntax as Gecko.
${helpers.single_keyword(
"align-self",
"auto stretch flex-start flex-end center baseline",
engines="servo",
servo_pref="layout.flexbox.enabled",
extra_prefixes="webkit",
spec="https://drafts.csswg.org/css-flexbox/#propdef-align-self",
animation_value_type="discrete",
servo_restyle_damage = "reflow",
affects="layout",
)}
% endif
% if engine == "gecko":
${helpers.predefined_type(
"align-self",
"AlignSelf",
"specified::AlignSelf(specified::SelfAlignment::auto())",
engines="gecko",
spec="https://drafts.csswg.org/css-align/#align-self-property",
extra_prefixes="webkit",
animation_value_type="discrete",
affects="layout",
)}
${helpers.predefined_type(
"align-self",
"AlignSelf",
"specified::AlignSelf(specified::SelfAlignment::auto())",
engines="gecko servo",
spec="https://drafts.csswg.org/css-align/#align-self-property",
extra_prefixes="webkit",
animation_value_type="discrete",
affects="layout",
)}

${helpers.predefined_type(
"justify-self",
"JustifySelf",
"specified::JustifySelf(specified::SelfAlignment::auto())",
engines="gecko",
spec="https://drafts.csswg.org/css-align/#justify-self-property",
animation_value_type="discrete",
affects="layout",
)}
% endif
${helpers.predefined_type(
"justify-self",
"JustifySelf",
"specified::JustifySelf(specified::SelfAlignment::auto())",
engines="gecko servo",
spec="https://drafts.csswg.org/css-align/#justify-self-property",
animation_value_type="discrete",
affects="layout",
)}

// https://drafts.csswg.org/css-flexbox/#propdef-order
${helpers.predefined_type(
Expand Down
6 changes: 3 additions & 3 deletions style/properties/shorthands/position.mako.rs
Original file line number Diff line number Diff line change
Expand Up @@ -716,7 +716,7 @@

<%helpers:shorthand
name="place-content"
engines="gecko"
engines="gecko servo"
sub_properties="align-content justify-content"
spec="https://drafts.csswg.org/css-align/#propdef-place-content"
>
Expand Down Expand Up @@ -771,7 +771,7 @@

<%helpers:shorthand
name="place-self"
engines="gecko"
engines="gecko servo"
sub_properties="align-self justify-self"
spec="https://drafts.csswg.org/css-align/#place-self-property"
>
Expand Down Expand Up @@ -812,7 +812,7 @@

<%helpers:shorthand
name="place-items"
engines="gecko"
engines="gecko servo"
sub_properties="align-items justify-items"
spec="https://drafts.csswg.org/css-align/#place-items-property"
>
Expand Down
27 changes: 0 additions & 27 deletions style/style_adjuster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -402,29 +402,6 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
}
}

/// This implements an out-of-date spec. The new spec moves the handling of
/// this to layout, which Gecko implements but Servo doesn't.
///
/// See https://github.com/servo/servo/issues/15229
#[cfg(feature = "servo")]
fn adjust_for_alignment(&mut self, layout_parent_style: &ComputedValues) {
use crate::computed_values::align_items::T as AlignItems;
use crate::computed_values::align_self::T as AlignSelf;

if self.style.get_position().clone_align_self() == AlignSelf::Auto &&
!self.style.is_absolutely_positioned()
{
let self_align = match layout_parent_style.get_position().clone_align_items() {
AlignItems::Stretch => AlignSelf::Stretch,
AlignItems::Baseline => AlignSelf::Baseline,
AlignItems::FlexStart => AlignSelf::FlexStart,
AlignItems::FlexEnd => AlignSelf::FlexEnd,
AlignItems::Center => AlignSelf::Center,
};
self.style.mutate_position().set_align_self(self_align);
}
}

/// The initial value of border-*-width may be changed at computed value
/// time.
///
Expand Down Expand Up @@ -990,10 +967,6 @@ impl<'a, 'b: 'a> StyleAdjuster<'a, 'b> {
self.adjust_for_table_text_align();
self.adjust_for_justify_items();
}
#[cfg(feature = "servo")]
{
self.adjust_for_alignment(layout_parent_style);
}
self.adjust_for_border_width();
#[cfg(feature = "gecko")]
self.adjust_for_column_rule_width();
Expand Down
3 changes: 1 addition & 2 deletions style/values/computed/align.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@ use crate::values::computed::{Context, ToComputedValue};
use crate::values::specified;

pub use super::specified::{
AlignContent, AlignItems, AlignTracks, ContentDistribution, JustifyContent, JustifyTracks,
SelfAlignment,
AlignContent, AlignItems, ContentDistribution, JustifyContent, SelfAlignment,
};
pub use super::specified::{AlignSelf, JustifySelf};

Expand Down
6 changes: 1 addition & 5 deletions style/values/computed/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,9 @@ use std::cmp;
use std::f32;
use std::ops::{Add, Sub};

#[cfg(feature = "gecko")]
pub use self::align::{
AlignContent, AlignItems, AlignTracks, JustifyContent, JustifyItems, JustifyTracks,
SelfAlignment,
AlignContent, AlignItems, JustifyContent, JustifyItems, SelfAlignment,
};
#[cfg(feature = "gecko")]
pub use self::align::{AlignSelf, JustifySelf};
pub use self::angle::Angle;
pub use self::animation::{
Expand Down Expand Up @@ -121,7 +118,6 @@ pub use super::specified::ViewportVariant;
pub use super::specified::{BorderStyle, TextDecorationLine};
pub use app_units::Au;

#[cfg(feature = "gecko")]
pub mod align;
pub mod angle;
pub mod animation;
Expand Down
Loading