Skip to content

Commit

Permalink
fix: Do not remove table top border with thead and bottom border with…
Browse files Browse the repository at this point in the history
… tfoot at page break

When a table with `border-collapse: collapse` style is split across pages, the top border of the table should not be removed if the table has thead and the bottom border should not be removed if the table has tfoot.
  • Loading branch information
MurakamiShinyu committed Feb 28, 2025
1 parent 4c6f266 commit 02507b9
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 7 deletions.
4 changes: 2 additions & 2 deletions packages/core/src/vivliostyle/assets.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1423,14 +1423,14 @@ export const VivliostylePolyfillCss = `
border-start-end-radius: 0 !important;
border-end-end-radius: 0 !important;
}
[data-viv-box-break~="block-start"]:not([data-viv-box-break~="clone"]) {
[data-viv-box-break~="block-start"]:not([data-viv-box-break~="clone"]):not(table[style*="border-collapse: collapse"]:has(>thead)) {
margin-block-start: 0 !important;
padding-block-start: 0 !important;
border-block-start-width: 0 !important;
border-start-start-radius: 0 !important;
border-start-end-radius: 0 !important;
}
[data-viv-box-break~="block-end"]:not([data-viv-box-break~="clone"]) {
[data-viv-box-break~="block-end"]:not([data-viv-box-break~="clone"]):not(table[style*="border-collapse: collapse"]:has(>tfoot)) {
margin-block-end: 0 !important;
padding-block-end: 0 !important;
border-block-end-width: 0 !important;
Expand Down
7 changes: 2 additions & 5 deletions packages/core/src/vivliostyle/vgen.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1536,11 +1536,8 @@ export class ViewFactory
Break.setBoxBreakFlag(result, "block-start");
if (Break.isCloneBoxDecorationBreak(result)) {
Break.setBoxBreakFlag(result, "clone");

// When box-decoration-break: clone, cloned margins are always
// truncated to zero.
Break.setMarginDiscardFlag(result, "block-start");
}
Break.setMarginDiscardFlag(result, "block-start");
} else if (
!Display.isAbsolutelyPositioned(computedStyle["position"])
) {
Expand Down Expand Up @@ -2632,8 +2629,8 @@ export class ViewFactory
}
if (Break.isCloneBoxDecorationBreak(elem)) {
Break.setBoxBreakFlag(elem, "clone");
Break.setMarginDiscardFlag(elem, "block-end");
}
Break.setMarginDiscardFlag(elem, "block-end");
}
}
}
Expand Down

0 comments on commit 02507b9

Please sign in to comment.