@vivliostyle/core 2.40.0 → 2.41.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -3,6 +3,7 @@ import * as CmykStore from "./cmyk-store";
3
3
  import * as Constants from "./constants";
4
4
  import * as Counters from "./counters";
5
5
  import * as Css from "./css";
6
+ import * as CssCascade from "./css-cascade";
6
7
  import * as Exprs from "./exprs";
7
8
  import * as Font from "./font";
8
9
  import * as Net from "./net";
@@ -37,6 +38,7 @@ export declare class EPUBDocStore extends OPS.OPSDocStore {
37
38
  loadAsPlainXML(url: string, opt_required?: boolean, opt_message?: string): Task.Result<XmlDoc.XMLDocHolder>;
38
39
  startLoadingAsPlainXML(url: string): void;
39
40
  loadAsJSON(url: string, opt_required?: boolean, opt_message?: string): Task.Result<Base.JSON>;
41
+ loadWebPubManifest(url: string, frame: Task.Frame<OPFDoc>): void;
40
42
  loadPubDoc(url: string): Task.Result<OPFDoc>;
41
43
  loadEPUBDoc(url: string): Task.Result<OPFDoc>;
42
44
  loadOPF(pubURL: string, root: string): Task.Result<OPFDoc>;
@@ -189,6 +191,7 @@ export type OPFViewItem = {
189
191
  layoutPositions: Vtree.LayoutPosition[];
190
192
  pages: Vtree.Page[];
191
193
  complete: boolean;
194
+ pageCounterStarts: CssCascade.CounterValues[];
192
195
  };
193
196
  export declare class OPFView implements Vgen.CustomRendererFactory {
194
197
  readonly opf: OPFDoc;
@@ -212,6 +215,7 @@ export declare class OPFView implements Vgen.CustomRendererFactory {
212
215
  tocAutohide: boolean;
213
216
  tocVisible: boolean;
214
217
  tocView?: Toc.TOCView;
218
+ private paginationProgress;
215
219
  constructor(opf: OPFDoc, viewport: Vgen.Viewport, fontMapper: Font.Mapper, pref: Exprs.Preferences, pageSheetSizeReporter: (p1: {
216
220
  width: number;
217
221
  height: number;
@@ -220,7 +224,7 @@ export declare class OPFView implements Vgen.CustomRendererFactory {
220
224
  width: number;
221
225
  height: number;
222
226
  };
223
- }, p3: number, p4: number) => any);
227
+ }, p3: number, p4: number) => any, cmykReserveMap?: CmykStore.CmykReserveMapEntry[]);
224
228
  private getPage;
225
229
  /**
226
230
  * Wait until all previous spine items are loaded before accessing the target
@@ -233,6 +237,27 @@ export declare class OPFView implements Vgen.CustomRendererFactory {
233
237
  private waitForPreviousSpines;
234
238
  getCurrentPageProgression(position: Position): Constants.PageProgression | null;
235
239
  private finishPageContainer;
240
+ private getRenderedPageCount;
241
+ /**
242
+ * Mark a spine item as complete if all layout positions have corresponding
243
+ * rendered pages (Issue #1498). When the item becomes complete, clean up
244
+ * inherited CSS properties that were propagated to the layout box during
245
+ * page float rendering so they don't leak into the next spine item or
246
+ * remain in the DOM after layout (Issue #1752).
247
+ */
248
+ private markSpineItemCompleteIfReady;
249
+ private getTotalOffsetForViewItem;
250
+ private getTotalOffsetAll;
251
+ private getRenderedOffsetAll;
252
+ private reportPaginationProgress;
253
+ private isInCounterResolveScope;
254
+ private hasNonEmptyPageType;
255
+ private hasPageTypeBoundaryBetween;
256
+ private resolvePageTypeForRenderSlot;
257
+ private evaluateNextPageRelayout;
258
+ private preparePageCountersForRender;
259
+ private maybeRelayoutFollowingPage;
260
+ private resolveUnresolvedReferencesForPage;
236
261
  /**
237
262
  * Render a single page. If the new page contains elements with ids that are
238
263
  * referenced from other pages by 'target-counter()', those pages are rendered
@@ -306,6 +331,7 @@ export declare class OPFView implements Vgen.CustomRendererFactory {
306
331
  * Move to the page specified by the given CFI and render it.
307
332
  */
308
333
  navigateToFragment(fragment: string, position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
334
+ private resolveSemanticFootnoteNavigationOffset;
309
335
  /**
310
336
  * Move to the page specified by the given URL and render it.
311
337
  */
@@ -34,7 +34,7 @@ export declare class FootnoteLayoutStrategy implements PageFloats.PageFloatLayou
34
34
  /** @override */
35
35
  findPageFloatFragment(float: PageFloats.PageFloat, pageFloatLayoutContext: PageFloats.PageFloatLayoutContext): PageFloats.PageFloatFragment | null;
36
36
  /** @override */
37
- adjustPageFloatArea(floatArea: Layout.PageFloatArea, floatContainer: Vtree.Container, column: Layout.Column): void;
37
+ adjustPageFloatArea(floatArea: Layout.PageFloatArea, floatContainer: Vtree.Container, column: Layout.Column): Task.Result<void>;
38
38
  /** @override */
39
39
  forbid(float: PageFloats.PageFloat, pageFloatLayoutContext: PageFloats.PageFloatLayoutContext): void;
40
40
  }
