1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
use crate::style::errors::PropertyParseError;
use crate::style::properties::ComputedValues;
use crate::style::properties::{ComputedValuesForEarlyCascade, ComputedValuesForLateCascade};
use cssparser::Parser;

mod background;
mod border;
mod box_;
mod color;
mod fonts;
mod generic;
mod length;
mod writing_modes;

pub use self::{background::*, generic::*};
pub use self::{border::*, box_::*, color::*, fonts::*, length::*, writing_modes::*};

pub trait Parse: Sized {
    fn parse<'i, 't>(parser: &mut Parser<'i, 't>) -> Result<Self, PropertyParseError<'i>>;
}

pub struct CascadeContext<'a> {
    pub inherited: &'a ComputedValues,
    pub this: ComputedValuesForLateCascade<'a>,
}

pub struct EarlyCascadeContext<'a> {
    pub inherited: &'a ComputedValues,
    pub this: ComputedValuesForEarlyCascade<'a>,
}

pub trait SpecifiedValue {
    type SpecifiedValue;
}

pub trait FromSpecified: SpecifiedValue {
    fn from_specified(specified: &Self::SpecifiedValue, context: &CascadeContext) -> Self;
}

pub trait EarlyFromSpecified: SpecifiedValue {
    fn early_from_specified(
        specified: &Self::SpecifiedValue,
        context: &EarlyCascadeContext,
    ) -> Self;
}

#[derive(Copy, Clone, Parse)]
pub enum CssWideKeyword {
    Inherit,
    Initial,
    Unset,
}