Skip to main content

LayoutTree

Struct LayoutTree 

Source
pub struct LayoutTree { /* private fields */ }
Expand description

布局树。

包装 taffy 的 TaffyTree,并维护 DOM 节点指针地址(usize) 到 taffy NodeId 的映射。构建阶段由 build_layout_tree 填充;计算阶段由 compute_layout 读取。

§key 契约(PERF-12 降级)

node_map / LayoutResult 的 key 用 Rc::as_ptr as usize 裸地址(非不透明 句柄)。已知限制:DOM 树变更后地址可能失效/复用。后续批次应改为每个 元素一个稳定 id 的不透明句柄。

Implementations§

Source§

impl LayoutTree

Source

pub fn new() -> Self

创建空布局树(内部新建一份 FontSystem——每次调用支付一次 系统字体枚举;会话级复用请用 LayoutTree::new_with_fonts)。

Source

pub fn new_with_fonts(fonts: &SharedFontSystem) -> Self

创建空布局树,注入会话级共享字体系统(LAY-2)。

Trait Implementations§

Source§

impl Default for LayoutTree

Source§

fn default() -> Self

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

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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.