@@ -13,7 +13,7 @@ export declare function setBrowserColumnBreaking(column: Vtree.Container): void;
13
13
  * Disable the browser's multi-column feature for page/column breaking.
14
14
  * This function resets the CSS properties set by `setBrowserColumnBreaking`.
15
15
  */
16
- export declare function unsetBrowserColumnBreaking(column: Vtree.Container): void;
16
+ export declare function unsetBrowserColumnBreaking(columnOrElement: Vtree.Container | HTMLElement): void;
17
17
  /**
18
18
  * Check if the browser's multi-column feature is being used for page/column breaking.
19
19
  */
@@ -22,10 +22,6 @@ export declare function isUsingBrowserColumnBreaking(column: Vtree.Container): b
22
22
  * Mark the column as a root column for Vivliostyle layout processing.
23
23
  */
24
24
  export declare function setAsRootColumn(column: Vtree.Container): void;
25
- /**
26
- * Check if the column is marked as a root column for Vivliostyle layout processing.
27
- */
28
- export declare function isRootColumn(column: Vtree.Container): boolean;
29
25
  /**
30
26
  * Check if the client rectangle of an element or range is located
31
27
  * in a column beyond the current one due to the browser's column breaking.
@@ -71,6 +67,19 @@ export declare function findAncestorNonRootMultiColumn(node: Node): Element | nu
71
67
  * Fix overflow caused by forced column breaks in non-root multi-column elements.
72
68
  */
73
69
  export declare function fixOverflowAtForcedColumnBreak(node: Node): void;
70
+ /**
71
+ * Check if the root column's content overflows.
72
+ *
73
+ * Note: This check is based on the root column's trailing content
74
+ * (lastElementChild), not only on a specific target element.
75
+ */
76
+ export declare function checkRootColumnOverflow(column: Layout.Column): number;
77
+ /**
78
+ * Fix multi-column box with `column-fill: auto` that was changed to `column-fill: balance`
79
+ * for layout processing, by restoring `column-fill: auto` and setting block-size to prevent overflow.
80
+ */
81
+ export declare function fixAutoFillMultiColumnBox(element: HTMLElement, column: Layout.Column): void;
82
+ export declare function fixAutoFillMultiColumnBoxes(column: Layout.Column): void;
74
83
  /**
75
84
  * Calculate the position of the "after" edge in the block-progression.
76
85
  * Returns the edge position in pixels if it was determined successfully,
@@ -87,6 +96,18 @@ export declare function removeFollowingSiblings(parentNode: Node, viewNode: Node
87
96
  export declare const SPECIAL_ATTR = "data-adapt-spec";
88
97
  export declare function isSpecial(e: Element): boolean;
89
98
  export declare function isOutOfFlow(node: Node): boolean;
99
+ /**
100
+ * Check if element is out-of-flow due to CSS positioning or float.
101
+ * Unlike isOutOfFlow(), this does not check for special marker elements.
102
+ */
103
+ export declare function isCssOutOfFlow(node: Node): boolean;
104
+ /**
105
+ * Check if element has position:fixed. Used to identify running elements
106
+ * (position:running() rendered as position:fixed) without matching
107
+ * position:absolute elements. (Issue #1833, #1869, #1870)
108
+ */
109
+ export declare function isFixedPositioned(node: Node): boolean;
90
110
  export declare function isSpecialNodeContext(nodeContext: Vtree.NodeContext): boolean;
91
111
  export declare function isSpecialInlineDisplay(display: string): boolean;
92
112
  export declare function findAncestorSpecialInlineNodeContext(nodeContext: Vtree.NodeContext): Vtree.NodeContext | null;
113
+ export declare function findLastTextNodeInElement(element: Node): Node | null;
@@ -117,6 +117,7 @@ export declare class Column extends VtreeImpl.Container implements Layout.Column
117
117
  last: Node;
118
118
  viewDocument: Document;
119
119
  flowRootFormattingContext: Vtree.FormattingContext;
120
+ isNonFirstColumn: boolean;
120
121
  isFloat: boolean;
121
122
  isFootnote: boolean;
122
123
  startEdge: number;
@@ -140,6 +141,7 @@ export declare class Column extends VtreeImpl.Container implements Layout.Column
140
141
  pseudoParent: Column;
141
142
  nodeContextOverflowingDueToRepetitiveElements: Vtree.NodeContext | null;
142
143
  blockDistanceToBlockEndFloats: number;
144
+ lastLineStride: number;
143
145
  breakAtTheEdgeBeforeFloat: string | null;
144
146
  constructor(element: HTMLElement, layoutContext: Vtree.LayoutContext, clientLayout: Vtree.ClientLayout, layoutConstraint: LayoutConstraint, pageFloatLayoutContext: PageFloats.PageFloatLayoutContext);
145
147
  getTopEdge(): number;
@@ -148,6 +150,7 @@ export declare class Column extends VtreeImpl.Container implements Layout.Column
148
150
  getRightEdge(): number;
149
151
  isFloatNodeContext(nodeContext: Vtree.NodeContext): boolean;
150
152
  stopByOverflow(nodeContext: Vtree.NodeContext): boolean;
153
+ private almostEquals;
151
154
  isOverflown(edge: number): boolean;
152
155
  getExclusions(): GeometryUtil.Shape[];
