* W3C regarding whether borders or border-separation must be included or not
*/
private void computeRowHeights() {
log.debug("rowGroup:");
MinOptMax[] rowHeights = new MinOptMax[rowGroup.length];
EffRow row;
for (int rgi = 0; rgi < rowGroup.length; rgi++) {
row = rowGroup[rgi];
// The BPD of the biggest cell in the row
// int maxCellBPD = 0;
MinOptMax explicitRowHeight;
TableRow tableRowFO = rowGroup[rgi].getTableRow();
if (tableRowFO == null) {
rowHeights[rgi] = new MinOptMax(0, 0, Integer.MAX_VALUE);
explicitRowHeight = new MinOptMax(0, 0, Integer.MAX_VALUE);
} else {
LengthRangeProperty rowBPD = tableRowFO.getBlockProgressionDimension();
rowHeights[rgi] = MinOptMaxUtil.toMinOptMax(rowBPD, tableLM);
explicitRowHeight = MinOptMaxUtil.toMinOptMax(rowBPD, tableLM);
}
for (Iterator iter = row.getGridUnits().iterator(); iter.hasNext();) {
GridUnit gu = (GridUnit) iter.next();
if (!gu.isEmpty() && gu.getColSpanIndex() == 0 && gu.isLastGridUnitRowSpan()) {
PrimaryGridUnit primary = gu.getPrimary();
int effectiveCellBPD = 0;
LengthRangeProperty cellBPD = primary.getCell().getBlockProgressionDimension();
if (!cellBPD.getMinimum(tableLM).isAuto()) {
effectiveCellBPD = cellBPD.getMinimum(tableLM).getLength()
.getValue(tableLM);
}
if (!cellBPD.getOptimum(tableLM).isAuto()) {
effectiveCellBPD = cellBPD.getOptimum(tableLM).getLength()
.getValue(tableLM);
}
if (gu.getRowSpanIndex() == 0) {
effectiveCellBPD = Math.max(effectiveCellBPD, explicitRowHeight.opt);
}
effectiveCellBPD = Math.max(effectiveCellBPD, primary.getContentLength());
int borderWidths = primary.getBeforeAfterBorderWidth();
int padding = 0;
CommonBorderPaddingBackground cbpb = primary.getCell()
.getCommonBorderPaddingBackground();
padding += cbpb.getPaddingBefore(false, primary.getCellLM());
padding += cbpb.getPaddingAfter(false, primary.getCellLM());
int effRowHeight = effectiveCellBPD + padding + borderWidths;
for (int prev = rgi - 1; prev >= rgi - gu.getRowSpanIndex(); prev--) {
effRowHeight -= rowHeights[prev].opt;
}
if (effRowHeight > rowHeights[rgi].min) {
// This is the new height of the (grid) row
MinOptMaxUtil.extendMinimum(rowHeights[rgi], effRowHeight);
}
}
}
row.setHeight(rowHeights[rgi]);
row.setExplicitHeight(explicitRowHeight);
// TODO re-enable and improve after clarification
// if (maxCellBPD > row.getExplicitHeight().max) {
// log.warn(FONode.decorateWithContextInfo(
// "The contents of row " + (row.getIndex() + 1)
// + " are taller than they should be (there is a"