Skip to main content

nativeview_layout/
lib.rs

1//! Shared `NodeStore` layout layer used by every native backend and host runtime.
2//!
3//! Owns the [`StoreLayoutEngine`] / [`TextMeasurer`] traits, the deterministic
4//! [`HeuristicTextMeasurer`], and the default [`TaffyStoreLayout`] engine (direct Taffy 0.16
5//! low-level layout over `NodeStore` word columns). `nativeview-backend-headless`, `nativeview-backend-skia`,
6//! `nativeview-runtime`, and opt-in engines such as `packages/modules/layout-yoga` all depend on this
7//! crate, so no core crate ever depends on a backend to lay out a tree.
8
9#![cfg_attr(doctest, doc = include_str!("../README.md"))]
10
11mod engine;
12pub mod inspector;
13pub mod interaction;
14mod leaf_measure;
15mod measure;
16pub mod overlay;
17mod paragraph;
18pub mod scene;
19mod taffy_store;
20mod top;
21
22pub use engine::{DynLayoutEngine, SizeConstraints, StoreLayoutEngine, SurfaceMeasure};
23pub use leaf_measure::{AvailableSpace, LeafMeasureContext, LeafMeasureHook, Size};
24pub use inspector::{
25    CompactEdges, DEFAULT_FLASH_TTL, InspectorFlags, InspectorHeatTracker, InspectorNodeSnapshot,
26    LayoutWarningFlags, MAX_FLASH_RECTS, NODE_HEAT_FLASHING, NODE_HEAT_OCCUPIED, NodeHeat,
27    ResolvedBoxEdges, SceneDirtyKind, StackingReasonFlags, compute_layout_warnings,
28    compute_stacking_reasons, margin_edge_bands, resolve_fallback_box_edges, ring_bands,
29};
30pub use measure::{
31    HeuristicTextMeasurer, ResolvedFamily, ResolvedTextStyle, TextMeasurer, TextStyle,
32    resolve_inherited_text,
33};
34pub use paragraph::{InheritedText, ParagraphStore};
35pub use paragraph::measure::{
36    default_measure_paragraph, heuristic_hit_test_paragraph, heuristic_measure_paragraph,
37    paragraph_runs, paragraph_text_str, paragraph_wraps, run_font_family, run_line_height_points,
38    run_text_slice, sanitize_run_font_size, single_run_text_style,
39};
40pub use nativeview_abi::FocusMove;
41pub use scene::{
42    CloseRequestAction, FocusTraversalCtx, FocusTraversalOutcome, FocusTraversalPolicy,
43    FocusTraversalScratch, FocusTraverseFlags, FocusTraverseOutFlags, SceneGeometry,
44    TabOrderPolicy, CS_CLIPS, CS_HAS_SCROLL, CS_IS_STICKY,
45    CS_IS_TOP_LAYER, CS_IS_TRANSFORM, ClipScrollIdx, ClipScrollNode, CommitHooks, CommitOutcome, InteractionChange,
46    InstantScrollPhysics, ItemCount, ItemPaintPhase, LaidOutScene, NoCommitHooks,
47    OverlayState, PressOutcome, ResolvedOverlay, SCOPE_HAS_SCROLL, SCOPE_IS_MODAL, SCOPE_IS_STICKY, SCOPE_IS_TOP_LAYER, SceneStackingStyleSource, ScopeIdx, ScopeKind,
48    ScrollAxis, ScrollBoundsLookup, ScrollChainOutcome, ScrollContainerCtx, ScrollDeltaResult,
49    ScrollInputKind, ScrollOffsets, ScrollPhysicsEngine, ScrollTimestampMs, ScrollTouchPhase,
50    StackingBucket, StackingItem, StackingNodeRole, StackingOverrides, StackingPlan, StackingScope,
51    StackingStyleSource, StyleCascade, EffectiveBox, ResponsivePatches, NoResponsivePatches, TopLayerScope,
52    PressedOverlay, TopLayerPress, ZOrder, bucket_for_sc_z, close_request_owner, hide_popovers_until,
53    top_layer_press, topmost_modal_index,
54    classify_node_sc_with_parent_display, compute_scroll_content_size, default_px_per_line,
55    for_each_scrollbar_thumb_geom, intersect_rects, intersects_clip, layout_snapshot_of,
56    normalize_shift_wheel, paragraph_content_insets, push_unique_node, resolve_node_sc_state,
57    scroll_axes_allow, visual_snapshot_of,
58};
59pub use taffy_store::TaffyStoreLayout;
60pub use taffy_store::responsive::text::ResponsiveTextEnv;
61pub use top::TopLayerIndex;
62pub use scene::state_rules_patch_box;
63pub use scene::pointer::{
64    PointerHitTest, PointerOutcomeFlags, PointerProbe, PointerResolution,
65};
66pub use top::display::DisplayEnv;
67
68pub use nativeview_store::MAX_TREE_DEPTH;