waft-rendering 0.18.2

Render-object tree and layout for Waft
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
//! Flutter counterpart: `rendering/list_body.dart`.

use std::any::{Any, TypeId};
use std::fmt;

use waft_embedder::{Offset, Size, TextBaseline};
use waft_foundation::{App, DiagnosticPropertiesBuilder, EnumProperty, Handle};
use waft_painting::{Axis, AxisDirection, axis_direction_to_axis};

use crate::box_::{
    AnyRenderBox, BaselineOffset, BoxConstraints, BoxHitTestResult, BoxParentData,
    ContainerBoxParentData, RenderBox, RenderBoxContainerDefaultsMixin, RenderBoxData,
};
use crate::object::{
    AnyRenderObject, ContainerParentData, ContainerParentDataMixin, ContainerRenderObjectData,
    ContainerRenderObjectMixin, ParentData, RenderHandle, RenderObject, RenderObjectData,
};
use crate::painting_context::PaintingContext;
use crate::pipeline_owner::PipelineOwner;

/// Parent data for use with [`RenderListBody`].
#[derive(Debug, Default)]
pub struct ListBodyParentData {
    box_parent_data: BoxParentData,
    container_parent_data: ContainerParentData<AnyRenderBox>,
}

impl ListBodyParentData {
    /// Creates list body parent data at offset zero, with no siblings.
    pub const fn new() -> ListBodyParentData {
        ListBodyParentData {
            box_parent_data: BoxParentData::new(),
            container_parent_data: ContainerParentData::new(),
        }
    }
}

impl ParentData for ListBodyParentData {
    fn detach(&mut self) {
        ContainerParentDataMixin::detach(self);
    }

    fn provide(&self, id: TypeId) -> Option<&dyn Any> {
        if id == TypeId::of::<ListBodyParentData>() {
            return Some(self);
        }
        self.box_parent_data.provide(id)
    }

    fn provide_mut(&mut self, id: TypeId) -> Option<&mut dyn Any> {
        if id == TypeId::of::<ListBodyParentData>() {
            return Some(self);
        }
        self.box_parent_data.provide_mut(id)
    }
}

impl ContainerParentDataMixin for ListBodyParentData {
    type ChildType = AnyRenderBox;

    fn container_parent_data(&self) -> &ContainerParentData<AnyRenderBox> {
        &self.container_parent_data
    }

    fn container_parent_data_mut(&mut self) -> &mut ContainerParentData<AnyRenderBox> {
        &mut self.container_parent_data
    }
}

impl ContainerBoxParentData for ListBodyParentData {
    fn box_parent_data(&self) -> &BoxParentData {
        &self.box_parent_data
    }

    fn box_parent_data_mut(&mut self) -> &mut BoxParentData {
        &mut self.box_parent_data
    }
}

impl fmt::Display for ListBodyParentData {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        fmt::Display::fmt(&self.box_parent_data, f)
    }
}

/// The fields of a [`RenderListBody`].
///
/// A render object that inherits the list body layout holds this bag and implements
/// [`RenderListBodyMixin`].
pub struct RenderListBodyData {
    axis_direction: AxisDirection,
}

impl RenderListBodyData {
    /// Creates the list body fields with their defaults.
    ///
    /// The children are arranged along the vertical axis.
    pub fn new() -> RenderListBodyData {
        RenderListBodyData {
            axis_direction: AxisDirection::Down,
        }
    }

    /// Dart `RenderListBody(axisDirection:)`.
    pub fn axis_direction(mut self, axis_direction: AxisDirection) -> RenderListBodyData {
        self.axis_direction = axis_direction;
        self
    }
}

