Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When a large amount of data is entered into a 'td' cell within a table, exceeding the length of two pages, the table automatically paginates. This results in a blank content area above the table. #1326

Closed
EnochGao opened this issue May 11, 2024 · 12 comments · Fixed by #1339
Labels

Comments

@EnochGao
Copy link
Member

Describe the bug
When a large amount of data is entered into a 'td' cell within a table, exceeding the length of two pages, the table automatically paginates. This results in a blank content area above the table.

To Reproduce
table_bug.txt
online viewer
image

@EnochGao
Copy link
Member Author

This could be a table header related issue
table_bug.txt
image
image

@EnochGao
Copy link
Member Author

I found that for the time being you can set the display property to simulate the table
pseudo_table.txt

@MurakamiShinyu
Copy link
Member

I made a simple test case.

https://gist.github.com/MurakamiShinyu/22585fe8c74d2114477117d7d2cd0ff6#file-table-break-1-html

Test with Vivliostyle Viewer:

I think I can fix it today.

@EnochGao
Copy link
Member Author

Hi, Shinyu, how is the progress coming along?

@MurakamiShinyu
Copy link
Member

Hi, I'm still debugging it.

It seems the overflow checking has problem when table or table-cell has border and paddings.

checkOverflowAndSaveEdgeAndBreakPosition(
nodeContext: Vtree.NodeContext,
trailingEdgeContexts: Vtree.NodeContext[],
saveEvenOverflown: boolean,
breakAtTheEdge: string | null,
): boolean {
if (!nodeContext) {
return false;
}
if (LayoutHelper.isOrphan(nodeContext.viewNode)) {
return false;
}
const overflown = this.checkOverflowAndSaveEdge(
nodeContext,
trailingEdgeContexts,
);
if (saveEvenOverflown || !overflown) {
this.saveEdgeBreakPosition(nodeContext, breakAtTheEdge, overflown);
}
return overflown;
}

@MurakamiShinyu
Copy link
Member

Found bug:

findAcceptableBreakPosition(): Layout.BreakPositionAndNodeContext {
const element = this.cellNodeContext.viewNode as Element;
const verticalAlign = this.cellNodeContext.verticalAlign;
if (verticalAlign === "middle" || verticalAlign === "bottom") {
Base.setCSSProperty(element, "vertical-align", "top");
}
const bp = this.pseudoColumn.findAcceptableBreakPosition(true);
Base.setCSSProperty(element, "vertical-align", verticalAlign);
return bp;
}
}

This does not work as expected when the verticalAlign value is "inherit" which is the default setting for table cells in the UserAgentBaseCss:

tr,
td,
th {
vertical-align: inherit;
}

To fix this, if (verticalAlign === "middle" || verticalAlign === "bottom") should be corrected to if (verticalAlign !== "top" && verticalAlign !== "baseline").

However, the case in #1326 (comment) is not resolved in this fix.

@EnochGao
Copy link
Member Author

@MurakamiShinyu Ha ha, a major breakthrough!! Thanks for your hard work.

@MurakamiShinyu
Copy link
Member

MurakamiShinyu commented May 31, 2024

Fixed in #1339.

Tests:

(GitHub Gist: https://gist.github.com/MurakamiShinyu/22585fe8c74d2114477117d7d2cd0ff6)

MurakamiShinyu added a commit that referenced this issue Jun 2, 2024
Fixes the problem that the table break position is not good in some cases.

fix #1326
@jiang0112
Copy link

When a large amount of data is entered into "td" cells within a table, several special cases emerge after pagination: the data does not start from the top, giving rise to regions devoid of content.
iwEcAqNwbmcDAQTRAqUF0QMoBrCZrHRLDkeCJQZUmbn_Rd8AB9IZjKU6CAAJomltCgAL0gAAtIc png_720x720q90

min.txt

@jiang0112
Copy link

@MurakamiShinyu

@MurakamiShinyu
Copy link
Member

@jiang0112 Please open a new issue to report a new problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants