Block_Positioner

Positions block frames.

Defined (1)

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

/lib/dompdf/include/block_positioner.cls.php  
  1. class Block_Positioner extends Positioner { 
  2.  
  3.  
  4. function __construct(Frame_Decorator $frame) { parent::__construct($frame); } 
  5.  
  6. //........................................................................ 
  7.  
  8. function position() { 
  9. $frame = $this->_frame; 
  10. $style = $frame->get_style(); 
  11. $cb = $frame->get_containing_block(); 
  12. $p = $frame->find_block_parent(); 
  13.  
  14. if ( $p ) { 
  15. $float = $style->float; 
  16.  
  17. $enable_css_float = $frame->get_dompdf()->get_option("enable_css_float"); 
  18. if ( !$enable_css_float || !$float || $float === "none" ) { 
  19. $p->add_line(true); 
  20. $y = $p->get_current_line_box()->y; 
  21.  
  22. else { 
  23. $y = $cb["y"]; 
  24.  
  25. $x = $cb["x"]; 
  26.  
  27. // Relative positionning 
  28. if ( $style->position === "relative" ) { 
  29. $top = $style->length_in_pt($style->top, $cb["h"]); 
  30. //$right = $style->length_in_pt($style->right, $cb["w"]); 
  31. //$bottom = $style->length_in_pt($style->bottom, $cb["h"]); 
  32. $left = $style->length_in_pt($style->left, $cb["w"]); 
  33.  
  34. $x += $left; 
  35. $y += $top; 
  36.  
  37. $frame->set_position($x, $y);