You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
When rendering following HTML with weasyprint, the CSS for named-page is not applied on the first page. The first page is blue (from the default @page rule), but it contains content of the named page.
You can get the expected result (both pages in red) by moving the HTML elements for the header and watermark below the named page. However, I think this is unexpected behavior.
Suggestion
I think the problem is in calculating the start page value of the first page. Currently the start page value of the first element (#header) is used which results in an unnamed page. I think weasyprint should exclude elements that are out of the normal page flow from the start/end page value calculation (such as position: running() and position: fixed).
Next, a start page value and end page value is determined for each box as the value (if any) propagated from its first or last child box (respectively), else the used value on the box itself. A child propagates its own start or end page value if and only if the page property applies to it.
NOTE: A first or last child box is not always generated by a first or last child element. For example, an element could only have a previous sibling with 'display: none' which does not generate any box.
What is your opinion on that?
The text was updated successfully, but these errors were encountered:
The second point is slightly different from "elements in the flow" (because floats create class A break points for exemple even if they’re not in the flow), but your overall diagnostic seems to be the right one.
The code to fix this is probably in the page_values methods in boxes.py and in the places where they’re called.
Problem
When rendering following HTML with weasyprint, the CSS for
named-page
is not applied on the first page. The first page is blue (from the default@page
rule), but it contains content of the named page.You can get the expected result (both pages in red) by moving the HTML elements for the header and watermark below the named page. However, I think this is unexpected behavior.
Suggestion
I think the problem is in calculating the start page value of the first page. Currently the start page value of the first element (
#header
) is used which results in an unnamed page. I think weasyprint should exclude elements that are out of the normal page flow from the start/end page value calculation (such asposition: running()
andposition: fixed
).This should be compliant with the CSS specification for
page
(https://drafts.csswg.org/css-page-3/#propdef-page):What is your opinion on that?
The text was updated successfully, but these errors were encountered: