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
impl AnyRenderObject
Sourcepub fn as_box(self) -> Option<AnyRenderBox>
pub fn as_box(self) -> Option<AnyRenderBox>
Dart’s object as RenderBox, as an Option.
Sourcepub fn as_sliver(self) -> Option<AnyRenderSliver>
pub fn as_sliver(self) -> Option<AnyRenderSliver>
Dart’s object as RenderSliver, as an Option.
Sourcepub fn debug_active_layout() -> Option<AnyRenderObject>
pub fn debug_active_layout() -> Option<AnyRenderObject>
The render object that is actively computing layout.
Only meaningful when asserts are enabled.
Sourcepub fn debug_active_paint() -> Option<AnyRenderObject>
pub fn debug_active_paint() -> Option<AnyRenderObject>
The render object that is actively painting.
Only meaningful when asserts are enabled.
Sourcepub fn parent_data(self, app: &App) -> Option<&dyn ParentData>
pub fn parent_data(self, app: &App) -> Option<&dyn ParentData>
Data for use by the parent render object.
Sourcepub fn parent_data_mut(self, app: &mut App) -> Option<&mut dyn ParentData>
pub fn parent_data_mut(self, app: &mut App) -> Option<&mut dyn ParentData>
Mutable parent data.
Sourcepub fn parent_data_is<P: ParentData + 'static>(self, app: &App) -> bool
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).
Sourcepub fn parent_data_of<P: ParentData + 'static>(self, app: &App) -> &P
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.
Sourcepub fn parent_data_of_mut<P: ParentData + 'static>(
self,
app: &mut App,
) -> &mut P
pub fn parent_data_of_mut<P: ParentData + 'static>( self, app: &mut App, ) -> &mut P
See parent_data_of.
Sourcepub fn set_parent_data(
self,
app: &mut App,
parent_data: impl ParentData + 'static,
)
pub fn set_parent_data( self, app: &mut App, parent_data: impl ParentData + 'static, )
Installs parent data. Dart’s child.parentData = ….
Sourcepub fn parent(self, app: &App) -> Option<AnyRenderObject>
pub fn parent(self, app: &App) -> Option<AnyRenderObject>
The parent of this render object in the render tree.
Sourcepub fn owner(self, app: &App) -> Option<Handle<PipelineOwner>>
pub fn owner(self, app: &App) -> Option<Handle<PipelineOwner>>
The owner for this render object (None if unattached).
Sourcepub fn attached(self, app: &App) -> bool
pub fn attached(self, app: &App) -> bool
Whether this render object belongs to a PipelineOwner.
Sourcepub fn debug_needs_layout(self, app: &App) -> bool
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.
Sourcepub fn visit_children(self, app: &App, visitor: &mut dyn FnMut(AnyRenderObject))
pub fn visit_children(self, app: &App, visitor: &mut dyn FnMut(AnyRenderObject))
Calls visitor for each immediate child.
Sourcepub fn setup_parent_data(self, app: &mut App, child: AnyRenderObject)
pub fn setup_parent_data(self, app: &mut App, child: AnyRenderObject)
Override point used by adopt_child.
Sourcepub fn redepth_child(self, app: &mut App, child: AnyRenderObject)
pub fn redepth_child(self, app: &mut App, child: AnyRenderObject)
Adjust the depth of child to be greater than this node’s own depth.
Sourcepub fn adopt_child(self, app: &mut App, child: AnyRenderObject)
pub fn adopt_child(self, app: &mut App, child: AnyRenderObject)
Called by subclasses when they decide a render object is a child.
Sourcepub fn drop_child(self, app: &mut App, child: AnyRenderObject)
pub fn drop_child(self, app: &mut App, child: AnyRenderObject)
Called by subclasses when they decide a render object is no longer a child.
Sourcepub fn attach(self, app: &mut App, owner: Handle<PipelineOwner>)
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.
Sourcepub fn detach(self, app: &mut App)
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.
Sourcepub fn mark_needs_layout(self, app: &mut App)
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.
Sourcepub fn mark_parent_needs_layout(self, app: &mut App)
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.
Sourcepub fn invoke_layout_callback(
self,
app: &mut App,
callback: impl FnOnce(&mut App),
)
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.
pub fn mark_needs_layout_for_sized_by_parent_change(self, app: &mut App)
Sourcepub fn schedule_initial_layout(self, app: &mut App)
pub fn schedule_initial_layout(self, app: &mut App)
Bootstrap the rendering pipeline by scheduling the very first layout.
Sourcepub fn debug_needs_paint(self, app: &App) -> bool
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.
Sourcepub fn debug_needs_composited_layer_update(self, app: &App) -> bool
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.
Sourcepub fn downcast<T: RenderObject>(self, app: &App) -> Option<RenderHandle<T>>
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.
Sourcepub fn dispose(self, app: &mut App)
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.
Sourcepub fn is_repaint_boundary(self, app: &App) -> bool
pub fn is_repaint_boundary(self, app: &App) -> bool
Whether this render object repaints separately from its parent.
Sourcepub fn paint_bounds(self, app: &App) -> Rect
pub fn paint_bounds(self, app: &App) -> Rect
An estimate of the bounds within which this render object will paint.
Sourcepub fn apply_paint_transform(
self,
app: &App,
child: AnyRenderObject,
transform: &mut Matrix4,
)
pub fn apply_paint_transform( self, app: &App, child: AnyRenderObject, transform: &mut Matrix4, )
Sourcepub fn get_transform_to(
self,
app: &App,
target: Option<AnyRenderObject>,
) -> Matrix4
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).
Sourcepub fn mouse_tracker_annotation(
self,
app: &App,
) -> Option<MouseTrackerAnnotation>
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.
Sourcepub fn interface<I: 'static>(self) -> Option<I>
pub fn interface<I: 'static>(self) -> Option<I>
See RenderObject::interface: Dart’s object is RenderAbstractViewport, as
interface::<AnyRenderAbstractViewport>().
Sourcepub fn show_on_screen(
self,
app: &mut App,
descendant: Option<AnyRenderObject>,
rect: Option<Rect>,
duration: Duration,
curve: Rc<dyn Curve>,
)
pub fn show_on_screen( self, app: &mut App, descendant: Option<AnyRenderObject>, rect: Option<Rect>, duration: Duration, curve: Rc<dyn Curve>, )
Sourcepub fn update_composited_layer(
self,
app: &mut App,
old_layer: Option<AnyOffsetLayer>,
) -> AnyOffsetLayer
pub fn update_composited_layer( self, app: &mut App, old_layer: Option<AnyOffsetLayer>, ) -> AnyOffsetLayer
Sourcepub fn always_needs_compositing(self, app: &App) -> bool
pub fn always_needs_compositing(self, app: &App) -> bool
Whether this render object always needs compositing.
Sourcepub fn layer(self, app: &App) -> Option<AnyContainerLayer>
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.
Sourcepub fn set_layer(self, app: &mut App, new_layer: Option<AnyContainerLayer>)
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.
Sourcepub fn debug_layer(self, app: &App) -> Option<AnyContainerLayer>
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.
Sourcepub fn mark_needs_compositing_bits_update(self, app: &mut App)
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.
Sourcepub fn needs_compositing(self, app: &App) -> bool
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.
Sourcepub fn mark_needs_paint(self, app: &mut App)
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.
Sourcepub fn mark_needs_composited_layer_update(self, app: &mut App)
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.
Sourcepub fn schedule_initial_paint(
self,
app: &mut App,
root_layer: AnyContainerLayer,
)
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.
Sourcepub fn replace_root_layer(self, app: &mut App, root_layer: AnyOffsetLayer)
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
impl Clone for AnyRenderObject
impl Copy for AnyRenderObject
Source§impl Debug for AnyRenderObject
impl Debug for AnyRenderObject
impl Eq for AnyRenderObject
Source§impl From<AnyRenderBox> for AnyRenderObject
impl From<AnyRenderBox> for AnyRenderObject
Source§fn from(box_: AnyRenderBox) -> AnyRenderObject
fn from(box_: AnyRenderBox) -> AnyRenderObject
Source§impl From<AnyRenderObject> for HandleId
impl From<AnyRenderObject> for HandleId
Source§fn from(object: AnyRenderObject) -> HandleId
fn from(object: AnyRenderObject) -> HandleId
Source§impl From<AnyRenderSliver> for AnyRenderObject
impl From<AnyRenderSliver> for AnyRenderObject
Source§fn from(sliver: AnyRenderSliver) -> AnyRenderObject
fn from(sliver: AnyRenderSliver) -> AnyRenderObject
Source§impl Hash for AnyRenderObject
impl Hash for AnyRenderObject
Auto Trait Implementations§
impl Freeze for AnyRenderObject
impl RefUnwindSafe for AnyRenderObject
impl Send for AnyRenderObject
impl Sync for AnyRenderObject
impl Unpin for AnyRenderObject
impl UnsafeUnpin for AnyRenderObject
impl UnwindSafe for AnyRenderObject
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.