Skip to main content

AnyRenderObject

Struct AnyRenderObject 

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

Erased RenderObject: one identity and a static vtable, the fat pointer rustc cannot build for an arena id. No lease.

Equality is Dart’s == on an object reference.

Implementations§

Source§

impl AnyRenderObject

Source

pub fn as_box(self) -> Option<AnyRenderBox>

Dart’s object as RenderBox, as an Option.

Source

pub fn as_sliver(self) -> Option<AnyRenderSliver>

Dart’s object as RenderSliver, as an Option.

Source

pub fn debug_active_layout() -> Option<AnyRenderObject>

The render object that is actively computing layout.

Only meaningful when asserts are enabled.

Source

pub fn debug_active_paint() -> Option<AnyRenderObject>

The render object that is actively painting.

Only meaningful when asserts are enabled.

Source

pub fn parent_data(self, app: &App) -> Option<&dyn ParentData>

Data for use by the parent render object.

Source

pub fn parent_data_mut(self, app: &mut App) -> Option<&mut dyn ParentData>

Mutable parent data.

Source

pub fn parent_data_is<P: ParentData + 'static>(self, app: &App) -> bool

Dart’s parentData is P: whether parent data is a P, or a subclass embedding the P half (ParentData::provide).

Source

pub fn parent_data_of<P: ParentData + 'static>(self, app: &App) -> &P

Dart’s parentData! as P: the parent data when it is a P, or the P half a subclass embeds (ParentData::provide), as SliverGridParentData embeds SliverMultiBoxAdaptorParentData.

§Panics

If parent data is missing, or neither P nor a subclass of it.

Source

pub fn parent_data_of_mut<P: ParentData + 'static>( self, app: &mut App, ) -> &mut P

Source