impl Default for RenderListBodyData {
    fn default() -> RenderListBodyData {
        RenderListBodyData::new()
    }
}
/// Displays its children sequentially along a given axis, forcing them to the dimensions of the
/// parent in the other axis.
///
/// Flutter's `RenderListBody`: the shared bodies of the list body layout. A leaf holds a
/// [`RenderListBodyData`], implements this trait, and calls these where Dart would run the
/// inherited method: `RenderListBodyMixin::perform_layout(self, app)`.
///
/// See [`RenderListBody`] for the layout algorithm.
pub trait RenderListBodyMixin:
    RenderBox
    + ContainerRenderObjectMixin<ChildType = AnyRenderBox, ParentDataType = ListBodyParentData>
    + RenderBoxContainerDefaultsMixin
{
    /// Mixin field access.
    fn list_body_data(self: RenderHandle<Self>, app: &App) -> &RenderListBodyData;

    /// See [`list_body_data`](Self::list_body_data).
    fn list_body_data_mut(self: RenderHandle<Self>, app: &mut App) -> &mut RenderListBodyData;

    /// Dart's `RenderListBody.setupParentData`.
    fn setup_parent_data(self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject) {
        if !child.parent_data_is::<ListBodyParentData>(app) {
            child.set_parent_data(app, ListBodyParentData::new());
        }
    }

    /// Dart's `RenderListBody.debugFillProperties`, which a subclass of `RenderListBody`
    /// reaches through its super call.
    fn debug_fill_properties(
        self: RenderHandle<Self>,
        app: &App,
        properties: &mut DiagnosticPropertiesBuilder,
    ) {
        properties.add(EnumProperty::<AxisDirection>::new(
            "axisDirection",
            self.list_body_data(app).axis_direction,
        ));
    }

    /// The direction in which the children are laid out.
    ///
    /// For example, if the [`axis_direction`](Self::axis_direction) is [`AxisDirection::Down`],
    /// each child will be laid out below the next, vertically.
    fn axis_direction(self: RenderHandle<Self>, app: &App) -> AxisDirection {
        self.list_body_data(app).axis_direction
    }

    /// Sets [`axis_direction`](Self::axis_direction).
    fn set_axis_direction(self: RenderHandle<Self>, app: &mut App, value: AxisDirection) {
        if self.list_body_data(app).axis_direction == value {
            return;
        }
        self.list_body_data_mut(app).axis_direction = value;
        self.mark_needs_layout(app);
    }

    /// The axis (horizontal or vertical) corresponding to the current
    /// [`axis_direction`](Self::axis_direction).
    fn main_axis(self: RenderHandle<Self>, app: &App) -> Axis {
        axis_direction_to_axis(self.axis_direction(app))
    }

    /// Dart's `RenderListBody.computeDryBaseline`.
    fn compute_dry_baseline(
        self: RenderHandle<Self>,
        app: &mut App,
        constraints: BoxConstraints,
        baseline: TextBaseline,
    ) -> Option<f64> {
        debug_assert!(self.debug_check_constraints(app, constraints));
        let mut child;
        let next_child: fn(RenderHandle<Self>, &App, AnyRenderBox) -> Option<AnyRenderBox>;
        match self.axis_direction(app) {
            AxisDirection::Right | AxisDirection::Left => {
                let child_constraints =
                    BoxConstraints::tight_for(None, Some(constraints.max_height));
                let mut baseline_offset = BaselineOffset::NO_BASELINE;
                child = self.first_child(app);
                while let Some(current) = child {
                    baseline_offset = baseline_offset.min_of(BaselineOffset(
                        current.get_dry_baseline(app, child_constraints, baseline),
                    ));
                    child = self.child_after(app, current);
                }
                return baseline_offset.offset();
            }
            AxisDirection::Up => {
                child = self.last_child(app);
                next_child = |this, app, child| this.child_before(app, child);
            }
            AxisDirection::Down => {
                child = self.first_child(app);
                next_child = |this, app, child| this.child_after(app, child);
            }
        }
        let child_constraints = BoxConstraints::tight_for(Some(constraints.max_width), None);
        let mut main_axis_extent = 0.0;
        while let Some(current) = child {
            let child_baseline = current.get_dry_baseline(app, child_constraints, baseline);
            if let Some(child_baseline) = child_baseline {
                return Some(child_baseline + main_axis_extent);
            }
            main_axis_extent += current.get_dry_layout(app, child_constraints).height();
            child = next_child(self, app, current);
        }
        None
    }

    /// Dart's `RenderListBody.computeDryLayout`.
    fn compute_dry_layout(
        self: RenderHandle<Self>,
        app: &mut App,
        constraints: BoxConstraints,
    ) -> Size {
        debug_assert!(self.debug_check_constraints(app, constraints));
        let mut main_axis_extent = 0.0;
        let mut child = self.first_child(app);
        match self.axis_direction(app) {
            AxisDirection::Right | AxisDirection::Left => {
                let inner_constraints =
                    BoxConstraints::tight_for(None, Some(constraints.max_height));
                while let Some(current) = child {
                    let child_size = current.get_dry_layout(app, inner_constraints);
                    main_axis_extent += child_size.width();
                    child = self.child_after(app, current);
                }
                constraints.constrain(Size::new(main_axis_extent, constraints.max_height))
            }
            AxisDirection::Up | AxisDirection::Down => {
                let inner_constraints =
                    BoxConstraints::tight_for(Some(constraints.max_width), None);
                while let Some(current) = child {
                    let child_size = current.get_dry_layout(app, inner_constraints);
                    main_axis_extent += child_size.height();
                    child = self.child_after(app, current);
                }
                constraints.constrain(Size::new(constraints.max_width, main_axis_extent))
            }
        }
    }

    /// Flutter's `_debugCheckConstraints`: panics unless the main axis is unbounded and the cross
    /// axis bounded. Internal to the list body layout.
    fn debug_check_constraints(
        self: RenderHandle<Self>,
        app: &App,
        constraints: BoxConstraints,
    ) -> bool {
        if cfg!(debug_assertions) {
            let unbounded_main_axis = match self.main_axis(app) {
                Axis::Horizontal => !constraints.has_bounded_width(),
                Axis::Vertical => !constraints.has_bounded_height(),
            };
            assert!(
                unbounded_main_axis,
                "RenderListBody must have unlimited space along its main axis.\n\
                 RenderListBody does not clip or resize its children, so it must be placed in a \
                 parent that does not constrain the main axis.\n\
                 You probably want to put the RenderListBody inside a RenderViewport with a \
                 matching main axis."
            );
            let bounded_cross_axis = match self.main_axis(app) {
                Axis::Horizontal => constraints.has_bounded_height(),
                Axis::Vertical => constraints.has_bounded_width(),
            };
            assert!(
                bounded_cross_axis,
                "RenderListBody must have a bounded constraint for its cross axis.\n\
                 RenderListBody forces its children to expand to fit the RenderListBody's \
                 container, so it must be placed in a parent that constrains the cross axis to a \
                 finite dimension.\n\
                 If you are attempting to nest a RenderListBody with one direction inside one of \
                 another direction, you will want to wrap the inner one inside a box that fixes \
                 the dimension in that direction, for example, a RenderIntrinsicWidth or \
                 RenderIntrinsicHeight object. This is relatively expensive, however."
            );
        }
        true
    }

    /// Dart's `RenderListBody.performLayout`.
    fn perform_layout(self: RenderHandle<Self>, app: &mut App) {
        let constraints = self.constraints(app);
        debug_assert!(self.debug_check_constraints(app, constraints));
        let mut main_axis_extent = 0.0;
        let mut child = self.first_child(app);
        match self.axis_direction(app) {
            AxisDirection::Right => {
                let inner_constraints =
                    BoxConstraints::tight_for(None, Some(constraints.max_height));
                while let Some(current) = child {
                    current.layout(app, inner_constraints, true);
                    let child_parent_data = current
                        .as_object()
                        .parent_data_of_mut::<ListBodyParentData>(app);
                    child_parent_data.set_offset(Offset::new(main_axis_extent, 0.0));
                    let next_sibling = child_parent_data.next_sibling();
                    main_axis_extent += current.size(app).width();
                    child = next_sibling;
                }
                self.set_size(
                    app,
                    constraints.constrain(Size::new(main_axis_extent, constraints.max_height)),
                );
            }
            AxisDirection::Left => {
                let inner_constraints =
                    BoxConstraints::tight_for(None, Some(constraints.max_height));
                while let Some(current) = child {
                    current.layout(app, inner_constraints, true);
                    main_axis_extent += current.size(app).width();
                    child = self.child_after(app, current);
                }
                let mut position = 0.0;
                child = self.first_child(app);
                while let Some(current) = child {
                    position += current.size(app).width();
                    let child_parent_data = current
                        .as_object()
                        .parent_data_of_mut::<ListBodyParentData>(app);
                    child_parent_data.set_offset(Offset::new(main_axis_extent - position, 0.0));
                    child = child_parent_data.next_sibling();
                }
                self.set_size(
                    app,
                    constraints.constrain(Size::new(main_axis_extent, constraints.max_height)),
                );
            }
            AxisDirection::Down => {
                let inner_constraints =
                    BoxConstraints::tight_for(Some(constraints.max_width), None);
                while let Some(current) = child {
                    current.layout(app, inner_constraints, true);
                    let child_parent_data = current
                        .as_object()
                        .parent_data_of_mut::<ListBodyParentData>(app);
                    child_parent_data.set_offset(Offset::new(0.0, main_axis_extent));
                    let next_sibling = child_parent_data.next_sibling();
                    main_axis_extent += current.size(app).height();
                    child = next_sibling;
                }
                self.set_size(
                    app,
                    constraints.constrain(Size::new(constraints.max_width, main_axis_extent)),
                );
            }
            AxisDirection::Up => {
                let inner_constraints =
                    BoxConstraints::tight_for(Some(constraints.max_width), None);
                while let Some(current) = child {
                    current.layout(app, inner_constraints, true);
                    main_axis_extent += current.size(app).height();
                    child = self.child_after(app, current);
                }
                let mut position = 0.0;
                child = self.first_child(app);
                while let Some(current) = child {
                    position += current.size(app).height();
                    let child_parent_data = current
                        .as_object()
                        .parent_data_of_mut::<ListBodyParentData>(app);
                    child_parent_data.set_offset(Offset::new(0.0, main_axis_extent - position));
                    child = child_parent_data.next_sibling();
                }
                self.set_size(
                    app,
                    constraints.constrain(Size::new(constraints.max_width, main_axis_extent)),
                );
            }
        }
        debug_assert!(self.size(app).is_finite());
    }

    /// Flutter's `_getIntrinsicCrossAxis`: the largest of the children's sizes. Internal to the
    /// list body layout.
    fn get_intrinsic_cross_axis(
        self: RenderHandle<Self>,
        app: &mut App,
        child_size: impl Fn(&mut App, AnyRenderBox) -> f64,
    ) -> f64 {
        let mut extent: f64 = 0.0;
        let mut child = self.first_child(app);
        while let Some(current) = child {
            extent = extent.max(child_size(app, current));
            child = self.child_after(app, current);
        }
        extent
    }

    /// Flutter's `_getIntrinsicMainAxis`: the sum of the children's sizes. Internal to the list
    /// body layout.
    fn get_intrinsic_main_axis(
        self: RenderHandle<Self>,
        app: &mut App,
        child_size: impl Fn(&mut App, AnyRenderBox) -> f64,
    ) -> f64 {
        let mut extent = 0.0;
        let mut child = self.first_child(app);
        while let Some(current) = child {
            extent += child_size(app, current);
            child = self.child_after(app, current);
        }
        extent
    }

    /// Dart's `RenderListBody.computeMinIntrinsicWidth`.
    fn compute_min_intrinsic_width(self: RenderHandle<Self>, app: &mut App, height: f64) -> f64 {
        let child_size =
            |app: &mut App, child: AnyRenderBox| child.get_min_intrinsic_width(app, height);
        match self.main_axis(app) {
            Axis::Horizontal => self.get_intrinsic_main_axis(app, child_size),
            Axis::Vertical => self.get_intrinsic_cross_axis(app, child_size),
        }
    }

    /// Dart's `RenderListBody.computeMaxIntrinsicWidth`.
    fn compute_max_intrinsic_width(self: RenderHandle<Self>, app: &mut App, height: f64) -> f64 {
        let child_size =
            |app: &mut App, child: AnyRenderBox| child.get_max_intrinsic_width(app, height);
        match self.main_axis(app) {
            Axis::Horizontal => self.get_intrinsic_main_axis(app, child_size),
            Axis::Vertical => self.get_intrinsic_cross_axis(app, child_size),
        }
    }

    /// Dart's `RenderListBody.computeMinIntrinsicHeight`.
    fn compute_min_intrinsic_height(self: RenderHandle<Self>, app: &mut App, width: f64) -> f64 {
        let child_size =
            |app: &mut App, child: AnyRenderBox| child.get_min_intrinsic_height(app, width);
        match self.main_axis(app) {
            Axis::Horizontal => self.get_intrinsic_main_axis(app, child_size),
            Axis::Vertical => self.get_intrinsic_cross_axis(app, child_size),
        }
    }

    /// Dart's `RenderListBody.computeMaxIntrinsicHeight`.
    fn compute_max_intrinsic_height(self: RenderHandle<Self>, app: &mut App, width: f64) -> f64 {
        let child_size =
            |app: &mut App, child: AnyRenderBox| child.get_max_intrinsic_height(app, width);
        match self.main_axis(app) {
            Axis::Horizontal => self.get_intrinsic_main_axis(app, child_size),
            Axis::Vertical => self.get_intrinsic_cross_axis(app, child_size),
        }
    }

    /// Dart's `RenderListBody.computeDistanceToActualBaseline`.
    fn compute_distance_to_actual_baseline(
        self: RenderHandle<Self>,
        app: &mut App,
        baseline: TextBaseline,
    ) -> Option<f64> {
        self.default_compute_distance_to_first_actual_baseline(app, baseline)
    }

    /// Dart's `RenderListBody.paint`.
    fn paint(
        self: RenderHandle<Self>,
        app: &mut App,
        context: &mut PaintingContext,
        offset: Offset,
    ) {
        self.default_paint(app, context, offset);
    }

    /// Dart's `RenderListBody.hitTestChildren`.
    fn hit_test_children(
        self: RenderHandle<Self>,
        app: &mut App,
        result: &mut BoxHitTestResult<'_>,
        position: Offset,
    ) -> bool {
        self.default_hit_test_children(app, result, position)
    }
}

