| 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 |
use Dompdf\FrameDecorator\ListBullet as ListBulletFrameDecorator; |
| 11 |
|
| 12 |
/** |
| 13 |
* Positions list bullets |
| 14 |
* |
| 15 |
* @package dompdf |
| 16 |
*/ |
| 17 |
class ListBullet extends AbstractPositioner |
| 18 |
{ |
| 19 |
/** |
| 20 |
* @param ListBulletFrameDecorator $frame |
| 21 |
*/ |
| 22 |
function position(AbstractFrameDecorator $frame): void |
| 23 |
{ |
| 24 |
// List markers are positioned to the left of the border edge of their |
| 25 |
// parent element (FIXME: right for RTL) |
| 26 |
$parent = $frame->get_parent(); |
| 27 |
$style = $parent->get_style(); |
| 28 |
$cbw = $parent->get_containing_block("w"); |
| 29 |
$margin_left = (float) $style->length_in_pt($style->margin_left, $cbw); |
| 30 |
$border_edge = $parent->get_position("x") + $margin_left; |
| 31 |
|
| 32 |
// This includes the marker indentation |
| 33 |
$x = $border_edge - $frame->get_margin_width(); |
| 34 |
|
| 35 |
// The marker is later vertically aligned with the corresponding line |
| 36 |
// box and its vertical position is fine-tuned in the renderer |
| 37 |
$p = $frame->find_block_parent(); |
| 38 |
$y = $p->get_current_line_box()->y; |
| 39 |
|
| 40 |
$frame->set_position($x, $y); |
| 41 |
} |
| 42 |
} |
| 43 |
|