Exemplo n.º 1
0
 /**
  * Decorate the root Frame
  *
  * @param $root   Frame The frame to decorate
  * @param $dompdf Dompdf The dompdf instance
  *
  * @return PageFrameDecorator
  */
 static function decorate_root(Frame $root, Dompdf $dompdf)
 {
     $frame = new PageFrameDecorator($root, $dompdf);
     $frame->set_reflower(new PageFrameReflower($frame));
     $root->set_decorator($frame);
     return $frame;
 }
Exemplo n.º 2
0
 /**
  * Returns the floating elements inside the first floating parent
  *
  * @param Page $root
  *
  * @return Frame[]
  */
 function get_floats_inside(Page $root)
 {
     $floating_frames = $root->get_floating_frames();
     if (count($floating_frames) == 0) {
         return $floating_frames;
     }
     // Find nearest floating element
     $p = $this->_block_frame;
     while ($p->get_style()->float === "none") {
         $parent = $p->get_parent();
         if (!$parent) {
             break;
         }
         $p = $parent;
     }
     if ($p == $root) {
         return $floating_frames;
     }
     $parent = $p;
     $childs = array();
     foreach ($floating_frames as $_floating) {
         $p = $_floating->get_parent();
         while (($p = $p->get_parent()) && $p !== $parent) {
         }
         if ($p) {
             $childs[] = $p;
         }
     }
     return $childs;
 }