153
156
  openAllViews(position: Vtree.NodePosition): Task.Result<Vtree.NodeContext>;
@@ -187,6 +190,7 @@ export declare class Column extends VtreeImpl.Container implements Layout.Column
187
190
  * Create exclusion floats for a column.
188
191
  */
189
192
  createFloats(): void;
193
+ private adjustColumnBlockSizeForBlockEndFloats;
190
194
  /**
191
195
  * @param nodeContext position after the block
192
196
  * @param checkPoints array of possible breaking points.
@@ -230,14 +234,15 @@ export declare class Column extends VtreeImpl.Container implements Layout.Column
230
234
  * Layout a single float element.
231
235
  */
232
236
  layoutFloat(nodeContext: Vtree.NodeContext): Task.Result<Vtree.NodeContext>;
233
- setupFloatArea(area: PageFloatArea, floatReference: PageFloats.FloatReference, floatSide: string, anchorEdge: number | null, strategy: PageFloats.PageFloatLayoutStrategy, condition: PageFloats.PageFloatPlacementCondition): boolean;
234
- createPageFloatArea(float: PageFloats.PageFloat | null, floatSide: string, anchorEdge: number | null, strategy: PageFloats.PageFloatLayoutStrategy, condition: PageFloats.PageFloatPlacementCondition): PageFloatArea | null;
237
+ setupFloatArea(area: PageFloatArea, floatReference: PageFloats.FloatReference, floatSide: string, anchorEdge: number | null, strategy: PageFloats.PageFloatLayoutStrategy, condition: PageFloats.PageFloatPlacementCondition): Task.Result<boolean>;
238
+ createPageFloatArea(float: PageFloats.PageFloat | null, floatSide: string, anchorEdge: number | null, strategy: PageFloats.PageFloatLayoutStrategy, condition: PageFloats.PageFloatPlacementCondition): Task.Result<PageFloatArea | null>;
235
239
  layoutSinglePageFloatFragment(continuations: PageFloats.PageFloatContinuation[], floatSide: string, clearSide: string | null, allowFragmented: boolean, strategy: PageFloats.PageFloatLayoutStrategy, anchorEdge: number | null, pageFloatFragment?: PageFloats.PageFloatFragment | null): Task.Result<SinglePageFloatLayoutResult>;
236
240
  layoutPageFloatInner(continuation: PageFloats.PageFloatContinuation, strategy: PageFloats.PageFloatLayoutStrategy, anchorEdge: number | null, pageFloatFragment?: PageFloats.PageFloatFragment): Task.Result<boolean>;
237
241
  /**
238
242
  * @returns Represents if the layout was succeeded or not
239
243
  */
240
244
  private layoutStashedPageFloats;
245
+ private findFootnoteCallElement;
241
246
  setFloatAnchorViewNode(nodeContext: Vtree.NodeContext): Vtree.NodeContext;
242
247
  resolveFloatReferenceFromColumnSpan(floatReference: PageFloats.FloatReference, columnSpan: Css.Val, nodeContext: Vtree.NodeContext): Task.Result<PageFloats.FloatReference>;
243
248
  layoutPageFloat(nodeContext: Vtree.NodeContext): Task.Result<Vtree.NodeContext>;
@@ -287,9 +292,30 @@ export declare class Column extends VtreeImpl.Container implements Layout.Column
287
292
  */
288
293
  isBreakable(flowPosition: Vtree.NodeContext): boolean;
289
294
  /**
290
- * Determines if an indent value is zero
295
+ * Determines if a CSS length value is empty or zero.
291
296
  */
292
- zeroIndent(val: string | number): boolean;
297
+ isZeroLength(val: string): boolean;
298
+ /**
299
+ * Check if element has non-zero block-start inset (padding + border).
300
+ * Handles both horizontal and vertical writing modes.
301
+ */
302
+ hasNonZeroBlockStartInset(style: CSSStyleDeclaration): boolean;
303
+ /**
304
+ * Check if element has non-zero block-end inset (padding + border).
305
+ * Handles both horizontal and vertical writing modes.
306
+ */
307
+ hasNonZeroBlockEndInset(style: CSSStyleDeclaration): boolean;
308
+ /**
309
+ * Temporarily suppress block-end padding/border on ancestor containers
310
+ * that are still being laid out (not yet complete) when using browser
311
+ * column breaking for overflow detection. This prevents the browser's
312
+ * column-breaking layout from incorrectly accounting for padding that
313
+ * will be removed at actual break points due to box-decoration-break:
314
+ * slice (the default). (Issue #1846)
315
+ *
316
+ * Returns a cleanup function that restores the original state.
317
+ */
318
+ private suppressOpenAncestorBlockEndInset;
293
319
  /**
294
320
  * @return true if overflows
295
321
  */
@@ -302,6 +328,12 @@ export declare class Column extends VtreeImpl.Container implements Layout.Column
302
328
  checkOverflowAndSaveEdgeAndBreakPosition(nodeContext: Vtree.NodeContext, trailingEdgeContexts: Vtree.NodeContext[], saveEvenOverflown: boolean, breakAtTheEdge: string | null): boolean;
303
329
  applyClearance(nodeContext: Vtree.NodeContext): boolean;
304
330
  isBFC(formattingContext: Vtree.FormattingContext): boolean;
