pub struct CompactLayoutCache {
pub tier1_enums: Vec<u64>,
pub tier2_dims: Vec<CompactNodeProps>,
pub tier2_cold: Vec<CompactNodePropsCold>,
pub tier2b_text: Vec<CompactTextProps>,
pub font_dirty_nodes: Vec<usize>,
pub prev_font_hashes: Vec<u64>,
pub font_hash_to_families: BTreeMap<u64, StyleFontFamilyVec>,
pub dom_declared_flags: u32,
}Expand description
Overflow properties that couldn’t fit in Tier 1/2 encoding.
Contains the original CssProperty values for properties that:
- Have calc() expressions
- Exceed the numeric range of compact encoding
- Are rare CSS properties (grid, transforms, etc.) Three-tier compact layout property cache.
Allocated once per restyle, indexed by node index (same as NodeId). Provides O(1) array-indexed access to all layout properties.
Non-compact properties (background, box-shadow, transform, etc.) are
resolved via the slow cascade path in CssPropertyCache::get_property_slow().
Fields§
§tier1_enums: Vec<u64>Tier 1: ALL enum properties bitpacked into u64 per node (8 B/node)
tier2_dims: Vec<CompactNodeProps>Tier 2 hot: Layout-critical numeric dimensions per node (68 B/node)
tier2_cold: Vec<CompactNodePropsCold>Tier 2 cold: Paint-only properties per node (28 B/node)
tier2b_text: Vec<CompactTextProps>Tier 2b: Text/IFC properties per node (24 B/node)
font_dirty_nodes: Vec<usize>Indices of nodes whose font_family_hash changed since the last frame.
Enables per-node font dirty tracking instead of the global all-or-nothing
font_stacks_hash XOR approach. When this list is non-empty, only the
font chains for these specific nodes need to be re-resolved, avoiding O(N)
re-resolution when a single node’s font-family changes.
Populated during build_compact_cache() by comparing each node’s
font_family_hash against prev_font_hashes.
prev_font_hashes: Vec<u64>Previous frame’s per-node font_family_hash values.
Stored after each compact cache build so that the next build can detect which specific nodes’ font-family changed (rather than relying on a collision-prone global XOR hash).
font_hash_to_families: BTreeMap<u64, StyleFontFamilyVec>Reverse map: font_family_hash (u64) → actual StyleFontFamilyVec.
Populated during build_compact_cache() as a byproduct of hash computation.
Consumers use this to look up font family names from the compact cache hash
without going through get_property_slow() (which fails for inherited values
on text nodes).
dom_declared_flags: u32Bitfield tracking which rare text props are declared anywhere in the DOM.
Built once during build_compact_cache_with_inheritance. When a bit is
clear, callers (e.g. translate_to_text3_constraints) can skip the
cascade walk for that property — its slow path would always return
None and fall back to the default. See DOM_HAS_* constants.
Implementations§
Source§impl CompactLayoutCache
impl CompactLayoutCache
Sourcepub fn with_capacity(node_count: usize) -> Self
pub fn with_capacity(node_count: usize) -> Self
Create a cache pre-allocated for node_count nodes, filled with defaults.
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Number of nodes in this cache.
pub fn get_display(&self, node_idx: usize) -> LayoutDisplay
pub fn get_position(&self, node_idx: usize) -> LayoutPosition
pub fn get_float(&self, node_idx: usize) -> LayoutFloat
pub fn get_overflow_x(&self, node_idx: usize) -> LayoutOverflow
pub fn get_overflow_y(&self, node_idx: usize) -> LayoutOverflow
pub fn get_box_sizing(&self, node_idx: usize) -> LayoutBoxSizing
pub fn get_flex_direction(&self, node_idx: usize) -> LayoutFlexDirection
pub fn get_flex_wrap(&self, node_idx: usize) -> LayoutFlexWrap
pub fn get_justify_content(&self, node_idx: usize) -> LayoutJustifyContent
pub fn get_align_items(&self, node_idx: usize) -> LayoutAlignItems
pub fn get_align_content(&self, node_idx: usize) -> LayoutAlignContent
pub fn get_writing_mode(&self, node_idx: usize) -> LayoutWritingMode
pub fn get_clear(&self, node_idx: usize) -> LayoutClear
pub fn get_font_weight(&self, node_idx: usize) -> StyleFontWeight
pub fn get_font_style(&self, node_idx: usize) -> StyleFontStyle
pub fn get_text_align(&self, node_idx: usize) -> StyleTextAlign
pub fn get_visibility(&self, node_idx: usize) -> StyleVisibility
pub fn get_white_space(&self, node_idx: usize) -> StyleWhiteSpace
pub fn get_direction(&self, node_idx: usize) -> StyleDirection
pub fn get_vertical_align(&self, node_idx: usize) -> StyleVerticalAlign
pub fn get_border_collapse(&self, node_idx: usize) -> StyleBorderCollapse
Sourcepub fn get_width_raw(&self, node_idx: usize) -> u32
pub fn get_width_raw(&self, node_idx: usize) -> u32
Get width as encoded u32 (use decode_pixel_value_u32 or check sentinel).
pub fn get_height_raw(&self, node_idx: usize) -> u32
pub fn get_min_width_raw(&self, node_idx: usize) -> u32
pub fn get_max_width_raw(&self, node_idx: usize) -> u32
pub fn get_min_height_raw(&self, node_idx: usize) -> u32
pub fn get_max_height_raw(&self, node_idx: usize) -> u32
pub fn get_font_size_raw(&self, node_idx: usize) -> u32
pub fn get_flex_basis_raw(&self, node_idx: usize) -> u32
Sourcepub fn get_padding_top(&self, node_idx: usize) -> Option<f32>
pub fn get_padding_top(&self, node_idx: usize) -> Option<f32>
Get padding-top as resolved px. Returns None if sentinel (needs slow path).
pub fn get_padding_right(&self, node_idx: usize) -> Option<f32>
pub fn get_padding_bottom(&self, node_idx: usize) -> Option<f32>
pub fn get_padding_left(&self, node_idx: usize) -> Option<f32>
pub fn get_margin_top(&self, node_idx: usize) -> Option<f32>
pub fn get_margin_right(&self, node_idx: usize) -> Option<f32>
pub fn get_margin_bottom(&self, node_idx: usize) -> Option<f32>
pub fn get_margin_left(&self, node_idx: usize) -> Option<f32>
Sourcepub fn is_margin_top_auto(&self, node_idx: usize) -> bool
pub fn is_margin_top_auto(&self, node_idx: usize) -> bool
Check if margin is Auto (important for centering logic).
pub fn is_margin_right_auto(&self, node_idx: usize) -> bool
pub fn is_margin_bottom_auto(&self, node_idx: usize) -> bool
pub fn is_margin_left_auto(&self, node_idx: usize) -> bool
pub fn get_border_top_width(&self, node_idx: usize) -> Option<f32>
pub fn get_border_right_width(&self, node_idx: usize) -> Option<f32>
pub fn get_border_bottom_width(&self, node_idx: usize) -> Option<f32>
pub fn get_border_left_width(&self, node_idx: usize) -> Option<f32>
pub fn get_padding_top_raw(&self, node_idx: usize) -> i16
pub fn get_padding_right_raw(&self, node_idx: usize) -> i16
pub fn get_padding_bottom_raw(&self, node_idx: usize) -> i16
pub fn get_padding_left_raw(&self, node_idx: usize) -> i16
pub fn get_margin_top_raw(&self, node_idx: usize) -> i16
pub fn get_margin_right_raw(&self, node_idx: usize) -> i16
pub fn get_margin_bottom_raw(&self, node_idx: usize) -> i16
pub fn get_margin_left_raw(&self, node_idx: usize) -> i16
pub fn get_border_top_width_raw(&self, node_idx: usize) -> i16
pub fn get_border_right_width_raw(&self, node_idx: usize) -> i16
pub fn get_border_bottom_width_raw(&self, node_idx: usize) -> i16
pub fn get_border_left_width_raw(&self, node_idx: usize) -> i16
pub fn get_top(&self, node_idx: usize) -> i16
pub fn get_right(&self, node_idx: usize) -> i16
pub fn get_bottom(&self, node_idx: usize) -> i16
pub fn get_left(&self, node_idx: usize) -> i16
pub fn get_flex_grow(&self, node_idx: usize) -> Option<f32>
pub fn get_flex_shrink(&self, node_idx: usize) -> Option<f32>
pub fn get_z_index(&self, node_idx: usize) -> i16
pub fn get_border_top_color_raw(&self, node_idx: usize) -> u32
pub fn get_border_right_color_raw(&self, node_idx: usize) -> u32
pub fn get_border_bottom_color_raw(&self, node_idx: usize) -> u32
pub fn get_border_left_color_raw(&self, node_idx: usize) -> u32
pub fn get_border_styles_packed(&self, node_idx: usize) -> u16
pub fn get_border_top_style(&self, node_idx: usize) -> BorderStyle
pub fn get_border_right_style(&self, node_idx: usize) -> BorderStyle
pub fn get_border_bottom_style(&self, node_idx: usize) -> BorderStyle
pub fn get_border_left_style(&self, node_idx: usize) -> BorderStyle
pub fn get_border_spacing_h_raw(&self, node_idx: usize) -> i16
pub fn get_border_spacing_v_raw(&self, node_idx: usize) -> i16
pub fn get_tab_size_raw(&self, node_idx: usize) -> i16
pub fn get_border_top_left_radius_raw(&self, node_idx: usize) -> i16
pub fn get_border_top_right_radius_raw(&self, node_idx: usize) -> i16
pub fn get_border_bottom_left_radius_raw(&self, node_idx: usize) -> i16
pub fn get_border_bottom_right_radius_raw(&self, node_idx: usize) -> i16
Sourcepub fn get_opacity_raw(&self, node_idx: usize) -> u8
pub fn get_opacity_raw(&self, node_idx: usize) -> u8
Raw opacity byte. OPACITY_SENTINEL (255) = unset (default = 1.0).
Otherwise value / 254.0 yields the opacity in [0.0, 1.0].
pub fn get_hot_flags(&self, node_idx: usize) -> u8
pub fn has_transform(&self, node_idx: usize) -> bool
pub fn has_transform_origin(&self, node_idx: usize) -> bool
pub fn has_box_shadow(&self, node_idx: usize) -> bool
pub fn has_text_decoration(&self, node_idx: usize) -> bool
pub fn has_background(&self, node_idx: usize) -> bool
pub fn has_clip_path(&self, node_idx: usize) -> bool
pub fn has_scrollbar_css(&self, node_idx: usize) -> bool
pub fn has_counter(&self, node_idx: usize) -> bool
pub fn has_break(&self, node_idx: usize) -> bool
pub fn has_text_orientation(&self, node_idx: usize) -> bool
pub fn has_text_shadow(&self, node_idx: usize) -> bool
pub fn has_backdrop_filter(&self, node_idx: usize) -> bool
pub fn has_filter(&self, node_idx: usize) -> bool
pub fn has_mix_blend_mode(&self, node_idx: usize) -> bool
Sourcepub fn dom_declared(&self, flag: u32) -> bool
pub fn dom_declared(&self, flag: u32) -> bool
DOM-level fast-path check: returns true if the given flag bit is set
(some node in this DOM declared the corresponding property).
Sourcepub fn get_scrollbar_gutter_bits(&self, node_idx: usize) -> u8
pub fn get_scrollbar_gutter_bits(&self, node_idx: usize) -> u8
Scrollbar-gutter: 0 = auto (default), 1 = stable, 2 = both-edges, 3 = mirror.
pub fn get_text_color_raw(&self, node_idx: usize) -> u32
pub fn get_font_family_hash(&self, node_idx: usize) -> u64
pub fn get_line_height(&self, node_idx: usize) -> Option<f32>
pub fn get_letter_spacing(&self, node_idx: usize) -> Option<f32>
pub fn get_word_spacing(&self, node_idx: usize) -> Option<f32>
pub fn get_text_indent(&self, node_idx: usize) -> Option<f32>
Trait Implementations§
Source§impl Clone for CompactLayoutCache
impl Clone for CompactLayoutCache
Source§fn clone(&self) -> CompactLayoutCache
fn clone(&self) -> CompactLayoutCache
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CompactLayoutCache
impl Debug for CompactLayoutCache
Source§impl PartialEq for CompactLayoutCache
impl PartialEq for CompactLayoutCache
Source§fn eq(&self, other: &CompactLayoutCache) -> bool
fn eq(&self, other: &CompactLayoutCache) -> bool
self and other values to be equal, and is used by ==.