| 1 |
<?php |
| 2 |
/** |
| 3 |
* @package dompdf |
| 4 |
* @link https://github.com/dompdf/dompdf |
| 5 |
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License |
| 6 |
*/ |
| 7 |
namespace Dompdf\Positioner; |
| 8 |
|
| 9 |
use Dompdf\FrameDecorator\AbstractFrameDecorator; |
| 10 |
|
| 11 |
/** |
| 12 |
* Positions block frames |
| 13 |
* |
| 14 |
* @package dompdf |
| 15 |
*/ |
| 16 |
class Block extends AbstractPositioner |
| 17 |
{ |
| 18 |
|
| 19 |
function position(AbstractFrameDecorator $frame): void |
| 20 |
{ |
| 21 |
$style = $frame->get_style(); |
| 22 |
$cb = $frame->get_containing_block(); |
| 23 |
$p = $frame->find_block_parent(); |
| 24 |
|
| 25 |
if ($p) { |
| 26 |
$float = $style->float; |
| 27 |
|
| 28 |
if (!$float || $float === "none") { |
| 29 |
$p->add_line(true); |
| 30 |
} |
| 31 |
$y = $p->get_current_line_box()->y; |
| 32 |
} else { |
| 33 |
$y = $cb["y"]; |
| 34 |
} |
| 35 |
|
| 36 |
$x = $cb["x"]; |
| 37 |
|
| 38 |
$frame->set_position($x, $y); |
| 39 |
} |
| 40 |
} |
| 41 |
|