diff --git a/crates/obscura-render/src/css.rs b/crates/obscura-render/src/css.rs index 4ae95f5..609e6eb 100644 --- a/crates/obscura-render/src/css.rs +++ b/crates/obscura-render/src/css.rs @@ -77,6 +77,7 @@ struct ParsedRule { selector: String, declarations: String, container_condition_id: ContainerConditionId, + layer: Option, } struct Rule { @@ -86,6 +87,7 @@ struct Rule { /// Source order, for breaking specificity ties (later wins). order: usize, container_condition_id: ContainerConditionId, + layer: Option, } struct PseudoRule { @@ -94,6 +96,117 @@ struct PseudoRule { important_decls: String, order: usize, container_condition_id: ContainerConditionId, + layer: Option, +} + +/// A cascade layer's first-declaration position at each nesting level. +/// +/// The terminal (direct declarations in a parent layer) is intentionally not +/// stored. [`compare_layer_order`] treats a shorter prefix as the implicit +/// final sub-layer, matching CSS Cascade 5: normal declarations directly in a +/// layer outrank its nested layers, and the order reverses for `!important`. +#[derive(Clone, Debug, PartialEq, Eq, Hash)] +struct LayerOrder(Vec); + +/// Global author-layer name table for one `Stylesheet` parse. Layer ordering +/// spans all style sources in document order, so this registry must outlive +/// each individual `