mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
Change predefined type of flex-basis / make gecko glue auto-generate
Gecko doesn't support content value in flex-basis yet.
This commit is contained in:
parent
9e6fce4d36
commit
aa5477bd34
3 changed files with 26 additions and 11 deletions
|
@ -612,12 +612,6 @@ impl Debug for ${style_struct.gecko_struct_name} {
|
||||||
# These have unusual representations in gecko.
|
# These have unusual representations in gecko.
|
||||||
force_stub += ["list-style-type"]
|
force_stub += ["list-style-type"]
|
||||||
|
|
||||||
# These are part of shorthands so we must include them in stylo builds,
|
|
||||||
# but we haven't implemented the stylo glue for the longhand
|
|
||||||
# so we generate a stub
|
|
||||||
force_stub += ["flex-basis", # position
|
|
||||||
]
|
|
||||||
|
|
||||||
# Types used with predefined_type()-defined properties that we can auto-generate.
|
# Types used with predefined_type()-defined properties that we can auto-generate.
|
||||||
predefined_types = {
|
predefined_types = {
|
||||||
"length::LengthOrAuto": impl_style_coord,
|
"length::LengthOrAuto": impl_style_coord,
|
||||||
|
|
|
@ -195,13 +195,16 @@ ${helpers.predefined_type("flex-shrink", "Number",
|
||||||
}
|
}
|
||||||
</%helpers:longhand>
|
</%helpers:longhand>
|
||||||
|
|
||||||
|
// FIXME: Gecko doesn't support content value yet.
|
||||||
// FIXME: This property should be animatable.
|
// FIXME: This property should be animatable.
|
||||||
${helpers.predefined_type("flex-basis",
|
${helpers.predefined_type("flex-basis",
|
||||||
|
"LengthOrPercentageOrAuto" if product == "gecko" else
|
||||||
"LengthOrPercentageOrAutoOrContent",
|
"LengthOrPercentageOrAutoOrContent",
|
||||||
|
"computed::LengthOrPercentageOrAuto::Auto" if product == "gecko" else
|
||||||
"computed::LengthOrPercentageOrAutoOrContent::Auto",
|
"computed::LengthOrPercentageOrAutoOrContent::Auto",
|
||||||
spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property",
|
spec="https://drafts.csswg.org/css-flexbox/#flex-basis-property",
|
||||||
extra_prefixes="webkit",
|
extra_prefixes="webkit",
|
||||||
animatable=False)}
|
animatable=True if product == "gecko" else False)}
|
||||||
|
|
||||||
% for (size, logical) in ALL_SIZES:
|
% for (size, logical) in ALL_SIZES:
|
||||||
<%
|
<%
|
||||||
|
|
|
@ -49,7 +49,12 @@
|
||||||
<%helpers:shorthand name="flex" sub_properties="flex-grow flex-shrink flex-basis" extra_prefixes="webkit"
|
<%helpers:shorthand name="flex" sub_properties="flex-grow flex-shrink flex-basis" extra_prefixes="webkit"
|
||||||
spec="https://drafts.csswg.org/css-flexbox/#flex-property">
|
spec="https://drafts.csswg.org/css-flexbox/#flex-property">
|
||||||
use parser::Parse;
|
use parser::Parse;
|
||||||
use values::specified::{Number, NoCalcLength, LengthOrPercentageOrAutoOrContent};
|
use values::specified::{Number, NoCalcLength};
|
||||||
|
% if product == "gecko":
|
||||||
|
use values::specified::LengthOrPercentageOrAuto;
|
||||||
|
% else:
|
||||||
|
use values::specified::LengthOrPercentageOrAutoOrContent;
|
||||||
|
% endif
|
||||||
|
|
||||||
pub fn parse_flexibility(input: &mut Parser)
|
pub fn parse_flexibility(input: &mut Parser)
|
||||||
-> Result<(Number, Option<Number>),()> {
|
-> Result<(Number, Option<Number>),()> {
|
||||||
|
@ -67,7 +72,12 @@
|
||||||
return Ok(Longhands {
|
return Ok(Longhands {
|
||||||
flex_grow: Number(0.0),
|
flex_grow: Number(0.0),
|
||||||
flex_shrink: Number(0.0),
|
flex_shrink: Number(0.0),
|
||||||
flex_basis: LengthOrPercentageOrAutoOrContent::Auto
|
% if product == "gecko":
|
||||||
|
flex_basis: LengthOrPercentageOrAuto::Auto
|
||||||
|
% else:
|
||||||
|
flex_basis: LengthOrPercentageOrAutoOrContent::Auto
|
||||||
|
% endif
|
||||||
|
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
loop {
|
loop {
|
||||||
|
@ -79,7 +89,11 @@
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if basis.is_none() {
|
if basis.is_none() {
|
||||||
if let Ok(value) = input.try(|i| LengthOrPercentageOrAutoOrContent::parse(context, i)) {
|
% if product == "gecko":
|
||||||
|
if let Ok(value) = input.try(|i| LengthOrPercentageOrAuto::parse(context, i)) {
|
||||||
|
% else:
|
||||||
|
if let Ok(value) = input.try(|i| LengthOrPercentageOrAutoOrContent::parse(context, i)) {
|
||||||
|
% endif
|
||||||
basis = Some(value);
|
basis = Some(value);
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
@ -93,7 +107,11 @@
|
||||||
Ok(Longhands {
|
Ok(Longhands {
|
||||||
flex_grow: grow.unwrap_or(Number(1.0)),
|
flex_grow: grow.unwrap_or(Number(1.0)),
|
||||||
flex_shrink: shrink.unwrap_or(Number(1.0)),
|
flex_shrink: shrink.unwrap_or(Number(1.0)),
|
||||||
flex_basis: basis.unwrap_or(LengthOrPercentageOrAutoOrContent::Length(NoCalcLength::zero()))
|
% if product == "gecko":
|
||||||
|
flex_basis: basis.unwrap_or(LengthOrPercentageOrAuto::Length(NoCalcLength::zero()))
|
||||||
|
% else:
|
||||||
|
flex_basis: basis.unwrap_or(LengthOrPercentageOrAutoOrContent::Length(NoCalcLength::zero()))
|
||||||
|
% endif
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue