From aefbae5f96430249e468a164e4d52dfc222c9159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Fri, 26 Aug 2022 10:31:38 +0000 Subject: [PATCH] style: Improve CSS OM for CSSContainerRule This implements https://github.com/w3c/csswg-drafts/pull/7293, pending a spec resolution, so landing test as tentative for now, but the change makes sense. Differential Revision: https://phabricator.services.mozilla.com/D155602 --- components/style/stylesheets/container_rule.rs | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/components/style/stylesheets/container_rule.rs b/components/style/stylesheets/container_rule.rs index fe103d8986d..bc076ade89c 100644 --- a/components/style/stylesheets/container_rule.rs +++ b/components/style/stylesheets/container_rule.rs @@ -47,6 +47,11 @@ impl ContainerRule { &self.condition.condition } + /// Returns the query name filter. + pub fn container_name(&self) -> &ContainerName { + &self.condition.name + } + /// Measure heap usage. #[cfg(feature = "gecko")] pub fn size_of(&self, guard: &SharedRwLockReadGuard, ops: &mut MallocSizeOfOps) -> usize { @@ -88,10 +93,12 @@ impl ToCssWithGuard for ContainerRule { } /// A container condition and filter, combined. -#[derive(Debug, ToShmem)] +#[derive(Debug, ToShmem, ToCss)] pub struct ContainerCondition { + #[css(skip_if = "ContainerName::is_none")] name: ContainerName, condition: QueryCondition, + #[css(skip)] flags: FeatureFlags, }