Expand description
Shared NodeStore layout layer used by every native backend and host runtime.
Owns the StoreLayoutEngine / TextMeasurer traits, the deterministic
HeuristicTextMeasurer, and the default TaffyStoreLayout engine (direct Taffy 0.16
low-level layout over NodeStore word columns). nativeview-backend-headless, nativeview-backend-skia,
nativeview-runtime, and opt-in engines such as packages/modules/layout-yoga all depend on this
crate, so no core crate ever depends on a backend to lay out a tree.
Re-exports§
pub use inspector::CompactEdges;pub use inspector::DEFAULT_FLASH_TTL;pub use inspector::InspectorFlags;pub use inspector::InspectorHeatTracker;pub use inspector::InspectorNodeSnapshot;pub use inspector::LayoutWarningFlags;pub use inspector::MAX_FLASH_RECTS;pub use inspector::NODE_HEAT_FLASHING;pub use inspector::NODE_HEAT_OCCUPIED;pub use inspector::NodeHeat;pub use inspector::ResolvedBoxEdges;pub use inspector::SceneDirtyKind;pub use inspector::StackingReasonFlags;pub use inspector::compute_layout_warnings;pub use inspector::compute_stacking_reasons;pub use inspector::margin_edge_bands;pub use inspector::resolve_fallback_box_edges;pub use inspector::ring_bands;pub use scene::CloseRequestAction;pub use scene::FocusTraversalCtx;pub use scene::FocusTraversalOutcome;pub use scene::FocusTraversalPolicy;pub use scene::FocusTraversalScratch;pub use scene::FocusTraverseFlags;pub use scene::FocusTraverseOutFlags;pub use scene::SceneGeometry;pub use scene::TabOrderPolicy;pub use scene::CS_CLIPS;pub use scene::CS_HAS_SCROLL;pub use scene::CS_IS_STICKY;pub use scene::CS_IS_TOP_LAYER;pub use scene::CS_IS_TRANSFORM;pub use scene::ClipScrollIdx;pub use scene::ClipScrollNode;pub use scene::CommitHooks;pub use scene::CommitOutcome;pub use scene::InteractionChange;pub use scene::InstantScrollPhysics;pub use scene::ItemCount;pub use scene::ItemPaintPhase;pub use scene::LaidOutScene;pub use scene::NoCommitHooks;pub use scene::OverlayState;pub use scene::PressOutcome;pub use scene::ResolvedOverlay;pub use scene::SCOPE_HAS_SCROLL;pub use scene::SCOPE_IS_MODAL;pub use scene::SCOPE_IS_STICKY;pub use scene::SCOPE_IS_TOP_LAYER;pub use scene::SceneStackingStyleSource;pub use scene::ScopeIdx;pub use scene::ScopeKind;pub use scene::ScrollAxis;pub use scene::ScrollBoundsLookup;pub use scene::ScrollChainOutcome;pub use scene::ScrollContainerCtx;pub use scene::ScrollDeltaResult;pub use scene::ScrollInputKind;pub use scene::ScrollOffsets;pub use scene::ScrollPhysicsEngine;pub use scene::ScrollTimestampMs;pub use scene::ScrollTouchPhase;pub use scene::StackingBucket;pub use scene::StackingItem;pub use scene::StackingNodeRole;pub use scene::StackingOverrides;pub use scene::StackingPlan;pub use scene::StackingScope;pub use scene::StackingStyleSource;pub use scene::StyleCascade;pub use scene::EffectiveBox;pub use scene::ResponsivePatches;pub use scene::NoResponsivePatches;pub use scene::TopLayerScope;pub use scene::PressedOverlay;pub use scene::TopLayerPress;pub use scene::ZOrder;pub use scene::bucket_for_sc_z;pub use scene::close_request_owner;pub use scene::hide_popovers_until;pub use scene::top_layer_press;pub use scene::topmost_modal_index;pub use scene::classify_node_sc_with_parent_display;pub use scene::compute_scroll_content_size;pub use scene::default_px_per_line;pub use scene::for_each_scrollbar_thumb_geom;pub use scene::intersect_rects;pub use scene::intersects_clip;pub use scene::layout_snapshot_of;pub use scene::normalize_shift_wheel;pub use scene::paragraph_content_insets;pub use scene::push_unique_node;pub use scene::resolve_node_sc_state;pub use scene::scroll_axes_allow;pub use scene::visual_snapshot_of;pub use scene::state_rules_patch_box;pub use scene::pointer::PointerHitTest;pub use scene::pointer::PointerProbe;pub use scene::pointer::PointerResolution;
Modules§
- inspector
- Backend-agnostic Visual Layout & Recomposition Inspector data model.
- interaction
- Platform-agnostic interaction visual-effect filtering shared by retained scene backends.
- overlay
- Zero-allocation pure-Rust anchored overlay collision-flipping, viewport clamping, auto-sizing, arrow center tracking, and submenu safe-polygon hover corridor solver.
- scene
LaidOutScene: one surface’s laid-out view of aNodeStoreshared by every native backend andnativeview-runtime— the layout engine, viewport, text measurer, interaction pseudo-state (InteractionTracker), scroll offsets, and reusable zero-alloc hit-walk scratch.
Structs§
- Display
Env - Committed cascade inputs.
Defaultresolves the static rows only (engines without responsive support, store-only callers). - Heuristic
Text Measurer - Default deterministic text measurer matching NV’s cross-platform heuristic
(
font_size * 0.58 + letter_spacingper character,font_size * 1.35normalline height), with explicit\nline breaks,max_widthwrapping (none fornowrap/pre), explicit line heights, andmax_lines. - Inherited
Text - Resolved inheritance paragraphs compile against: every box’s resolved text style and
direction (indexed by node slot; empty = defaults), plus the active responsive environment
(
Nonewhen no@media/@containerrule exists). - Leaf
Measure Context - Compact, zero-allocation context passed to
LeafMeasureHook::measureduring Taffy leaf measurement. - Paragraph
Store - Compact flat store of all compiled paragraphs for a surface.
- Pointer
Outcome Flags - What the core pointer-resolution stage did with a batch’s raw samples
(
NV_POINTER_OUTCOME_*, bits 8.. of thedispatch_events_exdisposition word). - Resolved
Family - A node’s resolved font family: where it lives in the store plus the
xxh64of its text. Equality is by content hash alone, so an in-placeStrArenareplace that keeps the span ("Arial"→"Inter") still compares unequal, while the same family at another span does not. - Responsive
Text Env - Active responsive environment threaded into paragraph compilation: the
@mediaenvironment plus the@containerenvironment each node resolves against. - Size
- The width and height of a
Rect - Size
Constraints - Box layout constraints passed to
NvLayoutApi::measure. - Surface
Measure - Measured surface dimensions and optional baselines returned by
NvRuntimeApi::measure_surface. - Taffy
Store Layout - Text
Style - Fully resolved, inherited typography of one node: everything a host needs to measure text
exactly as it paints it.
Fis the family: aResolvedFamilyinto the store while layout keeps it per node (ResolvedTextStyle), a borrowed&strwhen handed to aTextMeasurer. - TopLayer
Index - Dense per-node
TopLayerStateplus the hoisted overlay roots in document (= back-to-front paint) order, relative to one layout root (NodeId::ROOTunless an engine lays out a subtree).
Enums§
- Available
Space - The amount of space available to a node in a given axis https://www.w3.org/TR/css-sizing-3/#available
- Focus
Move - Typed focus-traversal movement direction matching
NV_FOCUS_DIR_*.
Constants§
- MAX_
TREE_ DEPTH - Maximum tree depth any walk over a
NodeStore(ancestor chains, DFS, layout, hit-testing, semantics, publication) descends before truncating; guards corrupt cyclic parent pointers.
Traits§
- Leaf
Measure Hook - Intrinsic content-box measurement hook registered per
nativeview_store::TableSlotoncrate::StoreLayoutEngine::register_measure_hook. - Store
Layout Engine - Direct
NodeStorelayout engine trait implemented bycrate::TaffyStoreLayout, real React Native Yoga (packages/modules/layout-yoga), custom layout engines, andDynLayoutEngine(Box<dyn StoreLayoutEngine>). - Text
Measurer - Pluggable text & multi-run paragraph measurement / hit-test provider used by layout engines.
Functions§
- default_
measure_ paragraph - Default
TextMeasurer::measure_paragraphbridge: delegates single-run paragraphs tomeasurer.measure(preserving custom/closure/mock measurers) and uses deterministic multi-run heuristic measurement for multi-run paragraphs. - heuristic_
hit_ test_ paragraph - Deterministic heuristic per-run hit-tester used when no OS/Skia shaper is attached.
- heuristic_
measure_ paragraph - Deterministic cross-platform multi-run paragraph measurement matching
HeuristicTextMeasurer. - paragraph_
runs - Safely extracts the slice of
NvTextRunentries fromview(&[]if null/empty). - paragraph_
text_ str - Safely extracts the UTF-8 paragraph text slice from
view(""if null/empty/invalid). - paragraph_
wraps - resolve_
inherited_ text - Resolves one node’s inherited
ResolvedTextStylefrom its parent’s resolved typography and any explicit fields onid’sTypographyrow. Shared by every layout engine so invalid (< 0or non-finite) sizes and spacings fall back identically across Taffy and Yoga. - run_
font_ family - Safely extracts
run’s font family string fromview.font_families_slab(""= default). - run_
line_ height_ points - Resolves
run’s explicit line height in logical points (Noneforauto/normal). - run_
text_ slice - Safely extracts
run’s UTF-8 slice fromfull_text(""if out-of-bounds or mid-codepoint). - sanitize_
run_ font_ size - single_
run_ text_ style - Reconstructs a
TextStyle<&str>from a single-runNvTextParagraphView.
Type Aliases§
- DynLayout
Engine - Type alias for a runtime-switchable boxed
NodeStorelayout engine. - Resolved
Text Style - Inherited typography kept per node during a layout pass.