use super::*;
#[derive(Debug, Clone, PartialEq, Eq)]
pub(crate) enum Position {
Static,
Relative,
Absolute,
Fixed,
Sticky,
Running(RunningElementName),
}
impl Position {
pub(crate) const fn is_running(&self) -> bool {
matches!(self, Self::Running(_))
}
pub(crate) const fn is_out_of_flow_positioned(&self) -> bool {
matches!(self, Self::Absolute | Self::Fixed)
}
pub(crate) const fn is_in_flow_positioned(&self) -> bool {
matches!(self, Self::Relative | Self::Sticky)
}
pub(crate) const fn is_normal_flow(&self) -> bool {
matches!(
self,
Self::Static | Self::Relative | Self::Sticky | Self::Running(_)
)
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum Float {
None,
Left,
Right,
InlineStart,
InlineEnd,
Footnote,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum FloatLayoutRole {
None,
Exclusion,
Footnote,
}
impl Float {
pub(crate) const fn layout_role(self) -> FloatLayoutRole {
match self {
Self::None => FloatLayoutRole::None,
Self::Left | Self::Right | Self::InlineStart | Self::InlineEnd => {
FloatLayoutRole::Exclusion
}
Self::Footnote => FloatLayoutRole::Footnote,
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum Clear {
None,
Left,
Right,
Both,
InlineStart,
InlineEnd,
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub(crate) enum ZIndex {
Auto,
StackLevel(i32),
}
impl ZIndex {
pub(crate) const fn stack_level(self) -> Option<i32> {
match self {
Self::Auto => None,
Self::StackLevel(level) => Some(level),
}
}
pub(crate) const fn establishes_stacking_context(self) -> bool {
matches!(self, Self::StackLevel(_))
}
pub(crate) const fn unwrap_or(self, default: i32) -> i32 {
match self {
Self::Auto => default,
Self::StackLevel(level) => level,
}
}
}