mirror of
https://github.com/servo/servo.git
synced 2025-08-01 11:40:30 +01:00
style: Move BorderStyle to border.rs.
Differential Revision: https://phabricator.services.mozilla.com/D12858
This commit is contained in:
parent
374249fa54
commit
fd73f1665a
2 changed files with 42 additions and 41 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue