mirror of
https://github.com/servo/servo.git
synced 2025-08-07 06:25:32 +01:00
Auto merge of #15896 - canaltinova:flex-basis, r=Manishearth
Change the predefined type of flex-basis and make gecko glue auto-generate Gecko [doesn't support](https://bugzilla.mozilla.org/show_bug.cgi?id=1105111) content value in flex-basis yet. We had to change the predefined type to `LengthOrPercentageOrAuto` in stylo build. --- <!-- Thank you for contributing to Servo! Please replace each `[ ]` by `[X]` when the step is complete, and replace `__` with appropriate data: --> - [X] `./mach build -d` does not report any errors - [X] `./mach test-tidy` does not report any errors - [X] These changes fix [Bug 1331529](https://bugzilla.mozilla.org/show_bug.cgi?id=1331529) <!-- Either: --> - [X] These changes do not require tests because it's stylo glue change. <!-- Pull requests that do not address these steps are welcome, but they will require additional verification as part of the review process. --> <!-- Reviewable:start --> --- This change is [<img src="https://reviewable.io/review_button.svg" height="34" align="absmiddle" alt="Reviewable"/>](https://reviewable.io/reviews/servo/servo/15896) <!-- Reviewable:end -->
This commit is contained in:
commit
8b8eb5e192
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