composer package updates
[openemr.git] / vendor / dompdf / dompdf / src / FrameDecorator / TableRowGroup.php
blobaabbd4e5447d92e6416b7f1c802b6bf995a931e6
1 <?php
2 /**
3 * @package dompdf
4 * @link http://dompdf.github.com/
5 * @author Benj Carson <benjcarson@digitaljunkies.ca>
6 * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
7 */
8 namespace Dompdf\FrameDecorator;
10 use Dompdf\Dompdf;
11 use Dompdf\Frame;
13 /**
14 * Table row group decorator
16 * Overrides split() method for tbody, thead & tfoot elements
18 * @package dompdf
20 class TableRowGroup extends AbstractFrameDecorator
23 /**
24 * Class constructor
26 * @param Frame $frame Frame to decorate
27 * @param Dompdf $dompdf Current dompdf instance
29 function __construct(Frame $frame, Dompdf $dompdf)
31 parent::__construct($frame, $dompdf);
34 /**
35 * Override split() to remove all child rows and this element from the cellmap
37 * @param Frame $child
38 * @param bool $force_pagebreak
40 * @return void
42 function split(Frame $child = null, $force_pagebreak = false)
44 if (is_null($child)) {
45 parent::split();
46 return;
49 // Remove child & all subsequent rows from the cellmap
50 $cellmap = $this->get_parent()->get_cellmap();
51 $iter = $child;
53 while ($iter) {
54 $cellmap->remove_row($iter);
55 $iter = $iter->get_next_sibling();
58 // If we are splitting at the first child remove the
59 // table-row-group from the cellmap as well
60 if ($child === $this->get_first_child()) {
61 $cellmap->remove_row_group($this);
62 parent::split();
63 return;
66 $cellmap->update_row_group($this, $child->get_prev_sibling());
67 parent::split($child);