From 6febdf3751d78f3997f9d0dafe94e8568ccea679 Mon Sep 17 00:00:00 2001 From: Dmitry Date: Fri, 9 Mar 2018 00:01:41 +0300 Subject: [PATCH] Add docs for text-emphasis-property values --- components/style/values/computed/text.rs | 7 +++++++ components/style/values/specified/text.rs | 18 ++++++++++++++++++ 2 files changed, 25 insertions(+) diff --git a/components/style/values/computed/text.rs b/components/style/values/computed/text.rs index 37b38a75b55..2238a5d6804 100644 --- a/components/style/values/computed/text.rs +++ b/components/style/values/computed/text.rs @@ -152,15 +152,22 @@ impl TextDecorationsInEffect { /// A specified value for the `-moz-tab-size` property. pub type MozTabSize = GenericMozTabSize; +/// 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, } diff --git a/components/style/values/specified/text.rs b/components/style/values/specified/text.rs index 1559295eeec..23ea5ac4e34 100644 --- a/components/style/values/specified/text.rs +++ b/components/style/values/specified/text.rs @@ -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 { + /// 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(FillMode), + /// Shape(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)] 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 {