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
This commit is contained in:
Emilio Cobos Álvarez 2022-08-26 10:31:38 +00:00 committed by Martin Robinson
parent b268936308
commit aefbae5f96

View file

@ -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,
}