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
|
@ -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