mirror of
https://github.com/servo/servo.git
synced 2025-08-06 06:00:15 +01:00
style: Percentage values of translate are serialized as percent for computed values.
Basically, we rewrite the type of generics::transform::Translate and its ToCss to match the spec. Besides, we always serialize Translate by servo, so we could drop a lot of duplicated code. Differential Revision: https://phabricator.services.mozilla.com/D11206
This commit is contained in:
parent
d9453bc0ea
commit
c6ead1dc0e
7 changed files with 127 additions and 34 deletions
|
@ -11,6 +11,7 @@ use crate::values::distance::{ComputeSquaredDistance, SquaredDistance};
|
|||
use crate::values::generics::length::{
|
||||
MaxLength as GenericMaxLength, MozLength as GenericMozLength,
|
||||
};
|
||||
use crate::values::generics::transform::IsZeroLength;
|
||||
use crate::values::generics::NonNegative;
|
||||
use crate::values::specified::length::ViewportPercentageLength;
|
||||
use crate::values::specified::length::{AbsoluteLength, FontBaseSize, FontRelativeLength};
|
||||
|
@ -496,6 +497,17 @@ impl ToComputedValue for specified::LengthOrPercentage {
|
|||
}
|
||||
}
|
||||
|
||||
impl IsZeroLength for LengthOrPercentage {
|
||||
#[inline]
|
||||
fn is_zero_length(&self) -> bool {
|
||||
match *self {
|
||||
LengthOrPercentage::Length(l) => l.0 == 0.0,
|
||||
LengthOrPercentage::Percentage(p) => p.0 == 0.0,
|
||||
LengthOrPercentage::Calc(c) => c.unclamped_length().0 == 0.0 && c.percentage() == 0.0,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#[allow(missing_docs)]
|
||||
#[animate(fallback = "Self::animate_fallback")]
|
||||
#[css(derive_debug)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue