Blame view

dompdf/src/FrameDecorator/TableRow.php 1.24 KB
670b6d6f8   tuan   2016/09/22 - Copy...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
  <?php
  /**
   * @package dompdf
   * @link    http://dompdf.github.com/
   * @author  Benj Carson <benjcarson@digitaljunkies.ca>
   * @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
   */
  namespace Dompdf\FrameDecorator;
  
  use Dompdf\Dompdf;
  use Dompdf\Frame;
  use Dompdf\FrameDecorator\Table as TableFrameDecorator;
  
  /**
   * Decorates Frames for table row layout
   *
   * @package dompdf
   */
  class TableRow extends AbstractFrameDecorator
  {
      function __construct(Frame $frame, Dompdf $dompdf)
      {
          parent::__construct($frame, $dompdf);
      }
  
      //........................................................................
  
      /**
       * Remove all non table-cell frames from this row and move them after
       * the table.
       */
      function normalise()
      {
  
          // Find our table parent
          $p = TableFrameDecorator::find_parent_table($this);
  
          $erroneous_frames = array();
          foreach ($this->get_children() as $child) {
              $display = $child->get_style()->display;
  
              if ($display !== "table-cell")
                  $erroneous_frames[] = $child;
          }
  
          //  dump the extra nodes after the table.
          foreach ($erroneous_frames as $frame)
              $p->move_after($frame);
      }
  
  
  }