Skip to content

Commit

Permalink
fix: set overflow property of @-epubx-partition to hidden by default
Browse files Browse the repository at this point in the history
The spec https://idpf.org/epub/pgt/#s3.4.4 says "The overflow property of a partition is set by default to hidden."
However this implementation was changed in v2.14.0 commit cf25ad5 "fix: overflow:hidden should not be default in page margin boxes"

That change was good for page margin boxes (CSS Paged Media model) but not good for page partitions (EPUB Adaptive Layout model).
  • Loading branch information
MurakamiShinyu committed Feb 16, 2024
1 parent 88333c9 commit c196685
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion packages/core/src/vivliostyle/css-page.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1857,8 +1857,8 @@ export class PageRulePartitionInstance extends PageMaster.PartitionInstance<Page
docFaces: Font.DocumentFaces,
clientLayout: Vtree.ClientLayout,
): void {
super.prepareContainer(context, container, page, docFaces, clientLayout);
page.pageAreaElement = container.element as HTMLElement;
super.prepareContainer(context, container, page, docFaces, clientLayout);

// Set page area size for vw/vh unit calculation
context.pageAreaWidth = parseFloat(page.pageAreaElement.style.width);
Expand Down
4 changes: 4 additions & 0 deletions packages/core/src/vivliostyle/page-master.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1808,6 +1808,10 @@ export class PartitionInstance<
docFaces: Font.DocumentFaces,
clientLayout: Vtree.ClientLayout,
): void {
if (!page.pageAreaElement) {
// The overflow property of a `@-epubx-partition` is set by default to hidden.
Base.setCSSProperty(container.element, "overflow", "hidden");
}
super.prepareContainer(context, container, page, docFaces, clientLayout);
}
}
Expand Down

0 comments on commit c196685

Please sign in to comment.