Skip to content
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

#482: Smoke Testcase for the endless loop because of white-space hand… #483

Merged
merged 5 commits into from
May 18, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,14 @@ public static LineBreakResult breakText(LayoutContext c,
context.setEnd(savedEnd);
continue LOOP;
} else {
if (context.getWidth() == 0) {
String calculatedSubstring = context.getCalculatedSubstring();
if (calculatedSubstring.chars().allMatch(ch -> ch == SOFT_HYPHEN)) {
// Consists only of soft hypen, we have to break here and skip all togheter. We do not
// need to try breaking on the charater level, this will not work.
tryToBreakAnywhere = true;
}
}
// Else, retry it on a new line.
context.setEnd(savedEnd);
break LOOP;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,6 +373,7 @@ private static void startNewInlineLine(LayoutContext c, BlockBox box, int breakA
* layout box.
* Otherwise, if there are floats and the current line is otherwise empty, moves below float and trys again.
* Otherwise, trys again on a new line.
* @return true if the line is finished, false if we must continue
*/
private static boolean startInlineText(
LayoutContext c, LineBreakContext lbContext, InlineBox inlineBox,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,8 @@ public class TestcaseRunner {
*/
public static void main(String[] args) throws Exception {

runTestCase("soft-hypen-oom");

/*
* Note: The RepeatedTableSample optionally requires the font file
* NotoSans-Regular.ttf to be placed in the resources directory.
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<style>
* {
margin: 0;
padding: 0;
}

.content {
word-wrap: break-word;
white-space:pre-wrap;
}
</style>
</head>
<body>
<table class="content">
<tr>
<td>­</td>
</tr>
<tr>
<td>­­</td>
</tr>
<tr>
<td>­­­</td>
</tr>
</table>
<table class="content">
<tr>
<td> ­</td>
</tr>
<tr>
<td>­ ­</td>
</tr>
<tr>
<td>­ ­ ­</td>
</tr>
</table>
</body>
</html>