* 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] = MAX_STRETCH;
explicitRowHeight = MAX_STRETCH;
} else {
LengthRangeProperty rowBPD = tableRowFO.getBlockProgressionDimension();
rowHeights[rgi] = rowBPD.toMinOptMax(tableLM);
explicitRowHeight = rowBPD.toMinOptMax(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.getOpt());
}
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].getOpt();
}
if (effRowHeight > rowHeights[rgi].getMin()) {
// This is the new height of the (grid) row
rowHeights[rgi] = rowHeights[rgi].extendMinimum(effRowHeight);
}
}
}
row.setHeight(rowHeights[rgi]);
row.setExplicitHeight(explicitRowHeight);
// TODO re-enable and improve after clarification
//See http://markmail.org/message/h25ycwwu7qglr4k4
// if (maxCellBPD > row.getExplicitHeight().max) {
//old:
// log.warn(FONode.decorateWithContextInfo(