Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,6 @@
<Compile Include="$(WpfSharedDir)\MS\Internal\ReflectionUtils.cs">
<Link>Shared\MS\Internal\ReflectionUtils.cs</Link>
</Compile>
<Compile Include="$(WpfSharedDir)\MS\Internal\SecurityHelper.cs">
<Link>Shared\MS\Internal\SecurityHelper.cs</Link>
</Compile>
<Compile Include="$(WpfSharedDir)\MS\Internal\TokenizerHelper.cs">
<Link>Shared\MS\Internal\TokenizerHelper.cs</Link>
</Compile>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -714,6 +714,7 @@
<Compile Include="System\Windows\Media\CultureSpecificStringDictionary.cs" />
<Compile Include="System\Windows\Media\DashStyle.cs" />
<Compile Include="System\Windows\Media\DashStyles.cs" />
<Compile Include="System\Windows\Media\DoubleCollection.cs" />
<Compile Include="System\Windows\Media\Drawing.cs" />
<Compile Include="System\Windows\Media\DrawingBrush.cs" />
<Compile Include="System\Windows\Media\DrawingCollection.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
namespace System.Windows.Input
{
/// <summary>
/// Converter class for converting between a <see langword="string"/> and <see cref="MouseAction"/>.
/// Converter class for converting between a <see cref="string"/> and <see cref="MouseAction"/>.
/// </summary>
public class MouseActionConverter : TypeConverter
{
///<summary>
/// Used to check whether we can convert a <see langword="string"/> into a <see cref="MouseAction"/>.
/// Used to check whether we can convert a <see cref="string"/> into a <see cref="MouseAction"/>.
///</summary>
///<param name="context">ITypeDescriptorContext</param>
///<param name="sourceType">type to convert from</param>
Expand All @@ -24,32 +24,32 @@ public override bool CanConvertFrom(ITypeDescriptorContext context, Type sourceT
}

/// <summary>
/// Used to check whether we can convert specified value to <see langword="string"/>.
/// Used to check whether we can convert specified value to <see cref="string"/>.
/// </summary>
/// <param name="context">ITypeDescriptorContext</param>
/// <param name="destinationType">Type to convert to</param>
/// <returns><see langword="true"/> if conversion to <see langword="string"/> is possible, <see langword="false"/> otherwise.</returns>
/// <returns><see langword="true"/> if conversion to <see cref="string"/> is possible, <see langword="false"/> otherwise.</returns>
public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType)
{
// We can convert to an InstanceDescriptor or to a string
if (destinationType != typeof(string))
return false;

// When invoked by the serialization engine we can convert to string only for known type
if (context is null || context.Instance is null)
if (context?.Instance is not MouseAction mouseAction)
return false;

// Make sure the value falls within defined set
return IsDefinedMouseAction((MouseAction)context.Instance);
return IsDefinedMouseAction(mouseAction);
}

/// <summary>
/// Converts <paramref name="source"/> of <see langword="string"/> type to its <see cref="MouseAction"/> represensation.
/// Converts <paramref name="source"/> of <see cref="string"/> type to its <see cref="MouseAction"/> representation.
/// </summary>
/// <param name="context">Parser Context</param>
/// <param name="culture">Culture Info</param>
/// <param name="source">MouseAction String</param>
/// <returns>A <see cref="MouseAction"/> representing the <see langword="string"/> specified by <paramref name="source"/>.</returns>
/// <returns>A <see cref="MouseAction"/> representing the <see cref="string"/> specified by <paramref name="source"/>.</returns>
public override object ConvertFrom(ITypeDescriptorContext context, CultureInfo culture, object source)
{
if (source is not string mouseAction)
Expand All @@ -72,21 +72,20 @@ _ when mouseActionToken.Equals("MiddleDoubleClick", StringComparison.OrdinalIgno
}

/// <summary>
/// Converts a <paramref name="value"/> of <see cref="MouseAction"/> to its <see langword="string"/> represensation.
/// Converts a <paramref name="value"/> of <see cref="MouseAction"/> to its <see cref="string"/> representation.
/// </summary>
/// <param name="context">Serialization Context</param>
/// <param name="culture">Culture Info</param>
/// <param name="value">MouseAction value </param>
/// <param name="destinationType">Type to Convert</param>
/// <returns>A <see langword="string"/> representing the <see cref="MouseAction"/> specified by <paramref name="value"/>.</returns>
/// <returns>A <see cref="string"/> representing the <see cref="MouseAction"/> specified by <paramref name="value"/>.</returns>
public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType)
{
ArgumentNullException.ThrowIfNull(destinationType);

if (value is null || destinationType != typeof(string))
if (value is not MouseAction mouseAction || destinationType != typeof(string))
throw GetConvertToException(value, destinationType);

MouseAction mouseAction = (MouseAction)value;
return mouseAction switch
{
MouseAction.None => string.Empty,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.

using MS.Utility;

namespace System.Windows.Media;

public sealed partial class DoubleCollection
{
/// <summary>
/// Initializes a new instance using a <paramref name="values"/>. Elements are copied.
/// </summary>
/// <param name="values"></param>
internal DoubleCollection(params ReadOnlySpan<double> values)
{
_collection = new FrugalStructList<double>(values.Length);

foreach (double item in values)
{
_collection.Add(item);
}
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -271,13 +271,9 @@ private static CultureInfo GetDocumentCultureInfo(ITextContainer textContainer)
/// <param name="findToolBar">FindToolBar instance.</param>
internal static void ShowFindUnsuccessfulMessage(FindToolBar findToolBar)
{
string messageString;

// No, we did not find anything. Alert the user.
messageString = findToolBar.SearchUp ?
SR.DocumentViewerSearchUpCompleteLabel :
SR.DocumentViewerSearchDownCompleteLabel;
messageString = String.Format(System.Globalization.CultureInfo.CurrentCulture, messageString, findToolBar.SearchText);
string messageString = findToolBar.SearchUp ? SR.DocumentViewerSearchUpCompleteLabel : SR.DocumentViewerSearchDownCompleteLabel;
messageString = string.Format(CultureInfo.CurrentCulture, messageString, findToolBar.SearchText);

HwndSource hwndSource = PresentationSource.CriticalFromVisual(findToolBar) as HwndSource;
IntPtr hwnd = (hwndSource != null) ? hwndSource.Handle : IntPtr.Zero;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8464,9 +8464,13 @@ private object InvalidateCellsPanelHorizontalOffset(object args)
IProvideDataGridColumn cell = GetAnyCellOrColumnHeader();
if (cell != null)
{
CellsPanelHorizontalOffset = DataGridHelper.GetParentCellsPanelHorizontalOffset(cell);
// Due to layout rounding, computation of the offset may return a negative value while computing the difference between controls,
// however since this offset is used also for Button's Width servicing the DataGrid.SelectAllCommand in all standard styles,
// we cannot accept this. Even if we could, the DataGrid[CellsPanel] layout logic depends on this offset being 0 or greater.
// See https://github.com/dotnet/wpf/pull/9983 for more information regarding this.
CellsPanelHorizontalOffset = Math.Max(0d, DataGridHelper.GetParentCellsPanelHorizontalOffset(cell));
}
else if (!Double.IsNaN(RowHeaderWidth))
else if (!double.IsNaN(RowHeaderWidth))
{
CellsPanelHorizontalOffset = RowHeaderWidth;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -856,7 +856,7 @@ private bool HandleIsMouseOverChanged()
(_headerGripper == null || !_headerGripper.IsMouseOver))
{
// Hovering over the button will click in the OnHover click mode
SetValue(IsPressedPropertyKey, BooleanBoxes.Box(true));
SetValue(IsPressedPropertyKey, BooleanBoxes.TrueBox);
OnClick();
}
else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -85,23 +85,17 @@ public event HwndSourceHook MessageHook
{
add
{

if(_hooks == null)
{
_hooks = new ArrayList(8);
}
_hooks ??= new List<HwndSourceHook>(8);

_hooks.Add(value);
}

remove
{

if(_hooks != null)
if (_hooks is not null)
{
_hooks.Remove(value);

if(_hooks.Count == 0)
if (_hooks.Count == 0)
{
_hooks = null;
}
Expand Down Expand Up @@ -1101,22 +1095,19 @@ private object AsyncDestroyWindow(object arg)

private IntPtr SubclassWndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled)
{
IntPtr result = IntPtr.Zero ;
// Call the virtual first
IntPtr result = WndProc(hwnd, msg, wParam, lParam, ref handled);

// Call the virtual first.
result = WndProc(hwnd, msg, wParam, lParam, ref handled);
if (_hooks is null || handled)
return result;

// Call the handlers for the MessageHook event.
if(!handled && _hooks != null)
// Call the handlers for the MessageHook event
for (int i = 0, nCount = _hooks.Count; i < nCount; i++)
{
for(int i = 0, nCount = _hooks.Count; i < nCount; i++)
{
result = ((HwndSourceHook)_hooks[i])(hwnd, msg, wParam, lParam, ref handled);
if(handled)
{
break;
}
}
result = _hooks[i].Invoke(hwnd, msg, wParam, lParam, ref handled);

if (handled)
break;
}

return result;
Expand All @@ -1132,7 +1123,7 @@ private IntPtr SubclassWndProc(IntPtr hwnd, int msg, IntPtr wParam, IntPtr lPara

private HandleRef _hwnd;

private ArrayList _hooks;
private List<HwndSourceHook> _hooks;
private Size _desiredSize;

/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,7 @@
using System.Linq;
using System.Reflection;
using MS.Utility;
#if PBTCOMPILER
using MS.Internal.PresentationBuildTasks;
#else
#if !PBTCOMPILER
using MS.Internal.PresentationFramework;
using MS.Internal.Utility; // AssemblyCacheEnum
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -954,7 +954,7 @@ private static bool IsEqual(object a, object b)

// Original Style data (not including based-on data)
// Synchronized (write locks, lock-free reads): Covered by Style instance lock
/* property */ internal FrugalStructList<System.Windows.PropertyValue> PropertyValues = new FrugalStructList<System.Windows.PropertyValue>();
internal FrugalStructList<PropertyValue> PropertyValues = new();

// Properties driven on the container (by the Style) that should be
// invalidated when the style gets applied/unapplied. These properties
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,6 @@
</Compile>
<Compile Include="$(WpfSharedDir)\RefAssemblyAttrs.cs" />
<Compile Include="$(WpfSharedDir)\MS\Internal\SafeSecurityHelper.cs" />
<Compile Include="$(WpfSharedDir)\MS\Internal\SecurityHelper.cs" />
<Compile Include="$(WpfSharedDir)\MS\Internal\UriComparer.cs " />
<Compile Include="$(WpfSharedDir)\MS\Utility\BindUriHelper.cs" />
<Compile Include="GlobalUsings.cs" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,29 +7,18 @@
*
\***************************************************************************/

using System.Security;
using System.ComponentModel;
using System.Runtime.InteropServices;
using Microsoft.Win32;

#if !PBTCOMPILER
using MS.Win32;
using System.IO.Packaging;
#endif

#if PRESENTATION_CORE
using MS.Internal.AppModel;
using System.Security;
using MS.Win32;
#endif

#if PRESENTATIONFRAMEWORK_ONLY
using System.Diagnostics;
using System.Windows;
using MS.Internal.Utility; // BindUriHelper
using MS.Internal.AppModel;
#endif

#if REACHFRAMEWORK
using MS.Internal.Utility;
#endif
#if WINDOWS_BASE
// This existed originally to allow FontCache service to
Expand All @@ -50,10 +39,6 @@ namespace MS.Internal.WindowsBase
namespace MS.Internal // Promote the one from PresentationCore as the default to use.
#elif PRESENTATIONFRAMEWORK
namespace MS.Internal.PresentationFramework
#elif PBTCOMPILER
namespace MS.Internal.PresentationBuildTasks
#elif REACHFRAMEWORK
namespace MS.Internal.ReachFramework
#elif DRT
namespace MS.Internal.Drt
#else
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,7 @@
using System.Text; // for StringBuilder
using System.Diagnostics; // for Debug.Assert


#if PBTCOMPILER
using MS.Utility; // For SR.cs
using MS.Internal.PresentationBuildTasks;
#else
#if !PBTCOMPILER
using System.Windows;
using MS.Internal.WindowsBase;
#endif
Expand Down
Loading
Loading