Code Coverage
 
Lines
Functions and Methods
Classes and Traits
Total
n/a
0 / 0
n/a
0 / 0
CRAP
n/a
0 / 0
AtomicInlineBox
n/a
0 / 0
n/a
0 / 0
0
n/a
0 / 0
1<?php
2
3declare(strict_types=1);
4
5namespace Phpdftk\HtmlToPdf\Box;
6
7/**
8 * A box that's inline-level on the outside but opaque to inline layout —
9 * `display: inline-block`, replaced elements (`<img>`, `<input>`),
10 * `<svg>`, etc.
11 *
12 * Treated as a single atomic glyph in the parent inline formatting
13 * context: it takes a known width / height computed from its own
14 * intrinsic dimensions or CSS sizing, but its internal layout is its
15 * own affair (typically a BFC).
16 */
17final class AtomicInlineBox extends Box
18{
19    /**
20     * CSS 2.1 §10.3.9 — the content-box inline size this box resolved to
21     * when its own formatting context was laid out, set by
22     * `BlockLayout::layoutInlineAtomicContents()` before the surrounding
23     * inline formatting context runs.
24     *
25     * `null` means the box was never pre-laid (a replaced element, or one
26     * with no in-flow children), in which case `InlineLayout` falls back
27     * to sizing it straight off the cascade.
28     */
29    public ?float $laidOutContentWidth = null;
30
31    /** Companion block size for {@see $laidOutContentWidth}. */
32    public ?float $laidOutContentHeight = null;
33
34    /**
35     * CSS 2.1 §10.8.1 — the box's alphabetic baseline, as an offset down
36     * from its CONTENT-box top edge.
37     *
38     * `null` means the box has no in-flow line box to take a baseline from,
39     * or its `overflow` is not `visible`; §10.8.1 then makes the baseline
40     * the bottom margin edge, which is what `InlineLayout` falls back to.
41     *
42     * Captured during the pre-layout pass rather than derived later: the
43     * inline formatting context overwrites the box's own `geometry->y`
44     * while placing it, so the offset cannot be recovered from geometry
45     * afterwards.
46     */
47    public ?float $laidOutBaseline = null;
48}