mirror of
https://github.com/servo/servo.git
synced 2025-08-03 12:40:06 +01:00
Change AnimatedValue for PositiveInteger to CSSInteger
This commit is contained in:
parent
e0b38f9c49
commit
b79dc269f7
2 changed files with 16 additions and 16 deletions
|
@ -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;
|
||||
|
||||
|
|
|
@ -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<CSSInteger>;
|
||||
|
||||
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<CSSInteger> for PositiveInteger {
|
||||
#[inline]
|
||||
fn from(int: CSSInteger) -> PositiveInteger {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue