#[repr(C)]pub struct StyledDom {
pub root: NodeHierarchyItemId,
pub node_hierarchy: NodeHierarchyItemVec,
pub node_data: NodeDataVec,
pub styled_nodes: StyledNodeVec,
pub cascade_info: CascadeInfoVec,
pub nodes_with_window_callbacks: NodeIdVec,
pub nodes_with_not_callbacks: NodeIdVec,
pub nodes_with_datasets: NodeIdVec,
pub tag_ids_to_node_ids: TagIdToNodeIdMappingVec,
pub non_leaf_nodes: ParentWithNodeDepthVec,
pub css_property_cache: CssPropertyCachePtr,
pub dom_id: DomId,
}Fields§
§root: NodeHierarchyItemId§node_hierarchy: NodeHierarchyItemVec§node_data: NodeDataVec§styled_nodes: StyledNodeVec§cascade_info: CascadeInfoVec§nodes_with_window_callbacks: NodeIdVec§nodes_with_not_callbacks: NodeIdVec§nodes_with_datasets: NodeIdVec§tag_ids_to_node_ids: TagIdToNodeIdMappingVec§non_leaf_nodes: ParentWithNodeDepthVec§css_property_cache: CssPropertyCachePtr§dom_id: DomIdThe ID of this DOM in the layout tree (for multi-DOM support with IFrames)
Implementations§
Source§impl StyledDom
impl StyledDom
Sourcepub fn create(dom: &mut Dom, css: Css) -> Self
pub fn create(dom: &mut Dom, css: Css) -> Self
Creates a new StyledDom by applying CSS styles to a DOM tree.
NOTE: After calling this function, the DOM will be reset to an empty DOM.
Sourcepub fn append_child(&mut self, other: Self)
pub fn append_child(&mut self, other: Self)
Appends another StyledDom as a child to the self.root
without re-styling the DOM itself
Sourcepub fn with_child(self, other: Self) -> Self
pub fn with_child(self, other: Self) -> Self
Same as append_child(), but as a builder method
Sets the context menu for the root node
Builder method for setting the context menu
Sets the menu bar for the root node
Builder method for setting the menu bar
Sourcepub fn node_count(&self) -> usize
pub fn node_count(&self) -> usize
Returns the total number of nodes in this StyledDom.
Sourcepub fn get_css_property_cache<'a>(&'a self) -> &'a CssPropertyCache
pub fn get_css_property_cache<'a>(&'a self) -> &'a CssPropertyCache
Returns an immutable reference to the CSS property cache.
Sourcepub fn get_css_property_cache_mut<'a>(&'a mut self) -> &'a mut CssPropertyCache
pub fn get_css_property_cache_mut<'a>(&'a mut self) -> &'a mut CssPropertyCache
Returns a mutable reference to the CSS property cache.
Sourcepub fn get_styled_node_state(&self, node_id: &NodeId) -> StyledNodeState
pub fn get_styled_node_state(&self, node_id: &NodeId) -> StyledNodeState
Returns the current state (hover, active, focus) of a styled node.
Sourcepub fn scan_for_image_keys(
&self,
css_image_cache: &ImageCache,
) -> FastBTreeSet<ImageRef>
pub fn scan_for_image_keys( &self, css_image_cache: &ImageCache, ) -> FastBTreeSet<ImageRef>
Scans the display list for all image keys
Sourcepub fn restyle_nodes_hover(
&mut self,
nodes: &[NodeId],
new_hover_state: bool,
) -> BTreeMap<NodeId, Vec<ChangedCssProperty>>
pub fn restyle_nodes_hover( &mut self, nodes: &[NodeId], new_hover_state: bool, ) -> BTreeMap<NodeId, Vec<ChangedCssProperty>>
Updates hover state for nodes and returns changed CSS properties.
Sourcepub fn restyle_nodes_active(
&mut self,
nodes: &[NodeId],
new_active_state: bool,
) -> BTreeMap<NodeId, Vec<ChangedCssProperty>>
pub fn restyle_nodes_active( &mut self, nodes: &[NodeId], new_active_state: bool, ) -> BTreeMap<NodeId, Vec<ChangedCssProperty>>
Updates active state for nodes and returns changed CSS properties.
Sourcepub fn restyle_nodes_focus(
&mut self,
nodes: &[NodeId],
new_focus_state: bool,
) -> BTreeMap<NodeId, Vec<ChangedCssProperty>>
pub fn restyle_nodes_focus( &mut self, nodes: &[NodeId], new_focus_state: bool, ) -> BTreeMap<NodeId, Vec<ChangedCssProperty>>
Updates focus state for nodes and returns changed CSS properties.
Sourcepub fn restyle_on_state_change(
&mut self,
focus_changes: Option<FocusChange>,
hover_changes: Option<HoverChange>,
active_changes: Option<ActiveChange>,
) -> RestyleResult
pub fn restyle_on_state_change( &mut self, focus_changes: Option<FocusChange>, hover_changes: Option<HoverChange>, active_changes: Option<ActiveChange>, ) -> RestyleResult
Unified entry point for all CSS restyle operations.
This function synchronizes the StyledNodeState with runtime state and computes which CSS properties have changed. It determines whether layout, display list, or GPU-only updates are needed.
§Arguments
focus_changes- Nodes gaining/losing focushover_changes- Nodes gaining/losing hoveractive_changes- Nodes gaining/losing active (mouse down)
§Returns
RestyleResultcontaining changed nodes and what needs updating
Sourcepub fn restyle_user_property(
&mut self,
node_id: &NodeId,
new_properties: &[CssProperty],
) -> BTreeMap<NodeId, Vec<ChangedCssProperty>>
pub fn restyle_user_property( &mut self, node_id: &NodeId, new_properties: &[CssProperty], ) -> BTreeMap<NodeId, Vec<ChangedCssProperty>>
Overrides CSS properties for a node and returns changed properties.
Sourcepub fn scan_for_iframe_callbacks(&self) -> Vec<NodeId>
pub fn scan_for_iframe_callbacks(&self) -> Vec<NodeId>
Scans the StyledDom for iframe callbacks
Sourcepub fn scan_for_gltexture_callbacks(&self) -> Vec<NodeId>
pub fn scan_for_gltexture_callbacks(&self) -> Vec<NodeId>
Scans the StyledDom for OpenGL callbacks
Sourcepub fn get_html_string(
&self,
custom_head: &str,
custom_body: &str,
test_mode: bool,
) -> String
pub fn get_html_string( &self, custom_head: &str, custom_body: &str, test_mode: bool, ) -> String
Returns a HTML-formatted version of the DOM for easier debugging.
For example, a DOM with a parent div containing a child div would return:
<div id="hello">
<div id="test" />
</div>Sourcepub fn get_subtree(&self, parent: NodeId) -> Vec<NodeId>
pub fn get_subtree(&self, parent: NodeId) -> Vec<NodeId>
Returns the node ID of all sub-children of a node
Sourcepub fn get_subtree_parents(&self, parent: NodeId) -> Vec<NodeId>
pub fn get_subtree_parents(&self, parent: NodeId) -> Vec<NodeId>
Returns node IDs of all parent nodes in the subtree (nodes with children).
Sourcepub fn get_rects_in_rendering_order(&self) -> ContentGroup
pub fn get_rects_in_rendering_order(&self) -> ContentGroup
Returns nodes grouped by their rendering order (respects z-index and position).
Sourcepub fn swap_with_default(&mut self) -> Self
pub fn swap_with_default(&mut self) -> Self
Replaces this StyledDom with default and returns the old value.
Trait Implementations§
impl StructuralPartialEq for StyledDom
Auto Trait Implementations§
impl Freeze for StyledDom
impl RefUnwindSafe for StyledDom
impl Send for StyledDom
impl Sync for StyledDom
impl Unpin for StyledDom
impl UnwindSafe for StyledDom
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more