Refactor BorderRadius and move it to the border modules

BorderRadius now parses itself reusing Rect<T>.
This commit is contained in:
Anthony Ramine 2017-05-28 11:24:25 +02:00
parent 4144dc74db
commit af3ede418b
20 changed files with 269 additions and 286 deletions

View file

@ -17,7 +17,6 @@ use std::f32::consts::PI;
use std::fmt;
use style_traits::ToCss;
use super::{CSSFloat, CSSInteger, RGBA};
use super::generics::BorderRadiusSize as GenericBorderRadiusSize;
use super::generics::grid::{TrackBreadth as GenericTrackBreadth, TrackSize as GenericTrackSize};
use super::generics::grid::TrackList as GenericTrackList;
use super::specified;
@ -26,6 +25,7 @@ pub use app_units::Au;
pub use cssparser::Color as CSSColor;
pub use self::background::BackgroundSize;
pub use self::border::{BorderImageSlice, BorderImageWidth, BorderImageWidthSide};
pub use self::border::{BorderRadius, BorderRadiusSize};
pub use self::image::{Gradient, GradientItem, ImageLayer, LineDirection, Image, ImageRect};
pub use self::rect::LengthOrNumberRect;
pub use super::{Auto, Either, None_};
@ -462,20 +462,6 @@ impl ComputedValueAsSpecified for specified::AlignJustifyContent {}
impl ComputedValueAsSpecified for specified::AlignJustifySelf {}
impl ComputedValueAsSpecified for specified::BorderStyle {}
/// The computed value of `BorderRadiusSize`
pub type BorderRadiusSize = GenericBorderRadiusSize<LengthOrPercentage>;
impl BorderRadiusSize {
/// Create a null value.
#[inline]
pub fn zero() -> BorderRadiusSize {
let zero = LengthOrPercentage::zero();
GenericBorderRadiusSize(Size2D::new(zero.clone(), zero))
}
}
impl Copy for BorderRadiusSize {}
#[derive(Debug, PartialEq, Clone, Copy)]
#[cfg_attr(feature = "servo", derive(HeapSizeOf))]
#[allow(missing_docs)]