pub struct RuntimeContext {
pub application: ApplicationInstance,
pub property_graph: PropertyGraph,
pub layer_count: Cell<usize>,
pub dirty_canvases: Rc<RefCell<Vec<bool>>>,
/* private fields */
}Expand description
Shared context for properties pass recursion
Fields§
§application: ApplicationInstance§property_graph: PropertyGraphOwner-thread bridge for application properties.
layer_count: Cell<usize>§dirty_canvases: Rc<RefCell<Vec<bool>>>Implementations§
Source§impl RuntimeContext
impl RuntimeContext
Sourcepub fn register_root_expanded_node(&self, root: &Rc<ExpandedNode>)
pub fn register_root_expanded_node(&self, root: &Rc<ExpandedNode>)
Store the root expanded node after it has been initialized.
Sourcepub fn clear_root_expanded_node(&self)
pub fn clear_root_expanded_node(&self)
Clear the registered root expanded node.
Sourcepub fn add_to_cache(&self, node: &Rc<ExpandedNode>)
pub fn add_to_cache(&self, node: &Rc<ExpandedNode>)
Add a node to runtime lookup caches.
Sourcepub fn remove_from_cache(&self, node: &Rc<ExpandedNode>)
pub fn remove_from_cache(&self, node: &Rc<ExpandedNode>)
Remove a node from runtime lookup caches.
pub fn has_import_settings_nodes(&self) -> bool
pub fn register_node_effect_property( &self, node: ExpandedNodeIdentifier, prop: &LocalProperty<()>, )
pub fn register_node_effect_property_named( &self, node: ExpandedNodeIdentifier, prop: &LocalProperty<()>, effect_name: &str, )
pub fn register_expanded_node_effect_property_named( &self, node: &Rc<ExpandedNode>, prop: &LocalProperty<()>, effect_name: &str, )
pub fn register_node_effect( &self, node: ExpandedNodeIdentifier, dependencies: &[UntypedProperty], effect: impl Fn() + 'static, ) -> LocalProperty<()>
pub fn drain_node_effects(&self)
pub fn tick_handler_nodes(&self) -> Vec<ExpandedNodeIdentifier>
pub fn pre_render_handler_nodes(&self) -> Vec<ExpandedNodeIdentifier>
pub fn gyro_handler_nodes(&self) -> Vec<ExpandedNodeIdentifier>
pub fn accel_handler_nodes(&self) -> Vec<ExpandedNodeIdentifier>
Sourcepub fn get_expanded_node_by_eid(
&self,
id: ExpandedNodeIdentifier,
) -> Option<Rc<ExpandedNode>>
pub fn get_expanded_node_by_eid( &self, id: ExpandedNodeIdentifier, ) -> Option<Rc<ExpandedNode>>
Look up an expanded node by runtime id.
Sourcepub fn capture_touch_target(
&self,
identifier: i64,
target: ExpandedNodeIdentifier,
)
pub fn capture_touch_target( &self, identifier: i64, target: ExpandedNodeIdentifier, )
Route a touch sequence to the node hit at touch-down, even after the finger moves away.
Sourcepub fn captured_touch_target(&self, identifier: i64) -> Option<Rc<ExpandedNode>>
pub fn captured_touch_target(&self, identifier: i64) -> Option<Rc<ExpandedNode>>
Resolve the node captured for an active touch sequence.
Sourcepub fn release_touch_target(&self, identifier: i64) -> Option<Rc<ExpandedNode>>
pub fn release_touch_target(&self, identifier: i64) -> Option<Rc<ExpandedNode>>
Release and resolve the node captured for a completed touch sequence.
Sourcepub fn load_screenshot(&self, id: u32, data: ScreenshotData) -> bool
pub fn load_screenshot(&self, id: u32, data: ScreenshotData) -> bool
Store a screenshot payload delivered by the chassis.
Sourcepub fn get_screenshot_map(&self) -> Rc<RefCell<HashMap<u32, ScreenshotData>>>
pub fn get_screenshot_map(&self) -> Rc<RefCell<HashMap<u32, ScreenshotData>>>
Shared screenshot capture map keyed by request id.
Sourcepub fn set_scroller_surface_state(
&self,
id: u32,
state: ScrollerSurfaceState,
) -> ScrollerSurfaceStateChange
pub fn set_scroller_surface_state( &self, id: u32, state: ScrollerSurfaceState, ) -> ScrollerSurfaceStateChange
Remember browser-owned scroller state for native compositing and scroll transforms.
Sourcepub fn update_scroller_surface_scroll(
&self,
id: u32,
scroll_x: f64,
scroll_y: f64,
presentation_scroll_x: f64,
presentation_scroll_y: f64,
) -> ScrollerSurfaceStateChange
pub fn update_scroller_surface_scroll( &self, id: u32, scroll_x: f64, scroll_y: f64, presentation_scroll_x: f64, presentation_scroll_y: f64, ) -> ScrollerSurfaceStateChange
Update hot scroll offsets for an existing native scroller surface without touching structural state.
Sourcepub fn remove_scroller_surface_state(&self, id: u32)
pub fn remove_scroller_surface_state(&self, id: u32)
Remove cached scroller surface state.
Sourcepub fn get_scroller_surface_state(
&self,
id: u32,
) -> Option<ScrollerSurfaceState>
pub fn get_scroller_surface_state( &self, id: u32, ) -> Option<ScrollerSurfaceState>
Fetch cached scroller surface state by node id.
Sourcepub fn get_scroller_surface_scroll(&self, id: u32) -> Option<(f64, f64)>
pub fn get_scroller_surface_scroll(&self, id: u32) -> Option<(f64, f64)>
Fetch the presentation scroll offset for a native scroller surface, falling back to the authoritative scroll position when presentation scroll is unavailable.
Sourcepub fn clear_layer_scroller_owners(&self)
pub fn clear_layer_scroller_owners(&self)
Clear render-layer-to-scroller ownership before recomputing occlusion.
Sourcepub fn register_layer_scroller_owner(
&self,
layer_id: usize,
scroller_id: ExpandedNodeIdentifier,
)
pub fn register_layer_scroller_owner( &self, layer_id: usize, scroller_id: ExpandedNodeIdentifier, )
Record that a render layer is owned by a particular scroller.
Sourcepub fn get_layer_scroller_owner(
&self,
layer_id: usize,
) -> Option<ExpandedNodeIdentifier>
pub fn get_layer_scroller_owner( &self, layer_id: usize, ) -> Option<ExpandedNodeIdentifier>
Find the scroller that owns a render layer, when one exists.
Sourcepub fn set_root_scroller_id(&self, id: Option<u32>)
pub fn set_root_scroller_id(&self, id: Option<u32>)
Mark which node currently delegates root scrolling behavior to the page.
Sourcepub fn get_root_scroller_id(&self) -> Option<u32>
pub fn get_root_scroller_id(&self) -> Option<u32>
Current page-scroll-backed root scroller id.
Sourcepub fn safe_area_insets(&self) -> LocalProperty<SafeAreaInsets>
pub fn safe_area_insets(&self) -> LocalProperty<SafeAreaInsets>
Live native safe-area data used by opt-in layout primitives. Defaults to zero.
Sourcepub fn set_safe_area_insets(&self, insets: SafeAreaInsets)
pub fn set_safe_area_insets(&self, insets: SafeAreaInsets)
Update native safe-area data without changing the viewport or root layout.
Sourcepub fn set_visual_viewport_state(&self, state: VisualViewportState)
pub fn set_visual_viewport_state(&self, state: VisualViewportState)
Cache the browser visual viewport state for root scroller math.
Sourcepub fn clear_visual_viewport_state(&self)
pub fn clear_visual_viewport_state(&self)
Clear cached visual viewport state.
Sourcepub fn get_visual_viewport_state(&self) -> Option<VisualViewportState>
pub fn get_visual_viewport_state(&self) -> Option<VisualViewportState>
Return cached browser visual viewport state, if available.
Sourcepub fn resize_canvas_layers_to(&self, id: usize)
pub fn resize_canvas_layers_to(&self, id: usize)
Ensure the dirty-canvas table has entries up to the requested layer count.
pub fn mark_layer_canvas_plans_dirty(&self)
pub fn layer_canvas_plan_generation(&self) -> u32
Sourcepub fn set_canvas_drawable_layers(&self, layers: HashSet<usize>)
pub fn set_canvas_drawable_layers(&self, layers: HashSet<usize>)
Replace the set of render layers that currently contain canvas drawables.
Sourcepub fn layer_has_canvas_drawables(&self, layer: usize) -> bool
pub fn layer_has_canvas_drawables(&self, layer: usize) -> bool
Return whether a render layer currently has canvas work to paint.
Sourcepub fn clear_all_dirty_canvases(&self)
pub fn clear_all_dirty_canvases(&self)
Mark every canvas layer clean.
Sourcepub fn set_canvas_dirty(&self, id: usize)
pub fn set_canvas_dirty(&self, id: usize)
Mark a canvas layer dirty.
Sourcepub fn is_canvas_dirty(&self, id: &usize) -> bool
pub fn is_canvas_dirty(&self, id: &usize) -> bool
Check whether a canvas layer needs redraw.
pub fn dirty_canvas_layers(&self) -> Vec<usize>
pub fn has_dirty_canvas_layers(&self) -> bool
pub fn has_dirty_canvas_nodes(&self) -> bool
pub fn has_canvas_node_removals(&self) -> bool
pub fn has_canvas_render_work(&self) -> bool
Sourcepub fn mark_scene_lighting_dirty(&self)
pub fn mark_scene_lighting_dirty(&self)
Schedule lighting resolution without invalidating canvas geometry or contents. The retained renderer decides which surfaces depend on the changed lights.
pub fn mark_occlusion_dirty(&self)
Sourcepub fn mark_node_occlusion_dirty(&self, id: u32)
pub fn mark_node_occlusion_dirty(&self, id: u32)
Invalidate native compositing after a node’s paint or coverage changes. Detached source changes reconcile their owning mask in the visible scene.
Sourcepub fn occlusion_stats(&self) -> OcclusionStats
pub fn occlusion_stats(&self) -> OcclusionStats
Cumulative work performed by native compositing, including conservative rebuilds.
pub fn take_occlusion_dirty(&self) -> bool
pub fn set_all_canvases_dirty(&self)
pub fn mark_canvas_node_dirty(&self, id: ExpandedNodeIdentifier)
pub fn clear_canvas_node_dirty(&self, id: &ExpandedNodeIdentifier)
pub fn is_canvas_node_dirty(&self, id: &ExpandedNodeIdentifier) -> bool
pub fn dirty_canvas_node_ids(&self) -> Vec<ExpandedNodeIdentifier>
pub fn mark_canvas_nodes_on_layer_dirty(&self, layer: usize)
Sourcepub fn canvas_node_light_mask(&self, id: ExpandedNodeIdentifier) -> u32
pub fn canvas_node_light_mask(&self, id: ExpandedNodeIdentifier) -> u32
Return the direct-light membership mask resolved for a retained canvas node.
Sourcepub fn collect_scene_lighting_for_layer(&self, layer: usize) -> SceneLighting
pub fn collect_scene_lighting_for_layer(&self, layer: usize) -> SceneLighting
Resolve registered direct/ambient contributors in the target layer’s coordinates.
Light values remain live on every render; retained node masks are rebuilt only when selected light slots, lexical scope, or scene structure changes. Contributors are independent of viewport visibility, and an unlit scene needs no node scan.
Sourcepub fn canvas_surface_transform_for_node(&self, node: &ExpandedNode) -> Affine
pub fn canvas_surface_transform_for_node(&self, node: &ExpandedNode) -> Affine
Resolve a node’s local coordinates into its owning canvas’s content space. Scroller-owned layers use the registered owner’s origin; root layers use window coordinates. Detached mask sources retain their scene transform until capture projection. Physical tile offsets are applied later by the renderer.
Sourcepub fn prepare_scene_geometry(&self)
pub fn prepare_scene_geometry(&self)
Prepare geometry dirtied by scene changes. Surface replay alone does not invalidate it.
Sourcepub fn canvas_geometry_for_node(
&self,
node: &ExpandedNode,
) -> Rc<PreparedCanvasGeometry>
pub fn canvas_geometry_for_node( &self, node: &ExpandedNode, ) -> Rc<PreparedCanvasGeometry>
Obtain the same prepared record used by spatial replay selection.
Sourcepub fn scene_geometry_stats(&self) -> SceneGeometryStats
pub fn scene_geometry_stats(&self) -> SceneGeometryStats
Work counters for geometry preparation and spatial queries.
Sourcepub fn canvas_nodes_intersecting(
&self,
layer: usize,
regions: &[Rect],
) -> Option<Vec<u32>>
pub fn canvas_nodes_intersecting( &self, layer: usize, regions: &[Rect], ) -> Option<Vec<u32>>
Select canvas nodes using settled runtime geometry, even before their first draw. Call after draining scene effects; querying does not advance layout or dispatch events.
Sourcepub fn request_canvas_replay(&self, update: ReplayCanvasLayerUpdate)
pub fn request_canvas_replay(&self, update: ReplayCanvasLayerUpdate)
Apply a backend’s replay region request through the shared scene index.
pub fn mark_canvas_nodes_on_layer_dirty_by_id( &self, layer: usize, node_ids: &[u32], )
pub fn mark_targeted_canvas_replay_nodes(&self, layer: usize, node_ids: &[u32])
pub fn take_targeted_canvas_replay_node_ids( &self, ) -> HashMap<usize, HashSet<u32>>
pub fn mark_all_canvas_nodes_dirty(&self)
pub fn enqueue_canvas_node_removal(&self, layer: usize, node_id: u32)
pub fn take_canvas_node_removals(&self) -> Vec<(usize, u32)>
Sourcepub fn get_expanded_nodes_by_id(&self, id: &str) -> Vec<Rc<ExpandedNode>>
pub fn get_expanded_nodes_by_id(&self, id: &str) -> Vec<Rc<ExpandedNode>>
Finds all ExpandedNodes with the CommonProperty#id matching the provided string
Sourcepub fn get_expanded_nodes_by_global_ids(
&self,
uni: &UniqueTemplateNodeIdentifier,
) -> Vec<Rc<ExpandedNode>>
pub fn get_expanded_nodes_by_global_ids( &self, uni: &UniqueTemplateNodeIdentifier, ) -> Vec<Rc<ExpandedNode>>
Finds all ExpandedNodes with corresponding UniqueTemplateNodeIdentifier
Sourcepub fn get_elements_beneath_ray(
&self,
root: Option<Rc<ExpandedNode>>,
ray: Point2<Window>,
limit_one: bool,
accum: Vec<Rc<ExpandedNode>>,
hit_invisible: bool,
) -> Vec<Rc<ExpandedNode>>
pub fn get_elements_beneath_ray( &self, root: Option<Rc<ExpandedNode>>, ray: Point2<Window>, limit_one: bool, accum: Vec<Rc<ExpandedNode>>, hit_invisible: bool, ) -> Vec<Rc<ExpandedNode>>
Simple 2D raycasting: the coordinates of the ray represent a
ray running orthogonally to the view plane, intersecting at
the specified point ray. Areas outside of clipping bounds will
not register a hit, nor will elements that suppress input events.
Sourcepub fn get_topmost_element_beneath_ray(
self: &Rc<Self>,
ray: Point2<Window>,
) -> Option<Rc<ExpandedNode>>
pub fn get_topmost_element_beneath_ray( self: &Rc<Self>, ray: Point2<Window>, ) -> Option<Rc<ExpandedNode>>
Alias for get_elements_beneath_ray with limit_one = true
pub fn gen_uid(&self) -> ExpandedNodeIdentifier
pub fn enqueue_native_message(&self, message: NativeMessage)
pub fn take_native_messages(&self) -> Vec<NativeMessage>
pub fn globals(&self) -> Globals
pub fn edit_globals(&self, f: impl Fn(&mut Globals))
pub fn queue_custom_event( &self, source_expanded_node: Rc<ExpandedNode>, name: &'static str, )
pub fn flush_custom_events(self: &Rc<Self>) -> Result<(), String>
pub fn get_root_expanded_node(&self) -> Option<Rc<ExpandedNode>>
pub fn queue_render(&self, expanded_node: Rc<ExpandedNode>)
pub fn recurse_flush_queued_renders( self: &Rc<RuntimeContext>, rcs: &mut dyn RenderContext, )
Source§impl RuntimeContext
impl RuntimeContext
Sourcepub fn viewport_proximity_stats(&self) -> ViewportProximityStats
pub fn viewport_proximity_stats(&self) -> ViewportProximityStats
Observation counters. With no proximity bindings, no observation records are installed.