@vivliostyle/core 2.40.0 → 2.42.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.
@@ -54,16 +54,20 @@ export declare class ShapeVisitor extends Css.Visitor {
54
54
  export declare function toShape(val: Css.Val, x: number, y: number, width: number, height: number, context: Exprs.Context): GeometryUtil.Shape;
55
55
  export declare class CountersVisitor extends Css.Visitor {
56
56
  readonly reset: boolean;
57
+ readonly defaultValue: number;
57
58
  counters: {
58
59
  [key: string]: number;
59
60
  };
60
61
  name: string | null;
61
- constructor(reset: boolean);
62
+ constructor(reset: boolean, defaultValue: number);
62
63
  visitIdent(ident: Css.Ident): Css.Val;
63
64
  visitInt(num: Css.Int): Css.Val;
64
65
  visitSpaceList(list: Css.SpaceList): Css.Val;
65
66
  }
66
- export declare function toCounters(val: Css.Val, reset: boolean): {
67
+ export declare function toCounters(val: Css.Val, options?: {
68
+ reset?: boolean;
69
+ defaultValue?: number;
70
+ }): {
67
71
  [key: string]: number;
68
72
  };
69
73
  export declare class UrlTransformVisitor extends Css.FilterVisitor {
@@ -27,6 +27,14 @@ export declare class SlipMap {
27
27
  */
28
28
  fixedBySlipped(slipped: number): number;
29
29
  }
30
+ type CounterSnapshot = {
31
+ offset: number;
32
+ counters: CssCascade.CounterValues;
33
+ changes: string[];
34
+ changeTypes?: {
35
+ [key: string]: "reset" | "set" | "increment";
36
+ };
37
+ };
30
38
  export interface FlowListener {
31
39
  encounteredFlowChunk(flowChunk: Vtree.FlowChunk, flow: Vtree.Flow): void;
32
40
  }
@@ -151,6 +159,7 @@ export declare class Styler implements AbstractStyler {
151
159
  styleMap: {
152
160
  [key: string]: CssCascade.ElementStyle;
153
161
  };
162
+ counterSnapshots: CounterSnapshot[];
154
163
  flows: {
155
164
  [key: string]: Vtree.Flow;
156
165
  };
@@ -183,6 +192,11 @@ export declare class Styler implements AbstractStyler {
183
192
  postprocessTopStyle(elemStyle: CssCascade.ElementStyle, isBody: boolean): void;
184
193
  getTopContainerStyle(): CssCascade.ElementStyle;
185
194
  getAttrStyle(elem: Element): CssCascade.ElementStyle;
195
+ recordCounterSnapshot(offset: number, counters: CssCascade.CounterValues, changes?: string[], changeTypes?: {
196
+ [key: string]: "reset" | "set" | "increment";
197
+ }): void;
198
+ getCounterSnapshotAtOffset(offset: number): CounterSnapshot | null;
199
+ getLastCounterSnapshot(): CounterSnapshot | null;
186
200
  /**
187
201
  * @return currently reached offset
188
202
  */
@@ -210,3 +224,4 @@ export declare class Styler implements AbstractStyler {
210
224
  }, nodeContext: Vtree.NodeContext): void;
211
225
  }
212
226
  export declare const columnProps: string[];
227
+ export {};
@@ -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
  */
@@ -6,7 +6,8 @@ import { Layout } from "./types";
6
6
  declare const PageFloatFragment: typeof PageFloats.PageFloatFragment;
7
7
  export declare class Footnote extends PageFloats.PageFloat {
8
8
  readonly footnotePolicy: Css.Ident | null;
9
- constructor(nodePosition: Vtree.NodePosition, floatReference: PageFloats.FloatReference, flowName: string, footnotePolicy: Css.Ident | null, floatMinWrapBlock: Css.Numeric | null);
9
+ readonly policyAnchorNode: Node;
10
+ constructor(nodePosition: Vtree.NodePosition, floatReference: PageFloats.FloatReference, flowName: string, footnotePolicy: Css.Ident | null, floatMinWrapBlock: Css.Numeric | null, policyAnchorNode: Node);
10
11
  isAllowedToPrecede(other: PageFloats.PageFloat): boolean;
11
12
  }
12
13
  /**
@@ -34,7 +35,7 @@ export declare class FootnoteLayoutStrategy implements PageFloats.PageFloatLayou
34
35
  /** @override */
35
36
  findPageFloatFragment(float: PageFloats.PageFloat, pageFloatLayoutContext: PageFloats.PageFloatLayoutContext): PageFloats.PageFloatFragment | null;
36
37
  /** @override */
37
- adjustPageFloatArea(floatArea: Layout.PageFloatArea, floatContainer: Vtree.Container, column: Layout.Column): void;
38
+ adjustPageFloatArea(floatArea: Layout.PageFloatArea, floatContainer: Vtree.Container, column: Layout.Column): Task.Result<void>;
38
39
  /** @override */
39
40
  forbid(float: PageFloats.PageFloat, pageFloatLayoutContext: PageFloats.PageFloatLayoutContext): void;
40
41
  }
@@ -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.
@@ -62,6 +58,19 @@ export declare function getElementClientRectAdjusted(clientLayout: Vtree.ClientL
62
58
  * This is used to prevent unnecessary blank pages.
63
59
  */
64
60
  export declare function clearForcedColumnBreaks(prevNode: Node, currNode: Node): void;
61
+ /**
62
+ * Check if an element has non-root multi-column styles (column-count or
63
+ * column-width) set on its inline style.
64
+ *
65
+ * NOTE: Do not use `instanceof HTMLElement` for the check because it does
66
+ * not work when the node is inside an iframe. (Issue #1000)
67
+ */
68
+ export declare function hasNonRootMultiColumnStyle(element: Element): boolean;
69
+ /**
70
+ * Check if the given element or any of its descendants establishes a
71
+ * non-root multi-column layout (via inline style).
72
+ */
73
+ export declare function containsNonRootMultiColumn(element: Element): boolean;
65
74
  /**
66
75
  * Find the nearest ancestor element that establishes a multi-column
67
76
  * layout but is not the root column element.
@@ -71,6 +80,19 @@ export declare function findAncestorNonRootMultiColumn(node: Node): Element | nu
71
80
  * Fix overflow caused by forced column breaks in non-root multi-column elements.
72
81
  */
73
82
  export declare function fixOverflowAtForcedColumnBreak(node: Node): void;
83
+ /**
84
+ * Check if the root column's content overflows.
85
+ *
86
+ * Note: This check is based on the root column's trailing content
87
+ * (lastElementChild), not only on a specific target element.
88
+ */
89
+ export declare function checkRootColumnOverflow(column: Layout.Column): number;
90
+ /**
91
+ * Fix multi-column box with `column-fill: auto` that was changed to `column-fill: balance`
92
+ * for layout processing, by restoring `column-fill: auto` and setting block-size to prevent overflow.
93
+ */
94
+ export declare function fixAutoFillMultiColumnBox(element: HTMLElement, column: Layout.Column): void;
95
+ export declare function fixAutoFillMultiColumnBoxes(column: Layout.Column): void;
74
96
  /**
75
97
  * Calculate the position of the "after" edge in the block-progression.
76
98
  * Returns the edge position in pixels if it was determined successfully,
@@ -87,6 +109,18 @@ export declare function removeFollowingSiblings(parentNode: Node, viewNode: Node
87
109
  export declare const SPECIAL_ATTR = "data-adapt-spec";
88
110
  export declare function isSpecial(e: Element): boolean;
89
111
  export declare function isOutOfFlow(node: Node): boolean;
112
+ /**
113
+ * Check if element is out-of-flow due to CSS positioning or float.
114
+ * Unlike isOutOfFlow(), this does not check for special marker elements.
115
+ */
116
+ export declare function isCssOutOfFlow(node: Node): boolean;
117
+ /**
118
+ * Check if element has position:fixed. Used to identify running elements
119
+ * (position:running() rendered as position:fixed) without matching
120
+ * position:absolute elements. (Issue #1833, #1869, #1870)
121
+ */
122
+ export declare function isFixedPositioned(node: Node): boolean;
90
123
  export declare function isSpecialNodeContext(nodeContext: Vtree.NodeContext): boolean;
91
124
  export declare function isSpecialInlineDisplay(display: string): boolean;
92
125
  export declare function findAncestorSpecialInlineNodeContext(nodeContext: Vtree.NodeContext): Vtree.NodeContext | null;
126
+ 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,13 @@ 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 getFootnoteAfterPseudo;
489
+ private hasAuthorFootnoteAfterPseudo;
490
+ private createDefaultFootnoteAfterPseudo;
491
+ private getFootnoteBreakOpportunity;
492
+ private createFootnoteBreakOpportunity;
493
+ private updateInlineFootnoteSeparators;
450
494
  }
@@ -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,49 @@ export declare class PageFloatLayoutContext implements PageFloats.PageFloatLayou
89
102
  private floatsDeferredFromPrevious;
90
103
  private layoutConstraints;
91
104
  private locked;
105
+ /**
106
+ * Maximum outer block size for footnotes on this page.
107
+ * Set when a footnote is placed but then found to be not-allowed (anchor
108
+ * not reachable in multi-column). Each retry halves this value until
109
+ * the footnote fits or is too small to display. (Issue #1879)
110
+ */
111
+ footnoteMaxBlockSize: number | null;
112
+ /**
113
+ * When true, max-height on @footnote areas should be ignored.
114
+ * Set when a page contains only footnote continuation(s) and no body
115
+ * content. Per CSS GCPM §2.4.2, max-height should not apply in this
116
+ * case. (Issue #1878)
117
+ */
118
+ ignoreFootnoteAreaMaxHeight: boolean;
119
+ /**
120
+ * Tracks footnote IDs whose anchors have been registered at least once
121
+ * during this page's layout cycle. Unlike floatAnchors, this set
122
+ * survives invalidate() calls, so we can detect feedback loops where
123
+ * a footnote's own size pushes its anchor off the page. (Issue #1879)
124
+ */
125
+ private footnoteAnchorsSeen;
126
+ /**
127
+ * Reference to the outer column's context for page float area contexts.
128
+ * Used only for getParent() navigation to propagate nested page floats
129
+ * and footnotes to region/page level. Unlike `parent`, this does NOT
130
+ * affect children registration, isInvalidated() propagation, or
131
+ * getFloatFragmentExclusions(). (Issue #1675)
132
+ */
133
+ private outerContext;
92
134
  constructor(parent: PageFloatLayoutContext, floatReference: FloatReference | null, container: Vtree.Container, flowName: string | null, generatingNodePosition: Vtree.NodePosition | null, writingMode: Css.Val | null, direction: Css.Val | null);
135
+ /**
136
+ * Returns the effective parent context for hierarchy traversal.
137
+ * For normal contexts, returns `parent`. For page float area contexts
138
+ * (where `parent` is null), falls back to `outerContext`. (Issue #1675)
139
+ */
140
+ get effectiveParent(): PageFloatLayoutContext | null;
93
141
  private getParent;
142
+ /**
143
+ * Set the outer context for a page float area context.
144
+ * This shares the float store so that page floats/footnotes created inside
145
+ * a page float area are visible at all levels. (Issue #1675)
146
+ */
147
+ setOuterContext(outerContext: PageFloatLayoutContext): void;
94
148
  private getPreviousSiblingOf;
95
149
  private getPreviousSibling;
96
150
  getContainer(floatReference?: FloatReference): Vtree.Container;
@@ -105,15 +159,22 @@ export declare class PageFloatLayoutContext implements PageFloats.PageFloatLayou
105
159
  findPageFloatFragment(float: PageFloat): PageFloatFragment | null;
106
160
  hasFloatFragments(condition?: (p1: PageFloatFragment) => boolean): boolean;
107
161
  hasContinuingFloatFragmentsInFlow(flowName: string): boolean;
162
+ markPageFloatAnchorSeen(float: PageFloat): void;
108
163
  registerPageFloatAnchor(float: PageFloat, anchorViewNode: Node): void;
109
164
  collectPageFloatAnchors(): any;
110
165
  isAnchorAlreadyAppeared(floatId: PageFloatID): boolean;
111
166
  deferPageFloat(continuation: PageFloatContinuation): void;
167
+ removeFloatDeferredToNext(float: PageFloat): void;
112
168
  hasPrecedingFloatsDeferredToNext(float: PageFloat, ignoreReference?: boolean): boolean;
113
169
  getLastFollowingFloatInFragments(float: PageFloat): PageFloat | null;
114
170
  getDeferredPageFloatContinuations(flowName?: string | null): PageFloatContinuation[];
115
171
  getPageFloatContinuationsDeferredToNext(flowName?: string | null): PageFloatContinuation[];
116
172
  getFloatsDeferredToNextInChildContexts(): PageFloat[];
173
+ private hasRootMultiColumnFootnoteContext;
174
+ private hasNonRootMultiColumnFootnoteContext;
175
+ private hasMultiColumnFootnoteContext;
176
+ private trySetFootnoteRetryMaxBlockSize;
177
+ initFootnoteRetryFromEmptyFragment(float: PageFloat, area: LayoutType.PageFloatArea): boolean;
117
178
  checkAndForbidNotAllowedFloat(): boolean;
118
179
  checkAndForbidFloatFollowingDeferredFloat(): boolean;
119
180
  finish(): void;
@@ -144,7 +205,8 @@ export declare class PageFloatLayoutContext implements PageFloats.PageFloatLayou
144
205
  getFloatFragmentExclusions(): GeometryUtil.Shape[];
145
206
  private reattachFloatFragments;
146
207
  getMaxReachedAfterEdge(): number;
147
- getBlockStartEdgeOfBlockEndFloats(): number;
208
+ getBlockEndEdgeOfBlockStartFloats(inlinePos?: number): number;
209
+ getBlockStartEdgeOfBlockEndFloats(inlinePos?: number): number;
148
210
  getPageFloatClearEdge(clear: string, column: LayoutType.Column): number;
149
211
  getPageFloatPlacementCondition(float: PageFloat, floatSide: string, clearSide: string | null): PageFloatPlacementCondition;
150
212
  getLayoutConstraints(): LayoutType.LayoutConstraint[];
@@ -174,7 +236,7 @@ export declare class NormalPageFloatLayoutStrategy implements PageFloatLayoutStr
174
236
  /** @override */
175
237
  findPageFloatFragment(float: PageFloat, pageFloatLayoutContext: PageFloatLayoutContext): PageFloatFragment | null;
176
238
  /** @override */
177
- adjustPageFloatArea(floatArea: LayoutType.PageFloatArea, floatContainer: Vtree.Container, column: LayoutType.Column): void;
239
+ adjustPageFloatArea(floatArea: LayoutType.PageFloatArea, floatContainer: Vtree.Container, column: LayoutType.Column): Task.Result<void>;
178
240
  /** @override */
179
241
  forbid(float: PageFloat, pageFloatLayoutContext: PageFloatLayoutContext): void;
180
242
  }
@@ -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
  }
@@ -160,3 +160,10 @@ export declare class RepetitiveElementsOwnerLayoutProcessor extends LayoutProces
160
160
  export declare function appendHeaderToAncestors(nodeContext: Vtree.NodeContext, column: LayoutType.Column): void;
161
161
  export declare function appendHeader(formattingContext: RepetitiveElement.RepetitiveElementsOwnerFormattingContext, nodeContext: Vtree.NodeContext, column: LayoutType.Column): Task.Result<boolean>;
162
162
  export declare function appendFooter(formattingContext: RepetitiveElement.RepetitiveElementsOwnerFormattingContext, nodeContext: Vtree.NodeContext, column: LayoutType.Column): Task.Result<boolean>;
163
+ /**
164
+ * Check whether an overflow is within the scope of the repetitive elements
165
+ * owner. Returns true if the overflow should trigger header/footer skipping
166
+ * (i.e., the overflowing node is inside the owner), false otherwise.
167
+ * (Issue #1873)
168
+ */
169
+ export declare function isOverflowInsideRepetitiveElementsOwner(nodeContext: Vtree.NodeContext, overflownNodeContext: Vtree.NodeContext, repetitiveElements: RepetitiveElement.RepetitiveElements): boolean;