accessibility_tree/style/values/
mod.rs

1use crate::style::errors::PropertyParseError;
2use crate::style::properties::ComputedValues;
3use crate::style::properties::{ComputedValuesForEarlyCascade, ComputedValuesForLateCascade};
4use cssparser::Parser;
5
6mod background;
7mod border;
8mod box_;
9mod color;
10mod fonts;
11mod generic;
12mod length;
13mod writing_modes;
14
15pub use self::{background::*, generic::*};
16pub use self::{border::*, box_::*, color::*, fonts::*, length::*, writing_modes::*};
17
18pub trait Parse: Sized {
19    fn parse<'i, 't>(parser: &mut Parser<'i, 't>) -> Result<Self, PropertyParseError<'i>>;
20}
21
22pub struct CascadeContext<'a> {
23    pub inherited: &'a ComputedValues,
24    pub this: ComputedValuesForLateCascade<'a>,
25}
26
27pub struct EarlyCascadeContext<'a> {
28    pub inherited: &'a ComputedValues,
29    pub this: ComputedValuesForEarlyCascade<'a>,
30}
31
32pub trait SpecifiedValue {
33    type SpecifiedValue;
34}
35
36pub trait FromSpecified: SpecifiedValue {
37    fn from_specified(specified: &Self::SpecifiedValue, context: &CascadeContext) -> Self;
38}
39
40pub trait EarlyFromSpecified: SpecifiedValue {
41    fn early_from_specified(
42        specified: &Self::SpecifiedValue,
43        context: &EarlyCascadeContext,
44    ) -> Self;
45}
46
47#[derive(Copy, Clone, Parse)]
48pub enum CssWideKeyword {
49    Inherit,
50    Initial,
51    Unset,
52}