danfickle / neoflyingsaucer

[Deprecated - Please use openhtmltopdf at link] An attempt to modernize flyingsaucer, the HTML and CSS 2.1 renderer in pure Java
https://github.com/danfickle/openhtmltopdf
Other
38 stars 12 forks source link

Infinite loop bug (possibly when margins are too large for page). #39

Open danfickle opened 9 years ago

danfickle commented 9 years ago

Test case at: com.github.neoflyingsaucer.test.pdf.TestPage.testInfiniteLoopBugOnTooWideContent():

    @Test
    @Ignore("Failing (infinite loop somewhere in code)")
    public void testInfiniteLoopBugOnTooWideContent()
    {
        PdfTest pdf = new PdfTest("InfiniteLoopBugOnTooWideContent");

        String html =
            "<html><head><style>" +
            "@page { size: 30px; margin: 0; }" +
            "</style></head><body>" +
            "<ul><li>TEST</li></ul></body></html>";

        pdf.prepare(html);
        pdf.assertContains("/MediaBox");
    }
danfickle commented 9 years ago

Found the location of the endless loop at: com.github.neoflyingsaucer.layout.InlineBoxing.layoutContent(LayoutContext, BlockBox, int, int) inside the do loop.

danfickle commented 9 years ago

The fix is broken. The endless loop is solved but now it just discards words that are too long for the block. This is obviously not acceptable so I'll reopen this issue.