@vivliostyle/core 2.24.2 → 2.25.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.
Files changed (63) hide show
  1. package/lib/vivliostyle/adaptive-viewer.d.ts +167 -167
  2. package/lib/vivliostyle/asserts.d.ts +21 -21
  3. package/lib/vivliostyle/assets.d.ts +35 -35
  4. package/lib/vivliostyle/base.d.ts +189 -189
  5. package/lib/vivliostyle/break-position.d.ts +39 -39
  6. package/lib/vivliostyle/break.d.ts +112 -112
  7. package/lib/vivliostyle/cfi.d.ts +77 -77
  8. package/lib/vivliostyle/columns.d.ts +52 -52
  9. package/lib/vivliostyle/constants.d.ts +53 -53
  10. package/lib/vivliostyle/core-viewer.d.ts +240 -240
  11. package/lib/vivliostyle/counters.d.ts +127 -127
  12. package/lib/vivliostyle/css-cascade.d.ts +974 -954
  13. package/lib/vivliostyle/css-logical-util.d.ts +3 -3
  14. package/lib/vivliostyle/css-page.d.ts +451 -450
  15. package/lib/vivliostyle/css-parser.d.ts +320 -320
  16. package/lib/vivliostyle/css-prop.d.ts +74 -74
  17. package/lib/vivliostyle/css-styler.d.ts +210 -210
  18. package/lib/vivliostyle/css-tokenizer.d.ts +243 -243
  19. package/lib/vivliostyle/css-validator.d.ts +319 -319
  20. package/lib/vivliostyle/css.d.ts +205 -205
  21. package/lib/vivliostyle/diff.d.ts +26 -26
  22. package/lib/vivliostyle/display.d.ts +62 -57
  23. package/lib/vivliostyle/epub.d.ts +329 -329
  24. package/lib/vivliostyle/exprs.d.ts +395 -395
  25. package/lib/vivliostyle/font.d.ts +87 -87
  26. package/lib/vivliostyle/footnotes.d.ts +41 -41
  27. package/lib/vivliostyle/geometry-util.d.ts +110 -110
  28. package/lib/vivliostyle/layout-helper.d.ts +16 -15
  29. package/lib/vivliostyle/layout-processor.d.ts +73 -73
  30. package/lib/vivliostyle/layout-retryers.d.ts +21 -21
  31. package/lib/vivliostyle/layout-util.d.ts +55 -55
  32. package/lib/vivliostyle/layout.d.ts +456 -456
  33. package/lib/vivliostyle/logging.d.ts +56 -56
  34. package/lib/vivliostyle/matchers.d.ts +36 -36
  35. package/lib/vivliostyle/math-util.d.ts +22 -22
  36. package/lib/vivliostyle/net.d.ts +72 -72
  37. package/lib/vivliostyle/ops.d.ts +263 -263
  38. package/lib/vivliostyle/page-floats.d.ts +178 -178
  39. package/lib/vivliostyle/page-master.d.ts +247 -247
  40. package/lib/vivliostyle/plugin.d.ts +172 -172
  41. package/lib/vivliostyle/print.d.ts +7 -7
  42. package/lib/vivliostyle/profile.d.ts +59 -59
  43. package/lib/vivliostyle/pseudo-element.d.ts +32 -32
  44. package/lib/vivliostyle/repetitive-element.d.ts +162 -162
  45. package/lib/vivliostyle/scripts.d.ts +15 -15
  46. package/lib/vivliostyle/sha1.d.ts +33 -33
  47. package/lib/vivliostyle/shared.d.ts +24 -24
  48. package/lib/vivliostyle/sizing.d.ts +29 -29
  49. package/lib/vivliostyle/table.d.ts +263 -263
  50. package/lib/vivliostyle/task-util.d.ts +37 -37
  51. package/lib/vivliostyle/task.d.ts +357 -357
  52. package/lib/vivliostyle/text-polyfill.d.ts +3 -3
  53. package/lib/vivliostyle/toc.d.ts +64 -64
  54. package/lib/vivliostyle/types.d.ts +977 -977
  55. package/lib/vivliostyle/urls.d.ts +25 -25
  56. package/lib/vivliostyle/vgen.d.ts +213 -213
  57. package/lib/vivliostyle/viewer-app.d.ts +19 -19
  58. package/lib/vivliostyle/vtree.d.ts +392 -392
  59. package/lib/vivliostyle/xml-doc.d.ts +88 -88
  60. package/lib/vivliostyle.d.ts +6 -6
  61. package/lib/vivliostyle.js +1 -1
  62. package/lib/vivliostyle.js.map +1 -1
  63. package/package.json +5 -5
