use crate::values::computed::length::{NonNegativeLength, NonNegativeLengthPercentage};
use crate::values::computed::{NonNegativeNumber, NonNegativeNumberOrPercentage};
use crate::values::generics::border::{
GenericBorderCornerRadius, GenericBorderImageSideWidth, GenericBorderImageSlice,
GenericBorderRadius, GenericBorderSpacing,
};
use crate::values::generics::rect::Rect;
use crate::values::generics::size::Size2D;
use crate::values::generics::NonNegative;
use crate::Zero;
use app_units::Au;
pub use crate::values::specified::border::BorderImageRepeat;
pub type LineWidth = Au;
pub type BorderSideWidth = Au;
pub type BorderImageWidth = Rect<BorderImageSideWidth>;
pub type BorderImageSideWidth =
GenericBorderImageSideWidth<NonNegativeLengthPercentage, NonNegativeNumber>;
pub type BorderImageSlice = GenericBorderImageSlice<NonNegativeNumberOrPercentage>;
pub type BorderRadius = GenericBorderRadius<NonNegativeLengthPercentage>;
pub type BorderCornerRadius = GenericBorderCornerRadius<NonNegativeLengthPercentage>;
pub type BorderSpacing = GenericBorderSpacing<NonNegativeLength>;
impl BorderImageSideWidth {
#[inline]
pub fn one() -> Self {
GenericBorderImageSideWidth::Number(NonNegative(1.))
}
}
impl BorderImageSlice {
#[inline]
pub fn hundred_percent() -> Self {
GenericBorderImageSlice {
offsets: Rect::all(NonNegativeNumberOrPercentage::hundred_percent()),
fill: false,
}
}
}
impl BorderSpacing {
pub fn zero() -> Self {
GenericBorderSpacing(Size2D::new(
NonNegativeLength::zero(),
NonNegativeLength::zero(),
))
}
pub fn horizontal(&self) -> Au {
Au::from(*self.0.width())
}
pub fn vertical(&self) -> Au {
Au::from(*self.0.height())
}
}