mirror of
https://github.com/servo/servo.git
synced 2025-08-07 14:35:33 +01:00
style: Update calc() serialization to the spec.
This commit is contained in:
parent
d17f27640b
commit
f8a6eccda2
5 changed files with 89 additions and 25 deletions
|
@ -11,7 +11,7 @@ use values::CSSFloat;
|
|||
use values::animated::ToAnimatedZero;
|
||||
|
||||
/// A computed percentage.
|
||||
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, Default, HasViewportPercentage, PartialEq)]
|
||||
#[derive(Clone, ComputeSquaredDistance, Copy, Debug, Default, HasViewportPercentage, PartialEq, PartialOrd)]
|
||||
#[cfg_attr(feature = "servo", derive(Deserialize, HeapSizeOf, Serialize))]
|
||||
pub struct Percentage(pub CSSFloat);
|
||||
|
||||
|
@ -27,6 +27,12 @@ impl Percentage {
|
|||
pub fn hundred() -> Self {
|
||||
Percentage(1.)
|
||||
}
|
||||
|
||||
/// Returns the absolute value for this percentage.
|
||||
#[inline]
|
||||
pub fn abs(&self) -> Self {
|
||||
Percentage(self.0.abs())
|
||||
}
|
||||
}
|
||||
|
||||
/// https://drafts.csswg.org/css-transitions/#animtype-percentage
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue