Permalink
Browse files

style: Move BorderStyle to border.rs.

  • Loading branch information...
emilio committed Nov 30, 2018
1 parent 374249f commit fd73f1665a912ee1aab9e2d2de25f7130db2e214
Showing with 42 additions and 41 deletions.
  1. +41 −0 components/style/values/specified/border.rs
  2. +1 −41 components/style/values/specified/mod.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 {
@@ -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 `<number>` specified value.
///
/// https://drafts.csswg.org/css-values-3/#number-value

0 comments on commit fd73f16

Please sign in to comment.