pub fn set_parent_data( self, app: &mut App, parent_data: impl ParentData + 'static, )

Installs parent data. Dart’s child.parentData = ….

Source

pub fn parent(self, app: &App) -> Option<AnyRenderObject>

The parent of this render object in the render tree.

Source

pub fn owner(self, app: &App) -> Option<Handle<PipelineOwner>>

The owner for this render object (None if unattached).

Source

pub fn attached(self, app: &App) -> bool

Whether this render object belongs to a PipelineOwner.

Source

pub fn depth(self, app: &App) -> i32

The depth of this render object in the render tree.

Source

pub fn debug_needs_layout(self, app: &App) -> bool

Whether this render object’s layout information is dirty.

Always false when debug assertions are disabled.

Source

pub fn visit_children(self, app: &App, visitor: &mut dyn FnMut(AnyRenderObject))

Calls visitor for each immediate child.

Source

pub fn setup_parent_data(self, app: &mut App, child: AnyRenderObject)

Override point used by adopt_child.

Source

pub fn redepth_child(self, app: &mut App, child: AnyRenderObject)

Adjust the depth of child to be greater than this node’s own depth.

Source

pub fn adopt_child(self, app: &mut App, child: AnyRenderObject)

Called by subclasses when they decide a render object is a child.

Source

pub fn drop_child(self, app: &mut App, child: AnyRenderObject)

Called by subclasses when they decide a render object is no longer a child.

Source

pub fn attach(self, app: &mut App, owner: Handle<PipelineOwner>)

Mark this render object as attached to owner.

Flutter’s RenderObject.attach body, then the RenderObject::did_attach hook, which by default attaches the children.

Source

pub fn detach(self, app: &mut App)

Mark this render object as detached from its PipelineOwner.

Flutter’s RenderObject.detach body, then the RenderObject::did_detach hook, which by default detaches the children.

Source

pub fn mark_needs_layout(self, app: &mut App)

Mark this render object’s layout information as dirty.

The box protocol overrides this with crate::RenderBox::mark_needs_layout, which clears the intrinsics and dry-layout caches first.

Source

pub fn mark_parent_needs_layout(self, app: &mut App)

Mark this render object’s layout information as dirty, and then defer to the parent.

Source

pub fn invoke_layout_callback( self, app: &mut App, callback: impl FnOnce(&mut App), )

Mark layout dirty and also mark the parent, for a sized_by_parent change. Allows mutations to be made to this object’s child list (and any descendants) as well as to any other dirty nodes in the render tree owned by the same PipelineOwner as this object. The callback argument is invoked synchronously, and the mutations are allowed only during that callback’s execution.

This exists to allow child lists to be built on-demand during layout (e.g. based on the object’s size), and to enable nodes to be moved around the tree as this happens (e.g. to handle GlobalKey reparenting), while still ensuring that any particular node is only laid out once per frame.

Calling this function disables a number of asserts that are intended to catch likely bugs. As such, using this function is generally discouraged.

This function can only be called during layout.

Source

pub fn mark_needs_layout_for_sized_by_parent_change(self, app: &mut App)

Source

pub fn schedule_initial_layout(self, app: &mut App)

Bootstrap the rendering pipeline by scheduling the very first layout.

Source

pub fn debug_needs_paint(self, app: &App) -> bool

Whether this render object’s paint information is dirty.

Always false when debug assertions are disabled.

Source

pub fn debug_needs_composited_layer_update(self, app: &App) -> bool

Whether this render object’s layer information is dirty.

Always false when debug assertions are disabled.

Source

pub fn id(self) -> HandleId

The arena id behind this handle.

Source

pub fn downcast<T: RenderObject>(self, app: &App) -> Option<RenderHandle<T>>

Dart’s renderObject as T: the typed handle when this object is a T, else None.

Source

pub fn dispose(self, app: &mut App)

Release any resources held by this render object and free its arena slot. Dart’s dispose nulls the layer handle and leaves the object to the collector; the arena has no collector, so the slot is destroyed here after the virtual RenderObject::dispose.

The object must be detached. Its parent may still hold a handle to it: the widget layer unmounts bottom-up and disposes the parent next, as Dart does.

Source

pub fn is_repaint_boundary(self, app: &App) -> bool

Whether this render object repaints separately from its parent.

Source

pub fn paint_bounds(self, app: &App) -> Rect

An estimate of the bounds within which this render object will paint.

Source

pub fn apply_paint_transform( self, app: &App, child: AnyRenderObject, transform: &mut Matrix4, )

Source

pub fn get_transform_to( self, app: &App, target: Option<AnyRenderObject>, ) -> Matrix4

Applies the paint transform from this AnyRenderObject to the target AnyRenderObject.

Returns a matrix that maps the local paint coordinate system to the coordinate system of target, or a Matrix4::zero() if the paint transform can not be computed.

This method throws an exception when the target is not in the same render tree as this render object.

The target argument defaults to the root of the render tree (None).

Source

pub fn mouse_tracker_annotation( self, app: &App, ) -> Option<MouseTrackerAnnotation>

See RenderObject::mouse_tracker_annotation. Also None once the object has left the arena: Dart’s tracker keeps a stale annotation object alive, the arena does not.

Source

pub fn interface<I: 'static>(self) -> Option<I>

See RenderObject::interface: Dart’s object is RenderAbstractViewport, as interface::<AnyRenderAbstractViewport>().

Source

pub fn show_on_screen( self, app: &mut App, descendant: Option<AnyRenderObject>, rect: Option<Rect>, duration: Duration, curve: Rc<dyn Curve>, )

Source

pub fn update_composited_layer( self, app: &mut App, old_layer: Option<AnyOffsetLayer>, ) -> AnyOffsetLayer

Source

pub fn always_needs_compositing(self, app: &App) -> bool

Whether this render object always needs compositing.

Source

pub fn layer(self, app: &App) -> Option<AnyContainerLayer>

The compositing layer that this render object uses to repaint.

If this render object is not a repaint boundary, it is the responsibility of the RenderObject::paint method to populate this field. If needs_compositing is true, this field may be populated with the root-most layer used by the render object implementation. When repainting, instead of creating a new layer the render object may update the layer stored in this field for better performance. It is also OK to leave this field as None and create a new layer on every repaint, but without the performance benefit. If needs_compositing is false, this field must be set to None either by never populating this field, or by setting it to None when the value of needs_compositing changes from true to false.

If this render object is a repaint boundary, the framework automatically creates an OffsetLayer and populates this field prior to calling the RenderObject::paint method. The paint method must not replace the value of this field.

Source

pub fn set_layer(self, app: &mut App, new_layer: Option<AnyContainerLayer>)

Dart’s layer = newLayer. The setter asserts this is not a repaint boundary: the framework creates and assigns an OffsetLayer to a repaint boundary automatically.

Source

pub fn layer_as<T: 'static>(self, app: &App) -> Option<Handle<T>>

Dart’s layer as T?.

Source

pub fn debug_layer(self, app: &App) -> Option<AnyContainerLayer>

In debug mode, the compositing layer that this render object uses to repaint.

This getter is intended for debugging purposes only. In release builds, it always returns None. In debug builds, it returns the layer even if the layer is dirty.

For production code, consider layer.

Source

pub fn mark_needs_compositing_bits_update(self, app: &mut App)

Mark the compositing state for this render object as dirty.

This is called to indicate that the value for needs_compositing needs to be recomputed during the next PipelineOwner::flush_compositing_bits engine phase.

When the subtree is mutated, we need to recompute our needs_compositing bit, and some of our ancestors need to do the same (in case ours changed in a way that will change theirs). To this end, adopt_child and drop_child call this method, and, as necessary, this method calls the parent’s, etc, walking up the tree to mark all the nodes that need updating.

This method does not schedule a rendering frame, because since it cannot be the case that only the compositing bits changed, something else will have scheduled a frame for us.

Source

pub fn needs_compositing(self, app: &App) -> bool

Whether we or one of our descendants has a compositing layer.

If this node needs compositing as indicated by this bit, then all ancestor nodes will also need compositing.

Only legal to call after PipelineOwner::flush_layout and PipelineOwner::flush_compositing_bits have been called.

Source

pub fn mark_needs_paint(self, app: &mut App)

Mark this render object as having changed its visual appearance.

Rather than eagerly updating this render object’s display list in response to writes, we instead mark the render object as needing to paint, which schedules a visual update. As part of the visual update, the rendering pipeline will give this render object an opportunity to update its display list.

Source

pub fn mark_needs_composited_layer_update(self, app: &mut App)

Mark this render object as having changed a property on its composited layer.

Render objects that have a composited layer have is_repaint_boundary equal to true may update the properties of that composited layer without repainting their children. If this render object is a repaint boundary but does not yet have a composited layer created for it, this method will instead mark the nearest repaint boundary parent as needing to be painted.

If this method is called on a render object that is not a repaint boundary or is a repaint boundary but hasn’t been composited yet, it is equivalent to calling mark_needs_paint.

Source

pub fn schedule_initial_paint( self, app: &mut App, root_layer: AnyContainerLayer, )

Bootstrap the rendering pipeline by scheduling the very first paint.

Requires that this render object is attached, is the root of the render tree, and has a composited layer.

Source

pub fn replace_root_layer(self, app: &mut App, root_layer: AnyOffsetLayer)

Replace the layer. This is only valid for the root of a render object subtree (whatever object schedule_initial_paint was called on).

This might be called if, e.g., the device pixel ratio changed.

Trait Implementations§

Source§

impl Clone for AnyRenderObject

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Copy for AnyRenderObject

Source§

impl Debug for AnyRenderObject

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Eq for AnyRenderObject

Source§

impl From<AnyRenderBox> for AnyRenderObject

Source§

fn from(box_: AnyRenderBox) -> AnyRenderObject

Converts to this type from the input type.
Source§

impl From<AnyRenderObject> for HandleId

Source§

fn from(object: AnyRenderObject) -> HandleId

Converts to this type from the input type.
Source§

impl From<AnyRenderSliver> for AnyRenderObject

Source§

fn from(sliver: AnyRenderSliver) -> AnyRenderObject

Converts to this type from the input type.
Source§

impl Hash for AnyRenderObject

Source§

fn hash<H: Hasher>(&self, state: &mut H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl PartialEq for AnyRenderObject

Source§

fn eq(&self, other: &AnyRenderObject) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more

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> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> Downcast<T> for T

Source§

fn downcast(&self) -> &T

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. Read more
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
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> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
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<T> Upcast<T> for T

Source§

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

Source§

impl<T> WasmNotSend for T
where T: Send,

Source§

impl<T> WasmNotSendSync for T

Source§

impl<T> WasmNotSync for T
where T: Sync,