Inline_Frame_Decorator

Decorates frames for inline layout.

Defined (1)

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

/lib/dompdf/include/inline_frame_decorator.cls.php  
  1. class Inline_Frame_Decorator extends Frame_Decorator { 
  2.  
  3. function __construct(Frame $frame, DOMPDF $dompdf) { parent::__construct($frame, $dompdf); } 
  4.  
  5. function split(Frame $frame = null, $force_pagebreak = false) { 
  6.  
  7. if ( is_null($frame) ) { 
  8. $this->get_parent()->split($this, $force_pagebreak); 
  9. return; 
  10.  
  11. if ( $frame->get_parent() !== $this ) 
  12. throw new DOMPDF_Exception("Unable to split: frame is not a child of this one."); 
  13.  
  14. $split = $this->copy( $this->_frame->get_node()->cloneNode() );  
  15. $this->get_parent()->insert_child_after($split, $this); 
  16.  
  17. // Unset the current node's right style properties 
  18. $style = $this->_frame->get_style(); 
  19. $style->margin_right = 0; 
  20. $style->padding_right = 0; 
  21. $style->border_right_width = 0; 
  22.  
  23. // Unset the split node's left style properties since we don't want them 
  24. // to propagate 
  25. $style = $split->get_style(); 
  26. $style->margin_left = 0; 
  27. $style->padding_left = 0; 
  28. $style->border_left_width = 0; 
  29.  
  30. //On continuation of inline element on next line,  
  31. //don't repeat non-vertically repeatble background images 
  32. //See e.g. in testcase image_variants, long desriptions 
  33. if ( ($url = $style->background_image) && $url !== "none" 
  34. && ($repeat = $style->background_repeat) && $repeat !== "repeat" && $repeat !== "repeat-y" 
  35. ) { 
  36. $style->background_image = "none"; 
  37. }  
  38.  
  39. // Add $frame and all following siblings to the new split node 
  40. $iter = $frame; 
  41. while ($iter) { 
  42. $frame = $iter;  
  43. $iter = $iter->get_next_sibling(); 
  44. $frame->reset(); 
  45. $split->append_child($frame); 
  46.  
  47. $page_breaks = array("always", "left", "right"); 
  48. $frame_style = $frame->get_style(); 
  49. if( $force_pagebreak || 
  50. in_array($frame_style->page_break_before, $page_breaks) || 
  51. in_array($frame_style->page_break_after, $page_breaks) ) { 
  52.  
  53. $this->get_parent()->split($split, true); 
  54.