accessibility_tree/style/properties/
definitions.rs1use crate::style::values::*;
2use cssparser::{Color, RGBA};
3
4type FourSidesAuto = FourSides<SpecifiedLengthOrPercentageOrAuto>;
5type FourSidesAutoPercentage = FourSides<SpecifiedLengthOrPercentage>;
6type FourSidesLineStyle = FourSides<LineStyle>;
7type FourSidesColor = FourSides<Color>;
8type FourSidesLineWidth = FourSides<SpecifiedLineWidth>;
9
10properties! {
11 type Discriminant = u8;
12
13 inherited struct font {
14 @early font_size { "font-size", FontSize, initial = Length { px: 16. } }
15 }
16
17 inherited struct color {
18 color { "color", RGBA, initial = BLACK }
20 }
21
22 reset struct box_ {
23 position { "position", Position, initial = Position::Static }
24 float { "float", Float, initial = Float::None }
25 display { "display", Display, initial = Display::INITIAL }
26 top { "top", LengthOrPercentageOrAuto, initial = LengthOrPercentageOrAuto::Auto }
27 left { "left", LengthOrPercentageOrAuto, initial = LengthOrPercentageOrAuto::Auto }
28 bottom { "bottom", LengthOrPercentageOrAuto, initial = LengthOrPercentageOrAuto::Auto }
29 right { "right", LengthOrPercentageOrAuto, initial = LengthOrPercentageOrAuto::Auto }
30 width { "width", LengthOrPercentageOrAuto, initial = LengthOrPercentageOrAuto::Auto }
31 height { "height", LengthOrPercentageOrAuto, initial = LengthOrPercentageOrAuto::Auto }
32 }
33
34 reset struct margin {
35 margin_top { "margin-top", LengthOrPercentageOrAuto, initial = Length::zero() }
36 margin_left { "margin-left", LengthOrPercentageOrAuto, initial = Length::zero() }
37 margin_bottom { "margin-bottom", LengthOrPercentageOrAuto, initial = Length::zero() }
38 margin_right { "margin-right", LengthOrPercentageOrAuto, initial = Length::zero() }
39 }
40
41 reset struct padding {
42 padding_top { "padding-top", LengthOrPercentage, initial = Length::zero() }
43 padding_left { "padding-left", LengthOrPercentage, initial = Length::zero() }
44 padding_bottom { "padding-bottom", LengthOrPercentage, initial = Length::zero() }
45 padding_right { "padding-right", LengthOrPercentage, initial = Length::zero() }
46 }
47
48 reset struct border {
49 border_top_color { "border-top-color", Color, initial = Color::CurrentColor }
50 border_left_color { "border-left-color", Color, initial = Color::CurrentColor }
51 border_bottom_color { "border-bottom-color", Color, initial = Color::CurrentColor }
52 border_right_color { "border-color-right", Color, initial = Color::CurrentColor }
53
54 border_top_style { "border-top-style", LineStyle, initial = LineStyle::None }
55 border_left_style { "border-left-style", LineStyle, initial = LineStyle::None }
56 border_bottom_style { "border-bottom-style", LineStyle, initial = LineStyle::None }
57 border_right_style { "border-right-style", LineStyle, initial = LineStyle::None }
58
59 border_top_width { "border-top-width", LineWidth, initial = LineWidth::MEDIUM }
60 border_left_width { "border-left-width", LineWidth, initial = LineWidth::MEDIUM }
61 border_bottom_width { "border-bottom-width", LineWidth, initial = LineWidth::MEDIUM }
62 border_right_width { "border-right-width", LineWidth, initial = LineWidth::MEDIUM }
63 }
64
65 reset struct background {
66 background_color { "background-color", Color, initial = Color::RGBA(RGBA::transparent()) }
67 }
68
69 @shorthands {
70 "margin" => FourSidesAuto {
71 top: margin_top,
72 left: margin_left,
73 bottom: margin_bottom,
74 right: margin_right,
75 }
76 "padding" => FourSidesAutoPercentage {
77 top: padding_top,
78 left: padding_left,
79 bottom: padding_bottom,
80 right: padding_right,
81 }
82 "border-style" => FourSidesLineStyle {
83 top: border_top_style,
84 left: border_left_style,
85 bottom: border_bottom_style,
86 right: border_right_style,
87 }
88 "border-color" => FourSidesColor {
89 top: border_top_color,
90 left: border_left_color,
91 bottom: border_bottom_color,
92 right: border_right_color,
93 }
94 "border-width" => FourSidesLineWidth {
95 top: border_top_width,
96 left: border_left_width,
97 bottom: border_bottom_width,
98 right: border_right_width,
99 }
100 "border-top" => BorderSide {
101 style: border_top_style,
102 color: border_top_color,
103 width: border_top_width,
104 }
105 "background" => Background {
106 color: background_color,
107 }
108 }
109}