Skip to content

Commit 76cead4

Browse files
committed
Apply overflow: visible on anonymous flex items
Otherwise iText's internal FIT is set, which causes overflow being processed incorrectly DEVSIX-5178
1 parent 61561c7 commit 76cead4

File tree

4 files changed

+28
-0
lines changed

4 files changed

+28
-0
lines changed

src/main/java/com/itextpdf/html2pdf/attach/util/WaitingInlineElementsHelper.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,7 @@ public void flushHangingLeaves(IPropertyContainer container) {
195195
}
196196
} else if (((IElement) container).getRenderer() instanceof FlexContainerRenderer) {
197197
final Div div = new Div();
198+
OverflowApplierUtil.applyOverflow(map, div);
198199
div.add(p);
199200
((Div) container).add(div);
200201
} else if (container instanceof Div) {

src/test/java/com/itextpdf/html2pdf/css/DisplayFlexTest.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -481,6 +481,12 @@ public void smallHeightAndBigMaxHeightOnContainerTest() throws IOException, Inte
481481
convertToPdfAndCompare("smallHeightAndBigMaxHeightOnContainer", SOURCE_FOLDER, DESTINATION_FOLDER);
482482
}
483483

484+
@Test
485+
public void smallHeightAndBigMaxHeightOnContainerAnonymousFlexItemTest() throws IOException, InterruptedException {
486+
convertToPdfAndCompare("smallHeightAndBigMaxHeightOnContainerAnonymousFlexItem",
487+
SOURCE_FOLDER, DESTINATION_FOLDER);
488+
}
489+
484490
private static void assertDiv(IElement element, String text) {
485491
Assert.assertTrue(element instanceof Div);
486492
Assert.assertEquals(1, ((Div) element).getChildren().size());
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<html xmlns="http://www.w3.org/1999/xhtml">
3+
<head>
4+
<style>
5+
div { width: 200px; }
6+
div.flexbox {
7+
border: 1px dashed blue;
8+
background: lightgreen;
9+
font-size: 10px;
10+
display: flex;
11+
}
12+
</style>
13+
</head>
14+
<body>
15+
16+
<div class="flexbox" style="height: 2px; max-height: 100px; background-color: blue;">
17+
text<br/>text<br/>text<br/>text<br/>text<br/>
18+
</div>
19+
20+
</body>
21+
</html>

0 commit comments

Comments
 (0)