|
|
|
@ -138,11 +138,18 @@ namespace Avalonia.Layout |
|
|
|
|
|
|
|
private void Measure(ILayoutable control) |
|
|
|
{ |
|
|
|
// Controls closest to the visual root need to be arranged first. We don't try to store
|
|
|
|
// ordered invalidation lists, instead we traverse the tree upwards, measuring the
|
|
|
|
// controls closest to the root first. This has been shown by benchmarks to be the
|
|
|
|
// fastest and most memory-efficent algorithm.
|
|
|
|
if (control.VisualParent is ILayoutable parent) |
|
|
|
{ |
|
|
|
Measure(parent); |
|
|
|
} |
|
|
|
|
|
|
|
// If the control being measured has IsMeasureValid == true here then its measure was
|
|
|
|
// handed by an ancestor and can be ignored. The measure may have also caused the
|
|
|
|
// control to be removed.
|
|
|
|
if (!control.IsMeasureValid && control.IsAttachedToVisualTree) |
|
|
|
{ |
|
|
|
if (control is ILayoutRoot root) |
|
|
|
|