If a footnote has been output but we then decide to cancel the line it
was output on, we should cancel the output of the footnote itself.
This requires a bit of extra bookkeeping, so we know which footnotes are
relevant, but otherwise largely works using the existing
remove_placeholders code.
Includes a minor refactor of footnote area management in LayoutContext,
and a new testing utility: `tree_position`.
Closes#1564.
This commit:
- fixes the trailing space detection, by handling all trailing spacing
characters that could be ignored by Pango’s line break algorithm;
- tries harder to break waiting children when a line break occurs in an
inline block that can’t be separated from the previous one.
Fix#1562.
We want to get this list set only once, because we don’t want to change it
twice each time we add or remove an attribute.
This change probably means that extra work is now done, for style and for
definitions. This should definitely be optimized, but at least it shouldn’t be
wrong.
Tests definitely have to be added for SVG rendering.
Fix#1558.
When a box would break over the edge of a page, its height is extended
to the bottom of that page (per
https://www.w3.org/TR/css-break-3/#box-splitting , primarily to allow
backgrounds and borders to continue to the end of the page).
When this happened, sometimes the values that would be calculated for
the height of the extended element would be rounded *over* the
calculated height that remained on the page, forcing the entire
containing box to wrap to the next page.
Rather than trying to carefully manage the order of operations to try to
be safe in IEEE floats for directions, we apply a small "fudge factor":
if an element fits very nearly (within a thousandth of a pixel) into the
remaining space, it is still accepted.
With the release of Little CMS 2.13, Ghostscript sets a grey background when
generating raster images with no alpha channel. It’s probably a bug in
Ghostscript or in Little CMS, but the specification gives the possibility to
PDF renderers to choose the backdrop color (even if most of them use white).
Setting a white background for tests fixes this problem. We keep the
transparent background in the normal user agent for compatibility purpose, and
users will be able to set a white background if they need a "workaround".
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.
Counter styles keys are strings, and values are dicts. These dicts are only
created when new counters are created, but they are never modified, so there’s
no need to deepcopy them.
Tests are ~15% faster on my computer. We should get an interesting boost for
very small documents too.