style: Use Rust types for some misc properties.

-moz-tab-size, border-image-outset and border-image-slice.

This is not a particularly interesting patch, just removes some code. We can
remove way more code when a few related properties are also ported.

Differential Revision: https://phabricator.services.mozilla.com/D19825
This commit is contained in:
Emilio Cobos Álvarez 2019-02-14 19:03:04 +01:00
parent eefd440656
commit 6118e4d993
16 changed files with 149 additions and 184 deletions

View file

@ -9,6 +9,8 @@ use super::CustomIdent;
use crate::counter_style::{parse_counter_style_name, Symbols};
use crate::parser::{Parse, ParserContext};
use cssparser::Parser;
use num_traits::Zero;
use std::ops::Add;
use style_traits::{KeywordsCollectFn, ParseError};
use style_traits::{SpecifiedValueInfo, StyleParseErrorKind};
@ -177,6 +179,24 @@ impl SpecifiedValueInfo for CounterStyleOrNone {
#[repr(transparent)]
pub struct NonNegative<T>(pub T);
impl <T: Add<Output = T>> Add<NonNegative<T>> for NonNegative<T> {
type Output = Self;
fn add(self, other: Self) -> Self {
NonNegative(self.0 + other.0)
}
}
impl <T: Zero> Zero for NonNegative<T> {
fn is_zero(&self) -> bool {
self.0.is_zero()
}
fn zero() -> Self {
NonNegative(T::zero())
}
}
/// A wrapper of greater-than-or-equal-to-one values.
#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))]
#[derive(