use bitflags::bitflags;
use style::selector_parser::RestyleDamage;
bitflags! {
#[derive(Clone, Copy, Debug,Default, Eq, PartialEq)]
pub struct LayoutDamage: u16 {
const Repaint = 0b0001;
const RebuildStackingContextTree = 0b0011;
const RecalculateOverflow = 0b0111;
const Relayout = 0b1111;
const RecomputeInlineContentSizes = 0b1000_0000_0000_0000;
const DescendantCollectedAsLayoutRoot = 0b0100_0000_0000_0000;
const DescendantHasBoxDamage = 0b0011_1111_1111_0000;
const BoxDamage = 0b1111_1111_1111_0000;
}
}
impl LayoutDamage {
pub fn only_layout_modes(&self) -> LayoutDamage {
self.intersection(LayoutDamage::Relayout)
}
}
impl From<RestyleDamage> for LayoutDamage {
fn from(restyle_damage: RestyleDamage) -> Self {
LayoutDamage::from_bits_retain(restyle_damage.bits())
}
}
impl From<LayoutDamage> for RestyleDamage {
fn from(layout_damage: LayoutDamage) -> Self {
RestyleDamage::from_bits_retain(layout_damage.bits())
}
}
bitflags! {
#[derive(Clone, Copy, Default, Debug, Eq, PartialEq)]
pub struct AccessibilityDamage: u16 {
const Text = 0b0001;
const Children = 0b0010;
const Subtree = 0b0100;
const Rebuild = 0b1111;
}
}
malloc_size_of::malloc_size_of_is_0!(AccessibilityDamage);