Skip to main content

RuntimeContext

Struct RuntimeContext 

Source
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: PropertyGraph

Owner-thread bridge for application properties.

§layer_count: Cell<usize>§dirty_canvases: Rc<RefCell<Vec<bool>>>

Implementations§

Source§

impl RuntimeContext

Source

pub fn new(globals: Globals) -> Self

Create a runtime context for normal app execution.

Source

pub fn register_root_expanded_node(&self, root: &Rc<ExpandedNode>)

Store the root expanded node after it has been initialized.

Source

pub fn clear_root_expanded_node(&self)

Clear the registered root expanded node.

Source

pub fn add_to_cache(&self, node: &Rc<ExpandedNode>)

Add a node to runtime lookup caches.

Source

pub fn remove_from_cache(&self, node: &Rc<ExpandedNode>)

Remove a node from runtime lookup caches.

Source

pub fn has_import_settings_nodes(&self) -> bool

Source

pub fn register_node_effect_property( &self, node: ExpandedNodeIdentifier, prop: &LocalProperty<()>, )

Source

pub fn register_node_effect_property_named( &self, node: ExpandedNodeIdentifier, prop: &LocalProperty<()>, effect_name: &str, )

Source

pub fn register_expanded_node_effect_property_named( &self, node: &Rc<ExpandedNode>, prop: &LocalProperty<()>, effect_name: &str, )

Source

