pub struct ParserContext
{
pub(crate) rule_type: Option<CssRuleType>,
pub(crate) parsing_mode: ParsingMode,
}
impl ParserContext
{
pub(crate) fn new_with_rule_type(context: &ParserContext, rule_type: CssRuleType) -> ParserContext
{
Self
{
rule_type: Some(rule_type),
parsing_mode: context.parsing_mode,
}
}
#[inline(always)]
pub(crate) fn isInPageRule(&self) -> bool
{
self.rule_type.map_or(false, |rule_type| rule_type == CssRuleType::Page)
}
#[inline(always)]
pub(crate) fn isNotInPageRule(&self) -> bool
{
!self.isInPageRule()
}
pub(crate) fn parsing_mode_allows_unitless_lengths(&self) -> bool
{
self.parsing_mode.allows_unitless_lengths()
}
}