@@ -352,14 +352,20 @@ && hasChildRendererInHtmlMode()) {
352
352
353
353
MinMaxWidth childBlockMinMaxWidth = null ;
354
354
boolean isInlineBlockChild = isInlineBlockChild (childRenderer );
355
- if (!childWidthWasReplaced ) {
356
- if (isInlineBlockChild && childRenderer instanceof AbstractRenderer ) {
357
- childBlockMinMaxWidth = ((AbstractRenderer ) childRenderer ).getMinMaxWidth ();
358
- float childMaxWidth = childBlockMinMaxWidth .getMaxWidth ();
359
- float lineFullAvailableWidth = layoutContext .getArea ().getBBox ().getWidth () - lineLayoutContext .getTextIndent ();
360
- if (!noSoftWrap && childMaxWidth > bbox .getWidth () + MIN_MAX_WIDTH_CORRECTION_EPS && bbox .getWidth () != lineFullAvailableWidth ) {
361
- childResult = new LineLayoutResult (LayoutResult .NOTHING , null , null , childRenderer , childRenderer );
362
- } else {
355
+ if (isInlineBlockChild && childRenderer instanceof AbstractRenderer ) {
356
+ final MinMaxWidth childBlockMinMaxWidthLocal = ((AbstractRenderer ) childRenderer ).getMinMaxWidth ();
357
+ // Don't calculate childBlockMinMaxWidth in case of relative width here
358
+ // and further (childBlockMinMaxWidth != null)
359
+ if (!childWidthWasReplaced ) {
360
+ childBlockMinMaxWidth = childBlockMinMaxWidthLocal ;
361
+ }
362
+
363
+ float childMaxWidth = childBlockMinMaxWidthLocal .getMaxWidth ();
364
+ float lineFullAvailableWidth = layoutContext .getArea ().getBBox ().getWidth () - lineLayoutContext .getTextIndent ();
365
+ if (!noSoftWrap && childMaxWidth > bbox .getWidth () + MIN_MAX_WIDTH_CORRECTION_EPS && bbox .getWidth () != lineFullAvailableWidth ) {
366
+ childResult = new LineLayoutResult (LayoutResult .NOTHING , null , null , childRenderer , childRenderer );
367
+ } else {
368
+ if (childBlockMinMaxWidth != null ) {
363
369
childMaxWidth += MIN_MAX_WIDTH_CORRECTION_EPS ;
364
370
float inlineBlockWidth = Math .min (childMaxWidth , lineFullAvailableWidth );
365
371
@@ -376,8 +382,13 @@ && hasChildRendererInHtmlMode()) {
376
382
childRenderer .setProperty (Property .FORCED_PLACEMENT , true );
377
383
}
378
384
}
379
- childBlockMinMaxWidth .setChildrenMaxWidth (childBlockMinMaxWidth .getChildrenMaxWidth () + MIN_MAX_WIDTH_CORRECTION_EPS );
380
- childBlockMinMaxWidth .setChildrenMinWidth (childBlockMinMaxWidth .getChildrenMinWidth () + MIN_MAX_WIDTH_CORRECTION_EPS );
385
+ }
386
+
387
+ if (childBlockMinMaxWidth != null ) {
388
+ childBlockMinMaxWidth .setChildrenMaxWidth (
389
+ childBlockMinMaxWidth .getChildrenMaxWidth () + MIN_MAX_WIDTH_CORRECTION_EPS );
390
+ childBlockMinMaxWidth .setChildrenMinWidth (
391
+ childBlockMinMaxWidth .getChildrenMinWidth () + MIN_MAX_WIDTH_CORRECTION_EPS );
381
392
}
382
393
}
383
394
0 commit comments