Fixed_Positioner

Positions fixely positioned frames.

Defined (1)

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

/lib/dompdf/include/fixed_positioner.cls.php  
  1. class Fixed_Positioner extends Positioner { 
  2.  
  3. function __construct(Frame_Decorator $frame) { parent::__construct($frame); } 
  4.  
  5. function position() { 
  6.  
  7. $frame = $this->_frame; 
  8. $style = $frame->get_original_style(); 
  9. $root = $frame->get_root(); 
  10. $initialcb = $root->get_containing_block(); 
  11. $initialcb_style = $root->get_style(); 
  12.  
  13. $p = $frame->find_block_parent(); 
  14. if ( $p ) { 
  15. $p->add_line(); 
  16.  
  17. // Compute the margins of the @page style 
  18. $margin_top = $initialcb_style->length_in_pt($initialcb_style->margin_top, $initialcb["h"]); 
  19. $margin_right = $initialcb_style->length_in_pt($initialcb_style->margin_right, $initialcb["w"]); 
  20. $margin_bottom = $initialcb_style->length_in_pt($initialcb_style->margin_bottom, $initialcb["h"]); 
  21. $margin_left = $initialcb_style->length_in_pt($initialcb_style->margin_left, $initialcb["w"]); 
  22.  
  23. // The needed computed style of the element 
  24. $height = $style->length_in_pt($style->height, $initialcb["h"]); 
  25. $width = $style->length_in_pt($style->width, $initialcb["w"]); 
  26.  
  27. $top = $style->length_in_pt($style->top, $initialcb["h"]); 
  28. $right = $style->length_in_pt($style->right, $initialcb["w"]); 
  29. $bottom = $style->length_in_pt($style->bottom, $initialcb["h"]); 
  30. $left = $style->length_in_pt($style->left, $initialcb["w"]); 
  31.  
  32. $y = $margin_top; 
  33. if ( isset($top) ) { 
  34. $y = $top + $margin_top; 
  35. if ( $top === "auto" ) { 
  36. $y = $margin_top; 
  37. if ( isset($bottom) && $bottom !== "auto" ) { 
  38. $y = $initialcb["h"] - $bottom - $margin_bottom; 
  39. $margin_height = $this->_frame->get_margin_height(); 
  40. if ( $margin_height !== "auto" ) { 
  41. $y -= $margin_height; 
  42. else { 
  43. $y -= $height; 
  44.  
  45. $x = $margin_left; 
  46. if ( isset($left) ) { 
  47. $x = $left + $margin_left; 
  48. if ( $left === "auto" ) { 
  49. $x = $margin_left; 
  50. if ( isset($right) && $right !== "auto" ) { 
  51. $x = $initialcb["w"] - $right - $margin_right; 
  52. $margin_width = $this->_frame->get_margin_width(); 
  53. if ( $margin_width !== "auto" ) { 
  54. $x -= $margin_width; 
  55. else { 
  56. $x -= $width; 
  57.  
  58. $frame->set_position($x, $y); 
  59.  
  60. $children = $frame->get_children(); 
  61. foreach($children as $child) { 
  62. $child->set_position($x, $y);