8000 convert PresentationSource from params DependencyObject[] to params R… · dotnet/wpf@1217ef8 · GitHub
[go: up one dir, main page]

Skip to content

Commit 1217ef8

Browse files
committed
convert PresentationSource from params DependencyObject[] to params ReadOnlySpan<DependencyObject>
1 parent 6dfa53c commit 1217ef8

File tree

4 files changed

+8
-13
lines changed

4 files changed

+8
-13
lines changed

src/Microsoft.DotNet.Wpf/src/PresentationCore/System/Windows/PresentationSource.cs

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -598,25 +598,20 @@ internal static object FireContentRendered(object arg)
598598
/// Helper method which returns true when all the given visuals
599599
/// are in the same presentation source.
600600
/// </summary>
601-
[FriendAccessAllowed] // To allow internal code paths to access this function
602-
internal static bool UnderSamePresentationSource(params DependencyObject[] visuals)
601+
internal static bool IsUnderSamePresentationSource(params ReadOnlySpan<DependencyObject> visuals)
603602
{
604-
if (visuals == null || visuals.Length == 0)
605-
{
603+
if (visuals.IsEmpty)
606604
return true;
607-
}
608605

609606
PresentationSource baseSource = CriticalFromVisual(visuals[0]);
610-
611-
int count = visuals.Length;
612-
for (int i = 1; i < count; i++)
607+
for (int i = 1; i < visuals.Length; i++)
613608
{
614-
PresentationSource currentSource = CriticalFromVisual(visuals[i]);
615-
if (currentSource != baseSource)
609+
if (baseSource != CriticalFromVisual(visuals[i]))
616610
{
617611
return false;
618612
}
619613
}
614+
620615
return true;
621616
}
622617

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/Primitives/DataGridDetailsPresenter.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ private static void OnAnyMouseLeftButtonDownThunk(object sender, MouseButtonEven
109109
private void OnAnyMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs e)
110110
{
111111
// Ignore actions if the button down arises from a different presentation source
112-
if (!PresentationSource.UnderSamePresentationSource(e.OriginalSource as DependencyObject, this))
112+
if (!PresentationSource.IsUnderSamePresentationSource(e.OriginalSource as DependencyObject, this))
113113
{
114114
return;
115115
}

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Controls/ScrollViewer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1654,7 +1654,7 @@ private bool ShouldManipulateScroll(ManipulationStartingEventArgs e, ScrollConte
16541654
{
16551655
// If the original source is not from the same PresentationSource as of ScrollViewer,
16561656
// then do not start the manipulation.
1657-
if (!PresentationSource.UnderSamePresentationSource(e.OriginalSource as DependencyObject, this))
1657+
if (!PresentationSource.IsUnderSamePresentationSource(e.OriginalSource as DependencyObject, this))
16581658
{
16591659
return false;
16601660
}

src/Microsoft.DotNet.Wpf/src/PresentationFramework/System/Windows/Window.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7053,7 +7053,7 @@ protected override void OnManipulationBoundaryFeedback(ManipulationBoundaryFeedb
70537053

70547054
// If the original source is not from the same PresentationSource as of the Window,
70557055
// then do not act on the PanningFeedback.
7056-
if (!PresentationSource.UnderSamePresentationSource(e.OriginalSource as DependencyObject, this))
7056+
if (!PresentationSource.IsUnderSamePresentationSource(e.OriginalSource as DependencyObject, this))
70577057
{
70587058
return;
70597059
}

0 commit comments

Comments
 (0)
0