[NUI] Fix CustomView.GetNaturalSize() to return Size2D set by user
Originally, CustomView.GetNaturalSize() returned size set by user
explicitly.
It was changed by https://github.com/Samsung/TizenFX/pull/2515.
By the above PR, CustomView.GetNaturalSize() returned Size2D which can
be set by both user and Layout.
Since the current CustomView.GetNaturalSize() cannot distinguish the
size set by user from the size set by Layout, the size set by Layout
previously can be preserved incorrectly and the size is not updated
incorrectly.
To resolve the above issue, CustomView.GetNaturalSize() returns Size2D
set by user explicitly to make Layout preserve the size only set by user
explicitly.
e.g. problem case
var window = NUIApplication.GetDefaultWindow();
var parent = new Control()
{
Layout = new AbsoluteLayout(),
WidthSpecification = LayoutParamPolicies.MatchParent,
HeightSpecification = LayoutParamPolicies.WrapContent,
BackgroundColor = Color.Red,
};
window.Add(parent);
var child = new Control()
{
WidthSpecification = LayoutParamPolicies.MatchParent,
HeightSpecification = 200,
BackgroundColor = Color.Blue,
};
parent.Add(child);
var timer = new Timer(1000);
timer.Tick += (object sender, Timer.TickEventArgs args) =>
{
child.HeightSpecification = 100;
return false;
};
timer.Start();