mirror of
https://github.com/servo/servo.git
synced 2025-07-22 06:43:40 +01:00
Support prefixed intrinsic size value for flex-basis.
auto() and zero() are used in the parser for flex shorthand property.
This commit is contained in:
parent
3a3bc03eb8
commit
d06af8971d
4 changed files with 38 additions and 16 deletions
|
@ -1090,6 +1090,23 @@
|
|||
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
|
||||
pub struct SpecifiedValue(pub ${length_type});
|
||||
|
||||
% if length_type == "MozLength":
|
||||
impl SpecifiedValue {
|
||||
/// Returns the `auto` value.
|
||||
pub fn auto() -> Self {
|
||||
use values::specified::length::LengthOrPercentageOrAuto;
|
||||
SpecifiedValue(MozLength::LengthOrPercentageOrAuto(LengthOrPercentageOrAuto::Auto))
|
||||
}
|
||||
|
||||
/// Returns a value representing a `0` length.
|
||||
pub fn zero() -> Self {
|
||||
use values::specified::length::{LengthOrPercentageOrAuto, NoCalcLength};
|
||||
SpecifiedValue(MozLength::LengthOrPercentageOrAuto(
|
||||
LengthOrPercentageOrAuto::Length(NoCalcLength::zero())))
|
||||
}
|
||||
}
|
||||
% endif
|
||||
|
||||
#[inline]
|
||||
pub fn get_initial_value() -> computed_value::T {
|
||||
use values::computed::${length_type};
|
||||
|
|
|
@ -134,18 +134,23 @@ ${helpers.predefined_type("order", "Integer", "0",
|
|||
animation_value_type="ComputedValue",
|
||||
spec="https://drafts.csswg.org/css-flexbox/#order-property")}
|
||||
|
||||
// FIXME: Gecko doesn't support content value yet.
|
||||
// FIXME: This property should be animatable.
|
||||
${helpers.predefined_type("flex-basis",
|
||||
"LengthOrPercentageOrAuto" if product == "gecko" else
|
||||
"LengthOrPercentageOrAutoOrContent",
|
||||
"computed::LengthOrPercentageOrAuto::Auto" if product == "gecko" else
|
||||
"computed::LengthOrPercentageOrAutoOrContent::Auto",
|
||||
"parse_non_negative",
|
||||
spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property",
|
||||
extra_prefixes="webkit",
|
||||
animation_value_type="ComputedValue" if product == "gecko" else "none")}
|
||||
|
||||
% if product == "gecko":
|
||||
// FIXME: Gecko doesn't support content value yet.
|
||||
${helpers.gecko_size_type("flex-basis", "MozLength", "auto()",
|
||||
logical=False,
|
||||
spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property",
|
||||
extra_prefixes="webkit",
|
||||
animation_value_type="ComputedValue")}
|
||||
% else:
|
||||
// FIXME: This property should be animatable.
|
||||
${helpers.predefined_type("flex-basis",
|
||||
"LengthOrPercentageOrAutoOrContent",
|
||||
"computed::LengthOrPercentageOrAutoOrContent::Auto",
|
||||
"parse_non_negative",
|
||||
spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property",
|
||||
extra_prefixes="webkit",
|
||||
animation_value_type="none")}
|
||||
% endif
|
||||
% for (size, logical) in ALL_SIZES:
|
||||
<%
|
||||
spec = "https://drafts.csswg.org/css-box/#propdef-%s"
|
||||
|
|
|
@ -78,7 +78,7 @@
|
|||
}
|
||||
}
|
||||
if basis.is_none() {
|
||||
if let Ok(value) = input.try(|input| longhands::flex_basis::parse(context, input)) {
|
||||
if let Ok(value) = input.try(|input| longhands::flex_basis::parse_specified(context, input)) {
|
||||
basis = Some(value);
|
||||
continue
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue