Skip to content

Commit

Permalink
chore: Adjust nullability
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Jun 27, 2022
1 parent 507da10 commit 154e850
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/Uno.UI/UI/Xaml/Internal/VisualTree.uno.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ internal partial class VisualTree : IWeakReferenceProvider
private const int UnoTopZIndex = int.MaxValue - 100;
private const int FocusVisualZIndex = UnoTopZIndex + 1;

private ManagedWeakReference _selfWeakReference;
private ManagedWeakReference? _selfWeakReference;

public Canvas? FocusVisualRoot { get; private set; }

Expand Down
6 changes: 3 additions & 3 deletions src/Uno.UI/UI/Xaml/Media/VisualTreeHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@ static VisualTreeHelper()

internal static (UIElement? element, Branch? stale) HitTest(
Point position,
XamlRoot xamlRoot,
XamlRoot? xamlRoot,
GetHitTestability? getTestability = null,
Predicate<UIElement>? isStale = null
#if TRACE_HIT_TESTING
Expand All @@ -381,7 +381,7 @@ internal static (UIElement? element, Branch? stale) HitTest(
)
{
#endif
if (xamlRoot.VisualTree.RootElement is UIElement root)
if (xamlRoot?.VisualTree.RootElement is UIElement root)
{
return SearchDownForTopMostElementAt(position, root, getTestability ?? DefaultGetTestability, isStale);
}
Expand Down Expand Up @@ -681,7 +681,7 @@ private static void TRACE(FormattableString msg)
internal struct Branch
{
public static Branch ToWindowRoot(UIElement leaf)
=> new Branch(leaf.XamlRoot.VisualTree.RootElement, leaf);
=> new Branch(Window.Current.RootElement, leaf);

public Branch(UIElement root, UIElement leaf)
{
Expand Down
4 changes: 2 additions & 2 deletions src/Uno.UI/UI/Xaml/UIElement.Pointers.Managed.cs
Original file line number Diff line number Diff line change
Expand Up @@ -105,10 +105,10 @@ internal void ClearHitTestVisibilityForRoot()
#endregion

partial void CapturePointerNative(Pointer pointer)
=> XamlRoot.VisualTree.ContentRoot.InputManager!.SetPointerCapture(pointer.UniqueId);
=> XamlRoot?.VisualTree.ContentRoot.InputManager!.SetPointerCapture(pointer.UniqueId);

partial void ReleasePointerNative(Pointer pointer)
=> XamlRoot.VisualTree.ContentRoot.InputManager!.ReleasePointerCapture(pointer.UniqueId);
=> XamlRoot?.VisualTree.ContentRoot.InputManager!.ReleasePointerCapture(pointer.UniqueId);
}
}
#endif

0 comments on commit 154e850

Please sign in to comment.