Skip to content

Commit

Permalink
fix(core): Hang-up with footnote or page float on pseudo elements
Browse files Browse the repository at this point in the history
Fixes #703
  • Loading branch information
MurakamiShinyu committed Mar 2, 2021
1 parent 2c3ae9e commit cf324d4
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 1 deletion.
4 changes: 3 additions & 1 deletion packages/core/src/vivliostyle/ops.ts
Original file line number Diff line number Diff line change
Expand Up @@ -687,14 +687,16 @@ export class StyleInstance
const pageFloatLayoutContext = column.pageFloatLayoutContext;
const deferredFloats = pageFloatLayoutContext.getDeferredPageFloatContinuations();

// Fix for issue #681
// Prevent deferred page floats from appearing in the preceding pages,
// e.g., during re-layout the TOC page with target-counter() referencing
// later sections containing page floats.
if (
deferredFloats.length &&
deferredFloats[0].float.floatReference === "page"
) {
const deferredFloatNode = deferredFloats[0].nodePosition.steps[0].node;
const deferredFloatNode =
deferredFloats[0].float.nodePosition.steps[0].node;
const deferredFloatOffset =
deferredFloatNode &&
this.xmldoc.getNodeOffset(deferredFloatNode, 0, false);
Expand Down
12 changes: 12 additions & 0 deletions packages/core/src/vivliostyle/vtree.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ import * as GeometryUtil from "./geometry-util";
import * as TaskUtil from "./task-util";
import { assert } from "./asserts";
import { PageFloats, Selectors, Vtree, XmlDoc } from "./types";
import { PseudoelementStyler } from "./pseudo-element";

export const delayedProps = {
transform: true,
Expand Down Expand Up @@ -756,6 +757,17 @@ export class NodeContext implements Vtree.NodeContext {
toNodePosition(): NodePosition {
let nc: NodeContext = this;
const steps = [];

// Fix for issue #703
if (
nc.shadowType === Vtree.ShadowType.ROOTLESS &&
(nc.floatReference !== PageFloats.FloatReference.INLINE ||
nc.floatSide === "footnote") &&
nc.shadowContext.styler instanceof PseudoelementStyler
) {
nc = nc.parent;
}

do {
// We need fully "peeled" path, so don't record first-XXX pseudoelement
// containers
Expand Down

0 comments on commit cf324d4

Please sign in to comment.