Repository navigation
fix(commandbar): Fix rendering issues with commandbar - #13214
ramezgerges wants to merge 6 commits into
Conversation
|
There seems to be a new problem with the CommandBar expanding down. The There's an animation in the template that updates the Clip.Transform.Y of the that doesn't trigger the animation if the View is null, which is the case here since the Transform is affecting a Clip area, and not a view. It's not very clear atm why the condition is present. |
Because when animation was implemented few years ago, they assumed that an animation and transforms was tightly link to a view (and a single view) ... which is wrong (both can be re-used to animate/transform multiple dependency objects). But here the only effect is that the animation is considered as "dependent" (understand "will invalidate the layout") ... which is indeed probably the case on uno, but not on windows (cf. https://learn.microsoft.com/en-us/windows/uwp/debug-test-perf/optimize-animations-and-media#use-independent-instead-of-dependent-animations). We should just match the windows behavior and allow animations on the (Note: As a test to validate that it's the only issue, you can change the template to set the
|
… measured by the parent during the layout cycle
|
The previous fix had the problem of measuring elements multiple times. The new fix keeps state of which element(s) are currently being measured as part of the layout cycle and which are just getting measure due to any random call. Measure calls now only invalidate flags if they happen during a Parent's Measure call and that parent itself recursively satisfies this same condition. There are almost definitely some edge cases (although nothing that I can immediately think of), but I guess this should make sense for the overwhelming majority of cases. Some tests like When_InvalidatingMeasureExplicitly and When_InvalidatingMeasureAndArrangeByChangingSizeTwice explicitly test that flags are cleared on any Measure() call (not just as a part of layout cycle), so these will be changed once the changes get positively reviewed |
| var disposables = new List<IDisposable>(); | ||
| // This checks makes sure that this is part of the layout cycle, | ||
| // and not just a random call to a parent's Measure() | ||
| if (partOfLayoutCycle) | ||
| { | ||
| foreach (var child in GetChildren()) | ||
| { | ||
| child.CurrentlyBeingMeasuredByParentInLayoutCycle = true; | ||
| disposables.Add(Disposable.Create(() => child.CurrentlyBeingMeasuredByParentInLayoutCycle = false)); | ||
| } | ||
| } | ||
| MeasureCore(availableSize); | ||
| disposables.ForEach(d => d.Dispose()); |
There was a problem hiding this comment.
| var disposables = new List<IDisposable>(); | |
| // This checks makes sure that this is part of the layout cycle, | |
| // and not just a random call to a parent's Measure() | |
| if (partOfLayoutCycle) | |
| { | |
| foreach (var child in GetChildren()) | |
| { | |
| child.CurrentlyBeingMeasuredByParentInLayoutCycle = true; | |
| disposables.Add(Disposable.Create(() => child.CurrentlyBeingMeasuredByParentInLayoutCycle = false)); | |
| } | |
| } | |
| MeasureCore(availableSize); | |
| disposables.ForEach(d => d.Dispose()); | |
| UIElement[] children = null; | |
| // This checks makes sure that this is part of the layout cycle, | |
| // and not just a random call to a parent's Measure() | |
| if (partOfLayoutCycle) | |
| { | |
| children = GetChildren().ToArray(); | |
| foreach (var child in children) | |
| { | |
| child.CurrentlyBeingMeasuredByParentInLayoutCycle = true; | |
| } | |
| } | |
| MeasureCore(availableSize); | |
| if (partOfLayoutCycle) | |
| { | |
| foreach (var child in children) | |
| { | |
| child.CurrentlyBeingMeasuredByParentInLayoutCycle = false; | |
| } | |
| } |
| var disposables = new List<IDisposable>(); | ||
| // This checks makes sure that this is part of the layout cycle, | ||
| // and not just a random call to a parent's Measure() | ||
| if (partOfLayoutCycle) | ||
| { | ||
| foreach (var child in GetChildren()) |
There was a problem hiding this comment.
I'm really worried about the perf impact of this: Creating a new list on each measure, adding an enumeration of the Children collection and finally enumerating the newly created collection ... I would rather check in the child.Measure if the direct parent is CurrentlyBeingMeasuredByParentInLayoutCycle.
There was a problem hiding this comment.
We'll also need to add runtime or unit tests to validate that specific behavior on simple controls, as this could regress easily :)
| // Uno specific | ||
| private readonly SerialDisposable m_contentRootRenderTransformChangedEventHandler = new SerialDisposable(); |
There was a problem hiding this comment.
For now, these changes that are related to invalidating popup panel arrange can go into a separate PR. Also, I'd prefer us to open an issue to track removing this Uno-specific code
No, that's completely unrelated. The measure changes are needed because the first time the popup is opened, it opens with an incorrect width. The clipping issue is not related and I don't think changing the template instead of fixing the root cause is a good idea. |
I can't reproduce this.
Per my findings, the clipping issue appears to be an animations bug. Changing the template is definitely not the correct fix, but it can serve as a temporary workaround if we couldn't fix the animations issue. |


GitHub Issue (If applicable): closes #13213
PR Type
What kind of change does this PR introduce?
What is the current behavior?
What is the new behavior?
Copilot Summary
🤖 Generated by Copilot at 275d34b
This pull request improves the layout and positioning of the
CommandBarandPopupcontrols. It fixes a bug in theCommandBaroverflow popup and adds a feature to thePopupcustom layouter.PR Checklist
Please check if your PR fulfills the following requirements:
Screenshots Compare Test Runresults.Other information
Internal Issue (If applicable):