{
final StaticBoxLayoutProperties blp = box.getStaticBoxLayoutProperties();
final BoxDefinition bdef = box.getBoxDefinition();
final BoxDefinition boxDefinition = box.getBoxDefinition();
final RenderLength minHeight = boxDefinition.getMinimumHeight();
final RenderLength preferredHeight = boxDefinition.getPreferredHeight();
final RenderLength maxHeight = boxDefinition.getMaximumHeight();
final long insetsTop = (blp.getBorderTop() + bdef.getPaddingTop());
final long insetsBottom = blp.getBorderBottom() + bdef.getPaddingBottom();
final long insets = insetsTop + insetsBottom;
// find the maximum of the used height (for all childs) and the specified min-height.
final long minHeightResolved = minHeight.resolve(0);
long consumedHeight;
if (box.isSizeSpecifiesBorderBox())
{
consumedHeight = Math.max(minHeightResolved, insets) - insetsBottom;
}
else
{
consumedHeight = minHeightResolved + insetsTop;
}
final long boxY = box.getCachedY();
RenderNode node = box.getFirstChild();
while (node != null)
{
final long childY2 = (node.getCachedY() + node.getCachedHeight());
final long childLocalY2 = childY2 - boxY;
if (childLocalY2 > consumedHeight)
{
consumedHeight = childLocalY2;
}
node = node.getNext();
}
consumedHeight += insetsBottom;
// The consumed height computed above specifies the size at the border-edge.
// However, depending on the box-sizing property, we may have to resolve them against the
// content-edge instead.
final long maxHeightResolved = maxHeight.resolve(0, InfiniteMajorAxisLayoutStep.MAX_AUTO);
if (box.isSizeSpecifiesBorderBox())
{
final long prefHeightResolved;
if (RenderLength.AUTO.equals(preferredHeight))
{