protected void finishTableRowLevelBox(final RenderBox box) { try { box.setCachedX(nodeContext.getX()); box.setContentAreaX1(nodeContext.getX1()); box.setContentAreaX2(nodeContext.getX2()); if (box.getNodeType() != LayoutNodeTypes.TYPE_BOX_TABLE_CELL) { // break-marker boxes etc. box.setCachedWidth(resolveTableWidthOnFinish(box)); nodeContext.updateParentX2(box.getCachedX2()); } else { box.setCachedWidth( MinorAxisLayoutStepUtil.resolveNodeWidthOnFinish( box, nodeContext, isStrictLegacyMode())); final TableCellRenderBox cell = (TableCellRenderBox) box; final MinorAxisTableContext tableContext = getTableContext(); final TableRenderBox table = tableContext.getTable(); if (tableContext.isStructureValidated() == false) { table .getColumnModel() .updateCellSize( cell.getColumnIndex(), cell.getColSpan(), box.getCachedWidth() - box.getInsets()); } nodeContext.updateParentX2(box.getCachedX2()); } } finally { nodeContext = nodeContext.pop(); } }
protected boolean startTableRowLevelBox(final RenderBox box) { if (lineBreakState.isInsideParagraph()) { // The break-state exists only while we are inside of an paragraph // and suspend can only happen on inline elements. // A block-element inside a paragraph cannot be (and if it does, it is // a bug) throw new IllegalStateException("This cannot be."); } nodeContext = nodeContextPool.createContext(box, nodeContext, false); if (box.getNodeType() != LayoutNodeTypes.TYPE_BOX_TABLE_CELL) { startTableSectionOrRow(box); return true; } final MinorAxisTableContext tableContext = getTableContext(); final TableCellRenderBox tableCellRenderBox = (TableCellRenderBox) box; // This is slightly different for table cells ... final int columnIndex = tableCellRenderBox.getColumnIndex(); final TableColumnModel columnModel = tableContext.getColumnModel(); // cell-size does not include border spacing final long startOfRowX = nodeContext.getParentX1(); final long x = startOfRowX + columnModel.getCellPosition(columnIndex); final long insetsLeft = Math.max(box.getInsetsLeft(), columnModel.getBorderSpacing() / 2); final long insetsRight = Math.max(box.getInsetsRight(), columnModel.getBorderSpacing() / 2); final long width = computeCellWidth(tableCellRenderBox); nodeContext.setArea(x, insetsLeft, insetsRight, width); return true; }