331
+ /**
332
+ * Check if the nodeContext has a position:fixed ancestor in the view tree.
333
+ * Used to detect text inside running elements (position:running() rendered
334
+ * as position:fixed). (Issue #1833)
335
+ */
336
+ hasFixedPositionAncestor(nodeContext: Vtree.NodeContext): boolean;
305
337
  /**
306
338
  * Skips positions until either the start of unbreakable block or inline
307
339
  * content. Also sets breakBefore on the result combining break-before and
@@ -375,6 +407,7 @@ export declare class Column extends VtreeImpl.Container implements Layout.Column
375
407
  export declare class PseudoColumn {
376
408
  startNodeContexts: Vtree.NodeContext[];
377
409
  private column;
410
+ private readonly flowRootSourceNode;
378
411
  constructor(column: Layout.Column, viewRoot: HTMLElement, parentNodeContext: Vtree.NodeContext);
379
412
  /**
380
413
  * @param chunkPosition starting position.
@@ -389,6 +422,7 @@ export declare class PseudoColumn {
389
422
  doFinishBreakOfFragmentLayoutConstraints(positionAfter: Vtree.NodeContext): void;
390
423
  isStartNodeContext(nodeContext: Vtree.NodeContext): boolean;
391
424
  isLastAfterNodeContext(nodeContext: Vtree.NodeContext): boolean;
425
+ private isEffectivelyLastAfterNodeContext;
392
426
  getColumnElement(): Element;
393
427
  getColumn(): Layout.Column;
394
428
  }
@@ -410,6 +444,7 @@ export declare class ColumnLayoutRetryer extends LayoutRetryers.AbstractLayoutRe
410
444
  private initialPageBreakType;
411
445
  initialComputedBlockSize: number;
412
446
  private initialOverflown;
447
+ private initialLastLineStride;
413
448
  context: {
414
449
  overflownNodeContext: Vtree.NodeContext;
415
450
  };
@@ -447,4 +482,8 @@ export declare class PageFloatArea extends Column implements Layout.PageFloatAre
447
482
  convertPercentageSizesToPx(target: Element): void;
448
483
  fixFloatSizeAndPosition(nodeContext: Vtree.NodeContext): void;
449
484
  getContentInlineSize(): number;
485
+ getContentBlockMarginAfter(): number;
486
+ applyCompactFootnoteDisplay(): void;
487
+ private updateComputedBlockSizeForFootnoteArea;
488
+ private updateInlineFootnoteSeparators;
450
489
  }
@@ -104,6 +104,7 @@ export declare class StyleInstance extends Exprs.Context implements CssStyler.Fl
104
104
  };
105
105
  currentLayoutPosition: Vtree.LayoutPosition;
106
106
  layoutPositionAtPageStart: Vtree.LayoutPosition;
107
+ currentCascadedPageStyle: CssCascade.ElementStyle;
107
108
  lookupOffset: number;
108
109
  faces: Font.DocumentFaces;
109
110
  pageBoxInstances: {
@@ -125,6 +126,12 @@ export declare class StyleInstance extends Exprs.Context implements CssStyler.Fl
125
126
  };
126
127
  pageSheetHeight: number;
127
128
  pageSheetWidth: number;
129
+ private semanticFootnoteFirstRefOffsets;
130
+ private semanticFootnoteFirstRefOffsetsInitialized;
131
+ pageGroupPageCounts: {
132
+ [pageType: string]: Map<Element, number>;
133
+ };
134
+ currentPageGroupDocument: Document | null;
128
135
  constructor(style: Style, xmldoc: XmlDoc.XMLDocHolder, defaultLang: string | null, viewport: Vgen.Viewport, clientLayout: Vtree.ClientLayout, fontMapper: Font.Mapper, customRenderer: Vgen.CustomRenderer, fallbackMap: {
129
136
  [key: string]: string;
130
137
  }, pageNumberOffset: number, documentURLTransformer: Base.DocumentURLTransformer, counterStore: Counters.CounterStore, cmykStore: CmykStore.CmykStore, pageProgression?: Constants.PageProgression, isVersoFirstPage?: boolean);
@@ -145,6 +152,38 @@ export declare class StyleInstance extends Exprs.Context implements CssStyler.Fl
145
152
  */
146
153
  private evalSupportsSelector;
147
154
  getConsumedOffset(flowPosition: Vtree.FlowPosition): number;
