Browse Source

Fix a couple of bugs in LayoutManager.

- Clear `_running` at the end of all layout passes, not at the end of the first set of 3 attempts
- Fix a bizarre anti-copy-pasta in `RaiseEffectiveViewportChanged` where we were comparing `startCount` to the size of the measure queue twice instead of the arrange queue
pull/4201/head
Steven Kirk 6 years ago
parent
commit
f20039070d
  1. 40
      src/Avalonia.Layout/LayoutManager.cs

40
src/Avalonia.Layout/LayoutManager.cs

@ -106,8 +106,6 @@ namespace Avalonia.Layout
if (!_running)
{
_running = true;
Stopwatch? stopwatch = null;
const LogEventLevel timingLogLevel = LogEventLevel.Information;
@ -128,15 +126,24 @@ namespace Avalonia.Layout
_toMeasure.BeginLoop(MaxPasses);
_toArrange.BeginLoop(MaxPasses);
for (var pass = 0; pass < MaxPasses; ++pass)
try
{
InnerLayoutPass();
_running = true;
if (!RaiseEffectiveViewportChanged())
for (var pass = 0; pass < MaxPasses; ++pass)
{
break;
InnerLayoutPass();
if (!RaiseEffectiveViewportChanged())
{
break;
}
}
}
finally
{
_running = false;
}
_toMeasure.EndLoop();
_toArrange.EndLoop();
@ -221,23 +228,16 @@ namespace Avalonia.Layout
private void InnerLayoutPass()
{
try
for (var pass = 0; pass < MaxPasses; ++pass)
{
for (var pass = 0; pass < MaxPasses; ++pass)
{
ExecuteMeasurePass();
ExecuteArrangePass();
ExecuteMeasurePass();
ExecuteArrangePass();
if (_toMeasure.Count == 0)
{
break;
}
if (_toMeasure.Count == 0)
{
break;
}
}
finally
{
_running = false;
}
}
private void ExecuteMeasurePass()
@ -362,7 +362,7 @@ namespace Avalonia.Layout
}
}
return startCount != _toMeasure.Count + _toMeasure.Count;
return startCount != _toMeasure.Count + _toArrange.Count;
}
private Rect CalculateEffectiveViewport(IVisual control)

Loading…
Cancel
Save