diff --git a/src/Avalonia.Base/CornerRadius.cs b/src/Avalonia.Base/CornerRadius.cs
index 1666fac2e1..82791999d7 100644
--- a/src/Avalonia.Base/CornerRadius.cs
+++ b/src/Avalonia.Base/CornerRadius.cs
@@ -60,15 +60,6 @@ namespace Avalonia
///
public double BottomLeft { get; }
- ///
- /// Gets a value indicating whether the instance has default values (all corner radii are set to 0).
- ///
- public bool IsDefault => TopLeft == 0 && TopRight == 0 && BottomLeft == 0 && BottomRight == 0;
-
- ///
- [Obsolete("Use IsDefault instead.")]
- public bool IsEmpty => IsDefault;
-
///
/// Gets a value indicating whether all corner radii are equal.
///
diff --git a/src/Avalonia.Base/Input/GestureRecognizers/VelocityTracker.cs b/src/Avalonia.Base/Input/GestureRecognizers/VelocityTracker.cs
index ce41aa6308..20dd376aaa 100644
--- a/src/Avalonia.Base/Input/GestureRecognizers/VelocityTracker.cs
+++ b/src/Avalonia.Base/Input/GestureRecognizers/VelocityTracker.cs
@@ -180,7 +180,7 @@ namespace Avalonia.Input.GestureRecognizers
internal Velocity GetVelocity()
{
var estimate = GetVelocityEstimate();
- if (estimate == null || estimate.PixelsPerSecond.IsDefault)
+ if (estimate == null || estimate.PixelsPerSecond == default(Vector))
{
return new Velocity(Vector.Zero);
}
diff --git a/src/Avalonia.Base/Media/BoxShadow.cs b/src/Avalonia.Base/Media/BoxShadow.cs
index dd2c23f4ae..32b2f7a2fb 100644
--- a/src/Avalonia.Base/Media/BoxShadow.cs
+++ b/src/Avalonia.Base/Media/BoxShadow.cs
@@ -45,15 +45,6 @@ namespace Avalonia.Media
}
}
- ///
- /// Gets a value indicating whether the instance has default values.
- ///
- public bool IsDefault => OffsetX == 0 && OffsetY == 0 && Blur == 0 && Spread == 0;
-
- ///
- [Obsolete("Use IsDefault instead.")]
- public bool IsEmpty => IsDefault;
-
private readonly static char[] s_Separator = new char[] { ' ', '\t' };
struct ArrayReader
@@ -89,7 +80,7 @@ namespace Avalonia.Media
{
var sb = StringBuilderCache.Acquire();
- if (IsDefault)
+ if (this == default)
{
return "none";
}
diff --git a/src/Avalonia.Base/Media/BoxShadows.cs b/src/Avalonia.Base/Media/BoxShadows.cs
index 50ae7699dd..ca16452a96 100644
--- a/src/Avalonia.Base/Media/BoxShadows.cs
+++ b/src/Avalonia.Base/Media/BoxShadows.cs
@@ -21,7 +21,7 @@ namespace Avalonia.Media
{
_first = shadow;
_list = null;
- Count = _first.IsDefault ? 0 : 1;
+ Count = _first == default ? 0 : 1;
}
public BoxShadows(BoxShadow first, BoxShadow[] rest)
@@ -120,7 +120,7 @@ namespace Avalonia.Media
get
{
foreach(var boxShadow in this)
- if (!boxShadow.IsDefault && boxShadow.IsInset)
+ if (boxShadow != default && boxShadow.IsInset)
return true;
return false;
}
diff --git a/src/Avalonia.Base/Media/FontFamily.cs b/src/Avalonia.Base/Media/FontFamily.cs
index f4406bd010..498bcd43a0 100644
--- a/src/Avalonia.Base/Media/FontFamily.cs
+++ b/src/Avalonia.Base/Media/FontFamily.cs
@@ -79,11 +79,6 @@ namespace Avalonia.Media
/// Key is only used for custom fonts.
public FontFamilyKey? Key { get; }
- ///
- /// Returns True if this instance is the system's default.
- ///
- public bool IsDefault => Name.Equals(DefaultFontFamilyName);
-
///
/// Implicit conversion of string to FontFamily
///
diff --git a/src/Avalonia.Base/Media/FormattedText.cs b/src/Avalonia.Base/Media/FormattedText.cs
index d4640390d7..7d204ca8cd 100644
--- a/src/Avalonia.Base/Media/FormattedText.cs
+++ b/src/Avalonia.Base/Media/FormattedText.cs
@@ -1393,10 +1393,11 @@ namespace Avalonia.Media
}
}
- if (accumulatedBounds?.PlatformImpl == null || accumulatedBounds.PlatformImpl.Bounds.IsDefault)
+ if (accumulatedBounds?.PlatformImpl == null ||
+ (accumulatedBounds.PlatformImpl.Bounds.Width == 0 && accumulatedBounds.PlatformImpl.Bounds.Height == 0))
{
return null;
- }
+ }
return accumulatedBounds;
}
diff --git a/src/Avalonia.Base/Media/ImageDrawing.cs b/src/Avalonia.Base/Media/ImageDrawing.cs
index d3e5c4841b..77b1c52be0 100644
--- a/src/Avalonia.Base/Media/ImageDrawing.cs
+++ b/src/Avalonia.Base/Media/ImageDrawing.cs
@@ -42,7 +42,7 @@ namespace Avalonia.Media
var imageSource = ImageSource;
var rect = Rect;
- if (imageSource is object && !rect.IsDefault)
+ if (imageSource is object && (rect.Width != 0 || rect.Height != 0))
{
context.DrawImage(imageSource, rect);
}
diff --git a/src/Avalonia.Base/Media/Imaging/CroppedBitmap.cs b/src/Avalonia.Base/Media/Imaging/CroppedBitmap.cs
index 8e57f9a902..8cdf5b592a 100644
--- a/src/Avalonia.Base/Media/Imaging/CroppedBitmap.cs
+++ b/src/Avalonia.Base/Media/Imaging/CroppedBitmap.cs
@@ -77,7 +77,7 @@ namespace Avalonia.Media.Imaging
{
if (Source is not IBitmap bmp)
return default;
- if (SourceRect.IsDefault)
+ if (SourceRect.Width == 0 && SourceRect.Height == 0)
return Source.Size;
return SourceRect.Size.ToSizeWithDpi(bmp.Dpi);
}
diff --git a/src/Avalonia.Base/PixelRect.cs b/src/Avalonia.Base/PixelRect.cs
index ef207a3dae..85ec1041c3 100644
--- a/src/Avalonia.Base/PixelRect.cs
+++ b/src/Avalonia.Base/PixelRect.cs
@@ -9,12 +9,6 @@ namespace Avalonia
///
public readonly struct PixelRect : IEquatable
{
- ///
- /// An empty rectangle.
- ///
- [Obsolete("Use the default keyword instead.")]
- public static readonly PixelRect Empty = default;
-
///
/// Initializes a new instance of the structure.
///
@@ -133,15 +127,6 @@ namespace Avalonia
///
public PixelPoint Center => new PixelPoint(X + (Width / 2), Y + (Height / 2));
- ///
- /// Gets a value indicating whether the instance has default values (the rectangle is empty).
- ///
- public bool IsDefault => Width == 0 && Height == 0;
-
- ///
- [Obsolete("Use IsDefault instead.")]
- public bool IsEmpty => IsDefault;
-
///
/// Checks for equality between two s.
///
@@ -295,11 +280,11 @@ namespace Avalonia
/// The union.
public PixelRect Union(PixelRect rect)
{
- if (IsDefault)
+ if (Width == 0 && Height == 0)
{
return rect;
}
- else if (rect.IsDefault)
+ else if (rect.Width == 0 && rect.Height == 0)
{
return this;
}
diff --git a/src/Avalonia.Base/Point.cs b/src/Avalonia.Base/Point.cs
index 86f7adf0d1..d11596d6be 100644
--- a/src/Avalonia.Base/Point.cs
+++ b/src/Avalonia.Base/Point.cs
@@ -288,13 +288,5 @@ namespace Avalonia
x = this._x;
y = this._y;
}
-
- ///
- /// Gets a value indicating whether the X and Y coordinates are zero.
- ///
- public bool IsDefault
- {
- get { return (_x == 0) && (_y == 0); }
- }
}
}
diff --git a/src/Avalonia.Base/Rect.cs b/src/Avalonia.Base/Rect.cs
index 49dc087933..cc030eea04 100644
--- a/src/Avalonia.Base/Rect.cs
+++ b/src/Avalonia.Base/Rect.cs
@@ -16,12 +16,6 @@ namespace Avalonia
Animation.Animation.RegisterAnimator(prop => typeof(Rect).IsAssignableFrom(prop.PropertyType));
}
- ///
- /// An empty rectangle.
- ///
- [Obsolete("Use the default keyword instead.")]
- public static readonly Rect Empty = default;
-
///
/// The X position.
///
@@ -170,17 +164,6 @@ namespace Avalonia
///
public Point Center => new Point(_x + (_width / 2), _y + (_height / 2));
- ///
- /// Gets a value indicating whether the instance has default values (the rectangle is empty).
- ///
- // ReSharper disable CompareOfFloatsByEqualityOperator
- public bool IsDefault => _width == 0 && _height == 0;
- // ReSharper restore CompareOfFloatsByEqualityOperator
-
- ///
- [Obsolete("Use IsDefault instead.")]
- public bool IsEmpty => IsDefault;
-
///
/// Checks for equality between two s.
///
@@ -517,19 +500,18 @@ namespace Avalonia
return rect;
}
-
- ///
- /// Gets the union of two rectangles.
- ///
- /// The other rectangle.
- /// The union.
- public Rect Union(Rect rect)
+ ///
+ /// Gets the union of two rectangles.
+ ///
+ /// The other rectangle.
+ /// The union.
+ public Rect Union(Rect rect)
{
- if (IsDefault)
+ if (Width == 0 && Height == 0)
{
return rect;
}
- else if (rect.IsDefault)
+ else if (rect.Width == 0 && rect.Height == 0)
{
return this;
}
diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs
index 977acd8470..3e88b9e77b 100644
--- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs
+++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionTarget.cs
@@ -130,8 +130,8 @@ namespace Avalonia.Rendering.Composition.Server
}
_renderTarget ??= _compositor.CreateRenderTarget(_surfaces());
-
- if(_dirtyRect.IsDefault && !_redrawRequested)
+
+ if ((_dirtyRect.Width == 0 && _dirtyRect.Height == 0) && !_redrawRequested)
return;
Revision++;
@@ -163,7 +163,7 @@ namespace Avalonia.Rendering.Composition.Server
_dirtyRect = new Rect(0, 0, layerSize.Width, layerSize.Height);
}
- if (!_dirtyRect.IsDefault)
+ if (_dirtyRect.Width != 0 || _dirtyRect.Height != 0)
{
using (var context = _layer.CreateDrawingContext())
{
@@ -260,7 +260,7 @@ namespace Avalonia.Rendering.Composition.Server
public void AddDirtyRect(Rect rect)
{
- if(rect.IsDefault)
+ if (rect.Width == 0 && rect.Height == 0)
return;
var snapped = SnapToDevicePixels(rect, Scaling);
DebugEvents?.RectInvalidated(rect);
@@ -275,7 +275,7 @@ namespace Avalonia.Rendering.Composition.Server
public void Dispose()
{
- if(_disposed)
+ if (_disposed)
return;
_disposed = true;
using (_compositor.RenderInterface.EnsureCurrent())
@@ -302,7 +302,7 @@ namespace Avalonia.Rendering.Composition.Server
{
if (_attachedVisuals.Remove(visual) && IsEnabled)
visual.Deactivate();
- if(visual.IsVisibleInFrame)
+ if (visual.IsVisibleInFrame)
AddDirtyRect(visual.TransformedOwnContentBounds);
}
diff --git a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual.cs b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual.cs
index f9492d0015..6fb5ad3741 100644
--- a/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual.cs
+++ b/src/Avalonia.Base/Rendering/Composition/Server/ServerCompositionVisual.cs
@@ -23,21 +23,20 @@ namespace Avalonia.Rendering.Composition.Server
private bool _isBackface;
private Rect? _transformedClipBounds;
private Rect _combinedTransformedClipBounds;
-
+
protected virtual void RenderCore(CompositorDrawingContextProxy canvas, Rect currentTransformedClip)
{
-
}
public void Render(CompositorDrawingContextProxy canvas, Rect currentTransformedClip)
{
- if(Visible == false || IsVisibleInFrame == false)
+ if (Visible == false || IsVisibleInFrame == false)
return;
- if(Opacity == 0)
+ if (Opacity == 0)
return;
currentTransformedClip = currentTransformedClip.Intersect(_combinedTransformedClipBounds);
- if(currentTransformedClip.IsDefault)
+ if (currentTransformedClip.Width == 0 && currentTransformedClip.Height == 0)
return;
Root!.RenderedVisuals++;
@@ -61,7 +60,7 @@ namespace Avalonia.Rendering.Composition.Server
canvas.PushClip(Root!.SnapToDevicePixels(boundsRect));
if (Clip != null)
canvas.PushGeometryClip(Clip);
- if(OpacityMaskBrush != null)
+ if (OpacityMaskBrush != null)
canvas.PushOpacityMask(OpacityMaskBrush, boundsRect);
RenderCore(canvas, currentTransformedClip);
@@ -78,12 +77,12 @@ namespace Avalonia.Rendering.Composition.Server
canvas.PopClip();
if (AdornedVisual != null && AdornerIsClipped)
canvas.PopClip();
- if(Opacity != 1)
+ if (Opacity != 1)
canvas.PopOpacity();
}
protected virtual bool HandlesClipToBounds => false;
-
+
private ReadbackData _readback0, _readback1, _readback2;
///
@@ -98,17 +97,17 @@ namespace Avalonia.Rendering.Composition.Server
return ref _readback1;
return ref _readback2;
}
-
+
public Matrix4x4 CombinedTransformMatrix { get; private set; } = Matrix4x4.Identity;
public Matrix4x4 GlobalTransformMatrix { get; private set; }
public virtual void Update(ServerCompositionTarget root)
{
- if(Parent == null && Root == null)
+ if (Parent == null && Root == null)
return;
-
+
var wasVisible = IsVisibleInFrame;
-
+
// Calculate new parent-relative transform
if (_combinedTransformDirty)
{
@@ -122,7 +121,7 @@ namespace Avalonia.Rendering.Composition.Server
var parentTransform = (AdornedVisual ?? Parent)?.GlobalTransformMatrix ?? Matrix4x4.Identity;
var newTransform = CombinedTransformMatrix * parentTransform;
-
+
// Check if visual was moved and recalculate face orientation
var positionChanged = false;
if (GlobalTransformMatrix != newTransform)
@@ -134,23 +133,23 @@ namespace Avalonia.Rendering.Composition.Server
var oldTransformedContentBounds = TransformedOwnContentBounds;
var oldCombinedTransformedClipBounds = _combinedTransformedClipBounds;
-
+
if (_parent?.IsDirtyComposition == true)
{
IsDirtyComposition = true;
_isDirtyForUpdate = true;
}
-
+
var invalidateOldBounds = _isDirtyForUpdate;
var invalidateNewBounds = _isDirtyForUpdate;
GlobalTransformMatrix = newTransform;
-
+
var ownBounds = OwnContentBounds;
if (ownBounds != _oldOwnContentBounds || positionChanged)
{
_oldOwnContentBounds = ownBounds;
- if (ownBounds.IsDefault)
+ if (ownBounds.Width == 0 && ownBounds.Height == 0)
TransformedOwnContentBounds = default;
else
TransformedOwnContentBounds =
@@ -171,16 +170,16 @@ namespace Avalonia.Rendering.Composition.Server
AdornedVisual?._combinedTransformedClipBounds
?? Parent?._combinedTransformedClipBounds
?? new Rect(Root!.Size);
-
+
if (_transformedClipBounds != null)
_combinedTransformedClipBounds = _combinedTransformedClipBounds.Intersect(_transformedClipBounds.Value);
-
+
EffectiveOpacity = Opacity * (Parent?.EffectiveOpacity ?? 1);
IsHitTestVisibleInFrame = _parent?.IsHitTestVisibleInFrame != false
&& Visible
&& !_isBackface
- && !_combinedTransformedClipBounds.IsDefault;
+ && (_combinedTransformedClipBounds.Width != 0 || _combinedTransformedClipBounds.Height != 0);
IsVisibleInFrame = IsHitTestVisibleInFrame
&& _parent?.IsVisibleInFrame != false
@@ -213,11 +212,11 @@ namespace Avalonia.Rendering.Composition.Server
void AddDirtyRect(Rect rc)
{
- if(rc == default)
+ if (rc == default)
return;
Root?.AddDirtyRect(rc);
}
-
+
///
/// Data that can be read from the UI thread
///
@@ -228,7 +227,7 @@ namespace Avalonia.Rendering.Composition.Server
public long TargetId;
public bool Visible;
}
-
+
partial void DeserializeChangesExtra(BatchStreamReader c)
{
ValuesInvalidated();
@@ -245,9 +244,8 @@ namespace Avalonia.Rendering.Composition.Server
protected virtual void OnDetachedFromRoot(ServerCompositionTarget target)
{
-
}
-
+
partial void OnRootChanged()
{
if (Root != null)
@@ -256,12 +254,11 @@ namespace Avalonia.Rendering.Composition.Server
OnAttachedToRoot(Root);
}
}
-
+
protected virtual void OnAttachedToRoot(ServerCompositionTarget target)
{
-
}
-
+
protected override void ValuesInvalidated()
{
_isDirtyForUpdate = true;
@@ -274,6 +271,4 @@ namespace Avalonia.Rendering.Composition.Server
public Rect TransformedOwnContentBounds { get; set; }
public virtual Rect OwnContentBounds => new Rect(0, 0, Size.X, Size.Y);
}
-
-
}
diff --git a/src/Avalonia.Base/Rendering/DirtyRects.cs b/src/Avalonia.Base/Rendering/DirtyRects.cs
index 723fe400b3..610163191d 100644
--- a/src/Avalonia.Base/Rendering/DirtyRects.cs
+++ b/src/Avalonia.Base/Rendering/DirtyRects.cs
@@ -30,7 +30,7 @@ namespace Avalonia.Rendering
///
public void Add(Rect rect)
{
- if (!rect.IsDefault)
+ if (rect.Width != 0 || rect.Height != 0)
{
for (var i = 0; i < _rects.Count; ++i)
{
diff --git a/src/Avalonia.Base/Size.cs b/src/Avalonia.Base/Size.cs
index aec237afae..7781aec607 100644
--- a/src/Avalonia.Base/Size.cs
+++ b/src/Avalonia.Base/Size.cs
@@ -27,12 +27,6 @@ namespace Avalonia
///
public static readonly Size Infinity = new Size(double.PositiveInfinity, double.PositiveInfinity);
- ///
- /// A size representing zero.
- ///
- [Obsolete("Use the default keyword instead.")]
- public static readonly Size Empty = new Size(0, 0);
-
///
/// The width.
///
@@ -306,10 +300,5 @@ namespace Avalonia
width = this._width;
height = this._height;
}
-
- ///
- /// Gets a value indicating whether the Width and Height values are zero.
- ///
- public bool IsDefault => (_width == 0) && (_height == 0);
}
}
diff --git a/src/Avalonia.Base/Thickness.cs b/src/Avalonia.Base/Thickness.cs
index f9e4355edd..9513d04782 100644
--- a/src/Avalonia.Base/Thickness.cs
+++ b/src/Avalonia.Base/Thickness.cs
@@ -97,10 +97,6 @@ namespace Avalonia
///
public double Bottom => _bottom;
- ///
- [Obsolete("Use IsDefault instead.")]
- public bool IsEmpty => IsDefault;
-
///
/// Gets a value indicating whether all sides are equal.
///
@@ -293,11 +289,5 @@ namespace Avalonia
right = this._right;
bottom = this._bottom;
}
-
- ///
- /// Gets a value indicating whether the instance has default values
- /// (the left, top, right and bottom values are zero).
- ///
- public bool IsDefault => (_left == 0) && (_top == 0) && (_right == 0) && (_bottom == 0);
}
}
diff --git a/src/Avalonia.Base/Vector.cs b/src/Avalonia.Base/Vector.cs
index 810530066f..085f043627 100644
--- a/src/Avalonia.Base/Vector.cs
+++ b/src/Avalonia.Base/Vector.cs
@@ -360,13 +360,5 @@ namespace Avalonia
x = this._x;
y = this._y;
}
-
- ///
- /// Gets a value indicating whether the X and Y components are zero.
- ///
- public bool IsDefault
- {
- get { return (_x == 0) && (_y == 0); }
- }
}
}
diff --git a/src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs b/src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs
index 39c1e4c118..5d080f5ef6 100644
--- a/src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs
+++ b/src/Avalonia.Controls.DataGrid/DataGridCheckBoxColumn.cs
@@ -177,14 +177,14 @@ namespace Avalonia.Controls
}
bool? uneditedValue = editingCheckBox.IsChecked;
- if(editingEventArgs is PointerPressedEventArgs args)
+ if (editingEventArgs is PointerPressedEventArgs args)
{
void ProcessPointerArgs()
{
// Editing was triggered by a mouse click
Point position = args.GetPosition(editingCheckBox);
Rect rect = new Rect(0, 0, editingCheckBox.Bounds.Width, editingCheckBox.Bounds.Height);
- if(rect.Contains(position))
+ if (rect.Contains(position))
{
EditValue();
}
@@ -192,14 +192,14 @@ namespace Avalonia.Controls
void OnLayoutUpdated(object sender, EventArgs e)
{
- if(!editingCheckBox.Bounds.IsDefault)
+ if (editingCheckBox.Bounds.Width != 0 || editingCheckBox.Bounds.Height != 0)
{
editingCheckBox.LayoutUpdated -= OnLayoutUpdated;
ProcessPointerArgs();
}
}
- if(editingCheckBox.Bounds.IsDefault)
+ if (editingCheckBox.Bounds.Width == 0 && editingCheckBox.Bounds.Height == 0)
{
editingCheckBox.LayoutUpdated += OnLayoutUpdated;
}
diff --git a/src/Avalonia.Controls.ItemsRepeater/Controls/ViewportManager.cs b/src/Avalonia.Controls.ItemsRepeater/Controls/ViewportManager.cs
index 6ed817c238..6e9cf2f0cf 100644
--- a/src/Avalonia.Controls.ItemsRepeater/Controls/ViewportManager.cs
+++ b/src/Avalonia.Controls.ItemsRepeater/Controls/ViewportManager.cs
@@ -441,7 +441,7 @@ namespace Avalonia.Controls
_pendingViewportShift = default;
_unshiftableShift = default;
- if (_visibleWindow.IsDefault)
+ if (_visibleWindow.Width == 0 && _visibleWindow.Height == 0)
{
// We got cleared.
_layoutExtent = default;
@@ -527,7 +527,7 @@ namespace Avalonia.Controls
private void TryInvalidateMeasure()
{
// Don't invalidate measure if we have an invalid window.
- if (!_visibleWindow.IsDefault)
+ if (_visibleWindow.Width != 0 || _visibleWindow.Height != 0)
{
// We invalidate measure instead of just invalidating arrange because
// we don't invalidate measure in UpdateViewport if the view is changing to
diff --git a/src/Avalonia.Controls/BorderVisual.cs b/src/Avalonia.Controls/BorderVisual.cs
index b0e5c30e2f..591604a3c5 100644
--- a/src/Avalonia.Controls/BorderVisual.cs
+++ b/src/Avalonia.Controls/BorderVisual.cs
@@ -50,7 +50,7 @@ class CompositionBorderVisual : CompositionDrawListVisual
if (ClipToBounds)
{
var clipRect = Root!.SnapToDevicePixels(new Rect(new Size(Size.X, Size.Y)));
- if (_cornerRadius.IsDefault)
+ if (_cornerRadius == default)
canvas.PushClip(clipRect);
else
canvas.PushClip(new RoundedRect(clipRect, _cornerRadius));
diff --git a/src/Avalonia.Controls/Flyouts/PopupFlyoutBase.cs b/src/Avalonia.Controls/Flyouts/PopupFlyoutBase.cs
index a3d05a34b7..168421c625 100644
--- a/src/Avalonia.Controls/Flyouts/PopupFlyoutBase.cs
+++ b/src/Avalonia.Controls/Flyouts/PopupFlyoutBase.cs
@@ -407,7 +407,7 @@ namespace Avalonia.Controls.Primitives
{
Size sz;
// Popup.Child can't be null here, it was set in ShowAtCore.
- if (Popup.Child!.DesiredSize.IsDefault)
+ if (Popup.Child!.DesiredSize == default)
{
// Popup may not have been shown yet. Measure content
sz = LayoutHelper.MeasureChild(Popup.Child, Size.Infinity, new Thickness());
diff --git a/src/Avalonia.Controls/LayoutTransformControl.cs b/src/Avalonia.Controls/LayoutTransformControl.cs
index 387dc27562..f747e278f0 100644
--- a/src/Avalonia.Controls/LayoutTransformControl.cs
+++ b/src/Avalonia.Controls/LayoutTransformControl.cs
@@ -91,7 +91,7 @@ namespace Avalonia.Controls
arrangedsize = TransformRoot.Bounds.Size;
// This is the first opportunity under Silverlight to find out the Child's true DesiredSize
- if (IsSizeSmaller(finalSizeTransformed, arrangedsize) && _childActualSize.IsDefault)
+ if (IsSizeSmaller(finalSizeTransformed, arrangedsize) && _childActualSize == default)
{
//// Unfortunately, all the work so far is invalid because the wrong DesiredSize was used
//// Make a note of the actual DesiredSize
@@ -122,7 +122,7 @@ namespace Avalonia.Controls
}
Size measureSize;
- if (_childActualSize.IsDefault)
+ if (_childActualSize == default)
{
// Determine the largest size after the transformation
measureSize = ComputeLargestTransformedSize(availableSize);
diff --git a/src/Avalonia.Controls/NativeControlHost.cs b/src/Avalonia.Controls/NativeControlHost.cs
index a94a1ee983..aa3d6db9e0 100644
--- a/src/Avalonia.Controls/NativeControlHost.cs
+++ b/src/Avalonia.Controls/NativeControlHost.cs
@@ -141,7 +141,7 @@ namespace Avalonia.Controls
if (IsEffectivelyVisible && bounds.HasValue)
{
- if (bounds.Value.IsDefault)
+ if (bounds.Value.Width == 0 && bounds.Value.Height == 0)
return false;
_attachment?.ShowInBounds(bounds.Value);
}
diff --git a/src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositioner.cs b/src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositioner.cs
index 62e5f37273..9a60725c7e 100644
--- a/src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositioner.cs
+++ b/src/Avalonia.Controls/Primitives/PopupPositioning/ManagedPopupPositioner.cs
@@ -112,7 +112,8 @@ namespace Avalonia.Controls.Primitives.PopupPositioning
?? screens.FirstOrDefault(s => s.Bounds.Intersects(parentGeometry))
?? screens.FirstOrDefault();
- if (targetScreen != null && targetScreen.WorkingArea.IsDefault)
+ if (targetScreen != null &&
+ (targetScreen.WorkingArea.Width == 0 && targetScreen.WorkingArea.Height == 0))
{
return targetScreen.Bounds;
}
diff --git a/src/Avalonia.Controls/VirtualizingStackPanel.cs b/src/Avalonia.Controls/VirtualizingStackPanel.cs
index 4970a333a5..5bfa0966b2 100644
--- a/src/Avalonia.Controls/VirtualizingStackPanel.cs
+++ b/src/Avalonia.Controls/VirtualizingStackPanel.cs
@@ -459,7 +459,8 @@ namespace Avalonia.Controls
while (c is not null)
{
- if (!c.Bounds.IsDefault && c.TransformToVisual(this) is Matrix transform)
+ if ((c.Bounds.Width != 0 || c.Bounds.Height != 0) &&
+ c.TransformToVisual(this) is Matrix transform)
{
viewport = new Rect(0, 0, c.Bounds.Width, c.Bounds.Height)
.TransformToAABB(transform);
diff --git a/src/Skia/Avalonia.Skia/DrawingContextImpl.cs b/src/Skia/Avalonia.Skia/DrawingContextImpl.cs
index e3e2f664c3..671e4d134c 100644
--- a/src/Skia/Avalonia.Skia/DrawingContextImpl.cs
+++ b/src/Skia/Avalonia.Skia/DrawingContextImpl.cs
@@ -375,7 +375,7 @@ namespace Avalonia.Skia
foreach (var boxShadow in boxShadows)
{
- if (!boxShadow.IsDefault && !boxShadow.IsInset)
+ if (boxShadow != default && !boxShadow.IsInset)
{
using (var shadow = BoxShadowFilter.Create(_boxShadowPaint, boxShadow, _useOpacitySaveLayer ? 1 : _currentOpacity))
{
@@ -432,7 +432,7 @@ namespace Avalonia.Skia
foreach (var boxShadow in boxShadows)
{
- if (!boxShadow.IsDefault && boxShadow.IsInset)
+ if (boxShadow != default && boxShadow.IsInset)
{
using (var shadow = BoxShadowFilter.Create(_boxShadowPaint, boxShadow, _useOpacitySaveLayer ? 1 : _currentOpacity))
{