Add docs for text-emphasis-property values

This commit is contained in:
Dmitry 2018-03-09 00:01:41 +03:00
parent 73113e28dd
commit 6febdf3751
2 changed files with 25 additions and 0 deletions

View file

@ -152,15 +152,22 @@ impl TextDecorationsInEffect {
/// A specified value for the `-moz-tab-size` property. /// A specified value for the `-moz-tab-size` property.
pub type MozTabSize = GenericMozTabSize<NonNegativeNumber, NonNegativeLength>; pub type MozTabSize = GenericMozTabSize<NonNegativeNumber, NonNegativeLength>;
/// computed value for the text-emphasis-style property
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)] #[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub enum TextEmphasisStyle { pub enum TextEmphasisStyle {
/// Keyword value for the text-emphasis-style property (`filled` `open`)
Keyword(KeywordValue), Keyword(KeywordValue),
/// `none`
None, None,
/// String (will be used only first character) for the text-emphasis-style property
String(String), String(String),
} }
/// Keyword value for the text-emphasis-style property
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)] #[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub struct KeywordValue { pub struct KeywordValue {
/// fill for the text-emphasis-style property
pub fill: FillMode, pub fill: FillMode,
/// shape for the text-emphasis-style property
pub shape: ShapeKeyword, pub shape: ShapeKeyword,
} }

View file

@ -518,18 +518,26 @@ impl ToComputedValue for TextAlign {
} }
} }
/// Specified value of text-emphasis-style property.
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)] #[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
#[cfg_attr(feature = "servo", derive(ToComputedValue))] #[cfg_attr(feature = "servo", derive(ToComputedValue))]
pub enum TextEmphasisStyle { pub enum TextEmphasisStyle {
/// <fill> <shape>
Keyword(KeywordValue), Keyword(KeywordValue),
/// `none`
None, None,
/// String (will be used only first character) for the text-emphasis-style property
String(String), String(String),
} }
/// Keyword value for the text-emphasis-style property
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)] #[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub enum KeywordValue { pub enum KeywordValue {
/// <fill>
Fill(FillMode), Fill(FillMode),
/// <shape>
Shape(ShapeKeyword), Shape(ShapeKeyword),
/// <fill> <shape>
FillAndShape(FillMode, ShapeKeyword), FillAndShape(FillMode, ShapeKeyword),
} }
@ -551,22 +559,32 @@ impl KeywordValue {
} }
} }
/// Fill mode for the text-emphasis-style property
#[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, ToCss)] #[derive(Clone, Copy, Debug, MallocSizeOf, Parse, PartialEq, ToCss)]
pub enum FillMode { pub enum FillMode {
/// `filled`
Filled, Filled,
/// `open`
Open, Open,
} }
/// Shape keyword for the text-emphasis-style property
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)] #[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)]
pub enum ShapeKeyword { pub enum ShapeKeyword {
/// `dot`
Dot, Dot,
/// `circle`
Circle, Circle,
/// `double-circle`
DoubleCircle, DoubleCircle,
/// `triangle`
Triangle, Triangle,
/// `sesame`
Sesame, Sesame,
} }
impl ShapeKeyword { impl ShapeKeyword {
/// converts fill mode to a unicode char
pub fn char(&self, fill: FillMode) -> &str { pub fn char(&self, fill: FillMode) -> &str {
let fill = fill == FillMode::Filled; let fill = fill == FillMode::Filled;
match *self { match *self {