Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
100.00% |
1 / 1 |
|
100.00% |
1 / 1 |
CRAP | |
100.00% |
1 / 1 |
| PositionedAncestor | |
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 | /** |
| 8 | * CSS 2.1 §10.1 — the padding-box rectangle of the nearest positioned |
| 9 | * ancestor. `BlockLayout` threads an instance through `LayoutContext` |
| 10 | * whenever it enters a `position: relative | absolute | fixed | sticky` |
| 11 | * box, and reads it back when resolving offsets for an in-flow |
| 12 | * `position: absolute` / `fixed` descendant. |
| 13 | * |
| 14 | * Coordinates are layout-space (page-flow Y grows downward), matching |
| 15 | * the rest of the layout pipeline. |
| 16 | */ |
| 17 | final readonly class PositionedAncestor |
| 18 | { |
| 19 | public function __construct( |
| 20 | /** X of the padding-box top-left corner. */ |
| 21 | public float $originX, |
| 22 | /** Y of the padding-box top-left corner. */ |
| 23 | public float $originY, |
| 24 | /** Padding-box width (= content width + padding-left + padding-right). */ |
| 25 | public float $width, |
| 26 | /** Padding-box height (= content height + padding-top + padding-bottom). */ |
| 27 | public float $height, |
| 28 | ) {} |
| 29 | } |