/// Displays its children sequentially along a given axis, forcing them to the dimensions of the
/// parent in the other axis.
///
/// This layout algorithm arranges its children linearly along the main axis (either
/// horizontally or vertically). In the cross axis, children are stretched to match the box's
/// cross-axis extent. In the main axis, children are given unlimited space and the box expands
/// its main axis to contain all its children. Because [`RenderListBody`] boxes expand in the main
/// axis, they must be given unlimited space in the main axis, typically by being contained in a
/// viewport with a scrolling direction that matches the box's main axis.
pub struct RenderListBody {
    render_object: RenderObjectData,
    render_box: RenderBoxData,
    container: ContainerRenderObjectData<AnyRenderBox>,
    list_body: RenderListBodyData,
}

impl RenderListBody {
    /// Creates a render object that arranges its children sequentially along a
    /// given axis.
    ///
    /// By default, children are arranged along the vertical axis. Add children with
    /// [`add`](ContainerRenderObjectMixin::add) or [`add_all`](ContainerRenderObjectMixin::add_all);
    /// Dart's constructor takes them.
    pub fn new(app: &mut App, axis_direction: AxisDirection) -> RenderHandle<RenderListBody> {
        RenderHandle::new_box(
            app,
            RenderListBody {
                render_object: RenderObjectData::new(),
                render_box: RenderBoxData::new(),
                container: ContainerRenderObjectData::new(),
                list_body: RenderListBodyData::new().axis_direction(axis_direction),
            },
        )
    }