155
+ private getNodePositionOffset;
156
+ private getPageStartOffset;
157
+ private getPageStartCounterOffsets;
158
+ private getPageStartElement;
159
+ private isForcedPageBreakValue;
160
+ private hasForcedPageBreakBefore;
161
+ private getExplicitPageType;
162
+ private getPageGroupPageType;
163
+ private getPreviousInFlowSibling;
164
+ private getFirstDocumentFlowElement;
165
+ /**
166
+ * Resolve the page type for the first page by examining the first in-flow
167
+ * element's CSS `page` property. This is needed because `currentPageType`
168
+ * is only set during layout (in ViewFactory), but the first page's type
169
+ * must be known before layout begins for correct @page rule matching.
170
+ *
171
+ * Note: This must NOT set `currentPageType` as a side effect. Setting it
172
+ * early would cause intermediate wrapper elements (whose page type is
173
+ * null/auto) to get unwanted `breakBefore: "page"` during view tree
174
+ * construction, since their page type would differ from `currentPageType`.
175
+ * The `currentPageType` will be set naturally when the content element
176
+ * is processed during layout. (Issue #1869, #1870)
177
+ */
178
+ private resolveFirstPageType;
179
+ private shouldStartPageGroup;
180
+ private updatePageGroupPageIndices;
181
+ private getFirstInFlowElementAtOrAfter;
182
+ private getDeepestFirstInFlowChildOffset;
183
+ private getFirstInFlowChildElement;
184
+ private isNormalFlowElement;
185
+ private isInlineLevelElement;
186
+ private getDisplayValue;
148
187
  /**
149
188
  * @param noLookAhead Do not look ahead elements that are not styled yet
150
189
  * @return document offset of the given layoutPosition
@@ -159,6 +198,9 @@ export declare class StyleInstance extends Exprs.Context implements CssStyler.Fl
159
198
  selectPageMaster(cascadedPageStyle: CssCascade.ElementStyle): PageMaster.PageMasterInstance;
160
199
  flowChunkIsAfterParentFlowForcedBreak(flowChunk: Vtree.FlowChunk): boolean;
161
200
  setFormattingContextToColumn(column: LayoutType.Column, flowName: string): void;
201
+ beginIsolatedRootPageFloatLayoutContext(): PageFloats.PageFloatLayoutContext;
202
+ endIsolatedRootPageFloatLayoutContext(originalRootPageFloatLayoutContext: PageFloats.PageFloatLayoutContext): void;
203
+ hasActiveRootPageFloatLayoutContext(): boolean;
162
204
  layoutDeferredPageFloats(column: LayoutType.Column): Task.Result<boolean>;
163
205
  getLastAfterPositionIfDeferredFloatsExists(column: LayoutType.Column, newPosition: Vtree.ChunkPosition | null): Vtree.ChunkPosition | null;
164
206
  /**
@@ -22,6 +22,19 @@ export declare class PageFloat implements PageFloats.PageFloat {
22
22
  readonly floatMinWrapBlock: Css.Numeric | null;
23
23
  order: number | null;
24
24
  id: PageFloatID | null;
25
+ /**
26
+ * Set to true when this float is created inside a page float area.
27
+ * Used to bypass the normal anchor check in isAllowedOnContext because
28
+ * the anchor node is lost after page-level invalidation. (Issue #1675)
29
+ */
30
+ insidePageFloatArea: boolean;
31
+ /**
32
+ * Reference to the parent page float that contains this float.
33
+ * Set when this float is created inside a page float area, allowing
34
+ * isAllowedOnContext to check whether the parent is still present.
35
+ * (Issue #1675)
36
+ */
37
+ parentPageFloat: PageFloat | null;
25
38
  constructor(nodePosition: Vtree.NodePosition, floatReference: FloatReference, floatSide: string, clearSide: string | null, flowName: string, floatMinWrapBlock: Css.Numeric | null);
26
39
  getOrder(): number;
27
40
  getId(): PageFloatID;
@@ -89,8 +102,28 @@ export declare class PageFloatLayoutContext implements PageFloats.PageFloatLayou
89
102
  private floatsDeferredFromPrevious;
90
103
  private layoutConstraints;
91
104
  private locked;
105
+ /**
106
+ * Reference to the outer column's context for page float area contexts.
107
+ * Used only for getParent() navigation to propagate nested page floats
108
+ * and footnotes to region/page level. Unlike `parent`, this does NOT
109
+ * affect children registration, isInvalidated() propagation, or
110
+ * getFloatFragmentExclusions(). (Issue #1675)
111
+ */
112
+ private outerContext;
92
113
  constructor(parent: PageFloatLayoutContext, floatReference: FloatReference | null, container: Vtree.Container, flowName: string | null, generatingNodePosition: Vtree.NodePosition | null, writingMode: Css.Val | null, direction: Css.Val | null);
114
+ /**
115
+ * Returns the effective parent context for hierarchy traversal.
116
+ * For normal contexts, returns `parent`. For page float area contexts
117
+ * (where `parent` is null), falls back to `outerContext`. (Issue #1675)
118
+ */
119
+ get effectiveParent(): PageFloatLayoutContext | null;
93
120
  private getParent;
121
+ /**
122
+ * Set the outer context for a page float area context.
123
+ * This shares the float store so that page floats/footnotes created inside
124
+ * a page float area are visible at all levels. (Issue #1675)
125
+ */
126
+ setOuterContext(outerContext: PageFloatLayoutContext): void;
94
127
  private getPreviousSiblingOf;
95
128
  private getPreviousSibling;
96
129
  getContainer(floatReference?: FloatReference): Vtree.Container;
@@ -144,7 +177,8 @@ export declare class PageFloatLayoutContext implements PageFloats.PageFloatLayou
144
177
  getFloatFragmentExclusions(): GeometryUtil.Shape[];
145
178
  private reattachFloatFragments;
146
179
  getMaxReachedAfterEdge(): number;
147
- getBlockStartEdgeOfBlockEndFloats(): number;
180
+ getBlockEndEdgeOfBlockStartFloats(inlinePos?: number): number;
181
+ getBlockStartEdgeOfBlockEndFloats(inlinePos?: number): number;
148
182
  getPageFloatClearEdge(clear: string, column: LayoutType.Column): number;
149
183
  getPageFloatPlacementCondition(float: PageFloat, floatSide: string, clearSide: string | null): PageFloatPlacementCondition;
