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.
pub type MozTabSize = GenericMozTabSize<NonNegativeNumber, NonNegativeLength>;
/// computed value for the text-emphasis-style property
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub enum TextEmphasisStyle {
/// Keyword value for the text-emphasis-style property (`filled` `open`)
Keyword(KeywordValue),
/// `none`
None,
/// String (will be used only first character) for the text-emphasis-style property
String(String),
}
/// Keyword value for the text-emphasis-style property
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub struct KeywordValue {
/// fill for the text-emphasis-style property
pub fill: FillMode,
/// shape for the text-emphasis-style property
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)]
#[cfg_attr(feature = "servo", derive(ToComputedValue))]
pub enum TextEmphasisStyle {
/// <fill> <shape>
Keyword(KeywordValue),
/// `none`
None,
/// String (will be used only first character) for the text-emphasis-style property
String(String),
}
/// Keyword value for the text-emphasis-style property
#[derive(Clone, Debug, MallocSizeOf, PartialEq, ToCss)]
pub enum KeywordValue {
/// <fill>
Fill(FillMode),
/// <shape>
Shape(ShapeKeyword),
/// <fill> <shape>
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)]
pub enum FillMode {
/// `filled`
Filled,
/// `open`
Open,
}
/// Shape keyword for the text-emphasis-style property
#[derive(Clone, Copy, Debug, Eq, MallocSizeOf, Parse, PartialEq, ToCss)]
pub enum ShapeKeyword {
/// `dot`
Dot,
/// `circle`
Circle,
/// `double-circle`
DoubleCircle,
/// `triangle`
Triangle,
/// `sesame`
Sesame,
}
impl ShapeKeyword {
/// converts fill mode to a unicode char
pub fn char(&self, fill: FillMode) -> &str {
let fill = fill == FillMode::Filled;
match *self {