in src/Core/Misc/ExtensionMethods.cs [225:259]
public static bool IsSameUIElement(this A11yElement element1, string runtimeId, Rectangle? rect, int controltype, string name)
{
if (element1 != null)
{
if (string.IsNullOrEmpty(element1.RuntimeId) == false
|| string.IsNullOrEmpty(runtimeId) == false)
{
return element1.RuntimeId == runtimeId;
}
else if(element1.Name == name)
{
if (element1.ControlTypeId == controltype)
{
// if control type is same check, bounding rectangle for sure.
if (!element1.BoundingRectangle.IsEmpty
&& rect != null
&& !rect.Value.IsEmpty)
{
var r = element1.BoundingRectangle;
var l = rect.Value;
return l.Left == r.Left && l.Top == r.Top && l.Right == l.Right && l.Bottom == r.Bottom;
}
else
{
// if both has no bounding rectangle, consider them as same element.
return element1.BoundingRectangle.IsEmpty
&& (rect == null
|| rect.Value.IsEmpty);
}
}
}
}
return false;
}