lightningcss/properties/
outline.rs1use super::border::{BorderSideWidth, GenericBorder, LineStyle};
4use super::{Property, PropertyId};
5use crate::context::PropertyHandlerContext;
6use crate::declaration::{DeclarationBlock, DeclarationList};
7use crate::error::{ParserError, PrinterError};
8use crate::macros::{impl_shorthand, shorthand_handler};
9use crate::printer::Printer;
10use crate::targets::Browsers;
11use crate::traits::{FallbackValues, IsCompatible, Parse, PropertyHandler, Shorthand, ToCss};
12use crate::values::color::CssColor;
13#[cfg(feature = "visitor")]
14use crate::visitor::Visit;
15use cssparser::*;
16
17#[derive(Debug, Clone, PartialEq, Parse, ToCss)]
19#[cfg_attr(feature = "visitor", derive(Visit))]
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))]
27pub enum OutlineStyle {
28 Auto,
30 LineStyle(LineStyle),
32}
33
34impl Default for OutlineStyle {
35 fn default() -> OutlineStyle {
36 OutlineStyle::LineStyle(LineStyle::None)
37 }
38}
39
40impl IsCompatible for OutlineStyle {
41 fn is_compatible(&self, _browsers: Browsers) -> bool {
42 true
43 }
44}
45
46pub type Outline = GenericBorder<OutlineStyle, 11>;
48
49impl_shorthand! {
50 Outline(Outline) {
51 width: [OutlineWidth],
52 style: [OutlineStyle],
53 color: [OutlineColor],
54 }
55}
56
57shorthand_handler!(OutlineHandler -> Outline fallbacks: true {
58 width: OutlineWidth(BorderSideWidth),
59 style: OutlineStyle(OutlineStyle),
60 color: OutlineColor(CssColor, fallback: true),
61});