    /// See [`RenderListBodyMixin::axis_direction`].
    pub fn axis_direction(self: RenderHandle<Self>, app: &App) -> AxisDirection {
        RenderListBodyMixin::axis_direction(self, app)
    }

    /// See [`RenderListBodyMixin::set_axis_direction`].
    pub fn set_axis_direction(self: RenderHandle<Self>, app: &mut App, value: AxisDirection) {
        RenderListBodyMixin::set_axis_direction(self, app, value)
    }

    /// See [`RenderListBodyMixin::main_axis`].
    pub fn main_axis(self: RenderHandle<Self>, app: &App) -> Axis {
        RenderListBodyMixin::main_axis(self, app)
    }
}

impl ContainerRenderObjectMixin for RenderListBody {
    type ChildType = AnyRenderBox;
    type ParentDataType = ListBodyParentData;

    fn container_data(
        self: RenderHandle<Self>,
        app: &App,
    ) -> &ContainerRenderObjectData<AnyRenderBox> {
        &self.get(app).container
    }

    fn container_data_mut(
        self: RenderHandle<Self>,
        app: &mut App,
    ) -> &mut ContainerRenderObjectData<AnyRenderBox> {
        &mut self.get_mut(app).container
    }
}

impl RenderBoxContainerDefaultsMixin for RenderListBody {}

