Skip to content

Commit 8275a70

Browse files
Snipxitext-teamcity
authored andcommitted
Improve float renderer occupied area calculation
DEVSIX-1381 Autoported commit. Original commit hash: [0e969bef8]
1 parent 6b791d9 commit 8275a70

File tree

3 files changed

+4
-14
lines changed

3 files changed

+4
-14
lines changed

itext/itext.layout/itext/layout/renderer/BlockRenderer.cs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -323,12 +323,6 @@ public override LayoutResult Layout(LayoutContext layoutContext) {
323323
occupiedArea.SetBBox(Rectangle.GetCommonRectangle(occupiedArea.GetBBox(), result.GetOccupiedArea().GetBBox
324324
()));
325325
}
326-
else {
327-
if (IsAbsolutePosition() && childRenderer.GetOccupiedArea() != null) {
328-
occupiedArea.SetBBox(Rectangle.GetCommonRectangle(occupiedArea.GetBBox(), childRenderer.GetOccupiedArea().
329-
GetBBox()));
330-
}
331-
}
332326
}
333327
if (marginsCollapsingEnabled) {
334328
marginsCollapseHandler.EndChildMarginsHandling(layoutBox);
@@ -353,7 +347,7 @@ public override LayoutResult Layout(LayoutContext layoutContext) {
353347
if (true.Equals(GetPropertyAsBoolean(Property.FILL_AVAILABLE_AREA))) {
354348
occupiedArea.SetBBox(Rectangle.GetCommonRectangle(occupiedArea.GetBBox(), layoutBox));
355349
}
356-
if (FloatingHelper.IsRendererFloating(this) || isCellRenderer) {
350+
if (IsAbsolutePosition() || FloatingHelper.IsRendererFloating(this) || isCellRenderer) {
357351
FloatingHelper.IncludeChildFloatsInOccupiedArea(floatRendererAreas, this);
358352
}
359353
IRenderer overflowRenderer_1 = null;

itext/itext.layout/itext/layout/renderer/FloatingHelper.cs

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -239,14 +239,10 @@ internal static LayoutArea AdjustResultOccupiedAreaForFloatAndClear(IRenderer re
239239

240240
internal static void IncludeChildFloatsInOccupiedArea(IList<Rectangle> floatRendererAreas, IRenderer renderer
241241
) {
242-
Rectangle bBox = renderer.GetOccupiedArea().GetBBox();
243-
float lowestFloatBottom = bBox.GetBottom();
244242
foreach (Rectangle floatBox in floatRendererAreas) {
245-
if (floatBox.GetBottom() < lowestFloatBottom) {
246-
lowestFloatBottom = floatBox.GetBottom();
247-
}
243+
renderer.GetOccupiedArea().SetBBox(Rectangle.GetCommonRectangle(renderer.GetOccupiedArea().GetBBox(), floatBox
244+
));
248245
}
249-
bBox.SetHeight(bBox.GetTop() - lowestFloatBottom).SetY(lowestFloatBottom);
250246
}
251247

252248
internal static MinMaxWidth CalculateMinMaxWidthForFloat(AbstractRenderer renderer, FloatPropertyValue? floatPropertyVal

port-hash

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
b8ddb83622e0aa0735b1a9fd961f0f3b2dbc7550
1+
0e969bef87f097a1603843bcafa26ab5953f15f0

0 commit comments

Comments
 (0)