pub struct Rule {
pub selector: Selector<SelectorImpl>,
pub hashes: AncestorHashes,
pub source_order: u32,
pub layer_id: LayerId,
pub container_condition_id: ContainerConditionId,
pub style_rule: Arc<Locked<StyleRule>>,
}
Expand description
A rule, that wraps a style rule, but represents a single selector of the rule.
Fields§
§selector: Selector<SelectorImpl>
The selector this struct represents. We store this and the any_{important,normal} booleans inline in the Rule to avoid pointer-chasing when gathering applicable declarations, which can ruin performance when there are a lot of rules.
hashes: AncestorHashes
The ancestor hashes associated with the selector.
source_order: u32
The source order this style rule appears in. Note that we only use three bytes to store this value in ApplicableDeclarationsBlock, so we could repurpose that storage here if we needed to.
layer_id: LayerId
The current layer id of this style rule.
container_condition_id: ContainerConditionId
The current @container rule id.
style_rule: Arc<Locked<StyleRule>>
The actual style rule.
Implementations§
source§impl Rule
impl Rule
sourcepub fn specificity(&self) -> u32
pub fn specificity(&self) -> u32
Returns the specificity of the rule.
sourcepub fn to_applicable_declaration_block(
&self,
level: CascadeLevel,
cascade_data: &CascadeData
) -> ApplicableDeclarationBlock
pub fn to_applicable_declaration_block( &self, level: CascadeLevel, cascade_data: &CascadeData ) -> ApplicableDeclarationBlock
Turns this rule into an ApplicableDeclarationBlock
for the given
cascade level.
sourcepub fn new(
selector: Selector<SelectorImpl>,
hashes: AncestorHashes,
style_rule: Arc<Locked<StyleRule>>,
source_order: u32,
layer_id: LayerId,
container_condition_id: ContainerConditionId
) -> Self
pub fn new( selector: Selector<SelectorImpl>, hashes: AncestorHashes, style_rule: Arc<Locked<StyleRule>>, source_order: u32, layer_id: LayerId, container_condition_id: ContainerConditionId ) -> Self
Creates a new Rule.