Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor TableLayout to replace ArrayList #8151

Merged
merged 2 commits into from
Nov 10, 2022
Merged
Changes from 1 commit
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 @@ -765,7 +765,7 @@ private static int InflateColumns(ContainerInfo containerInfo, Size proposedCons
Strip strip = strips[i];
if (i < styles.Count)
{
TableLayoutStyle style = (TableLayoutStyle)styles[i];
TableLayoutStyle style = styles[i];
if (style.SizeType == SizeType.Percent)
{
totalPercent += style.Size;
Expand All @@ -784,7 +784,7 @@ private static int InflateColumns(ContainerInfo containerInfo, Size proposedCons
{
if (i < styles.Count)
{
TableLayoutStyle style = (TableLayoutStyle)styles[i];
TableLayoutStyle style = styles[i];
if (style.SizeType == SizeType.Percent)
{
float percentageOfTotal = style.Size / (float)totalPercent;
Expand Down Expand Up @@ -1207,7 +1207,7 @@ private static void SetElementBounds(ContainerInfo containerInfo, RectangleF dis
Sort(childrenInfo, PostAssignedPositionComparer.GetInstance);
for (int i = 0; i < childrenInfo.Length; i++)
{
LayoutInfo layoutInfo = (LayoutInfo)childrenInfo[i];
LayoutInfo layoutInfo = childrenInfo[i];

IArrangedElement element = layoutInfo.Element;

Expand Down Expand Up @@ -1487,7 +1487,7 @@ private static void Debug_VerifyNoOverlapping(IArrangedElement container)
// this code may be useful for debugging, but doesnt work well with
// row styles

ArrayList layoutInfos = new ArrayList(container.Children.Count);
List<LayoutInfo> layoutInfos = new List<LayoutInfo>(container.Children.Count);
elachlan marked this conversation as resolved.
Show resolved Hide resolved
ContainerInfo containerInfo = GetContainerInfo(container);
Strip[] rows = containerInfo.Rows;
Strip[] columns = containerInfo.Columns;
Expand All @@ -1506,13 +1506,13 @@ private static void Debug_VerifyNoOverlapping(IArrangedElement container)

for (int i = 0; i < layoutInfos.Count; i++)
{
LayoutInfo layoutInfo1 = (LayoutInfo)layoutInfos[i];
LayoutInfo layoutInfo1 = layoutInfos[i];

Rectangle elementBounds1 = layoutInfo1.Element.Bounds;
Rectangle cellsOccupied1 = new Rectangle(layoutInfo1.ColumnStart, layoutInfo1.RowStart, layoutInfo1.ColumnSpan, layoutInfo1.RowSpan);
for (int j = i + 1; j < layoutInfos.Count; j++)
{
LayoutInfo layoutInfo2 = (LayoutInfo)layoutInfos[j];
LayoutInfo layoutInfo2 = layoutInfos[j];
Rectangle elementBounds2 = layoutInfo2.Element.Bounds;
Rectangle cellsOccupied2 = new Rectangle(layoutInfo2.ColumnStart, layoutInfo2.RowStart, layoutInfo2.ColumnSpan, layoutInfo2.RowSpan);
Debug.Assert(!cellsOccupied1.IntersectsWith(cellsOccupied2), "controls overlap in the same cell");
Expand Down