private static bool IsBoundingRectangleContained()

in src/Rules/Library/BoundingRectangleContainedInParent.cs [47:71]


        private static bool IsBoundingRectangleContained(IA11yElement container, IA11yElement containee)
        {
            if (container == null) throw new ArgumentNullException(nameof(container));
            if (containee == null) throw new ArgumentNullException(nameof(containee));

            if (ScrollPattern.NotHorizontallyScrollable.Matches(container))
            {
                if (container.BoundingRectangle.Left - Margin > containee.BoundingRectangle.Left)
                    return false;

                if (container.BoundingRectangle.Right + Margin < containee.BoundingRectangle.Right)
                    return false;
            }

            if (ScrollPattern.NotVerticallyScrollable.Matches(container))
            {
                if (container.BoundingRectangle.Top - Margin > containee.BoundingRectangle.Top)
                    return false;

                if (container.BoundingRectangle.Bottom + Margin < containee.BoundingRectangle.Bottom)
                    return false;
            }

            return true;
        }