@@ -1,456 +1,456 @@
1
- /**
2
- * Copyright 2013 Google, Inc.
3
- * Copyright 2015 Trim-marks Inc.
4
- * Copyright 2019 Vivliostyle Foundation
5
- *
6
- * Vivliostyle.js is free software: you can redistribute it and/or modify
7
- * it under the terms of the GNU Affero General Public License as published by
8
- * the Free Software Foundation, either version 3 of the License, or
9
- * (at your option) any later version.
10
- *
11
- * Vivliostyle.js is distributed in the hope that it will be useful,
12
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
- * GNU Affero General Public License for more details.
15
- *
16
- * You should have received a copy of the GNU Affero General Public License
17
- * along with Vivliostyle.js. If not, see <http://www.gnu.org/licenses/>.
18
- *
19
- * @fileoverview Layout - Fills a column with styled content.
20
- * This file does not communicate with the styling system directly.
21
- * Instead it goes through the layout interface that gives it one view tree
22
- * node at a time.
23
- */
24
- import * as LayoutRetryers from "./layout-retryers";
25
- import * as BreakPosition from "./break-position";
26
- import * as Css from "./css";
27
- import * as GeometryUtil from "./geometry-util";
28
- import * as PageFloats from "./page-floats";
29
- import * as Matchers from "./matchers";
30
- import * as PseudoElement from "./pseudo-element";
31
- import * as Task from "./task";
32
- import * as VtreeImpl from "./vtree";
33
- import { FragmentLayoutConstraintType, Layout, RepetitiveElement, Selectors, Vtree } from "./types";
34
- export declare const isInstanceOfAfterIfContinuesLayoutConstraint: typeof Selectors.isInstanceOfAfterIfContinuesLayoutConstraint;
35
- export declare const registerFragmentIndex: typeof Matchers.NthFragmentMatcher.registerFragmentIndex;
36
- export declare const clearFragmentIndices: typeof Matchers.NthFragmentMatcher.clearFragmentIndices;
37
- export declare class AfterIfContinues implements Selectors.AfterIfContinues {
38
- readonly sourceNode: Element;
39
- readonly styler: PseudoElement.PseudoelementStyler;
40
- constructor(sourceNode: Element, styler: PseudoElement.PseudoelementStyler);
41
- createElement(column: Layout.Column, parentNodeContext: Vtree.NodeContext): Task.Result<Element>;
42
- private createNodePositionForPseudoElement;
43
- private createShadowContext;
44
- }
45
- export declare class AfterIfContinuesLayoutConstraint implements Selectors.AfterIfContinuesLayoutConstraint {
46
- nodeContext: Vtree.NodeContext;
47
- afterIfContinues: Selectors.AfterIfContinues;
48
- pseudoElementHeight: number;
49
- flagmentLayoutConstraintType: FragmentLayoutConstraintType;
50
- constructor(nodeContext: Vtree.NodeContext, afterIfContinues: Selectors.AfterIfContinues, pseudoElementHeight: number);
51
- /** @override */
52
- allowLayout(nodeContext: Vtree.NodeContext, overflownNodeContext: Vtree.NodeContext, column: Layout.Column): boolean;
53
- /** @override */
54
- nextCandidate(nodeContext: Vtree.NodeContext): boolean;
55
- /** @override */
56
- postLayout(allowed: boolean, positionAfter: Vtree.NodeContext, initialPosition: Vtree.NodeContext, column: Layout.Column): void;
57
- /** @override */
58
- finishBreak(nodeContext: Vtree.NodeContext, column: Layout.Column): Task.Result<boolean>;
59
- getRepetitiveElements(): AfterIfContinuesElementsOffset;
60
- /** @override */
61
- equalsTo(constraint: Layout.FragmentLayoutConstraint): boolean;
62
- /** @override */
63
- getPriorityOfFinishBreak(): number;
64
- }
65
- export declare class AfterIfContinuesElementsOffset implements Selectors.AfterIfContinuesElementsOffset {
66
- nodeContext: any;
67
- pseudoElementHeight: any;
68
- constructor(nodeContext: any, pseudoElementHeight: any);
69
- /** @override */
70
- calculateOffset(nodeContext: Vtree.NodeContext): number;
71
- /** @override */
72
- calculateMinimumOffset(nodeContext: Vtree.NodeContext): number;
73
- affectTo(nodeContext: Vtree.NodeContext): boolean;
74
- }
75
- export declare function processAfterIfContinues(result: Task.Result<Vtree.NodeContext>, column: Layout.Column): Task.Result<Vtree.NodeContext>;
76
- export declare function processAfterIfContinuesOfAncestors(nodeContext: Vtree.NodeContext, column: Layout.Column): Task.Result<boolean>;
77
- export declare function calculatePseudoElementHeight(nodeContext: Vtree.NodeContext, column: Layout.Column, pseudoElement: Element): number;
78
- export declare const mediaTags: {
79
- img: boolean;
80
- svg: boolean;
81
- audio: boolean;
82
- video: boolean;
83
- };
84
- /**
85
- * Represents a constraint on layout
86
- */
87
- export declare type LayoutConstraint = Layout.LayoutConstraint;
88
- /**
89
- * Represents a constraint that allows layout if all the constraints it contains
90
- * allow layout.
91
- */
92
- export declare class AllLayoutConstraint implements LayoutConstraint {
93
- readonly constraints: LayoutConstraint[];
94
- constructor(constraints: LayoutConstraint[]);
95
- /** @override */
96
- allowLayout(nodeContext: Vtree.NodeContext): boolean;
97
- }
98
- /**
99
- * Represents constraints on laying out fragments
100
- */
101
- export declare type FragmentLayoutConstraint = Layout.FragmentLayoutConstraint;
102
- export declare type BreakPositionAndNodeContext = Layout.BreakPositionAndNodeContext;
103
- /**
104
- * Potential breaking position inside CSS box (between lines).
105
- * @param checkPoints array of breaking points for breakable block
106
- */
107
- export declare class BoxBreakPosition extends BreakPosition.AbstractBreakPosition implements Layout.BoxBreakPosition {
108
- readonly checkPoints: Vtree.NodeContext[];
109
- readonly penalty: number;
110
- private alreadyEvaluated;
111
- breakNodeContext: Vtree.NodeContext;
112
- constructor(checkPoints: Vtree.NodeContext[], penalty: number);
113
- findAcceptableBreak(column: Column, penalty: number): Vtree.NodeContext;
114
- getMinBreakPenalty(): number;
115
- getNodeContext(): Vtree.NodeContext;
116
- }
117
- export declare function validateCheckPoints(checkPoints: Vtree.NodeContext[]): void;
118
- export declare class Column extends VtreeImpl.Container implements Layout.Column {
119
- layoutContext: Vtree.LayoutContext;
120
- clientLayout: Vtree.ClientLayout;
121
- readonly layoutConstraint: LayoutConstraint;
122
- readonly pageFloatLayoutContext: PageFloats.PageFloatLayoutContext;
123
- last: Node;
124
- viewDocument: Document;
125
- flowRootFormattingContext: Vtree.FormattingContext;
126
- isFloat: boolean;
127
- isFootnote: boolean;
128
- startEdge: number;
129
- endEdge: number;
130
- beforeEdge: number;
131
- afterEdge: number;
132
- footnoteEdge: number;
133
- box: GeometryUtil.Rect;
134
- chunkPositions: Vtree.ChunkPosition[];
135
- bands: GeometryUtil.Band[];
136
- overflown: boolean;
137
- breakPositions: BreakPosition.BreakPosition[];
138
- pageBreakType: string | null;
139
- forceNonfitting: boolean;
140
- leftFloatEdge: number;
141
- rightFloatEdge: number;
142
- bottommostFloatTop: number;
143
- stopAtOverflow: boolean;
144
- lastAfterPosition: Vtree.NodePosition | null;
145
- fragmentLayoutConstraints: FragmentLayoutConstraint[];
146
- pseudoParent: Column;
147
- nodeContextOverflowingDueToRepetitiveElements: Vtree.NodeContext | null;
148
- blockDistanceToBlockEndFloats: number;
149
- breakAtTheEdgeBeforeFloat: string | null;
150
- constructor(element: Element, layoutContext: Vtree.LayoutContext, clientLayout: Vtree.ClientLayout, layoutConstraint: LayoutConstraint, pageFloatLayoutContext: PageFloats.PageFloatLayoutContext);
151
- getTopEdge(): number;
152
- getBottomEdge(): number;
153
- getLeftEdge(): number;
154
- getRightEdge(): number;
155
- isFloatNodeContext(nodeContext: Vtree.NodeContext): boolean;
156
- stopByOverflow(nodeContext: Vtree.NodeContext): boolean;
157
- isOverflown(edge: number): boolean;
158
- getExclusions(): GeometryUtil.Shape[];
159
- openAllViews(position: Vtree.NodePosition): Task.Result<Vtree.NodeContext>;
160
- calculateOffsetInNodeForNodeContext(position: Vtree.NodePosition): number;
161
- /**
162
- * @param count first-XXX nesting identifier
163
- */
164
- maybePeelOff(position: Vtree.NodeContext, count: number): Task.Result<Vtree.NodeContext>;
165
- /**
166
- * Builds the view until a CSS box edge is reached.
167
- * @param position start source position.
168
- * @param checkPoints array to append possible breaking points.
169
- * @return holding box edge position reached or null if the source is exhausted.
170
- */
171
- buildViewToNextBlockEdge(position: Vtree.NodeContext, checkPoints: Vtree.NodeContext[]): Task.Result<Vtree.NodeContext>;
172
- nextInTree(position: Vtree.NodeContext, atUnforcedBreak?: boolean): Task.Result<Vtree.NodeContext>;
173
- /**
174
- * Builds the view for a single unbreakable element.
175
- * @param position start source position.
176
- * @return holding box edge position reached or null if the source is exhausted.
177
- */
178
- buildDeepElementView(position: Vtree.NodeContext): Task.Result<Vtree.NodeContext>;
179
- /**
180
- * Create a single floating element (for exclusion areas).
181
- * @param ref container's child to insert float before (can be null).
182
- * @param side float side ("left" or "right").
183
- * @param width float inline dimension.
184
- * @param height float box progression dimension.
185
- * @return newly created float element.
186
- */
187
- createFloat(ref: Node, side: string, width: number, height: number): Element;
188
- /**
189
- * Remove all the exclusion floats.
190
- */
191
- killFloats(): void;
192
- /**
193
- * Create exclusion floats for a column.
194
- */
195
- createFloats(): void;
196
- /**
197
- * @param nodeContext position after the block
198
- * @param checkPoints array of possible breaking points.
199
- * @param index index of the breaking point
200
- * @param boxOffset box offset
201
- * @return edge position
202
- */
203
- calculateEdge(nodeContext: Vtree.NodeContext, checkPoints: Vtree.NodeContext[], index: number, boxOffset: number): number;
204
- /**
205
- * Parse CSS computed length (in pixels)
206
- * @param val CSS length in "px" units or a number.
207
- * @return value in pixels or 0 if not parsable
208
- */
209
- parseComputedLength(val: string | number): number;
210
- /**
211
- * Reads element's computed CSS margin.
212
- */
213
- getComputedMargin(element: Element): GeometryUtil.Insets;
214
- /**
215
- * Reads element's computed padding + borders.
216
- */
217
- getComputedPaddingBorder(element: Element): GeometryUtil.Insets;
218
- /**
219
- * Reads element's computed CSS insets(margins + border + padding or margins :
220
- * depends on box-sizing)
221
- */
222
- getComputedInsets(element: Element): GeometryUtil.Insets;
223
- /**
224
- * Set element's computed CSS insets to Column Container
225
- */
226
- setComputedInsets(element: Element, container: Column): void;
227
- /**
228
- * Set element's computed width and height to Column Container
229
- */
230
- setComputedWidthAndHeight(element: Element, container: Column): void;
231
- /**
232
- * Layout a single unbreakable element.
233
- */
234
- layoutUnbreakable(nodeContextIn: Vtree.NodeContext): Task.Result<Vtree.NodeContext>;
235
- /**
236
- * Layout a single float element.
237
- */
238
- layoutFloat(nodeContext: Vtree.NodeContext): Task.Result<Vtree.NodeContext>;
239
- setupFloatArea(area: PageFloatArea, floatReference: PageFloats.FloatReference, floatSide: string, anchorEdge: number | null, strategy: PageFloats.PageFloatLayoutStrategy, condition: PageFloats.PageFloatPlacementCondition): boolean;
240
- createPageFloatArea(float: PageFloats.PageFloat | null, floatSide: string, anchorEdge: number | null, strategy: PageFloats.PageFloatLayoutStrategy, condition: PageFloats.PageFloatPlacementCondition): PageFloatArea | null;
241
- layoutSinglePageFloatFragment(continuations: PageFloats.PageFloatContinuation[], floatSide: string, clearSide: string | null, allowFragmented: boolean, strategy: PageFloats.PageFloatLayoutStrategy, anchorEdge: number | null, pageFloatFragment?: PageFloats.PageFloatFragment | null): Task.Result<SinglePageFloatLayoutResult>;
242
- layoutPageFloatInner(continuation: PageFloats.PageFloatContinuation, strategy: PageFloats.PageFloatLayoutStrategy, anchorEdge: number | null, pageFloatFragment?: PageFloats.PageFloatFragment): Task.Result<boolean>;
243
- /**
244
- * @returns Represents if the layout was succeeded or not
245
- */
246
- private layoutStashedPageFloats;
247
- setFloatAnchorViewNode(nodeContext: Vtree.NodeContext): Vtree.NodeContext;
248
- resolveFloatReferenceFromColumnSpan(floatReference: PageFloats.FloatReference, columnSpan: Css.Val, nodeContext: Vtree.NodeContext): Task.Result<PageFloats.FloatReference>;
249
- layoutPageFloat(nodeContext: Vtree.NodeContext): Task.Result<Vtree.NodeContext>;
250
- processLineStyling(nodeContext: Vtree.NodeContext, resNodeContext: Vtree.NodeContext, checkPoints: Vtree.NodeContext[]): Task.Result<Vtree.NodeContext>;
251
- isLoneImage(checkPoints: Vtree.NodeContext[]): boolean;
252
- getTrailingMarginEdgeAdjustment(trailingEdgeContexts: Vtree.NodeContext[]): number;
253
- /**
254
- * Layout a single CSS box.
255
- */
256
- layoutBreakableBlock(nodeContext: Vtree.NodeContext): Task.Result<Vtree.NodeContext>;
257
- postLayoutBlock(nodeContext: Vtree.NodeContext, checkPoints: Vtree.NodeContext[]): void;
258
- findEndOfLine(linePosition: number, checkPoints: Vtree.NodeContext[], isUpdateMaxReachedAfterEdge: boolean): {
259
- nodeContext: Vtree.NodeContext;
260
- index: number;
261
- checkPointIndex: number;
262
- };
263
- findAcceptableBreakInside(checkPoints: Vtree.NodeContext[], edgePosition: number, force: boolean): Vtree.NodeContext;
264
- resolveTextNodeBreaker(nodeContext: Vtree.NodeContext): TextNodeBreaker;
265
- /**
266
- * Read ranges skipping special elements
267
- */
268
- getRangeBoxes(start: Node, end: Node): Vtree.ClientRect[];
269
- /**
270
- * Give block's initial and final nodes, find positions of the line bottoms.
271
- * This is, of course, somewhat hacky implementation.
272
- * @return position of line breaks
273
- */
274
- findLinePositions(checkPoints: Vtree.NodeContext[]): number[];
275
- calculateClonedPaddingBorder(nodeContext: Vtree.NodeContext): number;
276
- private getOffsetByRepetitiveElements;
277
- findBoxBreakPosition(bp: BoxBreakPosition, force: boolean): Vtree.NodeContext;
278
- getAfterEdgeOfBlockContainer(nodeContext: Vtree.NodeContext): number;
279
- findFirstOverflowingEdgeAndCheckPoint(checkPoints: Vtree.NodeContext[]): {
280
- edge: number;
281
- checkPoint: Vtree.NodeContext | null;
282
- };
283
- findEdgeBreakPosition(bp: BreakPosition.EdgeBreakPosition): Vtree.NodeContext;
284
- /**
285
- * Finalize a line break.
286
- * @return holing true
287
- */
288
- finishBreak(nodeContext: Vtree.NodeContext, forceRemoveSelf: boolean, endOfColumn: boolean): Task.Result<boolean>;
289
- findAcceptableBreakPosition(): BreakPositionAndNodeContext;
290
- doFinishBreak(nodeContext: Vtree.NodeContext, overflownNodeContext: Vtree.NodeContext, initialNodeContext: Vtree.NodeContext, initialComputedBlockSize: number): Task.Result<Vtree.NodeContext>;
291
- /**
292
- * Determines if a page break is acceptable at this position
293
- */
294
- isBreakable(flowPosition: Vtree.NodeContext): boolean;
295
- /**
296
- * Determines if an indent value is zero
297
- */
298
- zeroIndent(val: string | number): boolean;
299
- /**
300
- * @return true if overflows
301
- */
302
- checkOverflowAndSaveEdge(nodeContext: Vtree.NodeContext, trailingEdgeContexts: Vtree.NodeContext[]): boolean;
303
- /**
304
- * Save a possible page break position on a CSS block edge. Check if it
305
- * overflows.
306
- * @return true if overflows
307
- */
308
- checkOverflowAndSaveEdgeAndBreakPosition(nodeContext: Vtree.NodeContext, trailingEdgeContexts: Vtree.NodeContext[], saveEvenOverflown: boolean, breakAtTheEdge: string | null): boolean;
309
- applyClearance(nodeContext: Vtree.NodeContext): boolean;
310
- isBFC(formattingContext: Vtree.FormattingContext): boolean;
311
- /**
312
- * Skips positions until either the start of unbreakable block or inline
313
- * content. Also sets breakBefore on the result combining break-before and
314
- * break-after properties from all elements that meet at the edge.
315
- */
316
- skipEdges(nodeContext: Vtree.NodeContext, leadingEdge: boolean, forcedBreakValue: string | null): Task.Result<Vtree.NodeContext>;
317
- /**
318
- * Skips non-renderable positions until it hits the end of the flow or some
319
- * renderable content. Returns the nodeContext that was passed in if some
320
- * content remains and null if all content could be skipped.
321
- */
322
- skipTailEdges(nodeContext: Vtree.NodeContext): Task.Result<Vtree.NodeContext>;
323
- layoutFloatOrFootnote(nodeContext: Vtree.NodeContext): Task.Result<Vtree.NodeContext>;
324
- /**
325
- * Layout next portion of the source.
326
- */
327
- layoutNext(nodeContext: Vtree.NodeContext, leadingEdge: boolean, forcedBreakValue?: string | null): Task.Result<Vtree.NodeContext>;
328
- clearOverflownViewNodes(nodeContext: Vtree.NodeContext, removeSelf: boolean): void;
329
- initGeom(): void;
330
- init(): void;
331
- /**
332
- * Save the potential breaking position at the edge. Should, in general, save
333
- * "after" position but only after skipping all of the "before" ones and
334
- * getting to the non-empty content (to get breakAtEdge right).
335
- */
336
- saveEdgeBreakPosition(position: Vtree.NodeContext, breakAtEdge: string | null, overflows: boolean): void;
337
- /**
338
- * @param checkPoints array of breaking points for breakable block
339
- */
340
- saveBoxBreakPosition(checkPoints: Vtree.NodeContext[]): void;
341
- updateMaxReachedAfterEdge(afterEdge: number): void;
342
- /**
343
- * @param chunkPosition starting position.
344
- * @return holding end position.
345
- */
346
- layout(chunkPosition: Vtree.ChunkPosition, leadingEdge: boolean, breakAfter?: string | null): Task.Result<Vtree.ChunkPosition>;
347
- isFullWithPageFloats(): boolean;
348
- getMaxBlockSizeOfPageFloats(): number;
349
- doFinishBreakOfFragmentLayoutConstraints(nodeContext: Vtree.NodeContext): Task.Result<boolean>;
350
- /**
351
- * @param nodeContext starting position.
352
- * @return holding end position.
353
- */
354
- doLayout(nodeContext: Vtree.NodeContext, leadingEdge: boolean, breakAfter?: string | null): Task.Result<{
355
- nodeContext: Vtree.NodeContext;
356
- overflownNodeContext: Vtree.NodeContext;
357
- }>;
358
- /**
359
- * Re-layout already laid-out chunks. Return the position of the last flow if
360
- * there is an overflow.
361
- * TODO: deal with chunks that did not fit at all.
362
- * @return holding end position.
363
- */
364
- redoLayout(): Task.Result<Vtree.ChunkPosition>;
365
- saveDistanceToBlockEndFloats(): void;
366
- collectElementsOffset(): RepetitiveElement.ElementsOffset[];
367
- }
368
- /**
369
- * Represents a "pseudo"-column nested inside a real column.
370
- * This class is created to handle parallel fragmented flows (e.g. table columns
371
- * in a single table row). A pseudo-column behaves in the same way as the
372
- * original column, sharing its properties. Property changes on the
373
- * pseudo-column are not propagated to the original column. The LayoutContext of
374
- * the original column is also cloned and used by the pseudo-column, not to
375
- * propagate state changes of the LayoutContext caused by the pseudo-column.
376
- * @param column The original (parent) column
377
- * @param viewRoot Root element for the pseudo-column, i.e., the root of the
378
- * fragmented flow.
379
- * @param parentNodeContext A NodeContext generating this PseudoColumn
380
- */
381
- export declare class PseudoColumn {
382
- startNodeContexts: Vtree.NodeContext[];
383
- private column;
384
- constructor(column: Layout.Column, viewRoot: Element, parentNodeContext: Vtree.NodeContext);
385
- /**
386
- * @param chunkPosition starting position.
387
- * @return holding end position.
388
- */
389
- layout(chunkPosition: Vtree.ChunkPosition, leadingEdge: boolean): Task.Result<Vtree.ChunkPosition>;
390
- findAcceptableBreakPosition(allowBreakAtStartPosition: boolean): Layout.BreakPositionAndNodeContext;
391
- /**
392
- * @return holing true
393
- */
394
- finishBreak(nodeContext: Vtree.NodeContext, forceRemoveSelf: boolean, endOfColumn: boolean): Task.Result<boolean>;
395
- doFinishBreakOfFragmentLayoutConstraints(positionAfter: Vtree.NodeContext): void;
396
- isStartNodeContext(nodeContext: Vtree.NodeContext): boolean;
397
- isLastAfterNodeContext(nodeContext: Vtree.NodeContext): boolean;
398
- getColumnElement(): Element;
399
- getColumn(): Layout.Column;
400
- }
401
- export declare type SinglePageFloatLayoutResult = Layout.SinglePageFloatLayoutResult;
402
- /**
403
- * breaking point resolver for Text Node.
404
- */
405
- export declare class TextNodeBreaker implements Layout.TextNodeBreaker {
406
- breakTextNode(textNode: Text, nodeContext: Vtree.NodeContext, low: number, checkPoints: Vtree.NodeContext[], checkpointIndex: number, force: boolean): Vtree.NodeContext;
407
- breakAfterSoftHyphen(textNode: Text, text: string, viewIndex: number, nodeContext: Vtree.NodeContext): number;
408
- breakAfterOtherCharacter(textNode: Text, text: string, viewIndex: number, nodeContext: Vtree.NodeContext): number;
409
- updateNodeContext(nodeContext: Vtree.NodeContext, viewIndex: number, textNode: Text): Vtree.NodeContext;
410
- static instance: TextNodeBreaker;
411
- }
412
- export declare function resolveHyphenateCharacter(nodeContext: Vtree.NodeContext): string;
413
- export declare class ColumnLayoutRetryer extends LayoutRetryers.AbstractLayoutRetryer {
414
- readonly leadingEdge: boolean;
415
- breakAfter: string | null;
416
- private initialPageBreakType;
417
- initialComputedBlockSize: number;
418
- private initialOverflown;
419
- context: {
420
- overflownNodeContext: Vtree.NodeContext;
421
- };
422
- constructor(leadingEdge: boolean, breakAfter?: string | null);
423
- resolveLayoutMode(nodeContext: Vtree.NodeContext): Layout.LayoutMode;
424
- prepareLayout(nodeContext: Vtree.NodeContext, column: Layout.Column): void;
425
- clearNodes(initialPosition: Vtree.NodeContext): void;
426
- saveState(nodeContext: Vtree.NodeContext, column: Layout.Column): void;
427
- restoreState(nodeContext: Vtree.NodeContext, column: Layout.Column): void;
428
- }
429
- export declare class DefaultLayoutMode implements Layout.LayoutMode {
430
- readonly leadingEdge: boolean;
431
- readonly breakAfter: string | null;
432
- readonly context: {
433
- overflownNodeContext: Vtree.NodeContext;
434
- };
435
- constructor(leadingEdge: boolean, breakAfter: string | null, context: {
436
- overflownNodeContext: Vtree.NodeContext;
437
- });
438
- /** @override */
439
- doLayout(nodeContext: Vtree.NodeContext, column: Layout.Column): Task.Result<Vtree.NodeContext>;
440
- /** @override */
441
- accept(nodeContext: Vtree.NodeContext, column: Layout.Column): boolean;
442
- /** @override */
443
- postLayout(positionAfter: Vtree.NodeContext, initialPosition: Vtree.NodeContext, column: Layout.Column, accepted: boolean): boolean;
444
- }
445
- export declare class PageFloatArea extends Column implements Layout.PageFloatArea {
446
- readonly floatSide: string;
447
- readonly parentContainer: Vtree.Container;
448
- private rootViewNodes;
449
- private floatMargins;
450
- adjustContentRelativeSize: boolean;
451
- constructor(floatSide: string, element: Element, layoutContext: Vtree.LayoutContext, clientLayout: Vtree.ClientLayout, layoutConstraint: LayoutConstraint, pageFloatLayoutContext: PageFloats.PageFloatLayoutContext, parentContainer: Vtree.Container);
452
- openAllViews(position: Vtree.NodePosition): Task.Result<Vtree.NodeContext>;
453
- convertPercentageSizesToPx(target: Element): void;
454
- fixFloatSizeAndPosition(nodeContext: Vtree.NodeContext): void;
455
- getContentInlineSize(): number;
456
- }
1
+ /**
2
+ * Copyright 2013 Google, Inc.
3
+ * Copyright 2015 Trim-marks Inc.
4
+ * Copyright 2019 Vivliostyle Foundation
5
+ *
6
+ * Vivliostyle.js is free software: you can redistribute it and/or modify
7
+ * it under the terms of the GNU Affero General Public License as published by
8
+ * the Free Software Foundation, either version 3 of the License, or
9
+ * (at your option) any later version.
10
+ *
11
+ * Vivliostyle.js is distributed in the hope that it will be useful,
12
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
13
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14
+ * GNU Affero General Public License for more details.
15
+ *
16
+ * You should have received a copy of the GNU Affero General Public License
17
+ * along with Vivliostyle.js. If not, see <http://www.gnu.org/licenses/>.
18
+ *
19
+ * @fileoverview Layout - Fills a column with styled content.
20
+ * This file does not communicate with the styling system directly.
21
+ * Instead it goes through the layout interface that gives it one view tree
22
+ * node at a time.
23
+ */
24
+ import * as LayoutRetryers from "./layout-retryers";
25
+ import * as BreakPosition from "./break-position";
26
+ import * as Css from "./css";
27
+ import * as GeometryUtil from "./geometry-util";
28
+ import * as PageFloats from "./page-floats";
29
+ import * as Matchers from "./matchers";
30
+ import * as PseudoElement from "./pseudo-element";
31
+ import * as Task from "./task";
32
+ import * as VtreeImpl from "./vtree";
33
+ import { FragmentLayoutConstraintType, Layout, RepetitiveElement, Selectors, Vtree } from "./types";
34
+ export declare const isInstanceOfAfterIfContinuesLayoutConstraint: typeof Selectors.isInstanceOfAfterIfContinuesLayoutConstraint;
35
+ export declare const registerFragmentIndex: typeof Matchers.NthFragmentMatcher.registerFragmentIndex;
36
+ export declare const clearFragmentIndices: typeof Matchers.NthFragmentMatcher.clearFragmentIndices;
37
+ export declare class AfterIfContinues implements Selectors.AfterIfContinues {
38
+ readonly sourceNode: Element;
39
+ readonly styler: PseudoElement.PseudoelementStyler;
40
+ constructor(sourceNode: Element, styler: PseudoElement.PseudoelementStyler);
41
+ createElement(column: Layout.Column, parentNodeContext: Vtree.NodeContext): Task.Result<Element>;
42
+ private createNodePositionForPseudoElement;
43
+ private createShadowContext;
44
+ }
45
+ export declare class AfterIfContinuesLayoutConstraint implements Selectors.AfterIfContinuesLayoutConstraint {
46
+ nodeContext: Vtree.NodeContext;
47
+ afterIfContinues: Selectors.AfterIfContinues;
48
+ pseudoElementHeight: number;
49
+ flagmentLayoutConstraintType: FragmentLayoutConstraintType;
50
+ constructor(nodeContext: Vtree.NodeContext, afterIfContinues: Selectors.AfterIfContinues, pseudoElementHeight: number);
51
+ /** @override */
52
+ allowLayout(nodeContext: Vtree.NodeContext, overflownNodeContext: Vtree.NodeContext, column: Layout.Column): boolean;
53
+ /** @override */
54
+ nextCandidate(nodeContext: Vtree.NodeContext): boolean;
55
+ /** @override */
56
+ postLayout(allowed: boolean, positionAfter: Vtree.NodeContext, initialPosition: Vtree.NodeContext, column: Layout.Column): void;
57
+ /** @override */
58
+ finishBreak(nodeContext: Vtree.NodeContext, column: Layout.Column): Task.Result<boolean>;
59
+ getRepetitiveElements(): AfterIfContinuesElementsOffset;
60
+ /** @override */
61
+ equalsTo(constraint: Layout.FragmentLayoutConstraint): boolean;
62
+ /** @override */
63
+ getPriorityOfFinishBreak(): number;
64
+ }
65
+ export declare class AfterIfContinuesElementsOffset implements Selectors.AfterIfContinuesElementsOffset {
66
+ nodeContext: any;
67
+ pseudoElementHeight: any;
68
+ constructor(nodeContext: any, pseudoElementHeight: any);
69
+ /** @override */
70
+ calculateOffset(nodeContext: Vtree.NodeContext): number;
71
+ /** @override */
72
+ calculateMinimumOffset(nodeContext: Vtree.NodeContext): number;
73
+ affectTo(nodeContext: Vtree.NodeContext): boolean;
74
+ }
75
+ export declare function processAfterIfContinues(result: Task.Result<Vtree.NodeContext>, column: Layout.Column): Task.Result<Vtree.NodeContext>;
76
+ export declare function processAfterIfContinuesOfAncestors(nodeContext: Vtree.NodeContext, column: Layout.Column): Task.Result<boolean>;
77
+ export declare function calculatePseudoElementHeight(nodeContext: Vtree.NodeContext, column: Layout.Column, pseudoElement: Element): number;
78
+ export declare const mediaTags: {
79
+ img: boolean;
80
+ svg: boolean;
81
+ audio: boolean;
82
+ video: boolean;
83
+ };
84
+ /**
85
+ * Represents a constraint on layout
86
+ */
87
+ export type LayoutConstraint = Layout.LayoutConstraint;
88
+ /**
89
+ * Represents a constraint that allows layout if all the constraints it contains
90
+ * allow layout.
91
+ */
92
+ export declare class AllLayoutConstraint implements LayoutConstraint {
93
+ readonly constraints: LayoutConstraint[];
94
+ constructor(constraints: LayoutConstraint[]);
95
+ /** @override */
96
+ allowLayout(nodeContext: Vtree.NodeContext): boolean;
97
+ }
98
+ /**
99
+ * Represents constraints on laying out fragments
100
+ */
101
+ export type FragmentLayoutConstraint = Layout.FragmentLayoutConstraint;
102
+ export type BreakPositionAndNodeContext = Layout.BreakPositionAndNodeContext;
103
+ /**
104
+ * Potential breaking position inside CSS box (between lines).
105
+ * @param checkPoints array of breaking points for breakable block
106
+ */
107
+ export declare class BoxBreakPosition extends BreakPosition.AbstractBreakPosition implements Layout.BoxBreakPosition {
108
+ readonly checkPoints: Vtree.NodeContext[];
109
+ readonly penalty: number;
110
+ private alreadyEvaluated;
111
+ breakNodeContext: Vtree.NodeContext;
112
+ constructor(checkPoints: Vtree.NodeContext[], penalty: number);
113
+ findAcceptableBreak(column: Column, penalty: number): Vtree.NodeContext;
114
+ getMinBreakPenalty(): number;
115
+ getNodeContext(): Vtree.NodeContext;
116
+ }
117
+ export declare function validateCheckPoints(checkPoints: Vtree.NodeContext[]): void;
118
+ export declare class Column extends VtreeImpl.Container implements Layout.Column {
119
+ layoutContext: Vtree.LayoutContext;
120
+ clientLayout: Vtree.ClientLayout;
121
+ readonly layoutConstraint: LayoutConstraint;
122
+ readonly pageFloatLayoutContext: PageFloats.PageFloatLayoutContext;
123
+ last: Node;
124
+ viewDocument: Document;
125
+ flowRootFormattingContext: Vtree.FormattingContext;
126
+ isFloat: boolean;
127
+ isFootnote: boolean;
128
+ startEdge: number;
129
+ endEdge: number;
130
+ beforeEdge: number;
131
+ afterEdge: number;
132
+ footnoteEdge: number;
133
+ box: GeometryUtil.Rect;
134
+ chunkPositions: Vtree.ChunkPosition[];
135
+ bands: GeometryUtil.Band[];
136
+ overflown: boolean;
137
+ breakPositions: BreakPosition.BreakPosition[];
138
+ pageBreakType: string | null;
139
+ forceNonfitting: boolean;
140
+ leftFloatEdge: number;
141
+ rightFloatEdge: number;
142
+ bottommostFloatTop: number;
143
+ stopAtOverflow: boolean;
144
+ lastAfterPosition: Vtree.NodePosition | null;
145
+ fragmentLayoutConstraints: FragmentLayoutConstraint[];
146
+ pseudoParent: Column;
147
+ nodeContextOverflowingDueToRepetitiveElements: Vtree.NodeContext | null;
148
+ blockDistanceToBlockEndFloats: number;
149
+ breakAtTheEdgeBeforeFloat: string | null;
150
+ constructor(element: Element, layoutContext: Vtree.LayoutContext, clientLayout: Vtree.ClientLayout, layoutConstraint: LayoutConstraint, pageFloatLayoutContext: PageFloats.PageFloatLayoutContext);
151
+ getTopEdge(): number;
152
+ getBottomEdge(): number;
153
+ getLeftEdge(): number;
154
+ getRightEdge(): number;
155
+ isFloatNodeContext(nodeContext: Vtree.NodeContext): boolean;
156
+ stopByOverflow(nodeContext: Vtree.NodeContext): boolean;
157
+ isOverflown(edge: number): boolean;
158
+ getExclusions(): GeometryUtil.Shape[];
159
+ openAllViews(position: Vtree.NodePosition): Task.Result<Vtree.NodeContext>;
160
+ calculateOffsetInNodeForNodeContext(position: Vtree.NodePosition): number;
161
+ /**
162
+ * @param count first-XXX nesting identifier
163
+ */
164
+ maybePeelOff(position: Vtree.NodeContext, count: number): Task.Result<Vtree.NodeContext>;
165
+ /**
166
+ * Builds the view until a CSS box edge is reached.
167
+ * @param position start source position.
168
+ * @param checkPoints array to append possible breaking points.
169
+ * @return holding box edge position reached or null if the source is exhausted.
170
+ */
171
+ buildViewToNextBlockEdge(position: Vtree.NodeContext, checkPoints: Vtree.NodeContext[]): Task.Result<Vtree.NodeContext>;
172
+ nextInTree(position: Vtree.NodeContext, atUnforcedBreak?: boolean): Task.Result<Vtree.NodeContext>;
173
+ /**
174
+ * Builds the view for a single unbreakable element.
175
+ * @param position start source position.
176
+ * @return holding box edge position reached or null if the source is exhausted.
177
+ */
178
+ buildDeepElementView(position: Vtree.NodeContext): Task.Result<Vtree.NodeContext>;
179
+ /**
180
+ * Create a single floating element (for exclusion areas).
181
+ * @param ref container's child to insert float before (can be null).
182
+ * @param side float side ("left" or "right").
183
+ * @param width float inline dimension.
184
+ * @param height float box progression dimension.
185
+ * @return newly created float element.
186
+ */
187
+ createFloat(ref: Node, side: string, width: number, height: number): Element;
188
+ /**
189
+ * Remove all the exclusion floats.
190
+ */
191
+ killFloats(): void;
192
+ /**
193
+ * Create exclusion floats for a column.
194
+ */
195
+ createFloats(): void;
196
+ /**
197
+ * @param nodeContext position after the block
198
+ * @param checkPoints array of possible breaking points.
199
+ * @param index index of the breaking point
200
+ * @param boxOffset box offset
201
+ * @return edge position
202
+ */
203
+ calculateEdge(nodeContext: Vtree.NodeContext, checkPoints: Vtree.NodeContext[], index: number, boxOffset: number): number;
204
+ /**
205
+ * Parse CSS computed length (in pixels)
206
+ * @param val CSS length in "px" units or a number.
207
+ * @return value in pixels or 0 if not parsable
208
+ */
209
+ parseComputedLength(val: string | number): number;
210
+ /**
211
+ * Reads element's computed CSS margin.
212
+ */
213
+ getComputedMargin(element: Element): GeometryUtil.Insets;
214
+ /**
215
+ * Reads element's computed padding + borders.
216
+ */
217
+ getComputedPaddingBorder(element: Element): GeometryUtil.Insets;
218
+ /**
219
+ * Reads element's computed CSS insets(margins + border + padding or margins :
220
+ * depends on box-sizing)
221
+ */
222
+ getComputedInsets(element: Element): GeometryUtil.Insets;
223
+ /**
224
+ * Set element's computed CSS insets to Column Container
225
+ */
226
+ setComputedInsets(element: Element, container: Column): void;
227
+ /**
228
+ * Set element's computed width and height to Column Container
229
+ */
230
+ setComputedWidthAndHeight(element: Element, container: Column): void;
231
+ /**
232
+ * Layout a single unbreakable element.
233
+ */
234
+ layoutUnbreakable(nodeContextIn: Vtree.NodeContext): Task.Result<Vtree.NodeContext>;
235
+ /**
236
+ * Layout a single float element.
237
+ */
238
+ layoutFloat(nodeContext: Vtree.NodeContext): Task.Result<Vtree.NodeContext>;
239
+ setupFloatArea(area: PageFloatArea, floatReference: PageFloats.FloatReference, floatSide: string, anchorEdge: number | null, strategy: PageFloats.PageFloatLayoutStrategy, condition: PageFloats.PageFloatPlacementCondition): boolean;
240
+ createPageFloatArea(float: PageFloats.PageFloat | null, floatSide: string, anchorEdge: number | null, strategy: PageFloats.PageFloatLayoutStrategy, condition: PageFloats.PageFloatPlacementCondition): PageFloatArea | null;
241
+ layoutSinglePageFloatFragment(continuations: PageFloats.PageFloatContinuation[], floatSide: string, clearSide: string | null, allowFragmented: boolean, strategy: PageFloats.PageFloatLayoutStrategy, anchorEdge: number | null, pageFloatFragment?: PageFloats.PageFloatFragment | null): Task.Result<SinglePageFloatLayoutResult>;
242
+ layoutPageFloatInner(continuation: PageFloats.PageFloatContinuation, strategy: PageFloats.PageFloatLayoutStrategy, anchorEdge: number | null, pageFloatFragment?: PageFloats.PageFloatFragment): Task.Result<boolean>;
243
+ /**
244
+ * @returns Represents if the layout was succeeded or not
245
+ */
246
+ private layoutStashedPageFloats;
247
+ setFloatAnchorViewNode(nodeContext: Vtree.NodeContext): Vtree.NodeContext;
248
+ resolveFloatReferenceFromColumnSpan(floatReference: PageFloats.FloatReference, columnSpan: Css.Val, nodeContext: Vtree.NodeContext): Task.Result<PageFloats.FloatReference>;
249
+ layoutPageFloat(nodeContext: Vtree.NodeContext): Task.Result<Vtree.NodeContext>;
250
+ processLineStyling(nodeContext: Vtree.NodeContext, resNodeContext: Vtree.NodeContext, checkPoints: Vtree.NodeContext[]): Task.Result<Vtree.NodeContext>;
251
+ isLoneImage(checkPoints: Vtree.NodeContext[]): boolean;
252
+ getTrailingMarginEdgeAdjustment(trailingEdgeContexts: Vtree.NodeContext[]): number;
253
+ /**
254
+ * Layout a single CSS box.
255
+ */
256
+ layoutBreakableBlock(nodeContext: Vtree.NodeContext): Task.Result<Vtree.NodeContext>;
257
+ postLayoutBlock(nodeContext: Vtree.NodeContext, checkPoints: Vtree.NodeContext[]): void;
258
+ findEndOfLine(linePosition: number, checkPoints: Vtree.NodeContext[], isUpdateMaxReachedAfterEdge: boolean): {
259
+ nodeContext: Vtree.NodeContext;
260
+ index: number;
261
+ checkPointIndex: number;
262
+ };
263
+ findAcceptableBreakInside(checkPoints: Vtree.NodeContext[], edgePosition: number, force: boolean): Vtree.NodeContext;
264
+ resolveTextNodeBreaker(nodeContext: Vtree.NodeContext): TextNodeBreaker;
265
+ /**
266
+ * Read ranges skipping special elements
267
+ */
268
+ getRangeBoxes(start: Node, end: Node): Vtree.ClientRect[];
269
+ /**
270
+ * Give block's initial and final nodes, find positions of the line bottoms.
271
+ * This is, of course, somewhat hacky implementation.
272
+ * @return position of line breaks
273
+ */
274
+ findLinePositions(checkPoints: Vtree.NodeContext[]): number[];
275
+ calculateClonedPaddingBorder(nodeContext: Vtree.NodeContext): number;
276
+ private getOffsetByRepetitiveElements;
277
+ findBoxBreakPosition(bp: BoxBreakPosition, force: boolean): Vtree.NodeContext;
278
+ getAfterEdgeOfBlockContainer(nodeContext: Vtree.NodeContext): number;
279
+ findFirstOverflowingEdgeAndCheckPoint(checkPoints: Vtree.NodeContext[]): {
280
+ edge: number;
281
+ checkPoint: Vtree.NodeContext | null;
282
+ };
283
+ findEdgeBreakPosition(bp: BreakPosition.EdgeBreakPosition): Vtree.NodeContext;
284
+ /**
285
+ * Finalize a line break.
286
+ * @return holing true
287
+ */
288
+ finishBreak(nodeContext: Vtree.NodeContext, forceRemoveSelf: boolean, endOfColumn: boolean): Task.Result<boolean>;
289
+ findAcceptableBreakPosition(): BreakPositionAndNodeContext;
290
+ doFinishBreak(nodeContext: Vtree.NodeContext, overflownNodeContext: Vtree.NodeContext, initialNodeContext: Vtree.NodeContext, initialComputedBlockSize: number): Task.Result<Vtree.NodeContext>;
291
+ /**
292
+ * Determines if a page break is acceptable at this position
293
+ */
294
+ isBreakable(flowPosition: Vtree.NodeContext): boolean;
295
+ /**
296
+ * Determines if an indent value is zero
297
+ */
298
+ zeroIndent(val: string | number): boolean;
299
+ /**
300
+ * @return true if overflows
301
+ */
302
+ checkOverflowAndSaveEdge(nodeContext: Vtree.NodeContext, trailingEdgeContexts: Vtree.NodeContext[]): boolean;
303
+ /**
304
+ * Save a possible page break position on a CSS block edge. Check if it
305
+ * overflows.
306
+ * @return true if overflows
307
+ */
308
+ checkOverflowAndSaveEdgeAndBreakPosition(nodeContext: Vtree.NodeContext, trailingEdgeContexts: Vtree.NodeContext[], saveEvenOverflown: boolean, breakAtTheEdge: string | null): boolean;
309
+ applyClearance(nodeContext: Vtree.NodeContext): boolean;
310
+ isBFC(formattingContext: Vtree.FormattingContext): boolean;
311
+ /**
312
+ * Skips positions until either the start of unbreakable block or inline
313
+ * content. Also sets breakBefore on the result combining break-before and
314
+ * break-after properties from all elements that meet at the edge.
315
+ */
316
+ skipEdges(nodeContext: Vtree.NodeContext, leadingEdge: boolean, forcedBreakValue: string | null): Task.Result<Vtree.NodeContext>;
317
+ /**
318
+ * Skips non-renderable positions until it hits the end of the flow or some
319
+ * renderable content. Returns the nodeContext that was passed in if some
320
+ * content remains and null if all content could be skipped.
321
+ */
322
+ skipTailEdges(nodeContext: Vtree.NodeContext): Task.Result<Vtree.NodeContext>;
323
+ layoutFloatOrFootnote(nodeContext: Vtree.NodeContext): Task.Result<Vtree.NodeContext>;
324
+ /**
325
+ * Layout next portion of the source.
326
+ */
327
+ layoutNext(nodeContext: Vtree.NodeContext, leadingEdge: boolean, forcedBreakValue?: string | null): Task.Result<Vtree.NodeContext>;
328
+ clearOverflownViewNodes(nodeContext: Vtree.NodeContext, removeSelf: boolean): void;
329
+ initGeom(): void;
330
+ init(): void;
331
+ /**
332
+ * Save the potential breaking position at the edge. Should, in general, save
333
+ * "after" position but only after skipping all of the "before" ones and
334
+ * getting to the non-empty content (to get breakAtEdge right).
335
+ */
336
+ saveEdgeBreakPosition(position: Vtree.NodeContext, breakAtEdge: string | null, overflows: boolean): void;
337
+ /**
338
+ * @param checkPoints array of breaking points for breakable block
339
+ */
340
+ saveBoxBreakPosition(checkPoints: Vtree.NodeContext[]): void;
341
+ updateMaxReachedAfterEdge(afterEdge: number): void;
342
+ /**
343
+ * @param chunkPosition starting position.
344
+ * @return holding end position.
345
+ */
346
+ layout(chunkPosition: Vtree.ChunkPosition, leadingEdge: boolean, breakAfter?: string | null): Task.Result<Vtree.ChunkPosition>;
347
+ isFullWithPageFloats(): boolean;
348
+ getMaxBlockSizeOfPageFloats(): number;
349
+ doFinishBreakOfFragmentLayoutConstraints(nodeContext: Vtree.NodeContext): Task.Result<boolean>;
350
+ /**
351
+ * @param nodeContext starting position.
352
+ * @return holding end position.
353
+ */
354
+ doLayout(nodeContext: Vtree.NodeContext, leadingEdge: boolean, breakAfter?: string | null): Task.Result<{
355
+ nodeContext: Vtree.NodeContext;
356
+ overflownNodeContext: Vtree.NodeContext;
357
+ }>;
358
+ /**
359
+ * Re-layout already laid-out chunks. Return the position of the last flow if
360
+ * there is an overflow.
361
+ * TODO: deal with chunks that did not fit at all.
362
+ * @return holding end position.
363
+ */
364
+ redoLayout(): Task.Result<Vtree.ChunkPosition>;
365
+ saveDistanceToBlockEndFloats(): void;
366
+ collectElementsOffset(): RepetitiveElement.ElementsOffset[];
367
+ }
368
+ /**
369
+ * Represents a "pseudo"-column nested inside a real column.
370
+ * This class is created to handle parallel fragmented flows (e.g. table columns
371
+ * in a single table row). A pseudo-column behaves in the same way as the
372
+ * original column, sharing its properties. Property changes on the
373
+ * pseudo-column are not propagated to the original column. The LayoutContext of
374
+ * the original column is also cloned and used by the pseudo-column, not to
375
+ * propagate state changes of the LayoutContext caused by the pseudo-column.
376
+ * @param column The original (parent) column
377
+ * @param viewRoot Root element for the pseudo-column, i.e., the root of the
378
+ * fragmented flow.
379
+ * @param parentNodeContext A NodeContext generating this PseudoColumn
380
+ */
381
+ export declare class PseudoColumn {
382
+ startNodeContexts: Vtree.NodeContext[];
383
+ private column;
384
+ constructor(column: Layout.Column, viewRoot: Element, parentNodeContext: Vtree.NodeContext);
385
+ /**
386
+ * @param chunkPosition starting position.
387
+ * @return holding end position.
388
+ */
389
+ layout(chunkPosition: Vtree.ChunkPosition, leadingEdge: boolean): Task.Result<Vtree.ChunkPosition>;
390
+ findAcceptableBreakPosition(allowBreakAtStartPosition: boolean): Layout.BreakPositionAndNodeContext;
391
+ /**
392
+ * @return holing true
393
+ */
394
+ finishBreak(nodeContext: Vtree.NodeContext, forceRemoveSelf: boolean, endOfColumn: boolean): Task.Result<boolean>;
395
+ doFinishBreakOfFragmentLayoutConstraints(positionAfter: Vtree.NodeContext): void;
396
+ isStartNodeContext(nodeContext: Vtree.NodeContext): boolean;
397
+ isLastAfterNodeContext(nodeContext: Vtree.NodeContext): boolean;
398
+ getColumnElement(): Element;
399
+ getColumn(): Layout.Column;
400
+ }
401
+ export type SinglePageFloatLayoutResult = Layout.SinglePageFloatLayoutResult;
402
+ /**
403
+ * breaking point resolver for Text Node.
404
+ */
405
+ export declare class TextNodeBreaker implements Layout.TextNodeBreaker {
406
+ breakTextNode(textNode: Text, nodeContext: Vtree.NodeContext, low: number, checkPoints: Vtree.NodeContext[], checkpointIndex: number, force: boolean): Vtree.NodeContext;
407
+ breakAfterSoftHyphen(textNode: Text, text: string, viewIndex: number, nodeContext: Vtree.NodeContext): number;
408
+ breakAfterOtherCharacter(textNode: Text, text: string, viewIndex: number, nodeContext: Vtree.NodeContext): number;
409
+ updateNodeContext(nodeContext: Vtree.NodeContext, viewIndex: number, textNode: Text): Vtree.NodeContext;
410
+ static instance: TextNodeBreaker;
411
+ }
412
+ export declare function resolveHyphenateCharacter(nodeContext: Vtree.NodeContext): string;
413
+ export declare class ColumnLayoutRetryer extends LayoutRetryers.AbstractLayoutRetryer {
414
+ readonly leadingEdge: boolean;
415
+ breakAfter: string | null;
416
+ private initialPageBreakType;
417
+ initialComputedBlockSize: number;
418
+ private initialOverflown;
419
+ context: {
420
+ overflownNodeContext: Vtree.NodeContext;
421
+ };
422
+ constructor(leadingEdge: boolean, breakAfter?: string | null);
423
+ resolveLayoutMode(nodeContext: Vtree.NodeContext): Layout.LayoutMode;
424
+ prepareLayout(nodeContext: Vtree.NodeContext, column: Layout.Column): void;
425
+ clearNodes(initialPosition: Vtree.NodeContext): void;
426
+ saveState(nodeContext: Vtree.NodeContext, column: Layout.Column): void;
427
+ restoreState(nodeContext: Vtree.NodeContext, column: Layout.Column): void;
428
+ }
429
+ export declare class DefaultLayoutMode implements Layout.LayoutMode {
430
+ readonly leadingEdge: boolean;
431
+ readonly breakAfter: string | null;
432
+ readonly context: {
433
+ overflownNodeContext: Vtree.NodeContext;
434
+ };
435
+ constructor(leadingEdge: boolean, breakAfter: string | null, context: {
436
+ overflownNodeContext: Vtree.NodeContext;
437
+ });
438
+ /** @override */
439
+ doLayout(nodeContext: Vtree.NodeContext, column: Layout.Column): Task.Result<Vtree.NodeContext>;
440
+ /** @override */
441
+ accept(nodeContext: Vtree.NodeContext, column: Layout.Column): boolean;
442
+ /** @override */
443
+ postLayout(positionAfter: Vtree.NodeContext, initialPosition: Vtree.NodeContext, column: Layout.Column, accepted: boolean): boolean;
444
+ }
445
+ export declare class PageFloatArea extends Column implements Layout.PageFloatArea {
446
+ readonly floatSide: string;
447
+ readonly parentContainer: Vtree.Container;
448
+ private rootViewNodes;
449
+ private floatMargins;
450
+ adjustContentRelativeSize: boolean;
451
+ constructor(floatSide: string, element: Element, layoutContext: Vtree.LayoutContext, clientLayout: Vtree.ClientLayout, layoutConstraint: LayoutConstraint, pageFloatLayoutContext: PageFloats.PageFloatLayoutContext, parentContainer: Vtree.Container);
452
+ openAllViews(position: Vtree.NodePosition): Task.Result<Vtree.NodeContext>;
453
+ convertPercentageSizesToPx(target: Element): void;
454
+ fixFloatSizeAndPosition(nodeContext: Vtree.NodeContext): void;
455
+ getContentInlineSize(): number;
456
+ }