150
184
  getLayoutConstraints(): LayoutType.LayoutConstraint[];
@@ -174,7 +208,7 @@ export declare class NormalPageFloatLayoutStrategy implements PageFloatLayoutStr
174
208
  /** @override */
175
209
  findPageFloatFragment(float: PageFloat, pageFloatLayoutContext: PageFloatLayoutContext): PageFloatFragment | null;
176
210
  /** @override */
177
- adjustPageFloatArea(floatArea: LayoutType.PageFloatArea, floatContainer: Vtree.Container, column: LayoutType.Column): void;
211
+ adjustPageFloatArea(floatArea: LayoutType.PageFloatArea, floatContainer: Vtree.Container, column: LayoutType.Column): Task.Result<void>;
178
212
  /** @override */
179
213
  forbid(float: PageFloat, pageFloatLayoutContext: PageFloatLayoutContext): void;
180
214
  }
@@ -125,7 +125,15 @@ export declare enum HOOKS {
125
125
  * {Array.<Vtree.NodeContext>} checkPoints
126
126
  * {Layout.Column} column
127
127
  */
128
- POST_LAYOUT_BLOCK = "POST_LAYOUT_BLOCK"
128
+ POST_LAYOUT_BLOCK = "POST_LAYOUT_BLOCK",
129
+ /**
130
+ * Called when pagination progresses during document load.
131
+ *
132
+ * The hook is called with an object with the following properties:
133
+ * {number} fraction: Fraction of the HTML content already paginated (0-1)
134
+ * {number} pages: Number of pages created so far
135
+ */
136
+ PAGINATION_PROGRESS = "PAGINATION_PROGRESS"
129
137
  }
130
138
  export type PreProcessSingleDocumentHook = (p1: Document) => any;
131
139
  export type PreProcessTextContentHook = (p1: Vtree.NodeContext, p2: string) => Task.Result<string>;
@@ -139,6 +147,10 @@ export type ResolveTextNodeBreakerHook = (p1: Vtree.NodeContext) => Layout.TextN
139
147
  export type ResolveFormattingContextHook = (p1: Vtree.NodeContext, p2: boolean, p3: Css.Val, p4: Css.Ident, p5: Css.Val, p6: boolean) => Vtree.FormattingContext;
140
148
  export type ResolveLayoutProcessorHook = (p1: Vtree.FormattingContext) => LayoutProcessor.LayoutProcessor;
141
149
  export type PostLayoutBlockHook = (p1: Vtree.NodeContext, p2: Vtree.NodeContext[], p3: Layout.Column) => void;
150
+ export type PaginationProgressHook = (p1: {
151
+ fraction: number;
152
+ pages: number;
153
+ }) => void;
142
154
  /**
143
155
  * Register a function to a hook with the specified name.
144
156
  * The registered function is called at appropriate timings by the core code.
@@ -29,8 +29,4 @@ export declare class PseudoelementStyler implements PseudoElement.PseudoelementS
29
29
  processContent(element: Element, styles: {
30
30
  [key: string]: Css.Val;
31
31
  }, nodeContext: Vtree.NodeContext): void;
32
- /**
33
- * ::marker support
34
- */
35
- private processMarker;
36
32
  }
