Skip to main content

Crate muskitty_layout

Crate muskitty_layout 

Source
Expand description

MusKitty Layout — CSS 布局引擎。

将 DOM 树 + ComputedStyle 转换为布局盒树, 使用 taffy 引擎计算 Flexbox/Grid/Block 布局, 输出每个元素的位置和尺寸。

§数据流

DOM 树 + ComputedStyle per element
    │  build_layout_tree
    ▼
LayoutTree (taffy TaffyTree + NodeId 映射)
    │  compute_layout
    ▼
LayoutResult (per-element x/y/width/height)

§规范依据

  • CSS Display Level 3: box tree / formatting context
  • CSS Box Model Level 3: margin/border/padding/content
  • CSS Flexbox Level 1: flex container/item
  • CSS Grid Level 2: grid container/item

Re-exports§

pub use result::LayoutError;
pub use result::LayoutResult;
pub use result::NodeLayout;

Modules§

result
布局计算结果提取与错误类型。

Structs§

LayoutTree
布局树。
SharedFontSystem
会话级共享的字体系统句柄(LAY-2)。

Functions§

build_layout_tree
从 DOM 树 + ComputedStyle 表构建 LayoutTree。
build_layout_tree_with_fonts
同 build_layout_tree,但注入会话级共享字体系统(LAY-2)。
compute_layout
计算布局树,返回每个元素的布局结果。