BlockRenderer extends AbstractRenderer { AbstractRenderer applyMinHeight(OverflowPropertyValue overflowY, Rectangle layoutBox) { AbstractRenderer overflowRenderer = null; Float blockMinHeight = retrieveMinHeight(); if (!Boolean.TRUE.equals(getPropertyAsBoolean(Property.FORCED_PLACEMENT)) && null != blockMinHeight && blockMinHeight > occupiedArea.getBBox().getHeight()) { float blockBottom = occupiedArea.getBBox().getBottom() - ((float) blockMinHeight - occupiedArea.getBBox().getHeight()); if (isFixedLayout()) { occupiedArea.getBBox().setY(blockBottom).setHeight((float) blockMinHeight); } else { if (isOverflowFit(overflowY) && blockBottom + EPS < layoutBox.getBottom()) { float hDelta = occupiedArea.getBBox().getBottom() - layoutBox.getBottom(); occupiedArea.getBBox() .increaseHeight(hDelta) .setY(layoutBox.getBottom()); if (occupiedArea.getBBox().getHeight() < 0) { occupiedArea.getBBox().setHeight(0); } this.isLastRendererForModelElement = false; overflowRenderer = createOverflowRenderer(LayoutResult.PARTIAL); overflowRenderer.updateMinHeight(UnitValue.createPointValue((float) blockMinHeight - occupiedArea.getBBox().getHeight())); if (hasProperty(Property.HEIGHT)) { overflowRenderer.updateHeight(UnitValue.createPointValue((float) retrieveHeight() - occupiedArea.getBBox().getHeight())); } } else { occupiedArea.getBBox().setY(blockBottom).setHeight((float) blockMinHeight); } } } return overflowRenderer; } protected  BlockRenderer(IElement modelElement); @Override LayoutResult layout(LayoutContext layoutContext); @Override void draw(DrawContext drawContext); @Override Rectangle getOccupiedAreaBBox(); @Override MinMaxWidth getMinMaxWidth();  }
@Test public void applyMinHeightForSpecificDimensionsCausingFloatPrecisionError () { float divHeight = 42.55f; Div div = new Div(); div.setHeight(UnitValue.createPointValue(divHeight)); float occupiedHeight = 17.981995f; float leftHeight = 24.567993f; Assert.assertTrue(occupiedHeight + leftHeight < divHeight); BlockRenderer blockRenderer = (BlockRenderer) div.createRendererSubTree(); blockRenderer.occupiedArea = new LayoutArea(1, new Rectangle(0, 267.9681f, 0, occupiedHeight)); AbstractRenderer renderer = blockRenderer.applyMinHeight(OverflowPropertyValue.FIT, new Rectangle(0, 243.40012f, 0, leftHeight)); Assert.assertNull(renderer); }