Skip to main content

ConditionalInstance

Struct ConditionalInstance 

Source
pub struct ConditionalInstance { /* private fields */ }
Expand description

A special “control-flow” primitive, Conditional (if) allows for a subtree of a component template to be rendered conditionally, based on the value of the property boolean_expression. The Pax compiler handles ConditionalInstance specially with the if syntax in templates.

Implementations§

Trait Implementations§

Source§

impl InstanceNode for ConditionalInstance

Source§

fn instantiate(args: InstantiationArgs) -> Rc<Self>
where Self: Sized,

Source§

fn handle_mount( self: Rc<Self>, expanded_node: &Rc<ExpandedNode>, context: &Rc<RuntimeContext>, )

Fires during the tick when a node is first attached to the render tree. For example, this event fires by all nodes on the global first tick, and by all nodes in a subtree when a Conditional subsequently turns on a subtree (i.e. when the Conditionals criterion becomes true after being false through the end of at least 1 frame.) A use-case: send a message to native renderers that a Text element should be rendered and tracked
Source§

fn handle_control_flow_node_expansion( self: Rc<Self>, expanded_node: &Rc<ExpandedNode>, context: &Rc<RuntimeContext>, )

Source§

fn resolve_debug( &self, f: &mut Formatter<'_>, _expanded_node: Option<&ExpandedNode>, ) -> Result

Source§

fn base(&self) -> &BaseInstance

Retrieves the base instance, containing common functionality that all instances share
Source§

fn supports_alpha_source_render(&self) -> bool

Whether ordinary render hooks are valid inside a detached vector alpha source. Native surfaces and cross-surface containers require separate capture support.
Source§

fn requires_non_reactive_update(&self, _expanded_node: &ExpandedNode) -> bool

Whether this instance has per-frame update work that cannot be driven entirely through reactive property effects.
Source§

fn has_scene_lighting(&self) -> bool

Whether this primitive can contribute direct or ambient scene lighting. Read more
Source§

fn resolve_scene_light( &self, _expanded_node: &ExpandedNode, _context: &RuntimeContext, ) -> Option<SceneLight>

Returns a resolved light contribution for a primitive with has_scene_lighting().
Source§

fn resolve_scene_ambient_light( &self, _expanded_node: &ExpandedNode, _context: &RuntimeContext, ) -> Option<SceneAmbientLight>

Returns a resolved ambient contribution for a primitive with has_scene_lighting().
Source§

fn establishes_light_frame(&self) -> bool

Whether this node establishes a lexical boundary for descendant lights.
Source§

fn update( self: Rc<Self>, _expanded_node: &Rc<ExpandedNode>, _context: &Rc<RuntimeContext>, )

Updates the expanded node, recomputing its properties and possibly updating its children.
Source§

fn handle_pre_render( &self, expanded_node: &ExpandedNode, context: &Rc<RuntimeContext>, rcs: &mut dyn RenderContext, )

Second lifecycle method during each render loop, occurs after properties have been computed, but before rendering Example use-case: perform side-effects to the drawing contexts. This is how Frame performs clipping, for example. Occurs in a pre-order traversal of the render tree.
Source§

fn prepare_canvas_geometry(&self, _node: &ExpandedNode) -> CanvasGeometry

Prepare primitive-local paint geometry independently of drawing or surface readiness. Read more
Source§

fn render( &self, expanded_node: &ExpandedNode, context: &Rc<RuntimeContext>, rcs: &mut dyn RenderContext, )

Third lifecycle method during each render loop, occurs after all descendents have been rendered. Occurs in a post-order traversal of the render tree. Most primitives are expected to draw their contents to the rendering context during this event.
Source§

fn handle_post_render( &self, expanded_node: &ExpandedNode, context: &Rc<RuntimeContext>, rcs: &mut dyn RenderContext, )

Fourth and final lifecycle method during each render loop, occurs after all descendents have been rendered AND the current node has been rendered. Useful for clean-up, e.g. this is where Frame cleans up the drawing contexts to stop clipping. Occurs in a post-order traversal of the render tree.
Source§

fn handle_unmount( &self, expanded_node: &Rc<ExpandedNode>, context: &Rc<RuntimeContext>, )

Fires during element unmount, when an element is about to be removed from the render tree (e.g. by a Conditional) A use-case: send a message to native renderers that a Text element should be removed
Source§

fn handle_scroll(&self, args_scroll: Scroll)

Invoked by event interrupts to pass scroll information to render node
Source§

fn get_template(&self) -> Option<&InstanceNodePtrList>

Source§

fn clips_content(&self, _expanded_node: &ExpandedNode) -> bool

Used by frame to control content clipping
Source§

fn ray_cast_test( &self, expanded_node: &ExpandedNode, ray: Point2<Window>, ) -> bool

Override when a primitive needs a more precise hit region than its layout bounds.
Source§

fn scrolls_content(&self, _expanded_node: &ExpandedNode) -> bool

Used by scroller-like primitives to allocate a browser-owned presentation layer.
Source§

fn property_requires_occlusion_recompute(&self, _property_name: &str) -> bool

Returns whether changes to a named typed property invalidate native compositing. Leaf changes update indexed coverage; changes to clipping or layer ownership reconcile the inherited structure. Read more
Source§

fn materializes_native_surface(&self, _expanded_node: &ExpandedNode) -> bool

True when an otherwise layout-only primitive currently materializes a native surface.
Source§

fn materializes_native_surface_before_children( &self, _expanded_node: &ExpandedNode, ) -> bool

True when a materialized native surface should be projected before descendants. Read more
Source§

fn resolve_scroll_offset( &self, _expanded_node: &ExpandedNode, ) -> Option<(f64, f64)>

Returns the current browser-owned scroll offset in local scroller coordinates.
Source§

fn received_children_source(&self) -> ReceivedChildrenSource

Selects which engine child family should be normalized into received_children for semantic container-style consumers. Read more
Source§

fn handle_native_interrupt( &self, _expanded_node: &Rc<ExpandedNode>, _interrupt: &NativeInterrupt, )

Source§

fn handle_setup_projected_children( self: Rc<Self>, _expanded_node: &Rc<ExpandedNode>, _context: &Rc<RuntimeContext>, )

Source§

fn resolve_coverage_path( &self, _expanded_node: &ExpandedNode, ) -> Option<BezPath>

Source§

fn resolve_alpha_mask_paints( &self, _expanded_node: &ExpandedNode, ) -> Vec<AlphaMaskPaint>

Resolves vector paint for an alpha-mask source without rendering or mutating the source’s retained canvas state. Paint-local coverage without common node/ancestor opacity. The Mask consumer applies the source subtree’s opacity factors relative to its own boundary.
Source§

fn resolve_occlusion_path( &self, expanded_node: &ExpandedNode, ) -> Option<BezPath>

Returns coverage used by the occlusion/native-mask/layer-partition pass. Read more
Source§

fn resolve_coverage_opacity(&self, expanded_node: &ExpandedNode) -> f64

Source§

fn resolve_effect_clip_path( &self, _expanded_node: &ExpandedNode, ) -> Option<BezPath>

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>