style: Plumb layer order through ApplicableDeclarationBlock, and make it have an effect

Same, I want to land this separately to see if it affects
micro-benchmarks. If so, we might want to pack the layer order
_somewhere_ (though in this case I'm not sure where, tbh).

With this, layer rules should have an effect on the page. There are
a few things missing before being able to enable them:

 * Fix nested layer order in some cases (when parent layers are declared
   out of order, see the previous commit mentioning this).
 * Some kind of OM representation, perhaps.
 * Tests of course, which are coming in bug 1728722 and bug 1727276.

But this should be enough to allow playing with them.

Depends on D124337

Differential Revision: https://phabricator.services.mozilla.com/D124338
This commit is contained in:
Emilio Cobos Álvarez 2023-05-27 06:05:52 +02:00 committed by Oriol Brufau
parent 93fb8861ae
commit 3dc3fb9412
3 changed files with 10 additions and 5 deletions

View file

@ -148,7 +148,7 @@ where
f(self);
if start != self.rules.len() {
self.rules[start..]
.sort_unstable_by_key(|block| (block.specificity, block.source_order()));
.sort_unstable_by_key(|block| (block.layer_order, block.specificity, block.source_order()));
}
self.context.current_host = old_host;
self.in_sort_scope = false;