-
-
Notifications
You must be signed in to change notification settings - Fork 700
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
Fix computed values on table element overwritten after first page in running tables #2051
Conversation
Thanks for this pull request!
For now, just as for #1278, I’d prefer to keep the bug than to add a fake value in the style dictionary. We can keep this PR open as a draft until we find the source of the problem and fix it in a clean and solid way. |
The following computed values on table element are overwritten by initial values in the first page: WeasyPrint/weasyprint/css/properties.py Lines 281 to 308 in 6e835e2
From https://lists.w3.org/Archives/Public/www-style/2012Jun/0066.html:
and in https://www.w3.org/TR/CSS21/tables.html#model, these computed values
In running tables, the table wrapper box and table box will be generated for every page. However for subsequent pages, the above computed values for the table element have been overwritten by initial values - it appears that table box computed values are copied in subsequent pages. |
Previously box style was copied as well:
|
The
It does not make a copy of |
That’s a recurring problem in WeasyPrint, see for example #950 and #497. Copying styles was an easy solution, but it was really slow and required a lot of memory (and caused different bugs). That’s why the current solution is to avoid style edition when possible, and to copy it only when it’s necessary. It’s a bit dangerous, but the performance improvement is worth the risk. The goal is to freeze style dictionaries to forbid all editions. But unfortunately, the few cases left are not easy to fix. Where is the style modified? We could try to take care of this special case instead of always copying it. |
WeasyPrint/weasyprint/formatting_structure/build.py Lines 990 to 992 in 6e835e2
|
Oh, of course! 😁 If it’s OK for you, I’ll keep 3926136 and merge this pull request. |
… table box wrapper
Thanks a lot for your work! |
This is a naive fix using "ghost" style properties until a proper fix can be implemented.
The comment before the computed values are overwritten is probably a hint for a proper fix but unable to grasp the logic of table wrapper box and table box yet:
WeasyPrint/weasyprint/formatting_structure/build.py
Lines 987 to 989 in 3f6775a
Note: This will fix #2013