Bug 1374233 - Part 6: Add PositiveInteger and PositiveIntegerOrAuto for column-count.

column-count should be a positive integer or auto.

MozReview-Commit-ID: 9LFvrYo8De5
This commit is contained in:
Boris Chiou 2017-07-20 17:32:56 +08:00
parent 190cd5b952
commit 9d69cb2866
7 changed files with 49 additions and 9 deletions

View file

@ -14,6 +14,7 @@ use values::computed::Angle as ComputedAngle;
use values::computed::GreaterThanOrEqualToOneNumber as ComputedGreaterThanOrEqualToOneNumber;
use values::computed::NonNegativeAu;
use values::computed::NonNegativeNumber as ComputedNonNegativeNumber;
use values::computed::PositiveInteger as ComputedPositiveInteger;
use values::specified::url::SpecifiedUrl;
pub mod effects;
@ -134,6 +135,20 @@ impl ToAnimatedValue for NonNegativeAu {
}
}
impl ToAnimatedValue for ComputedPositiveInteger {
type AnimatedValue = Self;
#[inline]
fn to_animated_value(self) -> Self {
self
}
#[inline]
fn from_animated_value(animated: Self::AnimatedValue) -> Self {
max(animated.0, 0).into()
}
}
/// Returns a value similar to `self` that represents zero.
pub trait ToAnimatedZero: Sized {
/// Returns a value that, when added with an underlying value, will produce the underlying