{
// check, if the section contains row-spanning cell declarations.
// if it does, check whether there are enough rows to make these
// constraints valid. If there are rows missing, then the section
// is not layoutable..
RenderNode node = box.getFirstChild();
int expectedRows = 0;
while (node != null)
{
if (node instanceof TableRowRenderBox == false)
{
node = node.getNext();
continue;
}
expectedRows -= 1;
final TableRowRenderBox row = (TableRowRenderBox) node;
final TableRowInfoStructure rowInfoStructure = row.getRowInfoStructure();
if (rowInfoStructure.isValidationDone())
{
// ok, we can take the shortcut ..
final int cellCount = rowInfoStructure.getCellCount();
for (int i = 0; i < cellCount; i++)
{
final TableCell cellAt = rowInfoStructure.getCellAt(i);
expectedRows = Math.max (expectedRows, cellAt.getRowSpan() - 1);
}
}
else
{
// the slow-lane: Look at the already declared cells ..
RenderNode nodeCell = row.getFirstChild();
while (nodeCell != null)
{
if (nodeCell instanceof TableCellRenderBox)
{
final TableCellRenderBox cellBox = (TableCellRenderBox) nodeCell;
expectedRows = Math.max (expectedRows, cellBox.getRowSpan() - 1);
}
nodeCell = nodeCell.getNext();
}
}
node = node.getNext();
}