// gets fired, and only if all cells have been replaced by removed-
// placeholders
return startTableRow((TableRowRenderBox) box);
}
final RenderNode node = box.getVisibleFirst();
if (node == null)
{
// The cell is empty ..
return false;
}
if (node.isOpen())
{
return true;
}
final long nodeY = node.getY();
if ((nodeY + node.getHeight()) > pageOffset)
{
// we cant handle that. At least parts of the node will be visible ..
if (nodeY > pageOffset)
{
// all childs will be visible too, so why visiting them ...
return false;
}
return true;
}
// Next, search the last node that is fully invisible. We collapse all
// invisible node into one big box for efficiency reasons. They wont be
// visible anyway and thus the result will be the same as if they were
// still alive ..
RenderNode last = node;
while (true)
{
final RenderNode next = last.getVisibleNext();
if (next == null)
{
break;
}
if (next.isOpen())
{
// as long as a box is open, it can grow and therefore it cannot be
// removed ..
break;
}
if ((next.getY() + next.getHeight()) > pageOffset)
{
// we cant handle that. This node will be visible. So the current last
// node is the one we can shrink ..
break;
}
last = next;
}
// So lets get started. We remove all nodes between (and inclusive)
// node and last.
final long width = box.getContentAreaX2() - box.getContentAreaX1();
final long height = last.getY() + last.getHeight() - nodeY;
// make sure that the finished-box inherits the margins ..
final long marginsTop = node.getEffectiveMarginTop();
final long marginsBottom = last.getEffectiveMarginBottom();
final FinishedRenderNode replacement =
new FinishedRenderNode(width, height, marginsTop, marginsBottom);
RenderNode removeNode = node;
while (removeNode != last)
{
final RenderNode next = removeNode.getNext();
if (removeNode.isOpen())
{
throw new IllegalStateException();
}
box.remove(removeNode);