Skip to content

Commit

Permalink
fix: Avoid deflating layout slot rect by border thickness twice
Browse files Browse the repository at this point in the history
  • Loading branch information
MartinZikmund committed Jan 4, 2023
1 parent 2cfb475 commit dd3631e
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -1025,7 +1025,7 @@ internal void InvalidateRender()
//}
}

private Thickness GetItemBorderThickness()
internal Thickness GetItemBorderThickness()
{
var pOwner = GetOwner();
if (pOwner is { })
Expand Down
6 changes: 6 additions & 0 deletions src/Uno.UI/UI/Xaml/FrameworkElementExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -368,6 +368,12 @@ internal static bool TryGetBorderThickness(this IFrameworkElement frameworkEleme
return true;
}

if (__LinkerHints.Is_Windows_UI_Xaml_Controls_CalendarViewBaseItem_Available && frameworkElement is CalendarViewBaseItem cbi)
{
borderThickness = cbi.GetItemBorderThickness();
return true;
}

borderThickness = default;
return false;
}
Expand Down
5 changes: 1 addition & 4 deletions src/Uno.UI/UI/Xaml/UIElement.skia.cs
Original file line number Diff line number Diff line change
Expand Up @@ -270,10 +270,7 @@ partial void OnRenderTransformSet()

internal void ArrangeVisual(Rect finalRect, Rect? clippedFrame = default)
{
LayoutSlotWithMarginsAndAlignments =
VisualTreeHelper.GetParent(this) is UIElement parent and not RootVisual
? finalRect.DeflateBy(parent.GetBorderThickness())
: finalRect;
LayoutSlotWithMarginsAndAlignments = finalRect;

var oldFinalRect = _currentFinalRect;
_currentFinalRect = finalRect;
Expand Down
5 changes: 1 addition & 4 deletions src/Uno.UI/UI/Xaml/UIElement.wasm.cs
Original file line number Diff line number Diff line change
Expand Up @@ -219,10 +219,7 @@ protected internal void SetClasses(string[] cssClasses, int index = -1)
/// <param name="clipRect">The Clip rect to set, if any</param>
protected internal void ArrangeVisual(Rect rect, Rect? clipRect)
{
LayoutSlotWithMarginsAndAlignments =
VisualTreeHelper.GetParent(this) is UIElement parent && parent is not RootVisual
? rect.DeflateBy(parent.GetBorderThickness())
: rect;
LayoutSlotWithMarginsAndAlignments = rect;

if (FeatureConfiguration.UIElement.AssignDOMXamlProperties)
{
Expand Down

0 comments on commit dd3631e

Please sign in to comment.