PluginProbe
MBE eShip / trunk
MBE eShip vtrunk
2.8.1 trunk 1.0.0 1.1.0 1.1.3 1.2.1 1.2.2 1.3.0 1.4.0 1.4.1 1.5.0 1.5.1 1.5.2 1.6.0 1.7.0 1.7.1 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.1.0 2.1.1 2.1.2 2.2.1 All 37 releases
mail-boxes-etc / lib / dompdf / src / Positioner / ListBullet.php

ListBullet.php in MBE eShip trunk, at lib/dompdf/src/Positioner/ListBullet.php

43 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
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