style: Store a LayerOrder in ApplicableDeclarationBlock

This shouldn't change behavior jut yet.

Differential Revision: https://phabricator.services.mozilla.com/D129380
This commit is contained in:
Emilio Cobos Álvarez 2023-05-27 17:35:10 +02:00 committed by Oriol Brufau
parent 77078dd660
commit 5f2a29659f
2 changed files with 6 additions and 5 deletions

View file

@ -6,6 +6,7 @@
use crate::properties::PropertyDeclarationBlock; use crate::properties::PropertyDeclarationBlock;
use crate::rule_tree::{CascadeLevel, StyleSource}; use crate::rule_tree::{CascadeLevel, StyleSource};
use crate::stylesheets::layer_rule::LayerOrder;
use crate::shared_lock::Locked; use crate::shared_lock::Locked;
use servo_arc::Arc; use servo_arc::Arc;
use smallvec::SmallVec; use smallvec::SmallVec;
@ -72,7 +73,7 @@ pub struct ApplicableDeclarationBlock {
/// The specificity of the selector. /// The specificity of the selector.
pub specificity: u32, pub specificity: u32,
/// The layer order of the selector. /// The layer order of the selector.
pub layer_order: u32, pub layer_order: LayerOrder,
} }
impl ApplicableDeclarationBlock { impl ApplicableDeclarationBlock {
@ -87,13 +88,13 @@ impl ApplicableDeclarationBlock {
source: StyleSource::from_declarations(declarations), source: StyleSource::from_declarations(declarations),
bits: ApplicableDeclarationBits::new(0, level), bits: ApplicableDeclarationBits::new(0, level),
specificity: 0, specificity: 0,
layer_order: 0, layer_order: LayerOrder::first(),
} }
} }
/// Constructs an applicable declaration block from the given components /// Constructs an applicable declaration block from the given components
#[inline] #[inline]
pub fn new(source: StyleSource, source_order: u32, level: CascadeLevel, specificity: u32, layer_order: u32) -> Self { pub fn new(source: StyleSource, source_order: u32, level: CascadeLevel, specificity: u32, layer_order: LayerOrder) -> Self {
ApplicableDeclarationBlock { ApplicableDeclarationBlock {
source, source,
bits: ApplicableDeclarationBits::new(source_order, level), bits: ApplicableDeclarationBits::new(source_order, level),

View file

@ -2184,7 +2184,7 @@ impl CascadeData {
self.rules_source_order, self.rules_source_order,
CascadeLevel::UANormal, CascadeLevel::UANormal,
selector.specificity(), selector.specificity(),
current_layer_order.raw(), current_layer_order,
)); ));
continue; continue;
} }
@ -2767,7 +2767,7 @@ impl Rule {
level: CascadeLevel, level: CascadeLevel,
) -> ApplicableDeclarationBlock { ) -> ApplicableDeclarationBlock {
let source = StyleSource::from_rule(self.style_rule.clone()); let source = StyleSource::from_rule(self.style_rule.clone());
ApplicableDeclarationBlock::new(source, self.source_order, level, self.specificity(), self.layer_order.raw()) ApplicableDeclarationBlock::new(source, self.source_order, level, self.specificity(), self.layer_order)
} }
/// Creates a new Rule. /// Creates a new Rule.