@@ -0,0 +1,20 @@
1
+ /**
2
+ * Copyright 2026 Vivliostyle Foundation
3
+ *
4
+ * Vivliostyle.js is free software: you can redistribute it and/or modify
5
+ * it under the terms of the GNU Affero General Public License as published by
6
+ * the Free Software Foundation, either version 3 of the License, or
7
+ * (at your option) any later version.
8
+ *
9
+ * Vivliostyle.js is distributed in the hope that it will be useful,
10
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
11
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
+ * GNU Affero General Public License for more details.
13
+ *
14
+ * You should have received a copy of the GNU Affero General Public License
15
+ * along with Vivliostyle.js. If not, see <http://www.gnu.org/licenses/>.
16
+ *
17
+ * @fileoverview Semantic footnote helper utilities.
18
+ */
19
+ export declare function isSemanticFootnoteElement(element: Element): boolean;
20
+ export declare function isSemanticFootnoteNoterefElement(element: Element): boolean;
@@ -10,6 +10,8 @@ export declare class TableRow {
10
10
  readonly rowIndex: number;
11
11
  readonly sourceNode: Node;
12
12
  cells: TableCell[];
13
+ breakBefore: string | null;
14
+ breakAfter: string | null;
13
15
  constructor(rowIndex: number, sourceNode: Node);
14
16
  addCell(cell: TableCell): void;
15
17
  getMinimumHeight(): number;
@@ -51,6 +53,13 @@ export declare class BetweenTableRowBreakPosition extends BreakPosition.EdgeBrea
51
53
  private rowIndex;
52
54
  constructor(position: Vtree.NodeContext, breakOnEdge: string | null, overflows: boolean, columnBlockSize: number);
53
55
  findAcceptableBreak(column: Layout.Column, penalty: number): Vtree.NodeContext;
56
+ /**
57
+ * Check if any non-spanning cell in the row has content that wasn't fully
58
+ * rendered. This happens when page floats (footnotes) reduce available space
59
+ * during a retry, causing cell content to overflow within the row even though
60
+ * the row boundary appears acceptable. (Issue #1663)
61
+ */
62
+ private hasUnfinishedCells;
54
63
  getMinBreakPenalty(): number;
55
64
  getAcceptableCellBreakPositions(): Layout.BreakPositionAndNodeContext[];
56
65
  private getRowIndex;
@@ -161,10 +170,19 @@ export declare class TableLayoutStrategy extends LayoutUtil.EdgeSkipper {
161
170
  inHeader: boolean;
162
171
  inFooter: boolean;
163
172
  constructor(formattingContext: TableFormattingContext, column: Layout.Column);
173
+ startNonInlineElementNode(state: LayoutUtil.LayoutIteratorState): void | Task.Result<boolean>;
164
174
  resetColumn(): void;
165
175
  getColSpanningCellWidth(cell: TableCell): number;
166
176
  layoutCell(cell: TableCell, cellNodeContext: Vtree.NodeContext, startChunkPosition: Vtree.ChunkPosition): Task.Result<boolean>;
167
- hasBrokenCellAtSlot(slotIndex: any): boolean;
177
+ /**
178
+ * Find the break position for the cell at the given slot index.
179
+ * Returns the break position and its index in cellBreakPositions, or null if not found.
180
+ * Uses sourceNode matching instead of sequential index to support layout retry (issue #1663).
181
+ */
182
+ findBrokenCellAtSlot(slotIndex: number, sourceNode: Node): {
183
+ position: BrokenTableCellPosition;
184
+ index: number;
185
+ } | null;
168
186
  private extractRowSpanningCellBreakPositions;
169
187
  layoutRowSpanningCellsFromPreviousFragment(state: LayoutUtil.LayoutIteratorState): Task.Result<boolean>;
170
188
  startTableRow(state: LayoutUtil.LayoutIteratorState): Task.Result<boolean>;
@@ -186,6 +204,11 @@ export declare class TableLayoutProcessor implements LayoutProcessor.LayoutProce
186
204
  */
187
205
  normalizeColGroups(formattingContext: TableFormattingContext, tableElement: Element, column: Layout.Column): void;
188
206
  doInitialLayout(nodeContext: Vtree.NodeContext, column: Layout.Column): Task.Result<Vtree.NodeContext>;
207
+ /**
208
+ * Check if any row inside the table has a forced break value
209
+ * (propagated from cells or set on the row itself).
210
+ */
211
+ private hasForcedBreakInRows;
189
212
  addCaptions(formattingContext: TableFormattingContext, rootViewNode: Element, firstChild: Node | null): void;
190
213
  addColGroups(formattingContext: TableFormattingContext, rootViewNode: Element, firstChild: Node | null): void;
191
214
  removeColGroups(formattingContext: TableFormattingContext, rootViewNode: Element): void;
@@ -110,6 +110,7 @@ export declare namespace Layout {
110
110
  last: Node;
111
111
  viewDocument: Document;
112
112
  flowRootFormattingContext: Vtree.FormattingContext;
113
+ isNonFirstColumn: boolean;
113
114
  isFloat: boolean;
114
115
  isFootnote: boolean;
115
116
  startEdge: number;
@@ -142,6 +143,7 @@ export declare namespace Layout {
142
143
  pseudoParent: Column;
143
144
  nodeContextOverflowingDueToRepetitiveElements: Vtree.NodeContext | null;
144
145
  blockDistanceToBlockEndFloats: number;
146
+ lastLineStride: number;
145
147
  computedBlockSize: number;
146
148
  layoutContext: Vtree.LayoutContext;
147
149
  clientLayout: Vtree.ClientLayout;
@@ -235,8 +237,8 @@ export declare namespace Layout {
235
237
  * Layout a single float element.
236
238
  */
237
239
  layoutFloat(nodeContext: Vtree.NodeContext): Task.Result<Vtree.NodeContext>;
238
- setupFloatArea(area: PageFloatArea, floatReference: PageFloats.FloatReference, floatSide: string, anchorEdge: number | null, strategy: PageFloats.PageFloatLayoutStrategy, condition: PageFloats.PageFloatPlacementCondition): boolean;
239
- createPageFloatArea(float: PageFloats.PageFloat | null, floatSide: string, anchorEdge: number | null, strategy: PageFloats.PageFloatLayoutStrategy, condition: PageFloats.PageFloatPlacementCondition): PageFloatArea | null;
240
+ setupFloatArea(area: PageFloatArea, floatReference: PageFloats.FloatReference, floatSide: string, anchorEdge: number | null, strategy: PageFloats.PageFloatLayoutStrategy, condition: PageFloats.PageFloatPlacementCondition): Task.Result<boolean>;
241
+ createPageFloatArea(float: PageFloats.PageFloat | null, floatSide: string, anchorEdge: number | null, strategy: PageFloats.PageFloatLayoutStrategy, condition: PageFloats.PageFloatPlacementCondition): Task.Result<PageFloatArea | null>;
240
242
  layoutSinglePageFloatFragment(continuations: PageFloats.PageFloatContinuation[], floatSide: string, clearSide: string | null, allowFragmented: boolean, strategy: PageFloats.PageFloatLayoutStrategy, anchorEdge: number | null, pageFloatFragment?: PageFloats.PageFloatFragment | null): Task.Result<SinglePageFloatLayoutResult>;
241
243
  layoutPageFloatInner(continuation: PageFloats.PageFloatContinuation, strategy: PageFloats.PageFloatLayoutStrategy, anchorEdge: number | null, pageFloatFragment?: PageFloats.PageFloatFragment): Task.Result<boolean>;
242
244
  setFloatAnchorViewNode(nodeContext: Vtree.NodeContext): Vtree.NodeContext;
@@ -286,10 +288,6 @@ export declare namespace Layout {
286
288
  * Determines if a page break is acceptable at this position
287
289
  */
288
290
  isBreakable(flowPosition: Vtree.NodeContext): boolean;
289
- /**
290
- * Determines if an indent value is zero
291
- */
292
- zeroIndent(val: string | number): boolean;
293
291
  /**
294
292
  * @return true if overflows
295
293
  */
@@ -384,6 +382,7 @@ export declare namespace Layout {
384
382
  readonly parentContainer: Vtree.Container;
385
383
  convertPercentageSizesToPx(target: Element): void;
386
384
  fixFloatSizeAndPosition(nodeContext: Vtree.NodeContext): void;
385
+ getContentBlockMarginAfter(): number;
387
386
  getContentInlineSize(): number;
388
387
  }
389
388
  }
@@ -437,6 +436,8 @@ export declare namespace PageFloats {
437
436
  interface PageFloat {
438
437
  order: number | null;
439
438
  id: PageFloatID | null;
439
+ insidePageFloatArea: boolean;
440
+ parentPageFloat: PageFloat | null;
440
441
  readonly nodePosition: Vtree.NodePosition;
441
442
  readonly floatReference: FloatReference;
442
443
  readonly floatSide: string;
@@ -477,10 +478,12 @@ export declare namespace PageFloats {
477
478
  direction: Css.Val;
478
479
  floatFragments: PageFloatFragment[];
479
480
  readonly parent: PageFloatLayoutContext;
481
+ readonly effectiveParent: PageFloatLayoutContext | null;
480
482
  readonly flowName: string | null;
481
483
  readonly generatingNodePosition: Vtree.NodePosition | null;
482
484
  getContainer(floatReference?: FloatReference): Vtree.Container;
483
485
  setContainer(container: Vtree.Container): any;
486
+ setOuterContext(outerContext: PageFloatLayoutContext): void;
484
487
  addPageFloat(float: PageFloat): void;
485
488
  getPageFloatLayoutContext(floatReference: FloatReference): PageFloatLayoutContext;
486
489
  findPageFloatByNodePosition(nodePosition: Vtree.NodePosition): PageFloat | null;
@@ -522,7 +525,8 @@ export declare namespace PageFloats {
522
525
  setFloatAreaDimensions(area: Layout.PageFloatArea, floatReference: FloatReference, floatSide: string, anchorEdge: number | null, init: boolean, force: boolean, condition: PageFloatPlacementCondition): string | null;
523
526
  getFloatFragmentExclusions(): GeometryUtil.Shape[];
524
527
  getMaxReachedAfterEdge(): number;
525
- getBlockStartEdgeOfBlockEndFloats(): number;
528
+ getBlockEndEdgeOfBlockStartFloats(inlinePos?: number): number;
529
+ getBlockStartEdgeOfBlockEndFloats(inlinePos?: number): number;
526
530
  getPageFloatClearEdge(clear: string, column: Layout.Column): number;
527
531
  getPageFloatPlacementCondition(float: PageFloat, floatSide: string, clearSide: string | null): PageFloatPlacementCondition;
528
532
  getLayoutConstraints(): Layout.LayoutConstraint[];
@@ -538,7 +542,7 @@ export declare namespace PageFloats {
538
542
  createPageFloat(nodeContext: Vtree.NodeContext, pageFloatLayoutContext: PageFloatLayoutContext, column: Layout.Column): Task.Result<PageFloat>;
539
543
  createPageFloatFragment(continuations: PageFloatContinuation[], floatSide: string, clearSide: string | null, floatArea: Layout.PageFloatArea, continues: boolean): PageFloatFragment;
540
544
  findPageFloatFragment(float: PageFloat, pageFloatLayoutContext: PageFloatLayoutContext): PageFloatFragment | null;
541
- adjustPageFloatArea(floatArea: Layout.PageFloatArea, floatContainer: Vtree.Container, column: Layout.Column): any;
545
+ adjustPageFloatArea(floatArea: Layout.PageFloatArea, floatContainer: Vtree.Container, column: Layout.Column): Task.Result<void>;
542
546
  forbid(float: PageFloat, pageFloatLayoutContext: PageFloatLayoutContext): any;
543
547
  }
544
548
  }
@@ -707,7 +711,7 @@ export declare namespace Vtree {
707
711
  * @param target element to apply styles to
708
712
  * @return vertical
709
713
  */
710
- applyFootnoteStyle(vertical: boolean, rtl: boolean, target: Element): boolean;
714
+ applyFootnoteStyle(vertical: boolean, rtl: boolean, target: Element): Task.Result<boolean>;
711
715
  /**
712
716
  * Peel off innermost first-XXX pseudoelement, create and create view nodes
713
717
  * after the end of that pseudoelement.
@@ -883,7 +887,6 @@ export declare namespace Vtree {
883
887
  clearSide: string | null;
884
888
  floatMinWrapBlock: Css.Numeric | null;
885
889
  columnSpan: Css.Val | null;
886
- verticalAlign: string;
887
890
  captionSide: string;
888
891
  inlineBorderSpacing: number;
889
892
  blockBorderSpacing: number;