Skip to main content

Crate nativeview_layout

Crate nativeview_layout 

Source
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 a NodeStore shared by every native backend and nativeview-runtime — the layout engine, viewport, text measurer, interaction pseudo-state (InteractionTracker), scroll offsets, and reusable zero-alloc hit-walk scratch.

Structs§

DisplayEnv
Committed cascade inputs. Default resolves the static rows only (engines without responsive support, store-only callers).
HeuristicTextMeasurer
Default deterministic text measurer matching NV’s cross-platform heuristic (font_size * 0.58 + letter_spacing per character, font_size * 1.35 normal line height), with explicit \n line breaks, max_width wrapping (none for nowrap / pre), explicit line heights, and max_lines.
InheritedText
Resolved inheritance paragraphs compile against: every box’s resolved text style and direction (indexed by node slot; empty = defaults), plus the active responsive environment (None when no @media / @container rule exists).
LeafMeasureContext
Compact, zero-allocation context passed to LeafMeasureHook::measure during Taffy leaf measurement.
ParagraphStore
Compact flat store of all compiled paragraphs for a surface.
PointerOutcomeFlags
What the core pointer-resolution stage did with a batch’s raw samples (NV_POINTER_OUTCOME_*, bits 8.. of the dispatch_events_ex disposition word).
ResolvedFamily
A node’s resolved font family: where it lives in the store plus the xxh64 of its text. Equality is by content hash alone, so an in-place StrArena replace that keeps the span ("Arial" → "Inter") still compares unequal, while the same family at another span does not.
ResponsiveTextEnv
Active responsive environment threaded into paragraph compilation: the @media environment plus the @container environment each node resolves against.
Size
The width and height of a Rect
SizeConstraints
Box layout constraints passed to NvLayoutApi::measure.
SurfaceMeasure
Measured surface dimensions and optional baselines returned by NvRuntimeApi::measure_surface.
TaffyStoreLayout
TextStyle
Fully resolved, inherited typography of one node: everything a host needs to measure text exactly as it paints it. F is the family: a ResolvedFamily into the store while layout keeps it per node (ResolvedTextStyle), a borrowed &str when handed to a TextMeasurer.
TopLayerIndex
Dense per-node TopLayerState plus the hoisted overlay roots in document (= back-to-front paint) order, relative to one layout root (NodeId::ROOT unless an engine lays out a subtree).

Enums§

AvailableSpace
The amount of space available to a node in a given axis https://www.w3.org/TR/css-sizing-3/#available
FocusMove
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§

LeafMeasureHook
Intrinsic content-box measurement hook registered per nativeview_store::TableSlot on crate::StoreLayoutEngine::register_measure_hook.
StoreLayoutEngine
Direct NodeStore layout engine trait implemented by crate::TaffyStoreLayout, real React Native Yoga (packages/modules/layout-yoga), custom layout engines, and DynLayoutEngine (Box<dyn StoreLayoutEngine>).
TextMeasurer
Pluggable text & multi-run paragraph measurement / hit-test provider used by layout engines.

Functions§

default_measure_paragraph
Default TextMeasurer::measure_paragraph bridge: delegates single-run paragraphs to measurer.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 NvTextRun entries from view (&[] 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 ResolvedTextStyle from its parent’s resolved typography and any explicit fields on id’s Typography row. Shared by every layout engine so invalid (< 0 or non-finite) sizes and spacings fall back identically across Taffy and Yoga.
run_font_family
Safely extracts run’s font family string from view.font_families_slab ("" = default).
run_line_height_points
Resolves run’s explicit line height in logical points (None for auto/normal).
run_text_slice
Safely extracts run’s UTF-8 slice from full_text ("" if out-of-bounds or mid-codepoint).
sanitize_run_font_size
single_run_text_style
Reconstructs a TextStyle<&str> from a single-run NvTextParagraphView.

Type Aliases§

DynLayoutEngine
Type alias for a runtime-switchable boxed NodeStore layout engine.
ResolvedTextStyle
Inherited typography kept per node during a layout pass.