-
-
Notifications
You must be signed in to change notification settings - Fork 704
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
Handle break-inside: avoid on tr tags #1547
Comments
Hello! |
I made a reduced test case, but weasyprint CLI command hangs on it (with 100% CPU usage). |
This test case actually shows that Going back to your issue, here is an example showing that <style>
@page { margin: 0; size: 3.5cm }
body { margin: 0 }
td { line-height: 1cm; orphans: 1; widows: 1 }
</style>
<table>
<tr>
<td>a</td>
</tr>
<tr>
<td style="break-inside: avoid">b<br>c<br>d</td>
</tr>
</table>
<table>
<tr>
<td>a</td>
</tr>
<tr>
<td>b<br>c<br>d</td>
</tr>
</table> In the first table, |
Hey! Just stumbled across it and yes with one cell per row you are correct, but when there are multiple cells per row then the row gets split, is this to be expected? <style>
@page {
margin: 0;
size: 3.5cm;
}
body {
margin: 0;
}
td {
line-height: 1cm;
orphans: 1;
widows: 1;
}
</style>
<table>
<tr>
<td>cc</td>
<td>a</td>
</tr>
<tr style="break-inside: avoid">
<td>cc</td>
<td style="break-inside: avoid">b<br />c<br />d</td>
</tr>
</table>
<table>
<tr>
<td>a</td>
</tr>
<tr>
<td>b<br />c<br />d</td>
</tr>
</table> |
Hmmm… It’s probably because |
Yeah |
Then that’s the bug we’ll fix! |
Ha! Amazing! |
This solution is not perfect, but at least it works for table cells (whose top margins never collapse) and avoids the related workaround. Related to #1547.
Thanks for the bug report! The different commits listed here:
These fixes are available in the |
How is <style>
@page {
height: 6cm;
}
td {
break-inside: avoid;
border: red 3px solid;
}
</style>
<div>
<table>
<tr>
<td rowspan="2">
a<br>
a<br>
a<br>
a<br>
a<br>
</td>
<td>
X<br>
X<br>
X<br>
</td>
</tr>
<tr>
<td>
Y<br>
Y<br>
Y<br>
</td>
</tr> |
Well, I suppose that nobody on Earth (or on another planet) knows that. Tables are not fully specified. So… 😀 For now, we’ll assume that fragmentation of |
Your knowledge about these technologies is astonishing! Chromium doesn't support this specific combination either. My use case is on screenshots in the bug description, which I guess is not that uncommon in reports (pivot tables etc.). I started using WeasyPrint because it was the only engine that didn't split the |
🤣 If you can change the HTML file, you can put rows with rowspan cells in |
Since commit 222677d table cells are split between pages, and
break-inside: avoid
is ignored.The text was updated successfully, but these errors were encountered: