1//! Elements are the workhorses of GPUI. They are responsible for laying out and painting all of
2//! the contents of a window. Elements form a tree and are laid out according to the web layout
3//! standards as implemented by [taffy](https://github.com/DioxusLabs/taffy). Most of the time,
4//! you won't need to interact with this module or these APIs directly. Elements provide their
5//! own APIs and GPUI, or other element implementation, uses the APIs in this module to convert
6//! that element tree into the pixels you see on the screen.
7//!
8//! # Element Basics
9//!
10//! Elements are constructed by calling [`Render::render()`] on the root view of the window,
11//! which recursively constructs the element tree from the current state of the application,.
12//! These elements are then laid out by Taffy, and painted to the screen according to their own
13//! implementation of [`Element::paint()`]. Before the start of the next frame, the entire element
14//! tree and any callbacks they have registered with GPUI are dropped and the process repeats.
15//!
16//! But some state is too simple and voluminous to store in every view that needs it, e.g.
17//! whether a hover has been started or not. For this, GPUI provides the [`Element::PrepaintState`], associated type.
18//!
19//! # Implementing your own elements
20//!
21//! Elements are intended to be the low level, imperative API to GPUI. They are responsible for upholding,
22//! or breaking, GPUI's features as they deem necessary. As an example, most GPUI elements are expected
23//! to stay in the bounds that their parent element gives them. But with [`Window::with_content_mask`],
24//! you can ignore this restriction and paint anywhere inside of the window's bounds. This is useful for overlays
25//! and popups and anything else that shows up 'on top' of other elements.
26//! With great power, comes great responsibility.
27//!
28//! However, most of the time, you won't need to implement your own elements. GPUI provides a number of
29//! elements that should cover most common use cases out of the box and it's recommended that you use those
30//! to construct `components`, using the [`RenderOnce`] trait and the `#[derive(IntoElement)]` macro. Only implement
31//! elements when you need to take manual control of the layout and painting process, such as when using
32//! your own custom layout algorithm or rendering a code editor.
33
34use crate::{
35 App, ArenaBox, AvailableSpace, Bounds, Context, DispatchNodeId, ELEMENT_ARENA, ElementId,
36 FocusHandle, InspectorElementId, LayoutId, Pixels, Point, Size, Style, Window,
37 util::FluentBuilder,
38};
39use derive_more::{Deref, DerefMut};
40pub(crate) use smallvec::SmallVec;
41use std::{
42 any::{Any, type_name},
43 fmt::{self, Debug, Display},
44 mem, panic,
45};
46
47/// Implemented by types that participate in laying out and painting the contents of a window.
48/// Elements form a tree and are laid out according to web-based layout rules, as implemented by Taffy.
49/// You can create custom elements by implementing this trait, see the module-level documentation
50/// for more details.
51pub trait Element: 'static + IntoElement {
52 /// The type of state returned from [`Element::request_layout`]. A mutable reference to this state is subsequently
53 /// provided to [`Element::prepaint`] and [`Element::paint`].
54 type RequestLayoutState: 'static;
55
56 /// The type of state returned from [`Element::prepaint`]. A mutable reference to this state is subsequently
57 /// provided to [`Element::paint`].
58 type PrepaintState: 'static;
59
60 /// If this element has a unique identifier, return it here. This is used to track elements across frames, and
61 /// will cause a GlobalElementId to be passed to the request_layout, prepaint, and paint methods.
62 ///
63 /// The global id can in turn be used to access state that's connected to an element with the same id across
64 /// frames. This id must be unique among children of the first containing element with an id.
65 fn id(&self) -> Option<ElementId>;
66
67 /// Source location where this element was constructed, used to disambiguate elements in the
68 /// inspector and navigate to their source code.
69 fn source_location(&self) -> Option<&'static panic::Location<'static>>;
70
71 /// Before an element can be painted, we need to know where it's going to be and how big it is.
72 /// Use this method to request a layout from Taffy and initialize the element's state.
73 fn request_layout(
74 &mut self,
75 id: Option<&GlobalElementId>,
76 inspector_id: Option<&InspectorElementId>,
77 window: &mut Window,
78 cx: &mut App,
79 ) -> (LayoutId, Self::RequestLayoutState);
80
81 /// After laying out an element, we need to commit its bounds to the current frame for hitbox
82 /// purposes. The state argument is the same state that was returned from [`Element::request_layout()`].
83 fn prepaint(
84 &mut self,
85 id: Option<&GlobalElementId>,
86 inspector_id: Option<&InspectorElementId>,
87 bounds: Bounds<Pixels>,
88 request_layout: &mut Self::RequestLayoutState,
89 window: &mut Window,
90 cx: &mut App,
91 ) -> Self::PrepaintState;
92
93 /// Once layout has been completed, this method will be called to paint the element to the screen.
94 /// The state argument is the same state that was returned from [`Element::request_layout()`].
95 fn paint(
96 &mut self,
97 id: Option<&GlobalElementId>,
98 inspector_id: Option<&InspectorElementId>,
99 bounds: Bounds<Pixels>,
100 request_layout: &mut Self::RequestLayoutState,
101 prepaint: &mut Self::PrepaintState,
102 window: &mut Window,
103 cx: &mut App,
104 );
105
106 /// Convert this element into a dynamically-typed [`AnyElement`].
107 fn into_any(self) -> AnyElement {
108 AnyElement::new(self)
109 }
110}
111
112/// Implemented by any type that can be converted into an element.
113pub trait IntoElement: Sized {
114 /// The specific type of element into which the implementing type is converted.
115 /// Useful for converting other types into elements automatically, like Strings
116 type Element: Element;
117
118 /// Convert self into a type that implements [`Element`].
119 fn into_element(self) -> Self::Element;
120
121 /// Convert self into a dynamically-typed [`AnyElement`].
122 fn into_any_element(self) -> AnyElement {
123 self.into_element().into_any()
124 }
125}
126
127impl<T: IntoElement> FluentBuilder for T {}
128
129/// An object that can be drawn to the screen. This is the trait that distinguishes "views" from
130/// other entities. Views are `Entity`'s which `impl Render` and drawn to the screen.
131pub trait Render: 'static + Sized {
132 /// Render this view into an element tree.
133 fn render(&mut self, window: &mut Window, cx: &mut Context<Self>) -> impl IntoElement;
134}
135
136impl Render for Empty {
137 fn render(&mut self, _window: &mut Window, _cx: &mut Context<Self>) -> impl IntoElement {
138 Empty
139 }
140}
141
142/// You can derive [`IntoElement`] on any type that implements this trait.
143/// It is used to construct reusable `components` out of plain data. Think of
144/// components as a recipe for a certain pattern of elements. RenderOnce allows
145/// you to invoke this pattern, without breaking the fluent builder pattern of
146/// the element APIs.
147pub trait RenderOnce: 'static {
148 /// Render this component into an element tree. Note that this method
149 /// takes ownership of self, as compared to [`Render::render()`] method
150 /// which takes a mutable reference.
151 fn render(self, window: &mut Window, cx: &mut App) -> impl IntoElement;
152}
153
154/// This is a helper trait to provide a uniform interface for constructing elements that
155/// can accept any number of any kind of child elements
156pub trait ParentElement {
157 /// Extend this element's children with the given child elements.
158 fn extend(&mut self, elements: impl IntoIterator<Item = AnyElement>);
159
160 /// Add a single child element to this element.
161 fn child(mut self, child: impl IntoElement) -> Self
162 where
163 Self: Sized,
164 {
165 self.extend(std::iter::once(child.into_element().into_any()));
166 self
167 }
168
169 /// Add multiple child elements to this element.
170 fn children(mut self, children: impl IntoIterator<Item = impl IntoElement>) -> Self
171 where
172 Self: Sized,
173 {
174 self.extend(children.into_iter().map(|child| child.into_any_element()));
175 self
176 }
177}
178
179/// An element for rendering components. An implementation detail of the [`IntoElement`] derive macro
180/// for [`RenderOnce`]
181#[doc(hidden)]
182pub struct Component<C: RenderOnce> {
183 component: Option<C>,
184 #[cfg(debug_assertions)]
185 source: &'static core::panic::Location<'static>,
186}
187
188impl<C: RenderOnce> Component<C> {
189 /// Create a new component from the given RenderOnce type.
190 #[track_caller]
191 pub fn new(component: C) -> Self {
192 Component {
193 component: Some(component),
194 #[cfg(debug_assertions)]
195 source: core::panic::Location::caller(),
196 }
197 }
198}
199
200impl<C: RenderOnce> Element for Component<C> {
201 type RequestLayoutState = AnyElement;
202 type PrepaintState = ();
203
204 fn id(&self) -> Option<ElementId> {
205 None
206 }
207
208 fn source_location(&self) -> Option<&'static core::panic::Location<'static>> {
209 #[cfg(debug_assertions)]
210 return Some(self.source);
211
212 #[cfg(not(debug_assertions))]
213 return None;
214 }
215
216 fn request_layout(
217 &mut self,
218 _id: Option<&GlobalElementId>,
219 _inspector_id: Option<&InspectorElementId>,
220 window: &mut Window,
221 cx: &mut App,
222 ) -> (LayoutId, Self::RequestLayoutState) {
223 window.with_global_id(ElementId::Name(type_name::<C>().into()), |_, window| {
224 let mut element = self
225 .component
226 .take()
227 .unwrap()
228 .render(window, cx)
229 .into_any_element();
230
231 let layout_id = element.request_layout(window, cx);
232 (layout_id, element)
233 })
234 }
235
236 fn prepaint(
237 &mut self,
238 _id: Option<&GlobalElementId>,
239 _inspector_id: Option<&InspectorElementId>,
240 _: Bounds<Pixels>,
241 element: &mut AnyElement,
242 window: &mut Window,
243 cx: &mut App,
244 ) {
245 window.with_global_id(ElementId::Name(type_name::<C>().into()), |_, window| {
246 element.prepaint(window, cx);
247 })
248 }
249
250 fn paint(
251 &mut self,
252 _id: Option<&GlobalElementId>,
253 _inspector_id: Option<&InspectorElementId>,
254 _: Bounds<Pixels>,
255 element: &mut Self::RequestLayoutState,
256 _: &mut Self::PrepaintState,
257 window: &mut Window,
258 cx: &mut App,
259 ) {
260 window.with_global_id(ElementId::Name(type_name::<C>().into()), |_, window| {
261 element.paint(window, cx);
262 })
263 }
264}
265
266impl<C: RenderOnce> IntoElement for Component<C> {
267 type Element = Self;
268
269 fn into_element(self) -> Self::Element {
270 self
271 }
272}
273
274/// A globally unique identifier for an element, used to track state across frames.
275#[derive(Deref, DerefMut, Default, Debug, Eq, PartialEq, Hash)]
276pub struct GlobalElementId(pub(crate) SmallVec<[ElementId; 32]>);
277
278impl Display for GlobalElementId {
279 fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
280 for (i, element_id) in self.0.iter().enumerate() {
281 if i > 0 {
282 write!(f, ".")?;
283 }
284 write!(f, "{}", element_id)?;
285 }
286 Ok(())
287 }
288}
289
290trait ElementObject {
291 fn inner_element(&mut self) -> &mut dyn Any;
292
293 fn request_layout(&mut self, window: &mut Window, cx: &mut App) -> LayoutId;
294
295 fn prepaint(&mut self, window: &mut Window, cx: &mut App);
296
297 fn paint(&mut self, window: &mut Window, cx: &mut App);
298
299 fn layout_as_root(
300 &mut self,
301 available_space: Size<AvailableSpace>,
302 window: &mut Window,
303 cx: &mut App,
304 ) -> Size<Pixels>;
305}
306
307/// A wrapper around an implementer of [`Element`] that allows it to be drawn in a window.
308pub struct Drawable<E: Element> {
309 /// The drawn element.
310 pub element: E,
311 phase: ElementDrawPhase<E::RequestLayoutState, E::PrepaintState>,
312}
313
314#[derive(Default)]
315enum ElementDrawPhase<RequestLayoutState, PrepaintState> {
316 #[default]
317 Start,
318 RequestLayout {
319 layout_id: LayoutId,
320 global_id: Option<GlobalElementId>,
321 inspector_id: Option<InspectorElementId>,
322 request_layout: RequestLayoutState,
323 },
324 LayoutComputed {
325 layout_id: LayoutId,
326 global_id: Option<GlobalElementId>,
327 inspector_id: Option<InspectorElementId>,
328 available_space: Size<AvailableSpace>,
329 request_layout: RequestLayoutState,
330 },
331 Prepaint {
332 node_id: DispatchNodeId,
333 global_id: Option<GlobalElementId>,
334 inspector_id: Option<InspectorElementId>,
335 bounds: Bounds<Pixels>,
336 request_layout: RequestLayoutState,
337 prepaint: PrepaintState,
338 },
339 Painted,
340}
341
342/// A wrapper around an implementer of [`Element`] that allows it to be drawn in a window.
343impl<E: Element> Drawable<E> {
344 pub(crate) fn new(element: E) -> Self {
345 Drawable {
346 element,
347 phase: ElementDrawPhase::Start,
348 }
349 }
350
351 fn request_layout(&mut self, window: &mut Window, cx: &mut App) -> LayoutId {
352 match mem::take(&mut self.phase) {
353 ElementDrawPhase::Start => {
354 let global_id = self.element.id().map(|element_id| {
355 window.element_id_stack.push(element_id);
356 GlobalElementId(window.element_id_stack.clone())
357 });
358
359 let inspector_id;
360 #[cfg(any(feature = "inspector", debug_assertions))]
361 {
362 inspector_id = self.element.source_location().map(|source| {
363 let path = crate::InspectorElementPath {
364 global_id: GlobalElementId(window.element_id_stack.clone()),
365 source_location: source,
366 };
367 window.build_inspector_element_id(path)
368 });
369 }
370 #[cfg(not(any(feature = "inspector", debug_assertions)))]
371 {
372 inspector_id = None;
373 }
374
375 let (layout_id, request_layout) = self.element.request_layout(
376 global_id.as_ref(),
377 inspector_id.as_ref(),
378 window,
379 cx,
380 );
381
382 if global_id.is_some() {
383 window.element_id_stack.pop();
384 }
385
386 self.phase = ElementDrawPhase::RequestLayout {
387 layout_id,
388 global_id,
389 inspector_id,
390 request_layout,
391 };
392 layout_id
393 }
394 _ => panic!("must call request_layout only once"),
395 }
396 }
397
398 pub(crate) fn prepaint(&mut self, window: &mut Window, cx: &mut App) {
399 match mem::take(&mut self.phase) {
400 ElementDrawPhase::RequestLayout {
401 layout_id,
402 global_id,
403 inspector_id,
404 mut request_layout,
405 }
406 | ElementDrawPhase::LayoutComputed {
407 layout_id,
408 global_id,
409 inspector_id,
410 mut request_layout,
411 ..
412 } => {
413 if let Some(element_id) = self.element.id() {
414 window.element_id_stack.push(element_id);
415 debug_assert_eq!(global_id.as_ref().unwrap().0, window.element_id_stack);
416 }
417
418 let bounds = window.layout_bounds(layout_id);
419 let node_id = window.next_frame.dispatch_tree.push_node();
420 let prepaint = self.element.prepaint(
421 global_id.as_ref(),
422 inspector_id.as_ref(),
423 bounds,
424 &mut request_layout,
425 window,
426 cx,
427 );
428 window.next_frame.dispatch_tree.pop_node();
429
430 if global_id.is_some() {
431 window.element_id_stack.pop();
432 }
433
434 self.phase = ElementDrawPhase::Prepaint {
435 node_id,
436 global_id,
437 inspector_id,
438 bounds,
439 request_layout,
440 prepaint,
441 };
442 }
443 _ => panic!("must call request_layout before prepaint"),
444 }
445 }
446
447 pub(crate) fn paint(
448 &mut self,
449 window: &mut Window,
450 cx: &mut App,
451 ) -> (E::RequestLayoutState, E::PrepaintState) {
452 match mem::take(&mut self.phase) {
453 ElementDrawPhase::Prepaint {
454 node_id,
455 global_id,
456 inspector_id,
457 bounds,
458 mut request_layout,
459 mut prepaint,
460 ..
461 } => {
462 if let Some(element_id) = self.element.id() {
463 window.element_id_stack.push(element_id);
464 debug_assert_eq!(global_id.as_ref().unwrap().0, window.element_id_stack);
465 }
466
467 window.next_frame.dispatch_tree.set_active_node(node_id);
468 self.element.paint(
469 global_id.as_ref(),
470 inspector_id.as_ref(),
471 bounds,
472 &mut request_layout,
473 &mut prepaint,
474 window,
475 cx,
476 );
477
478 if global_id.is_some() {
479 window.element_id_stack.pop();
480 }
481
482 self.phase = ElementDrawPhase::Painted;
483 (request_layout, prepaint)
484 }
485 _ => panic!("must call prepaint before paint"),
486 }
487 }
488
489 pub(crate) fn layout_as_root(
490 &mut self,
491 available_space: Size<AvailableSpace>,
492 window: &mut Window,
493 cx: &mut App,
494 ) -> Size<Pixels> {
495 if matches!(&self.phase, ElementDrawPhase::Start) {
496 self.request_layout(window, cx);
497 }
498
499 let layout_id = match mem::take(&mut self.phase) {
500 ElementDrawPhase::RequestLayout {
501 layout_id,
502 global_id,
503 inspector_id,
504 request_layout,
505 } => {
506 window.compute_layout(layout_id, available_space, cx);
507 self.phase = ElementDrawPhase::LayoutComputed {
508 layout_id,
509 global_id,
510 inspector_id,
511 available_space,
512 request_layout,
513 };
514 layout_id
515 }
516 ElementDrawPhase::LayoutComputed {
517 layout_id,
518 global_id,
519 inspector_id,
520 available_space: prev_available_space,
521 request_layout,
522 } => {
523 if available_space != prev_available_space {
524 window.compute_layout(layout_id, available_space, cx);
525 }
526 self.phase = ElementDrawPhase::LayoutComputed {
527 layout_id,
528 global_id,
529 inspector_id,
530 available_space,
531 request_layout,
532 };
533 layout_id
534 }
535 _ => panic!("cannot measure after painting"),
536 };
537
538 window.layout_bounds(layout_id).size
539 }
540}
541
542impl<E> ElementObject for Drawable<E>
543where
544 E: Element,
545 E::RequestLayoutState: 'static,
546{
547 fn inner_element(&mut self) -> &mut dyn Any {
548 &mut self.element
549 }
550
551 fn request_layout(&mut self, window: &mut Window, cx: &mut App) -> LayoutId {
552 Drawable::request_layout(self, window, cx)
553 }
554
555 fn prepaint(&mut self, window: &mut Window, cx: &mut App) {
556 Drawable::prepaint(self, window, cx);
557 }
558
559 fn paint(&mut self, window: &mut Window, cx: &mut App) {
560 Drawable::paint(self, window, cx);
561 }
562
563 fn layout_as_root(
564 &mut self,
565 available_space: Size<AvailableSpace>,
566 window: &mut Window,
567 cx: &mut App,
568 ) -> Size<Pixels> {
569 Drawable::layout_as_root(self, available_space, window, cx)
570 }
571}
572
573/// A dynamically typed element that can be used to store any element type.
574pub struct AnyElement(ArenaBox<dyn ElementObject>);
575
576impl AnyElement {
577 pub(crate) fn new<E>(element: E) -> Self
578 where
579 E: 'static + Element,
580 E::RequestLayoutState: Any,
581 {
582 let element = ELEMENT_ARENA
583 .with_borrow_mut(|arena| arena.alloc(|| Drawable::new(element)))
584 .map(|element| element as &mut dyn ElementObject);
585 AnyElement(element)
586 }
587
588 /// Attempt to downcast a reference to the boxed element to a specific type.
589 pub fn downcast_mut<T: 'static>(&mut self) -> Option<&mut T> {
590 self.0.inner_element().downcast_mut::<T>()
591 }
592
593 /// Request the layout ID of the element stored in this `AnyElement`.
594 /// Used for laying out child elements in a parent element.
595 pub fn request_layout(&mut self, window: &mut Window, cx: &mut App) -> LayoutId {
596 self.0.request_layout(window, cx)
597 }
598
599 /// Prepares the element to be painted by storing its bounds, giving it a chance to draw hitboxes and
600 /// request autoscroll before the final paint pass is confirmed.
601 pub fn prepaint(&mut self, window: &mut Window, cx: &mut App) -> Option<FocusHandle> {
602 let focus_assigned = window.next_frame.focus.is_some();
603
604 self.0.prepaint(window, cx);
605
606 if !focus_assigned && let Some(focus_id) = window.next_frame.focus {
607 return FocusHandle::for_id(focus_id, &cx.focus_handles);
608 }
609
610 None
611 }
612
613 /// Paints the element stored in this `AnyElement`.
614 pub fn paint(&mut self, window: &mut Window, cx: &mut App) {
615 self.0.paint(window, cx);
616 }
617
618 /// Performs layout for this element within the given available space and returns its size.
619 pub fn layout_as_root(
620 &mut self,
621 available_space: Size<AvailableSpace>,
622 window: &mut Window,
623 cx: &mut App,
624 ) -> Size<Pixels> {
625 self.0.layout_as_root(available_space, window, cx)
626 }
627
628 /// Prepaints this element at the given absolute origin.
629 /// If any element in the subtree beneath this element is focused, its FocusHandle is returned.
630 pub fn prepaint_at(
631 &mut self,
632 origin: Point<Pixels>,
633 window: &mut Window,
634 cx: &mut App,
635 ) -> Option<FocusHandle> {
636 window.with_absolute_element_offset(origin, |window| self.prepaint(window, cx))
637 }
638
639 /// Performs layout on this element in the available space, then prepaints it at the given absolute origin.
640 /// If any element in the subtree beneath this element is focused, its FocusHandle is returned.
641 pub fn prepaint_as_root(
642 &mut self,
643 origin: Point<Pixels>,
644 available_space: Size<AvailableSpace>,
645 window: &mut Window,
646 cx: &mut App,
647 ) -> Option<FocusHandle> {
648 self.layout_as_root(available_space, window, cx);
649 window.with_absolute_element_offset(origin, |window| self.prepaint(window, cx))
650 }
651}
652
653impl Element for AnyElement {
654 type RequestLayoutState = ();
655 type PrepaintState = ();
656
657 fn id(&self) -> Option<ElementId> {
658 None
659 }
660
661 fn source_location(&self) -> Option<&'static panic::Location<'static>> {
662 None
663 }
664
665 fn request_layout(
666 &mut self,
667 _: Option<&GlobalElementId>,
668 _inspector_id: Option<&InspectorElementId>,
669 window: &mut Window,
670 cx: &mut App,
671 ) -> (LayoutId, Self::RequestLayoutState) {
672 let layout_id = self.request_layout(window, cx);
673 (layout_id, ())
674 }
675
676 fn prepaint(
677 &mut self,
678 _: Option<&GlobalElementId>,
679 _inspector_id: Option<&InspectorElementId>,
680 _: Bounds<Pixels>,
681 _: &mut Self::RequestLayoutState,
682 window: &mut Window,
683 cx: &mut App,
684 ) {
685 self.prepaint(window, cx);
686 }
687
688 fn paint(
689 &mut self,
690 _: Option<&GlobalElementId>,
691 _inspector_id: Option<&InspectorElementId>,
692 _: Bounds<Pixels>,
693 _: &mut Self::RequestLayoutState,
694 _: &mut Self::PrepaintState,
695 window: &mut Window,
696 cx: &mut App,
697 ) {
698 self.paint(window, cx);
699 }
700}
701
702impl IntoElement for AnyElement {
703 type Element = Self;
704
705 fn into_element(self) -> Self::Element {
706 self
707 }
708
709 fn into_any_element(self) -> AnyElement {
710 self
711 }
712}
713
714/// The empty element, which renders nothing.
715pub struct Empty;
716
717impl IntoElement for Empty {
718 type Element = Self;
719
720 fn into_element(self) -> Self::Element {
721 self
722 }
723}
724
725impl Element for Empty {
726 type RequestLayoutState = ();
727 type PrepaintState = ();
728
729 fn id(&self) -> Option<ElementId> {
730 None
731 }
732
733 fn source_location(&self) -> Option<&'static panic::Location<'static>> {
734 None
735 }
736
737 fn request_layout(
738 &mut self,
739 _id: Option<&GlobalElementId>,
740 _inspector_id: Option<&InspectorElementId>,
741 window: &mut Window,
742 cx: &mut App,
743 ) -> (LayoutId, Self::RequestLayoutState) {
744 (window.request_layout(Style::default(), None, cx), ())
745 }
746
747 fn prepaint(
748 &mut self,
749 _id: Option<&GlobalElementId>,
750 _inspector_id: Option<&InspectorElementId>,
751 _bounds: Bounds<Pixels>,
752 _state: &mut Self::RequestLayoutState,
753 _window: &mut Window,
754 _cx: &mut App,
755 ) {
756 }
757
758 fn paint(
759 &mut self,
760 _id: Option<&GlobalElementId>,
761 _inspector_id: Option<&InspectorElementId>,
762 _bounds: Bounds<Pixels>,
763 _request_layout: &mut Self::RequestLayoutState,
764 _prepaint: &mut Self::PrepaintState,
765 _window: &mut Window,
766 _cx: &mut App,
767 ) {
768 }
769}