Skip to content

Commit

Permalink
fix: Named page at the first page is not applied when HTML head part …
Browse files Browse the repository at this point in the history
…is big

Fixes #770
  • Loading branch information
MurakamiShinyu committed Sep 14, 2021
1 parent d7944ca commit 0f696dc
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion packages/core/src/vivliostyle/css-styler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,12 @@ export class BoxStack {

encounteredTextNode(node: Node) {
const box = this.lastBox();
if ((this.atBlockStart || this.atFlowStart) && box.hasBox()) {
if (
(node.nodeType === Node.TEXT_NODE ||
node.nodeType === Node.CDATA_SECTION_NODE) &&
(this.atBlockStart || this.atFlowStart) &&
box.hasBox()
) {
const whitespaceValue = box
.styleValue("white-space", Css.ident.normal)
.toString();
Expand Down Expand Up @@ -1013,6 +1018,11 @@ export class Styler implements AbstractStyler {
} else {
this.offsetMap.addSlippedRange(this.lastOffset);
}
if (this.bodyReached && blockStartOffset === 0) {
// body reached but the named page type at first page is not determined
// (Fix for issue #770)
continue;
}
if (startOffset < this.lastOffset) {
if (targetSlippedOffset < 0) {
slippedOffset = this.offsetMap.slippedByFixed(startOffset);
Expand Down

0 comments on commit 0f696dc

Please sign in to comment.