style: Refactor ImportLayer into enum

Refactored ImportLayer into an enum instead of a struct and using
Option everywhere.

Differential Revision: https://phabricator.services.mozilla.com/D176793
This commit is contained in:
CanadaHonk 2023-05-01 21:56:33 +00:00 committed by Martin Robinson
parent 2e713d4366
commit a5b85ec834
4 changed files with 28 additions and 18 deletions

View file

@ -28,6 +28,7 @@ use crate::shared_lock::{Locked, SharedRwLockReadGuard, StylesheetGuards};
use crate::stylesheet_set::{DataValidity, DocumentStylesheetSet, SheetRebuildKind};
use crate::stylesheet_set::{DocumentStylesheetFlusher, SheetCollectionFlusher};
use crate::stylesheets::container_rule::ContainerCondition;
use crate::stylesheets::import_rule::ImportLayer;
use crate::stylesheets::keyframes_rule::KeyframesAnimation;
use crate::stylesheets::layer_rule::{LayerName, LayerOrder};
use crate::stylesheets::viewport_rule::{self, MaybeNew, ViewportRule};
@ -2944,8 +2945,10 @@ impl CascadeData {
self.effective_media_query_results
.saw_effective(import_rule);
}
if let Some(ref layer) = import_rule.layer {
maybe_register_layers(self, layer.name.as_ref(), containing_rule_state);
match import_rule.layer {
ImportLayer::Named(ref name) => maybe_register_layers(self, Some(name), containing_rule_state),
ImportLayer::Anonymous => maybe_register_layers(self, None, containing_rule_state),
ImportLayer::None => {},
}
},
CssRule::Media(ref lock) => {