diff --git a/openhtmltopdf-core/src/main/java/com/openhtmltopdf/render/displaylist/DisplayListCollector.java b/openhtmltopdf-core/src/main/java/com/openhtmltopdf/render/displaylist/DisplayListCollector.java
index 34e5296c3..ca87039b4 100644
--- a/openhtmltopdf-core/src/main/java/com/openhtmltopdf/render/displaylist/DisplayListCollector.java
+++ b/openhtmltopdf-core/src/main/java/com/openhtmltopdf/render/displaylist/DisplayListCollector.java
@@ -328,14 +328,19 @@ public static Map> collectCollapsedTable
}
}
- public DisplayListPageContainer collectInlineBlock(RenderingContext c, BlockBox bb, EnumSet noneOf) {
+ public DisplayListPageContainer collectInlineBlock(RenderingContext c, BlockBox bb, EnumSet noneOf, int shadowPageNo) {
DisplayListPageContainer pgInstructions = new DisplayListPageContainer(null);
PagedBoxCollector boxCollector = createBoundedBoxCollector(c.getPageNo(), c.getPageNo());
- boxCollector.collect(c, bb.getContainingLayer(), bb, c.getPageNo(), c.getPageNo(), PagedBoxCollector.PAGE_BASE_ONLY);
+ boxCollector.collect(c, bb.getContainingLayer(), bb, c.getPageNo(), c.getPageNo(), shadowPageNo);
PageResult pgResult = boxCollector.getPageResult(c.getPageNo());
- processPage(c, bb.getContainingLayer(), pgResult, pgInstructions, /* includeFloats: */ false, c.getPageNo(), /* shadow page number: */ -1);
+ if (shadowPageNo >= 0 && pgResult.hasShadowPage(shadowPageNo)) {
+ processPage(c, bb.getContainingLayer(), pgResult.shadowPages().get(shadowPageNo), pgInstructions, /* includeFloats: */ false, c.getPageNo(), shadowPageNo);
+ } else if (shadowPageNo < 0) {
+ processPage(c, bb.getContainingLayer(), pgResult, pgInstructions, /* includeFloats: */ false, c.getPageNo(), shadowPageNo);
+ }
+
return pgInstructions;
}
diff --git a/openhtmltopdf-core/src/main/java/com/openhtmltopdf/render/displaylist/DisplayListPainter.java b/openhtmltopdf-core/src/main/java/com/openhtmltopdf/render/displaylist/DisplayListPainter.java
index 71c4ffeea..1e982f3f8 100644
--- a/openhtmltopdf-core/src/main/java/com/openhtmltopdf/render/displaylist/DisplayListPainter.java
+++ b/openhtmltopdf-core/src/main/java/com/openhtmltopdf/render/displaylist/DisplayListPainter.java
@@ -115,7 +115,7 @@ private void paintInlineContent(RenderingContext c, List inline
BlockBox bb = (BlockBox) dli;
List pageBoxes = bb.getContainingLayer().getPages();
DisplayListCollector dlCollector = new DisplayListCollector(pageBoxes);
- DisplayListPageContainer pageInstructions = dlCollector.collectInlineBlock(c, bb, EnumSet.noneOf(CollectFlags.class));
+ DisplayListPageContainer pageInstructions = dlCollector.collectInlineBlock(c, bb, EnumSet.noneOf(CollectFlags.class), c.getShadowPageNumber());
paint(c, pageInstructions);
} else {
diff --git a/openhtmltopdf-examples/src/main/resources/visualtest/expected/text/horiz-page-overflow-inline-block-2.pdf b/openhtmltopdf-examples/src/main/resources/visualtest/expected/text/horiz-page-overflow-inline-block-2.pdf
new file mode 100644
index 000000000..85142288e
Binary files /dev/null and b/openhtmltopdf-examples/src/main/resources/visualtest/expected/text/horiz-page-overflow-inline-block-2.pdf differ
diff --git a/openhtmltopdf-examples/src/main/resources/visualtest/html/text/horiz-page-overflow-inline-block-2.html b/openhtmltopdf-examples/src/main/resources/visualtest/html/text/horiz-page-overflow-inline-block-2.html
index d25ebaf64..5fe1cc6e1 100644
--- a/openhtmltopdf-examples/src/main/resources/visualtest/html/text/horiz-page-overflow-inline-block-2.html
+++ b/openhtmltopdf-examples/src/main/resources/visualtest/html/text/horiz-page-overflow-inline-block-2.html
@@ -9,6 +9,7 @@
}
body {
margin: 0;
+ width: 120px;
}
div {
box-sizing: border-box;
diff --git a/openhtmltopdf-examples/src/test/java/com/openhtmltopdf/visualregressiontests/TextVisualRegressionTest.java b/openhtmltopdf-examples/src/test/java/com/openhtmltopdf/visualregressiontests/TextVisualRegressionTest.java
index 17b7ddb26..a4c927766 100644
--- a/openhtmltopdf-examples/src/test/java/com/openhtmltopdf/visualregressiontests/TextVisualRegressionTest.java
+++ b/openhtmltopdf-examples/src/test/java/com/openhtmltopdf/visualregressiontests/TextVisualRegressionTest.java
@@ -186,7 +186,6 @@ public void testHorizPageOverflowInlineBlock() throws IOException {
* Tests that a static inline-block sitting entirely on an overflow page appears.
*/
@Test
- @Ignore // The inline block and its text does not appear on the overflow page.
public void testHorizPageOverflowInlineBlock2() throws IOException {
assertTrue(run("horiz-page-overflow-inline-block-2"));
}