Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| ColumnRun | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |
100.00% |
1 / 1 |
| __construct | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
1 | |||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace Phpdftk\HtmlToPdf\Layout; |
| 6 | |
| 7 | use Phpdftk\HtmlToPdf\Box\Box; |
| 8 | |
| 9 | /** |
| 10 | * One fragmented columnar run inside a multi-column container |
| 11 | * (CSS Multi-column 1 §3.3, §6.2). |
| 12 | * |
| 13 | * A container with `column-span: all` children is carved into sequential |
| 14 | * segments — columnar runs separated by full-width spanners — and EACH |
| 15 | * run is its own fragmentation context with its own column height and its |
| 16 | * own band count. A single `columnHeight` on {@see MultiColumnLayout} |
| 17 | * cannot express that, so the container records a list of these. |
| 18 | * |
| 19 | * The run's `$children` were laid out as ONE TALL column starting at |
| 20 | * `$contentOffset` BELOW the container's content origin, at its |
| 21 | * content-left edge. The offset is relative on purpose: block layout can |
| 22 | * still move the container after its runs are recorded (margin collapsing |
| 23 | * pulls it up by the previous sibling's bottom margin) and the children |
| 24 | * move with it, so an absolute origin would desync from the content. The |
| 25 | * painter slices that tall column into `$bandCount` bands of |
| 26 | * `$columnHeight`, drawing band `i` clipped to column `i` |
| 27 | * ({@see \Phpdftk\HtmlToPdf\Painter\Painter::paintColumnRuns}). |
| 28 | * |
| 29 | * `$bandCount` can exceed the container's `column-count`: CSS |
| 30 | * Multi-column 1 §3.3 creates OVERFLOW COLUMNS when the content does not |
| 31 | * fit in the specified number of columns at the fragmentainer height. |
| 32 | */ |
| 33 | final readonly class ColumnRun |
| 34 | { |
| 35 | /** @param list<Box> $children */ |
| 36 | public function __construct( |
| 37 | public array $children, |
| 38 | public float $contentOffset, |
| 39 | public float $columnHeight, |
| 40 | public int $bandCount, |
| 41 | ) {} |
| 42 | } |