diff --git a/components/style/values/animated/mod.rs b/components/style/values/animated/mod.rs index 17151a51d171..084dbc8bb6be 100644 --- a/components/style/values/animated/mod.rs +++ b/components/style/values/animated/mod.rs @@ -11,7 +11,6 @@ use app_units::Au; use euclid::{Point2D, Size2D}; use smallvec::SmallVec; -use std::cmp::max; use values::computed::Angle as ComputedAngle; use values::computed::BorderCornerRadius as ComputedBorderCornerRadius; #[cfg(feature = "servo")] @@ -22,7 +21,6 @@ use values::computed::MozLength as ComputedMozLength; use values::computed::NonNegativeLength as ComputedNonNegativeLength; use values::computed::NonNegativeLengthOrPercentage as ComputedNonNegativeLengthOrPercentage; use values::computed::NonNegativeNumber as ComputedNonNegativeNumber; -use values::computed::PositiveInteger as ComputedPositiveInteger; use values::specified::url::SpecifiedUrl; pub mod color; @@ -308,20 +306,6 @@ impl ToAnimatedValue for ComputedNonNegativeLength { } } -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, 1).into() - } -} - impl ToAnimatedValue for ComputedNonNegativeLengthOrPercentage { type AnimatedValue = Self; diff --git a/components/style/values/computed/mod.rs b/components/style/values/computed/mod.rs index 8caed3ad3fe5..c8db13e8b99b 100644 --- a/components/style/values/computed/mod.rs +++ b/components/style/values/computed/mod.rs @@ -18,6 +18,7 @@ use rule_cache::RuleCacheConditions; #[cfg(feature = "servo")] use servo_url::ServoUrl; use std::cell::RefCell; +use std::cmp; use std::f32; use std::fmt::{self, Write}; #[cfg(feature = "servo")] @@ -25,6 +26,7 @@ use std::sync::Arc; use style_traits::{CssWriter, ToCss}; use style_traits::cursor::CursorKind; use super::{CSSFloat, CSSInteger}; +use super::animated::ToAnimatedValue; use super::generics::{GreaterThanOrEqualToOne, NonNegative}; use super::generics::grid::{GridLine as GenericGridLine, TrackBreadth as GenericTrackBreadth}; use super::generics::grid::{TrackSize as GenericTrackSize, TrackList as GenericTrackList}; @@ -511,6 +513,20 @@ impl IntegerOrAuto { /// A wrapper of Integer, but only accept a value >= 1. pub type PositiveInteger = GreaterThanOrEqualToOne; +impl ToAnimatedValue for PositiveInteger { + type AnimatedValue = CSSInteger; + + #[inline] + fn to_animated_value(self) -> Self::AnimatedValue { + self.0 + } + + #[inline] + fn from_animated_value(animated: Self::AnimatedValue) -> Self { + cmp::max(animated, 1).into() + } +} + impl From for PositiveInteger { #[inline] fn from(int: CSSInteger) -> PositiveInteger {