Inline_Positioner

Positions inline frames.

Defined (1)

The class is defined in the following location(s).

/lib/dompdf/include/inline_positioner.cls.php  
  1. class Inline_Positioner extends Positioner { 
  2.  
  3. function __construct(Frame_Decorator $frame) { parent::__construct($frame); } 
  4.  
  5. //........................................................................ 
  6.  
  7. function position() { 
  8. /** 
  9. * Find our nearest block level parent and access its lines property. 
  10. * @var Block_Frame_Decorator 
  11. */  
  12. $p = $this->_frame->find_block_parent(); 
  13.  
  14. // Debugging code: 
  15.  
  16. // pre_r("\nPositioning:"); 
  17. // pre_r("Me: " . $this->_frame->get_node()->nodeName . " (" . spl_object_hash($this->_frame->get_node()) . ")"); 
  18. // pre_r("Parent: " . $p->get_node()->nodeName . " (" . spl_object_hash($p->get_node()) . ")"); 
  19.  
  20. // End debugging 
  21.  
  22. if ( !$p ) 
  23. throw new DOMPDF_Exception("No block-level parent found. Not good."); 
  24.  
  25. $f = $this->_frame; 
  26.  
  27. $cb = $f->get_containing_block(); 
  28. $line = $p->get_current_line_box(); 
  29.  
  30. // Skip the page break if in a fixed position element 
  31. $is_fixed = false; 
  32. while($f = $f->get_parent()) { 
  33. if($f->get_style()->position === "fixed") { 
  34. $is_fixed = true; 
  35. break; 
  36.  
  37. $f = $this->_frame; 
  38.  
  39. if ( !$is_fixed && $f->get_parent() && 
  40. $f->get_parent() instanceof Inline_Frame_Decorator && 
  41. $f->is_text_node() ) { 
  42.  
  43. $min_max = $f->get_reflower()->get_min_max_width(); 
  44.  
  45. // If the frame doesn't fit in the current line, a line break occurs 
  46. if ( $min_max["min"] > ($cb["w"] - $line->left - $line->w - $line->right) ) { 
  47. $p->add_line(); 
  48.  
  49. $f->set_position($cb["x"] + $line->w, $line->y); 
  50.