Skip to content

Commit

Permalink
perf: Eliminate boxing of FrameworkPropertyMetadataOptions
Browse files Browse the repository at this point in the history
  • Loading branch information
Youssef1313 authored Nov 1, 2023
1 parent 9ebc975 commit 6e03929
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/Uno.UI/UI/Xaml/DependencyObjectStore.cs
Original file line number Diff line number Diff line change
Expand Up @@ -636,7 +636,7 @@ private void ApplyCoercion(DependencyObject actualInstanceAlias, DependencyPrope

var options = (propertyDetails.Metadata as FrameworkPropertyMetadata)?.Options ?? FrameworkPropertyMetadataOptions.Default;

if (Equals(previousValue, baseValue) && options.HasFlag(FrameworkPropertyMetadataOptions.CoerceOnlyWhenChanged))
if (Equals(previousValue, baseValue) && ((options & FrameworkPropertyMetadataOptions.CoerceOnlyWhenChanged) != 0))
{
// Value hasn't changed, don't coerce.
return;
Expand All @@ -652,7 +652,7 @@ private void ApplyCoercion(DependencyObject actualInstanceAlias, DependencyPrope
// Source: https://msdn.microsoft.com/en-us/library/ms745795%28v=vs.110%29.aspx?f=255&MSPPError=-2147217396
SetValueInternal(previousValue, DependencyPropertyValuePrecedences.Coercion, propertyDetails);
}
else if (!Equals(coercedValue, baseValue) || options.HasFlag(FrameworkPropertyMetadataOptions.KeepCoercedWhenEquals))
else if (!Equals(coercedValue, baseValue) || ((options & FrameworkPropertyMetadataOptions.KeepCoercedWhenEquals) != 0))
{
// The base value and the coerced value are different, which means that coercion must be applied.
// Set value using DependencyPropertyValuePrecedences.Coercion, which has the highest precedence.
Expand Down

0 comments on commit 6e03929

Please sign in to comment.