pub fn register_node_effect( &self, node: ExpandedNodeIdentifier, dependencies: &[UntypedProperty], effect: impl Fn() + 'static, ) -> LocalProperty<()>

Source

pub fn drain_node_effects(&self)

Source

pub fn tick_handler_nodes(&self) -> Vec<ExpandedNodeIdentifier>

Source

pub fn pre_render_handler_nodes(&self) -> Vec<ExpandedNodeIdentifier>

Source

pub fn gyro_handler_nodes(&self) -> Vec<ExpandedNodeIdentifier>

Source

pub fn accel_handler_nodes(&self) -> Vec<ExpandedNodeIdentifier>

Source

pub fn get_expanded_node_by_eid( &self, id: ExpandedNodeIdentifier, ) -> Option<Rc<ExpandedNode>>

Look up an expanded node by runtime id.

Source

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.

Source

pub fn captured_touch_target(&self, identifier: i64) -> Option<Rc<ExpandedNode>>

Resolve the node captured for an active touch sequence.

Source

pub fn release_touch_target(&self, identifier: i64) -> Option<Rc<ExpandedNode>>

Release and resolve the node captured for a completed touch sequence.

Source

pub fn load_screenshot(&self, id: u32, data: ScreenshotData) -> bool

Store a screenshot payload delivered by the chassis.

Source

pub fn get_screenshot_map(&self) -> Rc<RefCell<HashMap<u32, ScreenshotData>>>

Shared screenshot capture map keyed by request id.

Source

pub fn set_scroller_surface_state( &self, id: u32, state: ScrollerSurfaceState, ) -> ScrollerSurfaceStateChange

Remember browser-owned scroller state for native compositing and scroll transforms.

Source

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.

Source

pub fn remove_scroller_surface_state(&self, id: u32)

Remove cached scroller surface state.

Source

pub fn get_scroller_surface_state( &self, id: u32, ) -> Option<ScrollerSurfaceState>

Fetch cached scroller surface state by node id.

Source

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.

Source

pub fn clear_layer_scroller_owners(&self)

Clear render-layer-to-scroller ownership before recomputing occlusion.

Source

pub fn register_layer_scroller_owner( &self, layer_id: usize, scroller_id: ExpandedNodeIdentifier, )

Record that a render layer is owned by a particular scroller.

Source

pub fn get_layer_scroller_owner( &self, layer_id: usize, ) -> Option<ExpandedNodeIdentifier>

Find the scroller that owns a render layer, when one exists.

Source

pub fn set_root_scroller_id(&self, id: Option<u32>)

Mark which node currently delegates root scrolling behavior to the page.

Source

pub fn get_root_scroller_id(&self) -> Option<u32>

Current page-scroll-backed root scroller id.

Source

pub fn safe_area_insets(&self) -> LocalProperty<SafeAreaInsets>

Live native safe-area data used by opt-in layout primitives. Defaults to zero.

Source

pub fn set_safe_area_insets(&self, insets: SafeAreaInsets)

Update native safe-area data without changing the viewport or root layout.

Source

pub fn set_visual_viewport_state(&self, state: VisualViewportState)

Cache the browser visual viewport state for root scroller math.

Source

pub fn clear_visual_viewport_state(&self)

Clear cached visual viewport state.

Source

pub fn get_visual_viewport_state(&self) -> Option<VisualViewportState>

Return cached browser visual viewport state, if available.

Source

pub fn resize_canvas_layers_to(&self, id: usize)

Ensure the dirty-canvas table has entries up to the requested layer count.

Source

pub fn mark_layer_canvas_plans_dirty(&self)

Source

pub fn layer_canvas_plan_generation(&self) -> u32

Source

pub fn set_canvas_drawable_layers(&self, layers: HashSet<usize>)

Replace the set of render layers that currently contain canvas drawables.

Source

pub fn layer_has_canvas_drawables(&self, layer: usize) -> bool

Return whether a render layer currently has canvas work to paint.

Source

pub fn clear_all_dirty_canvases(&self)

Mark every canvas layer clean.

Source

pub fn set_canvas_dirty(&self, id: usize)

Mark a canvas layer dirty.

Source

pub fn is_canvas_dirty(&self, id: &usize) -> bool

Check whether a canvas layer needs redraw.

Source

pub fn dirty_canvas_layers(&self) -> Vec<usize>

Source

pub fn has_dirty_canvas_layers(&self) -> bool

Source

pub fn has_dirty_canvas_nodes(&self) -> bool

Source

pub fn has_canvas_node_removals(&self) -> bool

Source

pub fn has_canvas_render_work(&self) -> bool

Source

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.

Source

pub fn mark_occlusion_dirty(&self)

Source

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.

Source

pub fn occlusion_stats(&self) -> OcclusionStats

Cumulative work performed by native compositing, including conservative rebuilds.

Source

pub fn take_occlusion_dirty(&self) -> bool

Source

pub fn set_all_canvases_dirty(&self)

Source

pub fn mark_canvas_node_dirty(&self, id: ExpandedNodeIdentifier)

Source

pub fn clear_canvas_node_dirty(&self, id: &ExpandedNodeIdentifier)

Source

pub fn is_canvas_node_dirty(&self, id: &ExpandedNodeIdentifier) -> bool

Source

pub fn dirty_canvas_node_ids(&self) -> Vec<ExpandedNodeIdentifier>

Source

pub fn mark_canvas_nodes_on_layer_dirty(&self, layer: usize)

Source

pub fn canvas_node_light_mask(&self, id: ExpandedNodeIdentifier) -> u32

Return the direct-light membership mask resolved for a retained canvas node.

Source

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.

Source

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.

Source

pub fn prepare_scene_geometry(&self)

Prepare geometry dirtied by scene changes. Surface replay alone does not invalidate it.

Source

pub fn canvas_geometry_for_node( &self, node: &ExpandedNode, ) -> Rc<PreparedCanvasGeometry>

Obtain the same prepared record used by spatial replay selection.

Source

pub fn scene_geometry_stats(&self) -> SceneGeometryStats

Work counters for geometry preparation and spatial queries.

Source

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.

Source

pub fn request_canvas_replay(&self, update: ReplayCanvasLayerUpdate)

Apply a backend’s replay region request through the shared scene index.

Source

pub fn mark_canvas_nodes_on_layer_dirty_by_id( &self, layer: usize, node_ids: &[u32], )

Source

pub fn mark_targeted_canvas_replay_nodes(&self, layer: usize, node_ids: &[u32])

Source

pub fn take_targeted_canvas_replay_node_ids( &self, ) -> HashMap<usize, HashSet<u32>>

Source

pub fn mark_all_canvas_nodes_dirty(&self)

Source

pub fn enqueue_canvas_node_removal(&self, layer: usize, node_id: u32)

Source

pub fn take_canvas_node_removals(&self) -> Vec<(usize, u32)>

Source

pub fn get_expanded_nodes_by_id(&self, id: &str) -> Vec<Rc<ExpandedNode>>

Finds all ExpandedNodes with the CommonProperty#id matching the provided string

Source

pub fn get_expanded_nodes_by_global_ids( &self, uni: &UniqueTemplateNodeIdentifier, ) -> Vec<Rc<ExpandedNode>>

Finds all ExpandedNodes with corresponding UniqueTemplateNodeIdentifier

Source

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.

Source

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

Source

pub fn gen_uid(&self) -> ExpandedNodeIdentifier

Source

pub fn enqueue_native_message(&self, message: NativeMessage)

Source

pub fn take_native_messages(&self) -> Vec<NativeMessage>

Source

pub fn globals(&self) -> Globals

Source

pub fn edit_globals(&self, f: impl Fn(&mut Globals))

Source

pub fn queue_custom_event( &self, source_expanded_node: Rc<ExpandedNode>, name: &'static str, )

Source

pub fn flush_custom_events(self: &Rc<Self>) -> Result<(), String>

Source

pub fn get_root_expanded_node(&self) -> Option<Rc<ExpandedNode>>

Source

pub fn queue_render(&self, expanded_node: Rc<ExpandedNode>)

Source

pub fn recurse_flush_queued_renders( self: &Rc<RuntimeContext>, rcs: &mut dyn RenderContext, )

Source§

impl RuntimeContext

Source

pub fn viewport_proximity_stats(&self) -> ViewportProximityStats

Observation counters. With no proximity bindings, no observation records are installed.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> RoundFrom<T> for T

Source§

fn round_from(x: T) -> T

Performs the conversion.
Source§

impl<T, U> RoundInto<U> for T
where U: RoundFrom<T>,

Source§

fn round_into(self) -> U

Performs the conversion.
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<S, T> Upcast<T> for S
where T: UpcastFrom<S> + ?Sized, S: ?Sized,

Source§

fn upcast(&self) -> &T
where Self: ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider ref type within the Wasm bindgen generics type system. Read more
Source§

fn upcast_into(self) -> T
where Self: Sized + ErasableGeneric, T: Sized + ErasableGeneric<Repr = Self::Repr>,

Perform a zero-cost type-safe upcast to a wider type within the Wasm bindgen generics type system. Read more
Source§

impl<T> Upcast<T> for T

Source§

fn upcast(&self) -> Option<&T>