mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Combine LengthOrPercentage and Auto into LengthOrPercentageOrAuto for {Min,Max}Length.
This commit is contained in:
parent
323760f47e
commit
95bda2dff9
5 changed files with 54 additions and 80 deletions
|
@ -1241,10 +1241,10 @@ impl Animatable for MinLength {
|
|||
#[inline]
|
||||
fn add_weighted(&self, other: &Self, self_portion: f64, other_portion: f64) -> Result<Self, ()> {
|
||||
match (*self, *other) {
|
||||
(MinLength::LengthOrPercentage(ref this),
|
||||
MinLength::LengthOrPercentage(ref other)) => {
|
||||
(MinLength::LengthOrPercentageOrAuto(ref this),
|
||||
MinLength::LengthOrPercentageOrAuto(ref other)) => {
|
||||
this.add_weighted(other, self_portion, other_portion)
|
||||
.map(MinLength::LengthOrPercentage)
|
||||
.map(MinLength::LengthOrPercentageOrAuto)
|
||||
}
|
||||
_ => Err(()),
|
||||
}
|
||||
|
@ -1253,8 +1253,8 @@ impl Animatable for MinLength {
|
|||
#[inline]
|
||||
fn compute_distance(&self, other: &Self) -> Result<f64, ()> {
|
||||
match (*self, *other) {
|
||||
(MinLength::LengthOrPercentage(ref this),
|
||||
MinLength::LengthOrPercentage(ref other)) => {
|
||||
(MinLength::LengthOrPercentageOrAuto(ref this),
|
||||
MinLength::LengthOrPercentageOrAuto(ref other)) => {
|
||||
this.compute_distance(other)
|
||||
},
|
||||
_ => Err(()),
|
||||
|
@ -1267,10 +1267,10 @@ impl Animatable for MaxLength {
|
|||
#[inline]
|
||||
fn add_weighted(&self, other: &Self, self_portion: f64, other_portion: f64) -> Result<Self, ()> {
|
||||
match (*self, *other) {
|
||||
(MaxLength::LengthOrPercentage(ref this),
|
||||
MaxLength::LengthOrPercentage(ref other)) => {
|
||||
(MaxLength::LengthOrPercentageOrNone(ref this),
|
||||
MaxLength::LengthOrPercentageOrNone(ref other)) => {
|
||||
this.add_weighted(other, self_portion, other_portion)
|
||||
.map(MaxLength::LengthOrPercentage)
|
||||
.map(MaxLength::LengthOrPercentageOrNone)
|
||||
}
|
||||
_ => Err(()),
|
||||
}
|
||||
|
@ -1279,8 +1279,8 @@ impl Animatable for MaxLength {
|
|||
#[inline]
|
||||
fn compute_distance(&self, other: &Self) -> Result<f64, ()> {
|
||||
match (*self, *other) {
|
||||
(MaxLength::LengthOrPercentage(ref this),
|
||||
MaxLength::LengthOrPercentage(ref other)) => {
|
||||
(MaxLength::LengthOrPercentageOrNone(ref this),
|
||||
MaxLength::LengthOrPercentageOrNone(ref other)) => {
|
||||
this.compute_distance(other)
|
||||
},
|
||||
_ => Err(()),
|
||||
|
|
|
@ -164,7 +164,7 @@ ${helpers.predefined_type("flex-basis",
|
|||
% for min_max in ["min", "max"]:
|
||||
<%
|
||||
MinMax = min_max.title()
|
||||
initial = "None" if "max" == min_max else "Auto"
|
||||
initial = "none()" if "max" == min_max else "auto()"
|
||||
%>
|
||||
|
||||
// min-width, min-height, min-block-size, min-inline-size,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue