StyledDom

Struct StyledDom 

Source
#[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, }

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

Implementations§

Source§

impl StyledDom

Source

pub fn new(dom: &mut Dom, css: CssApiWrapper) -> Self

Source

pub fn append_child(&mut self, other: Self)

Appends another StyledDom as a child to the self.root without re-styling the DOM itself

Source

pub fn inject_scroll_bars(&mut self)

Inject scroll bar DIVs with relevant event handlers into the DOM

This function essentially takes a DOM and inserts a wrapper DIV on every parent. First, all scrollbars are set to “display:none;” with a special library-internal marker that indicates that this DIV is a scrollbar. Then later on in the layout code, the items are set to “display: flex / block” as necessary, because this way scrollbars aren’t treated as “special” objects (the event handling for scrollbars are just regular callback handlers).

Source

pub fn inject_menu_bar(self, menu_bar: &Menu) -> Self

Inject a menu bar into the root component

Source

pub fn with_child(&mut self, other: Self) -> Self

Same as append_child(), but as a builder method

Source

pub fn restyle(&mut self, css: CssApiWrapper)

Source

pub fn insert_default_system_callbacks(&mut self, config: DefaultCallbacksCfg)

Inserts default On::Scroll and On::Tab handle for scroll-able and tabindex-able nodes.

Source

pub fn node_count(&self) -> usize

Source

pub fn get_css_property_cache<'a>(&'a self) -> &'a CssPropertyCache

Source

pub fn get_css_property_cache_mut<'a>(&'a mut self) -> &'a mut CssPropertyCache

Source

pub fn get_styled_node_state(&self, node_id: &NodeId) -> StyledNodeState

Source

pub fn scan_for_font_keys( &self, resources: &RendererResources, ) -> FastHashMap<ImmediateFontId, FastBTreeSet<Au>>

Scans the display list for all font IDs + their font size

Source

pub fn scan_for_image_keys( &self, css_image_cache: &ImageCache, ) -> FastBTreeSet<ImageRef>

Scans the display list for all image keys

Source

pub fn restyle_nodes_hover( &mut self, nodes: &[NodeId], new_hover_state: bool, ) -> BTreeMap<NodeId, Vec<ChangedCssProperty>>

Source

pub fn restyle_nodes_active( &mut self, nodes: &[NodeId], new_active_state: bool, ) -> BTreeMap<NodeId, Vec<ChangedCssProperty>>

Source

pub fn restyle_nodes_focus( &mut self, nodes: &[NodeId], new_focus_state: bool, ) -> BTreeMap<NodeId, Vec<ChangedCssProperty>>

Source

pub fn restyle_user_property( &mut self, node_id: &NodeId, new_properties: &[CssProperty], ) -> BTreeMap<NodeId, Vec<ChangedCssProperty>>

Source

pub fn scan_for_iframe_callbacks(&self) -> Vec<NodeId>

Scans the StyledDom for iframe callbacks

Source

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, i.e.

Dom::div().with_id("hello")
    .with_child(Dom::div().with_id("test"))

will return:

<div id="hello">
     <div id="test" />
</div>
Source

pub fn get_subtree(&self, parent: NodeId) -> Vec<NodeId>

Returns the node ID of all sub-children of a node

Source

pub fn get_subtree_parents(&self, parent: NodeId) -> Vec<NodeId>

Source

pub fn get_rects_in_rendering_order(&self) -> ContentGroup

Source

pub fn swap_with_default(&mut self) -> Self

Source

pub fn set_menu_bar(&mut self, menu: Menu)

Source

pub fn set_context_menu(&mut self, menu: Menu)

Trait Implementations§

Source§

impl Clone for StyledDom

Source§

fn clone(&self) -> StyledDom

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for StyledDom

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for StyledDom

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Into<StyledDom> for DomXml

Source§

fn into(self) -> StyledDom

Converts this type into the (usually inferred) input type.
Source§

impl PartialEq for StyledDom

Source§

fn eq(&self, other: &StyledDom) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for StyledDom

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.