fix: a table cell's metrics follow LibreOffice, not the browser
Two measured deviations, both worth ~1mm a row on a fixture: a cell's first block got the space above that LibreOffice adds nowhere in a cell, and a repeating header row rendered centred and bold because it is a <th> and the UA says so. Pagination's page-top-drop detection now skips cell leaves, or the space that is never there would read as a decoration to add back.
This commit is contained in:
1 parent
7b8c7e21f5
commit
7a4174cd07
3 files changed
+25
-1
No files matched your search
@@ -807,8 +807,10 @@ export const PageBreaks = Extension.create({
|
||||
const cs = getComputedStyle(child);
|
||||
// The block's own space above, and how much of it the last pass took off
|
||||
// at a page top (the decoration zeroes both padding and margin).
|
||||
// A cell's first block never carries it (LibreOffice adds none there), so
|
||||
// the missing padding is the document, not a decoration to add back.
|
||||
const spaceAbove = parseFloat(cs.getPropertyValue('--space-before')) || 0;
|
||||
const dropped = spaceAbove > 0.5
|
||||
const dropped = spaceAbove > 0.5 && !inTableCell
|
||||
&& parseFloat(cs.paddingTop) < 0.5 && parseFloat(cs.marginTop) < 0.5
|
||||
? spaceAbove : 0;
|
||||
leaves.push({
|
||||
|
||||
Reference in new issue
Block a user