impl RenderListBodyMixin for RenderListBody {
    fn list_body_data(self: RenderHandle<Self>, app: &App) -> &RenderListBodyData {
        &self.get(app).list_body
    }

    fn list_body_data_mut(self: RenderHandle<Self>, app: &mut App) -> &mut RenderListBodyData {
        &mut self.get_mut(app).list_body
    }
}

impl RenderObject for RenderListBody {
    crate::render_object_accessors!();

    fn debug_fill_properties(
        self: RenderHandle<Self>,
        app: &App,
        properties: &mut DiagnosticPropertiesBuilder,
    ) {
        RenderListBodyMixin::debug_fill_properties(self, app, properties);
    }

    fn perform_layout(self: RenderHandle<Self>, app: &mut App) {
        RenderListBodyMixin::perform_layout(self, app)
    }

    fn visit_children(
        self: RenderHandle<Self>,
        app: &App,
        visitor: &mut dyn FnMut(AnyRenderObject),
    ) {
        ContainerRenderObjectMixin::visit_children(self, app, visitor)
    }

    fn did_attach(self: RenderHandle<Self>, app: &mut App, owner: Handle<PipelineOwner>) {
        ContainerRenderObjectMixin::did_attach(self, app, owner)
    }

    fn did_detach(self: RenderHandle<Self>, app: &mut App) {
        ContainerRenderObjectMixin::did_detach(self, app)
    }

