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

Update CssLayoutEngineTable.cs #69

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
14 changes: 13 additions & 1 deletion Source/HtmlRenderer/Core/Dom/CssLayoutEngineTable.cs
Original file line number Diff line number Diff line change
Expand Up @@ -611,6 +611,7 @@ private void LayoutCells(RGraphics g)
double cury = starty;
double maxRight = startx;
double maxBottom = 0f;
double maxHeaderBottom = 0f;
int currentrow = 0;

// change start X by if the table should align to center or right
Expand All @@ -634,6 +635,7 @@ private void LayoutCells(RGraphics g)
for (int j = 0; j < row.Boxes.Count; j++)
{
CssBox cell = row.Boxes[j];
var isheader = (cell.HtmlTag.Name == "th");
if (curCol >= _columnWidths.Length)
break;

Expand All @@ -660,6 +662,11 @@ private void LayoutCells(RGraphics g)
maxRight = Math.Max(maxRight, cell.ActualRight);
curCol++;
curx = cell.ActualRight + GetHorizontalSpacing();

if (isheader)
{
maxHeaderBottom = maxBottom;
}
}

foreach (CssBox cell in row.Boxes)
Expand Down Expand Up @@ -708,6 +715,11 @@ private void LayoutCells(RGraphics g)
maxRight = Math.Max(maxRight, _tableBox.Location.X + _tableBox.ActualWidth);
_tableBox.ActualRight = maxRight + GetHorizontalSpacing() + _tableBox.ActualBorderRightWidth;
_tableBox.ActualBottom = Math.Max(maxBottom, starty) + GetVerticalSpacing() + _tableBox.ActualBorderBottomWidth;

#warning EFR : Added headerbox calculation
_headerBox.Location = _tableBox.Location;
_headerBox.ActualRight = maxRight + GetHorizontalSpacing() + _headerBox.ActualBorderRightWidth;
_headerBox.ActualBottom = Math.Max(maxHeaderBottom, starty) + GetVerticalSpacing() + _headerBox.ActualBorderBottomWidth;
}

/// <summary>
Expand Down Expand Up @@ -1036,4 +1048,4 @@ private double GetVerticalSpacing()

#endregion
}
}
}