diff --git a/components/style/values/specified/border.rs b/components/style/values/specified/border.rs index 139e424ffd15..1c79d909b5b9 100644 --- a/components/style/values/specified/border.rs +++ b/components/style/values/specified/border.rs @@ -19,6 +19,47 @@ use cssparser::Parser; use std::fmt::{self, Write}; use style_traits::{CssWriter, ParseError, ToCss}; +/// A specified value for a single side of a `border-style` property. +/// +/// The integer values here correspond to the border conflict resolution rules +/// in CSS 2.1 § 17.6.2.1. Higher values override lower values. +#[allow(missing_docs)] +#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] +#[derive( + Clone, + Copy, + Debug, + Eq, + MallocSizeOf, + Ord, + Parse, + PartialEq, + PartialOrd, + SpecifiedValueInfo, + ToComputedValue, + ToCss, +)] +pub enum BorderStyle { + Hidden = -2, + None = -1, + Inset = 0, + Groove = 1, + Outset = 2, + Ridge = 3, + Dotted = 4, + Dashed = 5, + Solid = 6, + Double = 7, +} + +impl BorderStyle { + /// Whether this border style is either none or hidden. + #[inline] + pub fn none_or_hidden(&self) -> bool { + matches!(*self, BorderStyle::None | BorderStyle::Hidden) + } +} + /// A specified value for a single side of the `border-width` property. #[derive(Clone, Debug, MallocSizeOf, PartialEq, SpecifiedValueInfo, ToCss)] pub enum BorderSideWidth { diff --git a/components/style/values/specified/mod.rs b/components/style/values/specified/mod.rs index 64f0255762da..c185dce80d05 100644 --- a/components/style/values/specified/mod.rs +++ b/components/style/values/specified/mod.rs @@ -34,7 +34,7 @@ pub use self::background::{BackgroundRepeat, BackgroundSize}; pub use self::basic_shape::FillRule; pub use self::border::{BorderCornerRadius, BorderImageSlice, BorderImageWidth}; pub use self::border::{BorderImageRepeat, BorderImageSideWidth}; -pub use self::border::{BorderRadius, BorderSideWidth, BorderSpacing}; +pub use self::border::{BorderRadius, BorderSideWidth, BorderSpacing, BorderStyle}; pub use self::box_::{AnimationIterationCount, AnimationName, Contain, Display}; pub use self::box_::{Appearance, BreakBetween, BreakWithin, Clear, Float}; pub use self::box_::{OverflowClipBox, OverscrollBehavior, Perspective, Resize}; @@ -152,46 +152,6 @@ fn parse_number_with_clamping_mode<'i, 't>( }) } -// The integer values here correspond to the border conflict resolution rules in CSS 2.1 § -// 17.6.2.1. Higher values override lower values. -// -// FIXME(emilio): Should move to border.rs -#[allow(missing_docs)] -#[cfg_attr(feature = "servo", derive(Deserialize, Serialize))] -#[derive( - Clone, - Copy, - Debug, - Eq, - MallocSizeOf, - Ord, - Parse, - PartialEq, - PartialOrd, - SpecifiedValueInfo, - ToComputedValue, - ToCss, -)] -pub enum BorderStyle { - None = -1, - Solid = 6, - Double = 7, - Dotted = 4, - Dashed = 5, - Hidden = -2, - Groove = 1, - Ridge = 3, - Inset = 0, - Outset = 2, -} - -impl BorderStyle { - /// Whether this border style is either none or hidden. - pub fn none_or_hidden(&self) -> bool { - matches!(*self, BorderStyle::None | BorderStyle::Hidden) - } -} - /// A CSS `` specified value. /// /// https://drafts.csswg.org/css-values-3/#number-value