1use super::*;
2
3impl<H: UiHost> Default for UiTree<H> {
4 fn default() -> Self {
5 Self {
6 nodes: SlotMap::with_key(),
7 layers: SlotMap::with_key(),
8 layer_order: Vec::new(),
9 root_to_layer: HashMap::new(),
10 base_layer: None,
11 focus: None,
12 pending_focus_target: None,
13 captured: HashMap::new(),
14 active_touch_drag_target: HashMap::new(),
15 last_pointer_move_hit: HashMap::new(),
16 touch_pointer_down_outside_candidates: HashMap::new(),
17 hit_test_path_cache: None,
18 hit_test_bounds_trees: bounds_tree::HitTestBoundsTrees::default(),
19 last_internal_drag_target: None,
20 window: None,
21 ime_allowed: false,
22 ime_composing: false,
23 suppress_text_input_until_key_up: None,
24 pending_shortcut: PendingShortcut::default(),
25 replaying_pending_shortcut: false,
26 alt_menu_bar_arm_key: None,
27 alt_menu_bar_canceled: false,
28 observed_in_layout: ObservationIndex::default(),
29 observed_in_paint: ObservationIndex::default(),
30 observed_globals_in_layout: GlobalObservationIndex::default(),
31 observed_globals_in_paint: GlobalObservationIndex::default(),
32 measure_stack: Vec::new(),
33 measure_cache_this_frame: HashMap::new(),
34 frame_arena: FrameArenaScratch::default(),
35 paint_pass: 0,
36 scratch_pending_invalidations: HashMap::new(),
37 scratch_node_stack: Vec::new(),
38 scratch_element_nodes: Vec::new(),
39 scratch_bounds_records: Vec::new(),
40 scratch_visual_bounds_records: Vec::new(),
41 measure_reentrancy_diagnostics: MeasureReentrancyDiagnostics::default(),
42 layout_engine: crate::layout_engine::TaffyLayoutEngine::default(),
43 layout_call_depth: 0,
44 layout_invalidations_count: 0,
45 last_layout_frame_id: None,
46 last_layout_bounds: None,
47 last_layout_scale_factor: None,
48 interactive_resize_active: false,
49 interactive_resize_needs_full_rebuild: false,
50 interactive_resize_stable_frames: 0,
51 interactive_resize_last_updated_frame: None,
52 interactive_resize_last_bounds_delta: None,
53 viewport_roots: Vec::new(),
54 pending_barrier_relayouts: Vec::new(),
55 pending_declarative_window_snapshot_roots: HashSet::new(),
56 pending_post_layout_window_runtime_snapshot_refine: false,
57 #[cfg(debug_assertions)]
58 debug_last_declarative_render_root_frame_id: None,
59 debug_enabled: false,
60 debug_stats: UiDebugFrameStats::default(),
61 debug_view_cache_roots: Vec::new(),
62 debug_view_cache_contained_relayout_roots: Vec::new(),
63 debug_paint_cache_replays: HashMap::new(),
64 debug_paint_widget_exclusive_started: None,
65 debug_layout_engine_solves: Vec::new(),
66 debug_layout_hotspots: Vec::new(),
67 debug_layout_inclusive_hotspots: Vec::new(),
68 debug_layout_stack: Vec::new(),
69 debug_widget_measure_hotspots: Vec::new(),
70 debug_widget_measure_stack: Vec::new(),
71 debug_paint_widget_hotspots: Vec::new(),
72 debug_paint_text_prepare_hotspots: Vec::new(),
73 debug_paint_stack: Vec::new(),
74 debug_measure_children: HashMap::new(),
75 debug_invalidation_walks: Vec::new(),
76 debug_model_change_hotspots: Vec::new(),
77 debug_model_change_unobserved: Vec::new(),
78 debug_global_change_hotspots: Vec::new(),
79 debug_global_change_unobserved: Vec::new(),
80 debug_hover_edge_this_frame: false,
81 debug_hover_declarative_invalidations: HashMap::new(),
82 debug_dirty_views: Vec::new(),
83 #[cfg(feature = "diagnostics")]
84 debug_notify_requests: Vec::new(),
85 debug_virtual_list_windows: Vec::new(),
86 debug_virtual_list_window_shift_samples: Vec::new(),
87 debug_retained_virtual_list_reconciles: Vec::new(),
88 debug_scroll_handle_changes: Vec::new(),
89 debug_scroll_nodes: Vec::new(),
90 debug_scrollbars: Vec::new(),
91 debug_prepaint_actions: Vec::new(),
92 #[cfg(feature = "diagnostics")]
93 debug_set_children_writes: HashMap::new(),
94 #[cfg(feature = "diagnostics")]
95 debug_parent_sever_writes: HashMap::new(),
96 #[cfg(feature = "diagnostics")]
97 debug_layer_visible_writes: Vec::new(),
98 #[cfg(feature = "diagnostics")]
99 debug_overlay_policy_decisions: Vec::new(),
100 #[cfg(feature = "diagnostics")]
101 debug_remove_subtree_frame_context: HashMap::new(),
102 #[cfg(feature = "diagnostics")]
103 debug_removed_subtrees: Vec::new(),
104 #[cfg(feature = "diagnostics")]
105 debug_reachable_from_layer_roots: None,
106 #[cfg(feature = "diagnostics")]
107 debug_dispatch_snapshot: None,
108 #[cfg(feature = "diagnostics")]
109 debug_text_constraints_measured: HashMap::new(),
110 #[cfg(feature = "diagnostics")]
111 debug_text_constraints_prepared: HashMap::new(),
112 view_cache_enabled: false,
113 paint_cache_policy: PaintCachePolicy::Auto,
114 inspection_active: false,
115 paint_cache: PaintCacheState::default(),
116 interaction_cache: prepaint::InteractionCacheState::default(),
117 dirty_cache_roots: HashSet::new(),
118 dirty_cache_root_reasons: HashMap::new(),
119 last_redraw_request_tick: None,
120 propagation_depth_generation: 0,
121 propagation_depth_cache: SecondaryMap::new(),
122 propagation_chain: Vec::new(),
123 propagation_entries: Vec::new(),
124 invalidation_dedup: InvalidationDedupTable::default(),
125 invalidated_layout_nodes: 0,
126 invalidated_paint_nodes: 0,
127 invalidated_hit_test_nodes: 0,
128 semantics: None,
129 semantics_requested: false,
130 layout_node_profile: None,
131 measure_node_profile: None,
132 deferred_cleanup: Vec::new(),
133 }
134 }
135}
136
137impl<H: UiHost> UiTree<H> {
138 pub fn new() -> Self {
139 Self::default()
140 }
141}