style: Implement CSS round() function

Co-Authored-By: Emilio Cobos Álvarez <emilio@crisal.io>

Differential Revision: https://phabricator.services.mozilla.com/D156742
This commit is contained in:
Connor Pearson 2022-11-05 21:25:16 +00:00 committed by Martin Robinson
parent 17d33183c2
commit 6a4a97ad7c
6 changed files with 649 additions and 117 deletions

View file

@ -17,7 +17,7 @@ use crate::values::{specified, CSSFloat};
use crate::Zero;
use app_units::Au;
use std::fmt::{self, Write};
use std::ops::{Add, AddAssign, Div, Mul, MulAssign, Neg, Sub, SubAssign};
use std::ops::{Add, AddAssign, Div, Mul, MulAssign, Neg, Rem, Sub, SubAssign};
use style_traits::{CSSPixel, CssWriter, ToCss};
pub use super::image::Image;
@ -402,6 +402,15 @@ impl Neg for CSSPixelLength {
}
}
impl Rem for CSSPixelLength {
type Output = Self;
#[inline]
fn rem(self, other: Self) -> Self {
CSSPixelLength::new(self.0 % other.0)
}
}
impl Sub for CSSPixelLength {
type Output = Self;