Iterator iter = ranges.iterator();
final int defaultSize = colHelper.getDefaultSize();
final int defaultRowSize = rowHelper.getDefaultSize();
while (iter.hasNext()) {
MergedRect block = (MergedRect) iter.next();
int left = block.getLeft();
int right = block.getRight();
int width = 0;
for (int i = left; i <= right; i++) {
final HeaderPositionInfo info = colHelper.getInfo(i);
if (info != null) {
final boolean hidden = info.hidden;
final int colSize = hidden ? 0 : info.size;
width += colSize;
} else {
width += defaultSize ;
}
}
int top = block.getTop();
int bottom = block.getBottom();
int height = 0;
for (int i = top; i <= bottom; i++) {
final HeaderPositionInfo info = rowHelper.getInfo(i);
if (info != null) {
final boolean hidden = info.hidden;
final int rowSize = hidden ? 0 : info.size;
height += rowSize;
} else {
height += defaultRowSize ;
}
}
if (width <= 0 || height <= 0) { //total hidden
sb.append(name).append(" .zsmerge").append(block.getId()).append("{");
sb.append("display:none;");
sb.append("}");
sb.append(name).append(" .zsmerge").append(block.getId());
sb.append(" .zscelltxt").append("{");
sb.append("display:none;");
sb.append("}");
} else {
celltextwidth = width - 2 * cp - 1;// 1 is border width
int celltextheight = height - 1; //1 is border height
if (!isGecko) {
cellwidth = celltextwidth;
cellheight = celltextheight;
} else {
cellwidth = width;
cellheight = height;
}
sb.append(name).append(" .zsmerge").append(block.getId()).append("{");
sb.append("width:").append(cellwidth).append("px;");
sb.append("height:").append(cellheight).append("px;");
sb.append("}");
sb.append(name).append(" .zsmerge").append(block.getId());
sb.append(" .zscelltxt").append("{");
sb.append("width:").append(celltextwidth).append("px;");
sb.append("height:").append(celltextheight).append("px;");
sb.append("}");
}