From b41bac4efc246c62d79167aa5997df361cff3292 Mon Sep 17 00:00:00 2001 From: Jerome Laban Date: Sat, 12 Nov 2022 22:44:32 -0500 Subject: [PATCH 1/2] perf: Adjust IsLayoutRequested interop on arrange --- .../Uno/UI/UnoViewGroup.java | 4 ++-- src/Uno.UI/Controls/BindableView.Android.cs | 2 +- src/Uno.UI/UI/Xaml/Controls/Border/Border.Android.cs | 4 ++-- .../ContentPresenter/ContentPresenter.Android.cs | 4 ++-- src/Uno.UI/UI/Xaml/Controls/Panel/Panel.Android.cs | 4 ++-- src/Uno.UI/UI/Xaml/FrameworkElement.Android.cs | 9 +++++---- 6 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/Uno.UI.BindingHelper.Android/Uno/UI/UnoViewGroup.java b/src/Uno.UI.BindingHelper.Android/Uno/UI/UnoViewGroup.java index d4c712b35793..ab15b0e3a18f 100644 --- a/src/Uno.UI.BindingHelper.Android/Uno/UI/UnoViewGroup.java +++ b/src/Uno.UI.BindingHelper.Android/Uno/UI/UnoViewGroup.java @@ -129,13 +129,13 @@ public final void nativeFinishLayoutOverride(){ _unoLayoutOverride = false; } - protected abstract void onLayoutCore(boolean changed, int left, int top, int right, int bottom); + protected abstract void onLayoutCore(boolean changed, int left, int top, int right, int bottom, boolean isLayoutRequested); protected final void onLayout(boolean changed, int left, int top, int right, int bottom) { if(!_unoLayoutOverride) { - onLayoutCore(changed, left, top, right, bottom); + onLayoutCore(changed, left, top, right, bottom, isLayoutRequested()); } } diff --git a/src/Uno.UI/Controls/BindableView.Android.cs b/src/Uno.UI/Controls/BindableView.Android.cs index 1bf4092186eb..4d1f1289ecf1 100644 --- a/src/Uno.UI/Controls/BindableView.Android.cs +++ b/src/Uno.UI/Controls/BindableView.Android.cs @@ -55,7 +55,7 @@ private void Initialize() InitializeBinder(); } - protected override void OnLayoutCore(bool changed, int l, int t, int r, int b) + protected override void OnLayoutCore(bool changed, int l, int t, int r, int b, bool localIsLayoutRequested) { } diff --git a/src/Uno.UI/UI/Xaml/Controls/Border/Border.Android.cs b/src/Uno.UI/UI/Xaml/Controls/Border/Border.Android.cs index 01ba2a9ec037..5fad37e71993 100644 --- a/src/Uno.UI/UI/Xaml/Controls/Border/Border.Android.cs +++ b/src/Uno.UI/UI/Xaml/Controls/Border/Border.Android.cs @@ -47,9 +47,9 @@ private protected override void OnUnloaded() _borderRenderer.Clear(); } - protected override void OnLayoutCore(bool changed, int left, int top, int right, int bottom) + protected override void OnLayoutCore(bool changed, int left, int top, int right, int bottom, bool localIsLayoutRequested) { - base.OnLayoutCore(changed, left, top, right, bottom); + base.OnLayoutCore(changed, left, top, right, bottom, localIsLayoutRequested); UpdateBorder(); } diff --git a/src/Uno.UI/UI/Xaml/Controls/ContentPresenter/ContentPresenter.Android.cs b/src/Uno.UI/UI/Xaml/Controls/ContentPresenter/ContentPresenter.Android.cs index 24a14e6831e9..f34b6900b1b7 100644 --- a/src/Uno.UI/UI/Xaml/Controls/ContentPresenter/ContentPresenter.Android.cs +++ b/src/Uno.UI/UI/Xaml/Controls/ContentPresenter/ContentPresenter.Android.cs @@ -29,9 +29,9 @@ public ContentPresenter() IFrameworkElementHelper.Initialize(this); } - protected override void OnLayoutCore(bool changed, int left, int top, int right, int bottom) + protected override void OnLayoutCore(bool changed, int left, int top, int right, int bottom, bool localIsLayoutRequested) { - base.OnLayoutCore(changed, left, top, right, bottom); + base.OnLayoutCore(changed, left, top, right, bottom, localIsLayoutRequested); UpdateBorder(); } diff --git a/src/Uno.UI/UI/Xaml/Controls/Panel/Panel.Android.cs b/src/Uno.UI/UI/Xaml/Controls/Panel/Panel.Android.cs index d72fcc611c17..26a964d01696 100644 --- a/src/Uno.UI/UI/Xaml/Controls/Panel/Panel.Android.cs +++ b/src/Uno.UI/UI/Xaml/Controls/Panel/Panel.Android.cs @@ -73,9 +73,9 @@ private void UpdateBorder(bool willUpdateMeasures) } } - protected override void OnLayoutCore(bool changed, int left, int top, int right, int bottom) + protected override void OnLayoutCore(bool changed, int left, int top, int right, int bottom, bool localIsLayoutRequested) { - base.OnLayoutCore(changed, left, top, right, bottom); + base.OnLayoutCore(changed, left, top, right, bottom, localIsLayoutRequested); UpdateBorder(changed); } diff --git a/src/Uno.UI/UI/Xaml/FrameworkElement.Android.cs b/src/Uno.UI/UI/Xaml/FrameworkElement.Android.cs index 227d0c8aa763..2831e0824812 100644 --- a/src/Uno.UI/UI/Xaml/FrameworkElement.Android.cs +++ b/src/Uno.UI/UI/Xaml/FrameworkElement.Android.cs @@ -197,11 +197,11 @@ void ILayouterElement.SetMeasuredDimensionInternal(int width, int height) SetMeasuredDimension(width, height); } - protected override void OnLayoutCore(bool changed, int left, int top, int right, int bottom) + protected override void OnLayoutCore(bool changed, int left, int top, int right, int bottom, bool localIsLayoutRequested) { try { - base.OnLayoutCore(changed, left, top, right, bottom); + base.OnLayoutCore(changed, left, top, right, bottom, localIsLayoutRequested); Rect finalRect; if (TransientArrangeFinalRect is Rect tafr) @@ -244,7 +244,8 @@ protected override void OnLayoutCore(bool changed, int left, int top, int right, (changed && _lastLayoutSize != finalRect.Size) // Even if nothing changed, but a layout was requested, arrange the children. - || IsLayoutRequested + // Use the copy grabbed from the native invocation to avoid an additional interop call + || localIsLayoutRequested ) { _lastLayoutSize = finalRect.Size; @@ -281,7 +282,7 @@ internal void FastLayout(bool changed, int left, int top, int right, int bottom) NativeStartLayoutOverride(left, top, right, bottom); // Invoke our own layouting without going back and fort with Java. - OnLayoutCore(changed, left, top, right, bottom); + OnLayoutCore(changed, left, top, right, bottom, IsLayoutRequested); } finally { From fcc243c50c15b1e6d666001bfa9d655f933b06b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=B4me=20Laban?= Date: Mon, 14 Nov 2022 14:11:21 -0500 Subject: [PATCH 2/2] chore: Adjust diff ignore --- build/PackageDiffIgnore.xml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/build/PackageDiffIgnore.xml b/build/PackageDiffIgnore.xml index 54e65aeeac1e..485e66b1887a 100644 --- a/build/PackageDiffIgnore.xml +++ b/build/PackageDiffIgnore.xml @@ -9028,6 +9028,27 @@ + + + + + + + + + + + + + + + + + + + +