-
Notifications
You must be signed in to change notification settings - Fork 364
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add failing test that highlight the infinite loop issue in the inline box layout algorithm #482 #491
add failing test that highlight the infinite loop issue in the inline box layout algorithm #482 #491
Conversation
Additional info, it's still stuck inside https://github.com/danfickle/openhtmltopdf/blob/open-dev-v1/openhtmltopdf-core/src/main/java/com/openhtmltopdf/layout/InlineBoxing.java#L160 It seems that the |
Thanks @syjer, I'll merge and have a look right away. |
hi @danfickle , I've narrowed down a little bit more : the final file is
|
…phen overflowing line. The core problem seems to be the under-reporting of width when we have a soft hyphen that is found to be unbreakable.
I've committed a fix but I still don't think it is robust enough. The problem is we have pseudo code like this:
So that if the word breaking algorithm measures and determines it's impossible but under reports the width an infinite loop bug will occur. This was happening because the reported width was about 6px but the measured width with the inserted hyphen was twice this. A better solution would be to go ahead and output the rest on a new line if the first run reports a width less than line width (ie. DRY). I'll try this tomorrow. In the meantime, I'll add a comment in the release issue about P.S @syjer you were spot on about the width of a soft-hyphen being a problem. Thanks. |
Plus minor behaviour change for word break method to avoid setting ends-on -soft-hyphen flag for soft hyphen at end of box.
This is to make sure infinite loop fixes do not break this functionality.
This should ensure no infinite loop bugs creep in over time.
Hi @danfickle , I've added another failing test that cause an infinite loop somewhere in
the table layout algorithm.the inline box layout algorithmI've finally managed to reduce it in a more minimal case. As described in #482 (comment) there are multiple elements in play here:
SOFT_HYPHEN
issuetd
element seems to have an impact tooI'll try to understand what is true culprit :)