When no table content is small enough to fit in one page, we remove repeated
headers and footers to give table content more space. This is a good idea for
complicated situations, but not adapted when line groups avoid page breaks
inside.
This commit keeps headers and footers when the next line group avoids page
breaks, by forcing to render at least one line of the table, like if the page
was empty.
The device_size parameter was passed to many layout features, but it was only
used to set default size of replaced boxes with no implicit or explicit size
set. As this case is really rare for printed documents, and as it's also rare
to have printed supports that small, we can remove this "feature".
Moreover, in CSS3-images, another definition called "default object size" is
used to set replaced box size when no size is defined. This size doesn't seem
to be defined for images.
Float clearance requires to calculate the line minimum width and height before
setting the linebox position. When there are no floating boxes in the context,
there's no need to calculate these sizes.
We thus avoid a call to inline_min_content_width per text line. This call
required a lot of time as it needed to go through the whole line breaking
algorithm to render the first word.
We save 15% of the rendering time when generating our Odyssey sample.
The spec says that we can do what we want to improve the rendering in such
cases. Adding a line would probably give exactly the same rendering as if there
were text, but the difference is so small that there's no need to hack the
formatting structure and keep the fix in 3 small lines during the layout.
Fix#873.
"If a row has no cell box aligned to its baseline, the baseline of that row is
the bottom content edge of the lowest cell in the row."
Related to #867.
As the children's layout has not been done yet, their own children are not yet
positioned and thus can't be translated. We have to change the child position
instead and let the child layout move its own children.
Fix#811.
To fix#860 and #851, we decided to move block children a little bit to keep
them in the page. It's a bad idea, because children position is altered (and it
breaks many tests, by the way).
Increasing the allowed max_position_y is a better workaround as it doesn't
move blocks.
Here's another floating point rounding error we have to deal with. The original
issue comes from flex layout, but there are probably plenty of rounding
problems in other flows, so it's safe to put the workaround here.
Fix#851.
With the previous system, we were listing all page types as the cartesian
product of page names and pseudo selectors. Declarations were added for all
these possible page types.
The nth() page selector makes this system impossible, as we can't make the
cartesian product with a number of pages we don't know at the beginning of the
rendering. We now add declarations before rendering each page, based on the
properties of the page.
This new way is faster when the total number of pages is lower than the
cartesian product of possible pages. For long documents, we could improve speed
by detecting CSS rules based on page index or page name, and use cached results
for all pages that don't rely on such rules.