mirror of
https://github.com/servo/servo.git
synced 2025-08-03 04:30:10 +01:00
Add support for MaxLength
This builds on the ExtremumLength type from the previous commit.
This commit is contained in:
parent
76de979231
commit
dd4f331603
8 changed files with 154 additions and 11 deletions
|
@ -635,6 +635,7 @@ impl Debug for ${style_struct.gecko_struct_name} {
|
|||
"LengthOrPercentageOrAuto": impl_style_coord,
|
||||
"LengthOrPercentageOrNone": impl_style_coord,
|
||||
"LengthOrNone": impl_style_coord,
|
||||
"MaxLength": impl_style_coord,
|
||||
"MinLength": impl_style_coord,
|
||||
"Number": impl_simple,
|
||||
"Opacity": impl_simple,
|
||||
|
|
|
@ -33,7 +33,7 @@ use values::Either;
|
|||
use values::computed::{Angle, LengthOrPercentageOrAuto, LengthOrPercentageOrNone};
|
||||
use values::computed::{BorderRadiusSize, ClipRect, LengthOrNone};
|
||||
use values::computed::{CalcLengthOrPercentage, Context, LengthOrPercentage};
|
||||
use values::computed::MinLength;
|
||||
use values::computed::{MaxLength, MinLength};
|
||||
use values::computed::position::{HorizontalPosition, Position, VerticalPosition};
|
||||
use values::computed::ToComputedValue;
|
||||
use values::specified::Angle as SpecifiedAngle;
|
||||
|
@ -645,6 +645,20 @@ impl Interpolate for MinLength {
|
|||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-lpcalc
|
||||
impl Interpolate for MaxLength {
|
||||
#[inline]
|
||||
fn interpolate(&self, other: &Self, progress: f64) -> Result<Self, ()> {
|
||||
match (*self, *other) {
|
||||
(MaxLength::LengthOrPercentage(ref this),
|
||||
MaxLength::LengthOrPercentage(ref other)) => {
|
||||
this.interpolate(other, progress).map(MaxLength::LengthOrPercentage)
|
||||
}
|
||||
_ => Err(()),
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-number
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-length
|
||||
impl Interpolate for LineHeight {
|
||||
|
|
|
@ -237,13 +237,21 @@ ${helpers.predefined_type("flex-basis",
|
|||
% endif
|
||||
|
||||
// max-width, max-height, max-block-size, max-inline-size
|
||||
${helpers.predefined_type("max-%s" % size,
|
||||
"LengthOrPercentageOrNone",
|
||||
"computed::LengthOrPercentageOrNone::None",
|
||||
"parse_non_negative",
|
||||
needs_context=False,
|
||||
spec=spec % ("max-%s" % size),
|
||||
animatable=True, logical = logical)}
|
||||
% if product == "gecko":
|
||||
${helpers.predefined_type("max-%s" % size,
|
||||
"MaxLength",
|
||||
"computed::MaxLength::None",
|
||||
spec=spec % ("max-%s" % size),
|
||||
animatable=True, logical = logical)}
|
||||
% else:
|
||||
${helpers.predefined_type("max-%s" % size,
|
||||
"LengthOrPercentageOrNone",
|
||||
"computed::LengthOrPercentageOrNone::None",
|
||||
"parse_non_negative",
|
||||
needs_context=False,
|
||||
spec=spec % ("max-%s" % size),
|
||||
animatable=True, logical = logical)}
|
||||
% endif
|
||||
% endfor
|
||||
|
||||
${helpers.single_keyword("box-sizing",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue