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

Open
EnochGao opened this issue May 11, 2024 · 9 comments · May be fixed by #1339
Labels

Comments

@EnochGao
Copy link
Sponsor 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
Sponsor Member Author

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

@EnochGao
Copy link
Sponsor 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
Sponsor 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
Sponsor Member Author

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

MurakamiShinyu added a commit that referenced this issue May 31, 2024
@MurakamiShinyu MurakamiShinyu linked a pull request May 31, 2024 that will close this issue
@MurakamiShinyu
Copy link
Member

Still WIP, but almost fixed in #1339.

Tests:

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.

2 participants