@@ -46,6 +46,7 @@ This file is part of the iText (R) project.
4646import com .itextpdf .kernel .geom .Rectangle ;
4747import com .itextpdf .layout .borders .Border ;
4848import com .itextpdf .layout .element .Div ;
49+ import com .itextpdf .layout .layout .LayoutArea ;
4950import com .itextpdf .layout .layout .LayoutContext ;
5051import com .itextpdf .layout .layout .LayoutResult ;
5152import com .itextpdf .layout .margincollapse .MarginsCollapseHandler ;
@@ -235,7 +236,8 @@ LayoutResult processNotFullChildResult(LayoutContext layoutContext,
235236 if (splitRenderer != null ) {
236237 splitRenderer .setChildRenderers (getChildRenderers ());
237238 }
238- return new LayoutResult (LayoutResult .FULL , result .getOccupiedArea (), splitRenderer , null , null );
239+ return new LayoutResult (LayoutResult .FULL ,
240+ getOccupiedAreaInCaseNothingWasWrappedWithFull (result , splitRenderer ), splitRenderer , null , null );
239241 } else {
240242 applyPaddings (occupiedArea .getBBox (), paddings , true );
241243 applyBorderBox (occupiedArea .getBBox (), borders , true );
@@ -250,6 +252,11 @@ LayoutResult processNotFullChildResult(LayoutContext layoutContext,
250252 }
251253 }
252254
255+ // TODO DEVSIX-5238 Consider this fix (perhaps it should be improved or unified) while working on the ticket
256+ LayoutArea getOccupiedAreaInCaseNothingWasWrappedWithFull (LayoutResult result , IRenderer splitRenderer ) {
257+ return null != result .getOccupiedArea () ? result .getOccupiedArea () : splitRenderer .getOccupiedArea ();
258+ }
259+
253260 @ Override
254261 boolean stopLayoutingChildrenIfChildResultNotFull (LayoutResult returnResult ) {
255262 return returnResult .getStatus () != LayoutResult .FULL ;
0 commit comments