@vivliostyle/core 2.39.1 → 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.
@@ -1,3 +1,4 @@
1
+ import * as CmykStore from "./cmyk-store";
1
2
  import * as CounterStyle from "./counter-style";
2
3
  import * as Css from "./css";
3
4
  import * as CssParser from "./css-parser";
@@ -277,7 +278,8 @@ export declare class CheckNSTagAction extends ChainedAction {
277
278
  export declare class CheckTargetEpubTypeAction extends ChainedAction {
278
279
  readonly epubTypePatt: RegExp;
279
280
  readonly targetLocalName?: string;
280
- constructor(epubTypePatt: RegExp, targetLocalName?: string);
281
+ readonly useRoleAttr: boolean;
282
+ constructor(epubTypePatt: RegExp, targetLocalName?: string, useRoleAttr?: boolean);
281
283
  apply(cascadeInstance: CascadeInstance): void;
282
284
  }
283
285
  export declare class CheckNamespaceAction extends ChainedAction {
@@ -612,9 +614,20 @@ export declare class ContentPropVisitor extends Css.FilterVisitor {
612
614
  cascade: CascadeInstance;
613
615
  element: Element;
614
616
  readonly counterResolver: CounterResolver;
615
- constructor(cascade: CascadeInstance, element: Element, counterResolver: CounterResolver);
617
+ private readonly pseudoName?;
618
+ constructor(cascade: CascadeInstance, element: Element, counterResolver: CounterResolver, pseudoName?: string);
619
+ private getCounterStore;
620
+ private getPageScope;
621
+ /**
622
+ * Helper method to evaluate CSS values containing counter() and other functions,
623
+ * then convert to string.
624
+ */
625
+ private evaluateAndGetString;
616
626
  visitIdent(ident: Css.Ident): Css.Val;
617
627
  private format;
628
+ private formatCounterList;
629
+ private formatLastValue;
630
+ private buildCounterText;
618
631
  visitFuncCounter(values: Css.Val[]): Css.Val;
619
632
  visitFuncCounters(values: Css.Val[]): Css.Val;
620
633
  visitFuncTargetCounter(values: Css.Val[]): Css.Val;
@@ -670,7 +683,7 @@ export declare class Cascade {
670
683
  order: number;
671
684
  clone(): Cascade;
672
685
  insertInTable(table: ActionTable, key: string, action: CascadeAction): void;
673
- createInstance(context: Exprs.Context, counterListener: CounterListener, counterResolver: CounterResolver, lang: any, counterStyleStore: CounterStyle.CounterStyleStore): CascadeInstance;
686
+ createInstance(context: Exprs.Context, counterListener: CounterListener, counterResolver: CounterResolver, lang: any, counterStyleStore: CounterStyle.CounterStyleStore, cmykStore: CmykStore.CmykStore): CascadeInstance;
674
687
  nextOrder(): number;
675
688
  }
676
689
  export declare class CascadeInstance {
@@ -678,6 +691,7 @@ export declare class CascadeInstance {
678
691
  readonly counterListener: CounterListener;
679
692
  readonly counterResolver: CounterResolver;
680
693
  readonly counterStyleStore: CounterStyle.CounterStyleStore;
694
+ readonly cmykStore: CmykStore.CmykStore;
681
695
  code: Cascade;
682
696
  stack: ConditionItem[][];
683
697
  conditions: {
@@ -696,12 +710,16 @@ export declare class CascadeInstance {
696
710
  currentPageType: string | null;
697
711
  previousPageType: string | null;
698
712
  firstPageType: string | null;
699
- pageTypePageCounts: {
700
- [pageType: string]: number;
713
+ pageTypePageIndices: {
714
+ [pageType: string]: number[];
701
715
  };
702
716
  isFirst: boolean;
703
717
  isRoot: boolean;
704
718
  counters: CounterValues;
719
+ lastCounterChanges: string[];
720
+ lastCounterChangeTypes: {
721
+ [key: string]: "reset" | "set" | "increment";
722
+ };
705
723
  counterScoping: {
706
724
  [key: string]: boolean;
707
725
  }[];
@@ -737,7 +755,7 @@ export declare class CascadeInstance {
737
755
  };
738
756
  dependentConditions: string[];
739
757
  elementStack: Element[];
740
- constructor(cascade: Cascade, context: Exprs.Context, counterListener: CounterListener, counterResolver: CounterResolver, lang: string, counterStyleStore: CounterStyle.CounterStyleStore);
758
+ constructor(cascade: Cascade, context: Exprs.Context, counterListener: CounterListener, counterResolver: CounterResolver, lang: string, counterStyleStore: CounterStyle.CounterStyleStore, cmykStore: CmykStore.CmykStore);
741
759
  pushConditionItem(item: ConditionItem): void;
742
760
  increment(condition: string, viewCondition: Matchers.Matcher): void;
743
761
  decrement(condition: string, viewCondition: Matchers.Matcher): void;
@@ -757,9 +775,29 @@ export declare class CascadeInstance {
757
775
  * https://drafts.csswg.org/css-gcpm-3/#running-elements
758
776
  */
759
777
  setRunningElement(props: ElementStyle): void;
760
- processPseudoelementProps(pseudoprops: ElementStyle, element: Element): void;
778
+ processPseudoelementProps(pseudoprops: ElementStyle, element: Element, pseudoName?: string): void;
761
779
  pushElement(styler: CssStyler.AbstractStyler, element: Element, baseStyle: ElementStyle, elementOffset: number): void;
780
+ private hasNonTrivialViewConditionalPseudoContent;
781
+ /**
782
+ * Properties that are valid on ::marker and should be extracted
783
+ * to CSS custom properties on the parent element.
784
+ */
785
+ static readonly markerAllowedProps: string[];
786
+ /**
787
+ * Extract ::marker or ::footnote-marker properties into CSS custom
788
+ * properties (--viv-marker-*) on the parent element's currentStyle,
789
+ * so that the browser's native ::marker can be controlled via polyfill CSS.
790
+ *
791
+ * For ::marker: the content is resolved from list-style-type/list-style-image
792
+ * if not explicitly set. For ::footnote-marker: the content comes from
793
+ * ::footnote-marker { content: ... } declarations.
794
+ */
762
795
  processMarkerPseudoelementProps(pseudoProps: ElementStyle, element: Element, styler: CssStyler.AbstractStyler): void;
796
+ /**
797
+ * Resolve Css.Expr nodes in marker content to static values.
798
+ * counter() functions are evaluated to strings; URLs are kept as-is.
799
+ */
800
+ private resolveMarkerContentVal;
763
801
  /**
764
802
  * Get inherited property value
765
803
  * @param propName
@@ -768,6 +806,7 @@ export declare class CascadeInstance {
768
806
  * @returns the inherited property value, or the initial value (or null) if not found
769
807
  */
770
808
  getInheritedPropertyValue(propName: string, styler: CssStyler.AbstractStyler, element: Element): Css.Val | null;
809
+ resolvePseudoelementInheritedPropertyValue(pseudoProps: ElementStyle, propName: string, styler: CssStyler.AbstractStyler, element: Element): Css.Val | null;
771
810
  private applyAttrFilterInner;
772
811
  private applyAttrFilter;
773
812
  /**
@@ -778,6 +817,8 @@ export declare class CascadeInstance {
778
817
  * Calculate all calc() in property values in elementStyle
779
818
  */
780
819
  applyCalcFilter(elementStyle: ElementStyle, context: Exprs.Context): void;
820
+ applyCmykFilter(elementStyle: ElementStyle, element?: Element): void;
821
+ private applyCmykFilterInternal;
781
822
  private applyActions;
782
823
  private pop;
783
824
  popRule(): void;
@@ -174,6 +174,10 @@ export declare const pageRuleMasterPseudoName = "vivliostyle-page-rule-master";
174
174
  * box's name)].
175
175
  */
176
176
  export declare const marginBoxesKey: string;
177
+ /**
178
+ * Key for a footnote area style map in a page style object.
179
+ */
180
+ export declare const footnoteAreaKey: string;
177
181
  /**
178
182
  * Represent a page master generated for `@page` rules
179
183
  * @param style Cascaded style for `@page` rules
@@ -464,6 +468,7 @@ export declare class PageParserHandler extends CssCascade.CascadeParserHandler i
464
468
  simpleProperty(name: string, value: Css.Val, important: any): void;
465
469
  insertNonPrimary(action: CssCascade.CascadeAction): void;
466
470
  makeApplyRuleAction(specificity: number): CssCascade.ApplyRuleAction;
471
+ startFootnoteRule(pseudoelem: string | null): void;
467
472
  startPageMarginBoxRule(name: string): void;
468
473
  }
469
474
  /**
@@ -481,3 +486,18 @@ export declare class PageMarginBoxParserHandler extends CssParser.SlaveParserHan
481
486
  /** @override */
482
487
  simpleProperty(name: string, value: Css.Val, important: any): void;
483
488
  }
489
+ /**
490
+ * Parser handler for a footnote area rule.
491
+ */
492
+ export declare class PageFootnoteAreaParserHandler extends CssParser.SlaveParserHandler implements CssValidator.PropertyReceiver {
493
+ readonly validatorSet: CssValidator.ValidatorSet;
494
+ readonly areaStyle: CssCascade.ElementStyle;
495
+ constructor(scope: Exprs.LexicalScope, owner: CssParser.DispatchParserHandler, validatorSet: CssValidator.ValidatorSet, areaStyle: CssCascade.ElementStyle);
496
+ property(name: string, value: Css.Val, important: boolean): void;
497
+ /** @override */
498
+ invalidPropertyValue(name: string, value: Css.Val): void;
499
+ /** @override */
500
+ unknownProperty(name: string, value: Css.Val): void;
501
+ /** @override */
502
+ simpleProperty(name: string, value: Css.Val, important: any): void;
503
+ }
@@ -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 {
@@ -1,3 +1,4 @@
1
+ import * as CmykStore from "./cmyk-store";
1
2
  import * as CounterStyle from "./counter-style";
2
3
  import * as Css from "./css";
3
4
  import * as CssCascade from "./css-cascade";
@@ -26,6 +27,14 @@ export declare class SlipMap {
26
27
  */
27
28
  fixedBySlipped(slipped: number): number;
28
29
  }
30
+ type CounterSnapshot = {
31
+ offset: number;
32
+ counters: CssCascade.CounterValues;
33
+ changes: string[];
34
+ changeTypes?: {
35
+ [key: string]: "reset" | "set" | "increment";
36
+ };
37
+ };
29
38
  export interface FlowListener {
30
39
  encounteredFlowChunk(flowChunk: Vtree.FlowChunk, flow: Vtree.Flow): void;
31
40
  }
@@ -150,6 +159,7 @@ export declare class Styler implements AbstractStyler {
150
159
  styleMap: {
151
160
  [key: string]: CssCascade.ElementStyle;
152
161
  };
162
+ counterSnapshots: CounterSnapshot[];
153
163
  flows: {
154
164
  [key: string]: Vtree.Flow;
155
165
  };
@@ -171,7 +181,7 @@ export declare class Styler implements AbstractStyler {
171
181
  bodyReached: boolean;
172
182
  constructor(xmldoc: XmlDoc.XMLDocHolder, cascade: CssCascade.Cascade, scope: Exprs.LexicalScope, context: Exprs.Context, primaryFlows: {
173
183
  [key: string]: boolean;
174
- }, validatorSet: CssValidator.ValidatorSet, counterListener: CssCascade.CounterListener, counterResolver: CssCascade.CounterResolver, counterStyleStore: CounterStyle.CounterStyleStore);
184
+ }, validatorSet: CssValidator.ValidatorSet, counterListener: CssCascade.CounterListener, counterResolver: CssCascade.CounterResolver, counterStyleStore: CounterStyle.CounterStyleStore, cmykStore: CmykStore.CmykStore);
175
185
  hasProp(style: CssCascade.ElementStyle, map: CssValidator.ValueMap, name: string): boolean;
176
186
  transferPropsToRoot(srcStyle: CssCascade.ElementStyle, map: CssValidator.ValueMap): void;
177
187
  /**
@@ -182,6 +192,11 @@ export declare class Styler implements AbstractStyler {
182
192
  postprocessTopStyle(elemStyle: CssCascade.ElementStyle, isBody: boolean): void;
183
193
  getTopContainerStyle(): CssCascade.ElementStyle;
184
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;
185
200
  /**
186
201
  * @return currently reached offset
187
202
  */
@@ -209,3 +224,4 @@ export declare class Styler implements AbstractStyler {
209
224
  }, nodeContext: Vtree.NodeContext): void;
210
225
  }
211
226
  export declare const columnProps: string[];
227
+ export {};
@@ -1,7 +1,9 @@
1
1
  import * as Base from "./base";
2
+ import * as CmykStore from "./cmyk-store";
2
3
  import * as Constants from "./constants";
3
4
  import * as Counters from "./counters";
4
5
  import * as Css from "./css";
6
+ import * as CssCascade from "./css-cascade";
5
7
  import * as Exprs from "./exprs";
6
8
  import * as Font from "./font";
7
9
  import * as Net from "./net";
@@ -36,6 +38,7 @@ export declare class EPUBDocStore extends OPS.OPSDocStore {
36
38
  loadAsPlainXML(url: string, opt_required?: boolean, opt_message?: string): Task.Result<XmlDoc.XMLDocHolder>;
37
39
  startLoadingAsPlainXML(url: string): void;
38
40
  loadAsJSON(url: string, opt_required?: boolean, opt_message?: string): Task.Result<Base.JSON>;
41
+ loadWebPubManifest(url: string, frame: Task.Frame<OPFDoc>): void;
39
42
  loadPubDoc(url: string): Task.Result<OPFDoc>;
40
43
  loadEPUBDoc(url: string): Task.Result<OPFDoc>;
41
44
  loadOPF(pubURL: string, root: string): Task.Result<OPFDoc>;
@@ -188,6 +191,7 @@ export type OPFViewItem = {
188
191
  layoutPositions: Vtree.LayoutPosition[];
189
192
  pages: Vtree.Page[];
190
193
  complete: boolean;
194
+ pageCounterStarts: CssCascade.CounterValues[];
191
195
  };
192
196
  export declare class OPFView implements Vgen.CustomRendererFactory {
193
197
  readonly opf: OPFDoc;
@@ -207,9 +211,11 @@ export declare class OPFView implements Vgen.CustomRendererFactory {
207
211
  pref: Exprs.Preferences;
208
212
  clientLayout: Vgen.DefaultClientLayout;
209
213
  counterStore: Counters.CounterStore;
214
+ cmykStore: CmykStore.CmykStore;
210
215
  tocAutohide: boolean;
211
216
  tocVisible: boolean;
212
217
  tocView?: Toc.TOCView;
218
+ private paginationProgress;
213
219
  constructor(opf: OPFDoc, viewport: Vgen.Viewport, fontMapper: Font.Mapper, pref: Exprs.Preferences, pageSheetSizeReporter: (p1: {
214
220
  width: number;
215
221
  height: number;
@@ -218,10 +224,40 @@ export declare class OPFView implements Vgen.CustomRendererFactory {
218
224
  width: number;
219
225
  height: number;
220
226
  };
221
- }, p3: number, p4: number) => any);
227
+ }, p3: number, p4: number) => any, cmykReserveMap?: CmykStore.CmykReserveMapEntry[]);
222
228
  private getPage;
229
+ /**
230
+ * Wait until all previous spine items are loaded before accessing the target
231
+ * spine item. This prevents corrupting the page counter state when navigating
232
+ * to a later spine item while rendering is in progress.
233
+ * (Fix for issue #1616)
234
+ * @param spineIndex The target spine index to navigate to
235
+ * @param sync If true, skip waiting (synchronous mode)
236
+ */
237
+ private waitForPreviousSpines;
223
238
  getCurrentPageProgression(position: Position): Constants.PageProgression | null;
224
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;
225
261
  /**
226
262
  * Render a single page. If the new page contains elements with ids that are
227
263
  * referenced from other pages by 'target-counter()', those pages are rendered
@@ -295,6 +331,7 @@ export declare class OPFView implements Vgen.CustomRendererFactory {
295
331
  * Move to the page specified by the given CFI and render it.
296
332
  */
297
333
  navigateToFragment(fragment: string, position: Position, sync: boolean): Task.Result<PageAndPosition | null>;
334
+ private resolveSemanticFootnoteNavigationOffset;
298
335
  /**
299
336
  * Move to the page specified by the given URL and render it.
300
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
  }
@@ -22,6 +22,7 @@
22
22
  import "./footnotes";
23
23
  import "./table";
24
24
  import * as Base from "./base";
25
+ import * as CmykStore from "./cmyk-store";
25
26
  import * as Constants from "./constants";
26
27
  import * as Counters from "./counters";
27
28
  import * as CounterStyle from "./counter-style";
@@ -91,6 +92,7 @@ export declare class StyleInstance extends Exprs.Context implements CssStyler.Fl
91
92
  readonly pageNumberOffset: number;
92
93
  readonly documentURLTransformer: Base.DocumentURLTransformer;
93
94
  readonly counterStore: Counters.CounterStore;
95
+ readonly cmykStore: CmykStore.CmykStore;
94
96
  lang: string | null;
95
97
  primaryFlows: {
96
98
  [key: string]: boolean;
@@ -102,6 +104,7 @@ export declare class StyleInstance extends Exprs.Context implements CssStyler.Fl
102
104
  };
103
105
  currentLayoutPosition: Vtree.LayoutPosition;
104
106
  layoutPositionAtPageStart: Vtree.LayoutPosition;
107
+ currentCascadedPageStyle: CssCascade.ElementStyle;
105
108
  lookupOffset: number;
106
109
  faces: Font.DocumentFaces;
107
110
  pageBoxInstances: {
@@ -123,9 +126,15 @@ export declare class StyleInstance extends Exprs.Context implements CssStyler.Fl
123
126
  };
124
127
  pageSheetHeight: number;
125
128
  pageSheetWidth: number;
129
+ private semanticFootnoteFirstRefOffsets;
130
+ private semanticFootnoteFirstRefOffsetsInitialized;
131
+ pageGroupPageCounts: {
132
+ [pageType: string]: Map<Element, number>;
133
+ };
134
+ currentPageGroupDocument: Document | null;
126
135
  constructor(style: Style, xmldoc: XmlDoc.XMLDocHolder, defaultLang: string | null, viewport: Vgen.Viewport, clientLayout: Vtree.ClientLayout, fontMapper: Font.Mapper, customRenderer: Vgen.CustomRenderer, fallbackMap: {
127
136
  [key: string]: string;
128
- }, pageNumberOffset: number, documentURLTransformer: Base.DocumentURLTransformer, counterStore: Counters.CounterStore, pageProgression?: Constants.PageProgression, isVersoFirstPage?: boolean);
137
+ }, pageNumberOffset: number, documentURLTransformer: Base.DocumentURLTransformer, counterStore: Counters.CounterStore, cmykStore: CmykStore.CmykStore, pageProgression?: Constants.PageProgression, isVersoFirstPage?: boolean);
129
138
  init(): Task.Result<boolean>;
130
139
  private matchStartPageSide;
131
140
  /** @override */
@@ -143,6 +152,38 @@ export declare class StyleInstance extends Exprs.Context implements CssStyler.Fl
143
152
  */
144
153
  private evalSupportsSelector;
145
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;
146
187
  /**
147
188
  * @param noLookAhead Do not look ahead elements that are not styled yet
148
189
  * @return document offset of the given layoutPosition
@@ -157,6 +198,9 @@ export declare class StyleInstance extends Exprs.Context implements CssStyler.Fl
157
198
  selectPageMaster(cascadedPageStyle: CssCascade.ElementStyle): PageMaster.PageMasterInstance;
158
199
  flowChunkIsAfterParentFlowForcedBreak(flowChunk: Vtree.FlowChunk): boolean;
159
200
  setFormattingContextToColumn(column: LayoutType.Column, flowName: string): void;
201
+ beginIsolatedRootPageFloatLayoutContext(): PageFloats.PageFloatLayoutContext;
202
+ endIsolatedRootPageFloatLayoutContext(originalRootPageFloatLayoutContext: PageFloats.PageFloatLayoutContext): void;
203
+ hasActiveRootPageFloatLayoutContext(): boolean;
160
204
  layoutDeferredPageFloats(column: LayoutType.Column): Task.Result<boolean>;
161
205
  getLastAfterPositionIfDeferredFloatsExists(column: LayoutType.Column, newPosition: Vtree.ChunkPosition | null): Vtree.ChunkPosition | null;
162
206
  /**