/rust/registry/src/index.crates.io-1949cf8c6b5b557f/lightningcss-1.0.0-alpha.72/src/properties/outline.rs
Line | Count | Source |
1 | | //! CSS properties related to outlines. |
2 | | |
3 | | use super::border::{BorderSideWidth, GenericBorder, LineStyle}; |
4 | | use super::{Property, PropertyId}; |
5 | | use crate::context::PropertyHandlerContext; |
6 | | use crate::declaration::{DeclarationBlock, DeclarationList}; |
7 | | use crate::error::{ParserError, PrinterError}; |
8 | | use crate::macros::{impl_shorthand, shorthand_handler}; |
9 | | use crate::printer::Printer; |
10 | | use crate::targets::Browsers; |
11 | | use crate::traits::{FallbackValues, IsCompatible, Parse, PropertyHandler, Shorthand, ToCss}; |
12 | | use crate::values::color::CssColor; |
13 | | #[cfg(feature = "visitor")] |
14 | | use crate::visitor::Visit; |
15 | | use cssparser::*; |
16 | | |
17 | | /// A value for the [outline-style](https://drafts.csswg.org/css-ui/#outline-style) property. |
18 | | #[derive(Debug, Clone, PartialEq, Parse, ToCss)] |
19 | 0 | #[cfg_attr(feature = "visitor", derive(Visit))] Unexecuted instantiation: <lightningcss::properties::outline::OutlineStyle as lightningcss::visitor::Visit<lightningcss::parser::DefaultAtRule, fallow_extract::css_metrics::ValueCollector>>::visit_children Unexecuted instantiation: <lightningcss::properties::outline::OutlineStyle as lightningcss::visitor::Visit<lightningcss::parser::DefaultAtRule, fallow_extract::css_metrics::FirstRgbColorCollector>>::visit_children Unexecuted instantiation: <lightningcss::properties::outline::OutlineStyle as lightningcss::visitor::Visit<_, _>>::visit_children |
20 | | #[cfg_attr( |
21 | | feature = "serde", |
22 | | derive(serde::Serialize, serde::Deserialize), |
23 | | serde(tag = "type", content = "value", rename_all = "kebab-case") |
24 | | )] |
25 | | #[cfg_attr(feature = "jsonschema", derive(schemars::JsonSchema))] |
26 | | #[cfg_attr(feature = "into_owned", derive(static_self::IntoOwned))] |
27 | | pub enum OutlineStyle { |
28 | | /// The `auto` keyword. |
29 | | Auto, |
30 | | /// A value equivalent to the `border-style` property. |
31 | | LineStyle(LineStyle), |
32 | | } |
33 | | |
34 | | impl Default for OutlineStyle { |
35 | 89 | fn default() -> OutlineStyle { |
36 | 89 | OutlineStyle::LineStyle(LineStyle::None) |
37 | 89 | } |
38 | | } |
39 | | |
40 | | impl IsCompatible for OutlineStyle { |
41 | 0 | fn is_compatible(&self, _browsers: Browsers) -> bool { |
42 | 0 | true |
43 | 0 | } |
44 | | } |
45 | | |
46 | | /// A value for the [outline](https://drafts.csswg.org/css-ui/#outline) shorthand property. |
47 | | pub type Outline = GenericBorder<OutlineStyle, 11>; |
48 | | |
49 | | impl_shorthand! { |
50 | | Outline(Outline) { |
51 | | width: [OutlineWidth], |
52 | | style: [OutlineStyle], |
53 | | color: [OutlineColor], |
54 | | } |
55 | | } |
56 | | |
57 | | shorthand_handler!(OutlineHandler -> Outline fallbacks: true { |
58 | | width: OutlineWidth(BorderSideWidth), |
59 | | style: OutlineStyle(OutlineStyle), |
60 | | color: OutlineColor(CssColor, fallback: true), |
61 | | }); |