    fn redepth_children(self: RenderHandle<Self>, app: &mut App) {
        ContainerRenderObjectMixin::redepth_children(self, app)
    }

    fn paint(
        self: RenderHandle<Self>,
        app: &mut App,
        context: &mut PaintingContext,
        offset: Offset,
    ) {
        RenderListBodyMixin::paint(self, app, context, offset)
    }
}

impl RenderBox for RenderListBody {
    crate::render_box_accessors!();

    fn setup_parent_data(self: RenderHandle<Self>, app: &mut App, child: AnyRenderObject) {
        RenderListBodyMixin::setup_parent_data(self, app, child)
    }

    fn compute_dry_baseline(
        self: RenderHandle<Self>,
        app: &mut App,
        constraints: BoxConstraints,
        baseline: TextBaseline,
    ) -> Option<f64> {
        RenderListBodyMixin::compute_dry_baseline(self, app, constraints, baseline)
    }

    fn compute_dry_layout(
        self: RenderHandle<Self>,
        app: &mut App,
        constraints: BoxConstraints,
    ) -> Size {
        RenderListBodyMixin::compute_dry_layout(self, app, constraints)
    }

    fn compute_min_intrinsic_width(self: RenderHandle<Self>, app: &mut App, height: f64) -> f64 {
        RenderListBodyMixin::compute_min_intrinsic_width(self, app, height)
    }

    fn compute_max_intrinsic_width(self: RenderHandle<Self>, app: &mut App, height: f64) -> f64 {
        RenderListBodyMixin::compute_max_intrinsic_width(self, app, height)
    }

    fn compute_min_intrinsic_height(self: RenderHandle<Self>, app: &mut App, width: f64) -> f64 {
        RenderListBodyMixin::compute_min_intrinsic_height(self, app, width)
    }

    fn compute_max_intrinsic_height(self: RenderHandle<Self>, app: &mut App, width: f64) -> f64 {
        RenderListBodyMixin::compute_max_intrinsic_height(self, app, width)
    }

    fn compute_distance_to_actual_baseline(
        self: RenderHandle<Self>,
        app: &mut App,
        baseline: TextBaseline,
    ) -> Option<f64> {
        RenderListBodyMixin::compute_distance_to_actual_baseline(self, app, baseline)
    }

    fn hit_test_children(
        self: RenderHandle<Self>,
        app: &mut App,
        result: &mut BoxHitTestResult<'_>,
        position: Offset,
    ) -> bool {
        RenderListBodyMixin::hit_test_children(self, app, result, position)
    }
}