@react-x11/components 0.11.0 → 0.13.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.
- package/dist/flow/node.d.ts +14 -6
- package/dist/flow/node.d.ts.map +1 -1
- package/dist/flow/node.js +82 -64
- package/dist/flow/node.js.map +1 -1
- package/dist/html/controls.d.ts +38 -10
- package/dist/html/controls.d.ts.map +1 -1
- package/dist/html/controls.js +43 -58
- package/dist/html/controls.js.map +1 -1
- package/dist/html/css/cascade.d.ts +134 -20
- package/dist/html/css/cascade.d.ts.map +1 -1
- package/dist/html/css/cascade.js +538 -128
- package/dist/html/css/cascade.js.map +1 -1
- package/dist/html/css/color.d.ts +19 -0
- package/dist/html/css/color.d.ts.map +1 -1
- package/dist/html/css/color.js +86 -0
- package/dist/html/css/color.js.map +1 -1
- package/dist/html/css/parse.d.ts +40 -2
- package/dist/html/css/parse.d.ts.map +1 -1
- package/dist/html/css/parse.js +391 -13
- package/dist/html/css/parse.js.map +1 -1
- package/dist/html/css/style.d.ts +52 -1
- package/dist/html/css/style.d.ts.map +1 -1
- package/dist/html/css/style.js +328 -11
- package/dist/html/css/style.js.map +1 -1
- package/dist/html/css/ua.d.ts +11 -1
- package/dist/html/css/ua.d.ts.map +1 -1
- package/dist/html/css/ua.js +73 -7
- package/dist/html/css/ua.js.map +1 -1
- package/dist/html/css/values.d.ts +10 -1
- package/dist/html/css/values.d.ts.map +1 -1
- package/dist/html/css/values.js +27 -2
- package/dist/html/css/values.js.map +1 -1
- package/dist/html/css/vars.d.ts +5 -0
- package/dist/html/css/vars.d.ts.map +1 -1
- package/dist/html/css/vars.js +2 -2
- package/dist/html/css/vars.js.map +1 -1
- package/dist/html/dom.d.ts.map +1 -1
- package/dist/html/dom.js +38 -3
- package/dist/html/dom.js.map +1 -1
- package/dist/html/fonts.d.ts +25 -1
- package/dist/html/fonts.d.ts.map +1 -1
- package/dist/html/fonts.js +99 -6
- package/dist/html/fonts.js.map +1 -1
- package/dist/html/form.d.ts +200 -0
- package/dist/html/form.d.ts.map +1 -0
- package/dist/html/form.js +801 -0
- package/dist/html/form.js.map +1 -0
- package/dist/html/index.d.ts +12 -0
- package/dist/html/index.d.ts.map +1 -1
- package/dist/html/index.js +30 -264
- package/dist/html/index.js.map +1 -1
- package/dist/html/layout/block.d.ts +11 -2
- package/dist/html/layout/block.d.ts.map +1 -1
- package/dist/html/layout/block.js +186 -19
- package/dist/html/layout/block.js.map +1 -1
- package/dist/html/layout/boxes.d.ts +65 -7
- package/dist/html/layout/boxes.d.ts.map +1 -1
- package/dist/html/layout/boxes.js +87 -22
- package/dist/html/layout/boxes.js.map +1 -1
- package/dist/html/layout/cache.d.ts +2 -2
- package/dist/html/layout/cache.d.ts.map +1 -1
- package/dist/html/layout/cache.js +8 -3
- package/dist/html/layout/cache.js.map +1 -1
- package/dist/html/layout/flex.js +4 -1
- package/dist/html/layout/flex.js.map +1 -1
- package/dist/html/layout/floats.d.ts +4 -0
- package/dist/html/layout/floats.d.ts.map +1 -1
- package/dist/html/layout/floats.js +26 -0
- package/dist/html/layout/floats.js.map +1 -1
- package/dist/html/layout/inline.d.ts +26 -2
- package/dist/html/layout/inline.d.ts.map +1 -1
- package/dist/html/layout/inline.js +1232 -115
- package/dist/html/layout/inline.js.map +1 -1
- package/dist/html/node.d.ts +120 -15
- package/dist/html/node.d.ts.map +1 -1
- package/dist/html/node.js +993 -174
- package/dist/html/node.js.map +1 -1
- package/dist/html/paint.d.ts +75 -2
- package/dist/html/paint.d.ts.map +1 -1
- package/dist/html/paint.js +836 -200
- package/dist/html/paint.js.map +1 -1
- package/dist/html/surfaces.d.ts +7 -2
- package/dist/html/surfaces.d.ts.map +1 -1
- package/dist/html/surfaces.js +16 -0
- package/dist/html/surfaces.js.map +1 -1
- package/dist/html/widgets.d.ts +29 -0
- package/dist/html/widgets.d.ts.map +1 -0
- package/dist/html/widgets.js +620 -0
- package/dist/html/widgets.js.map +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js.map +1 -1
- package/dist/internal/window.d.ts +22 -0
- package/dist/internal/window.d.ts.map +1 -1
- package/dist/internal/window.js +35 -8
- package/dist/internal/window.js.map +1 -1
- package/dist/richtext/node.d.ts +7 -0
- package/dist/richtext/node.d.ts.map +1 -1
- package/dist/richtext/node.js.map +1 -1
- package/package.json +6 -4
- package/src/flow/node.ts +80 -64
- package/src/html/controls.ts +79 -58
- package/src/html/css/cascade.ts +610 -146
- package/src/html/css/color.ts +87 -0
- package/src/html/css/parse.ts +431 -13
- package/src/html/css/style.ts +367 -11
- package/src/html/css/ua.ts +76 -8
- package/src/html/css/values.ts +31 -3
- package/src/html/css/vars.ts +2 -2
- package/src/html/dom.ts +41 -3
- package/src/html/fonts.ts +116 -6
- package/src/html/form.ts +962 -0
- package/src/html/index.ts +49 -300
- package/src/html/layout/block.ts +231 -16
- package/src/html/layout/boxes.ts +133 -32
- package/src/html/layout/cache.ts +8 -3
- package/src/html/layout/flex.ts +4 -1
- package/src/html/layout/floats.ts +24 -0
- package/src/html/layout/inline.ts +1445 -108
- package/src/html/node.ts +1010 -166
- package/src/html/paint.ts +980 -270
- package/src/html/surfaces.ts +21 -1
- package/src/html/widgets.ts +735 -0
- package/src/index.ts +1 -0
- package/src/internal/window.ts +36 -8
- package/src/richtext/node.ts +7 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { Element } from 'domhandler';
|
|
2
2
|
import type { TextRun } from '../../richtext/index.js';
|
|
3
|
-
import type { Cascade } from '../css/cascade.js';
|
|
3
|
+
import type { Cascade, KeptStyles, SelectionStyle } from '../css/cascade.js';
|
|
4
4
|
import type { CollapsedTable } from './collapse.js';
|
|
5
5
|
import type { IntrinsicSize } from '../svg.js';
|
|
6
6
|
import type { ComputedStyle } from '../css/style.js';
|
|
@@ -129,6 +129,19 @@ export interface LineText {
|
|
|
129
129
|
* spacer: a unit of the layout that is no text of the document's
|
|
130
130
|
* (`documentOffsetOf`, `layoutOffsetOf`). */
|
|
131
131
|
gaps?: number[];
|
|
132
|
+
/**
|
|
133
|
+
* The spaces `pre-wrap` keeps that this fragment's line ends on, which an
|
|
134
|
+
* engine strips from a line's end as though CSS removed them there: each
|
|
135
|
+
* one's offset in the layout's text and where it is, from the layout's
|
|
136
|
+
* origin, beside the line's end in logical order (`hangPreserved`). They
|
|
137
|
+
* are their inline box's, whose background and border cover them, and
|
|
138
|
+
* the ones before a forced break that fit take room on the line.
|
|
139
|
+
*/
|
|
140
|
+
hung?: {
|
|
141
|
+
at: number;
|
|
142
|
+
x: number;
|
|
143
|
+
width: number;
|
|
144
|
+
}[];
|
|
132
145
|
/** Any offset in the layout's own text as a document index — how a run
|
|
133
146
|
* under the pointer finds the element whose text it is. Per pass: the
|
|
134
147
|
* layout may be one an earlier pass made (`TextLayoutCache`), and the
|
|
@@ -172,6 +185,10 @@ export interface TextLayoutLike {
|
|
|
172
185
|
height: number;
|
|
173
186
|
baseline: number;
|
|
174
187
|
width: number;
|
|
188
|
+
/** Its width with the white space it ends on kept, in the item it
|
|
189
|
+
* ends: how far it moves the pen where text goes on after it on the
|
|
190
|
+
* same line. ntk's, from 8.17.0; an engine without it leaves it out. */
|
|
191
|
+
advance?: number;
|
|
175
192
|
ascent: number;
|
|
176
193
|
descent: number;
|
|
177
194
|
start: number;
|
|
@@ -420,6 +437,9 @@ export declare const FIRST_LINE: WeakMap<Box, ComputedStyle>;
|
|
|
420
437
|
* applies to from `parent` and the rest from its parent's own style.
|
|
421
438
|
*/
|
|
422
439
|
export type FirstLineStyler = (box: Box, parent: ComputedStyle) => ComputedStyle;
|
|
440
|
+
/** The `::selection` of the element a box's text is in, or null for the
|
|
441
|
+
* palette's highlight (`Cascade.selectionStyle`). */
|
|
442
|
+
export type SelectionStyler = (box: Box | null) => SelectionStyle | null;
|
|
423
443
|
/** The url of an image generated content put in a pseudo-element: it has
|
|
424
444
|
* no element of its own to name it (`imageUrlOf`). */
|
|
425
445
|
export declare const CONTENT_IMAGES: WeakMap<Box, string>;
|
|
@@ -459,6 +479,11 @@ export declare const BOX_RAISES: WeakMap<Box, number>;
|
|
|
459
479
|
* line's edge puts it, which is a different height on every line, so its
|
|
460
480
|
* background, drawn from its baseline, is put there by line. */
|
|
461
481
|
export declare const LINE_BOX_RAISES: WeakMap<LineBox, Map<Box, number>>;
|
|
482
|
+
/** The face of an inline box with padding above or below its text and
|
|
483
|
+
* nothing to paint behind it, which has no `decoration`: its fragments
|
|
484
|
+
* still reach past its lines by the padding, and count in the scrollable
|
|
485
|
+
* overflow of the block they are in (`computePaintBounds`). */
|
|
486
|
+
export declare const PADDED_FACES: WeakMap<Box, InlineDecoration>;
|
|
462
487
|
/** The table cells wholly in columns `visibility: collapse` took out of
|
|
463
488
|
* their table (CSS 2.1 17.5.5), which the paint pass leaves out: a cell is
|
|
464
489
|
* no descendant of its column and inherits nothing from it, so its own
|
|
@@ -489,10 +514,20 @@ export declare const GRID_TRACKS: WeakMap<Box, GridTracks>;
|
|
|
489
514
|
* `order` first and the document's after it (CSS Flexbox 5.4), where
|
|
490
515
|
* `order` moves any: an absolutely positioned child's is 0. */
|
|
491
516
|
export declare const PAINT_ORDER: WeakMap<Box, Box[]>;
|
|
492
|
-
/** The blocks that broke
|
|
493
|
-
*
|
|
494
|
-
* though they stand outside it
|
|
517
|
+
/** The blocks that broke an inline box in pieces, under its first piece
|
|
518
|
+
* (`breakAround`): a relative offset of the box moves them too (CSS 2.1
|
|
519
|
+
* 9.2.1.1), though they stand outside it, and its rect takes them in, as
|
|
520
|
+
* a browser's does (`elementRect`). */
|
|
495
521
|
export declare const CUT_BLOCKS: WeakMap<Box, Box[]>;
|
|
522
|
+
/** Where a block that clearance moved below the floats would have stood
|
|
523
|
+
* without it, its border edge's top (CSS 2.1 9.5.2): a browser's
|
|
524
|
+
* fragment of an inline box around such a block starts there, and takes
|
|
525
|
+
* the clearance in (`elementRect`). Only the blocks that had clearance. */
|
|
526
|
+
export declare const CLEARED_FROM: WeakMap<Box, number>;
|
|
527
|
+
/** The element a pseudo-element's box is generated from, which has no
|
|
528
|
+
* element of its own (`Box.pseudo`): whose the images its styles name are,
|
|
529
|
+
* when the host is asked for them. */
|
|
530
|
+
export declare const GENERATED_FROM: WeakMap<Box, Element>;
|
|
496
531
|
/** The blocks that broke an inline box under full opacity in pieces, and
|
|
497
532
|
* the opacity they take from it — from each such inline box around them,
|
|
498
533
|
* multiplied. They stand outside it (CSS 2.1 9.2.1.1) and are still its
|
|
@@ -522,9 +557,14 @@ export interface BoxTree {
|
|
|
522
557
|
controls: Box[];
|
|
523
558
|
/** Every box carrying an `href`, for click and hover. */
|
|
524
559
|
links: Box[];
|
|
525
|
-
/**
|
|
526
|
-
*
|
|
527
|
-
*
|
|
560
|
+
/** The style of an anonymous box under a parent's (`anonymousStyles`):
|
|
561
|
+
* the one the fix-up gave each it made, and what such a box takes when
|
|
562
|
+
* its parent's style changes where it is (`HtmlViewNode._hoverInPlace`). */
|
|
563
|
+
anonymous: AnonymousStyle;
|
|
564
|
+
/** Every box with a `background-image`, a border image or a mask image,
|
|
565
|
+
* an element's or a pseudo-element's, for the host to be asked for: a
|
|
566
|
+
* document has a handful, and finding them was a walk over every box
|
|
567
|
+
* after every build. */
|
|
528
568
|
backgrounds: Box[];
|
|
529
569
|
/** Every image generated content names, the element whose
|
|
530
570
|
* pseudo-element names it, for the host to be asked for, and whether its
|
|
@@ -546,6 +586,10 @@ export interface BoxTree {
|
|
|
546
586
|
/** Each box's style on a first line (`FirstLineStyler`), where any
|
|
547
587
|
* block has a `::first-line`. */
|
|
548
588
|
firstLineStyler: FirstLineStyler | null;
|
|
589
|
+
/** Each box's `::selection` (`SelectionStyler`), where any rule styles
|
|
590
|
+
* one: worked out as a selection is first painted over it, not as the
|
|
591
|
+
* tree is built, since most builds are never selected in. */
|
|
592
|
+
selectionStyler: SelectionStyler | null;
|
|
549
593
|
/** Whether a float or an out-of-flow box sits in an inline box: where
|
|
550
594
|
* none does, layout looks for them among a block's own children and
|
|
551
595
|
* goes through no inline box to find them. */
|
|
@@ -565,6 +609,9 @@ export interface BoxTree {
|
|
|
565
609
|
}
|
|
566
610
|
export interface BuildOptions {
|
|
567
611
|
cascade: Cascade;
|
|
612
|
+
/** The styles of the tree this one replaces, where only some elements'
|
|
613
|
+
* can have changed since (`Cascade.beginSharing`). */
|
|
614
|
+
kept?: KeptStyles | null;
|
|
568
615
|
/** Device pixels per CSS pixel. An image's pixels and a `width="600"`
|
|
569
616
|
* attribute are CSS pixels; every box is device, so both are multiplied
|
|
570
617
|
* on the way in. Default 1. */
|
|
@@ -601,6 +648,17 @@ export declare function transformInPlace(text: string, transform: ComputedStyle[
|
|
|
601
648
|
* from the end, where it is almost always decided by the last character.
|
|
602
649
|
*/
|
|
603
650
|
export declare function letteredAfter(text: string, lettered: boolean): boolean;
|
|
651
|
+
/**
|
|
652
|
+
* The style of an anonymous box inside a parent: what the parent passes on
|
|
653
|
+
* by inheritance, and every other property at its initial value, as CSS 2.1
|
|
654
|
+
* gives anonymous boxes theirs (9.2.1.1, 17.2.1). An anonymous box that took
|
|
655
|
+
* the parent's style itself took its height, its padding and borders, its
|
|
656
|
+
* background, its relative offset and its opacity a second time — the text
|
|
657
|
+
* in `<div style="padding: 20px">text<p>…</p></div>` sat 40px in, and the
|
|
658
|
+
* paragraph after it the height of the div further down. One per parent
|
|
659
|
+
* style, which the cascade already shares between elements.
|
|
660
|
+
*/
|
|
661
|
+
export type AnonymousStyle = (parent: ComputedStyle, display: ComputedStyle['display']) => ComputedStyle;
|
|
604
662
|
/**
|
|
605
663
|
* Whether a text is white space alone: CSS's white space, which is the
|
|
606
664
|
* space, the tab and the three line breaks and nothing else (CSS Text 3,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"boxes.d.ts","sourceRoot":"","sources":["../../../src/html/layout/boxes.ts"],"names":[],"mappings":"AAkBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,YAAY,CAAC;AAE1C,OAAO,KAAK,EA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AC,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,OAAO,GAAG,OAAO,CAyBtE;AAieD;;;;;;;;;GASG;AACH,MAAM,MAAM,cAAc,GAAG,CAC3B,MAAM,EAAE,aAAa,EACrB,OAAO,EAAE,aAAa,CAAC,SAAS,CAAC,KAC9B,aAAa,CAAC;AA0InB;;;;;;;GAOG;AACH,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAE7C;AAYD;;;+DAG+D;AAC/D,wBAAgB,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAQtD"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { attr, childrenOf, isElement, isText, inImpliedHead, NON_RENDERED, tagOf, } from '../dom.js';
|
|
2
2
|
import { quoteAt } from '../css/content.js';
|
|
3
|
-
import { CONTAIN_STYLE, FIRST_LINE_INHERITED, copyStyle, firstLineParent, inherit, } from '../css/style.js';
|
|
3
|
+
import { CONTAIN_STYLE, FIRST_LINE_INHERITED, NO_MASK, copyStyle, firstLineParent, inherit, } from '../css/style.js';
|
|
4
4
|
import { AUTO } from '../css/values.js';
|
|
5
5
|
import { svgIntrinsics } from '../svg.js';
|
|
6
6
|
/**
|
|
@@ -241,6 +241,11 @@ export const BOX_RAISES = new WeakMap();
|
|
|
241
241
|
* line's edge puts it, which is a different height on every line, so its
|
|
242
242
|
* background, drawn from its baseline, is put there by line. */
|
|
243
243
|
export const LINE_BOX_RAISES = new WeakMap();
|
|
244
|
+
/** The face of an inline box with padding above or below its text and
|
|
245
|
+
* nothing to paint behind it, which has no `decoration`: its fragments
|
|
246
|
+
* still reach past its lines by the padding, and count in the scrollable
|
|
247
|
+
* overflow of the block they are in (`computePaintBounds`). */
|
|
248
|
+
export const PADDED_FACES = new WeakMap();
|
|
244
249
|
/** The table cells wholly in columns `visibility: collapse` took out of
|
|
245
250
|
* their table (CSS 2.1 17.5.5), which the paint pass leaves out: a cell is
|
|
246
251
|
* no descendant of its column and inherits nothing from it, so its own
|
|
@@ -261,10 +266,20 @@ export const GRID_TRACKS = new WeakMap();
|
|
|
261
266
|
* `order` first and the document's after it (CSS Flexbox 5.4), where
|
|
262
267
|
* `order` moves any: an absolutely positioned child's is 0. */
|
|
263
268
|
export const PAINT_ORDER = new WeakMap();
|
|
264
|
-
/** The blocks that broke
|
|
265
|
-
*
|
|
266
|
-
* though they stand outside it
|
|
269
|
+
/** The blocks that broke an inline box in pieces, under its first piece
|
|
270
|
+
* (`breakAround`): a relative offset of the box moves them too (CSS 2.1
|
|
271
|
+
* 9.2.1.1), though they stand outside it, and its rect takes them in, as
|
|
272
|
+
* a browser's does (`elementRect`). */
|
|
267
273
|
export const CUT_BLOCKS = new WeakMap();
|
|
274
|
+
/** Where a block that clearance moved below the floats would have stood
|
|
275
|
+
* without it, its border edge's top (CSS 2.1 9.5.2): a browser's
|
|
276
|
+
* fragment of an inline box around such a block starts there, and takes
|
|
277
|
+
* the clearance in (`elementRect`). Only the blocks that had clearance. */
|
|
278
|
+
export const CLEARED_FROM = new WeakMap();
|
|
279
|
+
/** The element a pseudo-element's box is generated from, which has no
|
|
280
|
+
* element of its own (`Box.pseudo`): whose the images its styles name are,
|
|
281
|
+
* when the host is asked for them. */
|
|
282
|
+
export const GENERATED_FROM = new WeakMap();
|
|
268
283
|
/** The blocks that broke an inline box under full opacity in pieces, and
|
|
269
284
|
* the opacity they take from it — from each such inline box around them,
|
|
270
285
|
* multiplied. They stand outside it (CSS 2.1 9.2.1.1) and are still its
|
|
@@ -333,7 +348,7 @@ class Builder {
|
|
|
333
348
|
}
|
|
334
349
|
run(root) {
|
|
335
350
|
const cascade = this._options.cascade;
|
|
336
|
-
cascade.beginSharing();
|
|
351
|
+
cascade.beginSharing(this._options.kept ?? null);
|
|
337
352
|
const { style: rootStyle, html: impliedHtml } = cascade.rootStyle(hasBody(root), hasHtml(root));
|
|
338
353
|
const rootBox = new Box('block', null, rootStyle);
|
|
339
354
|
// a fragment's root stands in for a `<body>`, counters and all
|
|
@@ -349,10 +364,13 @@ class Builder {
|
|
|
349
364
|
// it carries no margins of its own and cannot collapse with anything.
|
|
350
365
|
this._children(root, rootBox, rootStyle, false, null, ROOT_SHARE_KEY);
|
|
351
366
|
this._endLine();
|
|
352
|
-
|
|
367
|
+
cascade.endSharing();
|
|
368
|
+
const anonymous = anonymousStyles(cascade.initial);
|
|
369
|
+
fixUp(rootBox, anonymous);
|
|
353
370
|
assignSubtreeRanges(rootBox);
|
|
354
371
|
return {
|
|
355
372
|
root: rootBox,
|
|
373
|
+
anonymous,
|
|
356
374
|
text: this._chunks.join(''),
|
|
357
375
|
textBoxes: this._textBoxes,
|
|
358
376
|
textStyles: this._textStyles,
|
|
@@ -365,12 +383,38 @@ class Builder {
|
|
|
365
383
|
negative: this._negative,
|
|
366
384
|
firstLine: this._firstLine,
|
|
367
385
|
firstLineStyler: this._firstLine ? this._firstLineStyler() : null,
|
|
386
|
+
selectionStyler: cascade.hasSelection ? this._selectionStyler() : null,
|
|
368
387
|
nestedOutOfLine: this._nestedOutOfLine,
|
|
369
388
|
movedInline: this._movedInline,
|
|
370
389
|
clipText: this._clipText,
|
|
371
390
|
impliedHtml,
|
|
372
391
|
};
|
|
373
392
|
}
|
|
393
|
+
/** `BoxTree.selectionStyler`, over this build's cascade: an element's
|
|
394
|
+
* over its parent's, each once. A box with no element of its own — text,
|
|
395
|
+
* an anonymous box — is its nearest element's. */
|
|
396
|
+
_selectionStyler() {
|
|
397
|
+
const cascade = this._options.cascade;
|
|
398
|
+
const styles = this._styles;
|
|
399
|
+
const known = new Map();
|
|
400
|
+
const of = (el) => {
|
|
401
|
+
let found = known.get(el);
|
|
402
|
+
if (found !== undefined)
|
|
403
|
+
return found;
|
|
404
|
+
// the parser keeps a document to 256 elements deep (`dom.ts`)
|
|
405
|
+
const parent = isElement(el.parent) ? of(el.parent) : null;
|
|
406
|
+
const own = styles.get(el)?.style;
|
|
407
|
+
found = own ? cascade.selectionStyle(el, own, parent) : parent;
|
|
408
|
+
known.set(el, found);
|
|
409
|
+
return found;
|
|
410
|
+
};
|
|
411
|
+
return (box) => {
|
|
412
|
+
let at = box;
|
|
413
|
+
while (at && !at.el)
|
|
414
|
+
at = at.parent;
|
|
415
|
+
return at?.el ? of(at.el) : null;
|
|
416
|
+
};
|
|
417
|
+
}
|
|
374
418
|
/** `BoxTree.firstLineStyler`, over this build's cascade. */
|
|
375
419
|
_firstLineStyler() {
|
|
376
420
|
const cascade = this._options.cascade;
|
|
@@ -517,14 +561,20 @@ class Builder {
|
|
|
517
561
|
return;
|
|
518
562
|
}
|
|
519
563
|
// an `<object>` is its image once it has one, and its content until;
|
|
520
|
-
// an `<embed>` its image, and a `<video>` its poster, or a frame
|
|
564
|
+
// an `<embed>` its image, and a `<video>` its poster, or a frame; an
|
|
565
|
+
// image button its image, and a button saying what it is for until it
|
|
566
|
+
// has one, so it can be pressed either way
|
|
521
567
|
const replaced = tag === 'object'
|
|
522
568
|
? this._options.imageSize(el)
|
|
523
569
|
? 'image'
|
|
524
570
|
: 'none'
|
|
525
571
|
: (tag === 'embed' || tag === 'video') && this._options.imageSize(el)
|
|
526
572
|
? 'image'
|
|
527
|
-
:
|
|
573
|
+
: isImageButton(el, tag)
|
|
574
|
+
? this._options.imageSize(el)
|
|
575
|
+
? 'image'
|
|
576
|
+
: 'button'
|
|
577
|
+
: replacedKind(el, tag);
|
|
528
578
|
if (replaced !== 'none') {
|
|
529
579
|
this._replaced(el, tag, replaced, style, into);
|
|
530
580
|
return;
|
|
@@ -542,11 +592,8 @@ class Builder {
|
|
|
542
592
|
this._firstLine = true;
|
|
543
593
|
}
|
|
544
594
|
}
|
|
545
|
-
if (style
|
|
546
|
-
style.backgroundImages ||
|
|
547
|
-
typeof style.borderImage.source === 'string') {
|
|
595
|
+
if (namesImages(style))
|
|
548
596
|
this._backgrounds.push(box);
|
|
549
|
-
}
|
|
550
597
|
if (style.position === 'absolute' || style.position === 'fixed')
|
|
551
598
|
box.outOfFlow = true;
|
|
552
599
|
else if (style.float !== 'none')
|
|
@@ -674,11 +721,8 @@ class Builder {
|
|
|
674
721
|
const box = new Box('replaced', el, style);
|
|
675
722
|
box.replaced = replaced;
|
|
676
723
|
into.append(box);
|
|
677
|
-
if (style
|
|
678
|
-
style.backgroundImages ||
|
|
679
|
-
typeof style.borderImage.source === 'string') {
|
|
724
|
+
if (namesImages(style))
|
|
680
725
|
this._backgrounds.push(box);
|
|
681
|
-
}
|
|
682
726
|
if (style.position === 'absolute' || style.position === 'fixed')
|
|
683
727
|
box.outOfFlow = true;
|
|
684
728
|
else if (style.float !== 'none')
|
|
@@ -808,6 +852,11 @@ class Builder {
|
|
|
808
852
|
const box = new Box(boxKindFor(style.display), null, style);
|
|
809
853
|
box.pseudo = which;
|
|
810
854
|
into.append(box);
|
|
855
|
+
// its images are its element's to ask for: a `::after` with no content
|
|
856
|
+
// but a background, which designs hang a picture on, drew nothing
|
|
857
|
+
GENERATED_FROM.set(box, el);
|
|
858
|
+
if (namesImages(style))
|
|
859
|
+
this._backgrounds.push(box);
|
|
811
860
|
// a list item it generates has a marker as an element's has, of the
|
|
812
861
|
// `list-item` counter it has just counted (CSS 2.1 12.5): outside it,
|
|
813
862
|
// or at the start of its content
|
|
@@ -1169,6 +1218,11 @@ class Builder {
|
|
|
1169
1218
|
const letterStyle = cascade.firstLetterStyle(search.rules, style);
|
|
1170
1219
|
const box = new Box(boxKindFor(letterStyle.display), null, letterStyle);
|
|
1171
1220
|
box.pseudo = 'first-letter';
|
|
1221
|
+
if (owner) {
|
|
1222
|
+
GENERATED_FROM.set(box, owner);
|
|
1223
|
+
if (namesImages(letterStyle))
|
|
1224
|
+
this._backgrounds.push(box);
|
|
1225
|
+
}
|
|
1172
1226
|
if (letterStyle.float !== 'none') {
|
|
1173
1227
|
box.isFloat = true;
|
|
1174
1228
|
if (into.kind === 'inline')
|
|
@@ -1715,6 +1769,10 @@ function setIntrinsics(box, size, scale) {
|
|
|
1715
1769
|
ratio: size.ratio,
|
|
1716
1770
|
};
|
|
1717
1771
|
}
|
|
1772
|
+
/** An `<input type=image>`: a picture that submits its form. */
|
|
1773
|
+
function isImageButton(el, tag) {
|
|
1774
|
+
return (tag === 'input' && (attr(el, 'type') ?? '').trim().toLowerCase() === 'image');
|
|
1775
|
+
}
|
|
1718
1776
|
function replacedKind(el, tag) {
|
|
1719
1777
|
switch (tag) {
|
|
1720
1778
|
case 'img':
|
|
@@ -1990,8 +2048,7 @@ function breakAround(inline) {
|
|
|
1990
2048
|
for (let i = 0; i < pieces.length; i += 1) {
|
|
1991
2049
|
pieces[i].cut = (i > 0 ? 1 : 0) | (i < pieces.length - 1 ? 2 : 0);
|
|
1992
2050
|
}
|
|
1993
|
-
|
|
1994
|
-
CUT_BLOCKS.set(pieces[0], blocks);
|
|
2051
|
+
CUT_BLOCKS.set(pieces[0], blocks);
|
|
1995
2052
|
const fade = inline.style.opacity;
|
|
1996
2053
|
if (fade < 1) {
|
|
1997
2054
|
for (const block of blocks) {
|
|
@@ -2000,19 +2057,27 @@ function breakAround(inline) {
|
|
|
2000
2057
|
}
|
|
2001
2058
|
return out;
|
|
2002
2059
|
}
|
|
2060
|
+
/** Whether a style names an image for its box to be drawn with: a
|
|
2061
|
+
* background's, a border's, or a mask's. */
|
|
2062
|
+
function namesImages(style) {
|
|
2063
|
+
return (!!style.backgroundImage ||
|
|
2064
|
+
!!style.backgroundImages ||
|
|
2065
|
+
typeof style.borderImage.source === 'string' ||
|
|
2066
|
+
style.mask !== NO_MASK);
|
|
2067
|
+
}
|
|
2003
2068
|
function anonymousStyles(initial) {
|
|
2004
2069
|
const made = new WeakMap();
|
|
2005
2070
|
return (parent, display) => {
|
|
2006
|
-
let byDisplay = made.get(parent
|
|
2071
|
+
let byDisplay = made.get(parent);
|
|
2007
2072
|
if (!byDisplay) {
|
|
2008
2073
|
byDisplay = new Map();
|
|
2009
|
-
made.set(parent
|
|
2074
|
+
made.set(parent, byDisplay);
|
|
2010
2075
|
}
|
|
2011
2076
|
let style = byDisplay.get(display);
|
|
2012
2077
|
if (!style) {
|
|
2013
2078
|
// `display` is the one property it does not start from: it is the
|
|
2014
2079
|
// box the fix-up made, and layout asks the style what a box is
|
|
2015
|
-
style = inherit(parent
|
|
2080
|
+
style = inherit(parent, initial);
|
|
2016
2081
|
style.display = display;
|
|
2017
2082
|
byDisplay.set(display, style);
|
|
2018
2083
|
}
|
|
@@ -2103,7 +2168,7 @@ function wrapOrphans(box, kind, accept, anonymous) {
|
|
|
2103
2168
|
}
|
|
2104
2169
|
}
|
|
2105
2170
|
function anonymousOf(parent, kind, run, anonymous, display = kind) {
|
|
2106
|
-
const box = new Box(kind, null, anonymous(parent, display));
|
|
2171
|
+
const box = new Box(kind, null, anonymous(parent.style, display));
|
|
2107
2172
|
box.parent = parent;
|
|
2108
2173
|
for (const child of run) {
|
|
2109
2174
|
child.parent = box;
|