|
Apache/2.4.41 (Ubuntu) Linux vmi616275.contaboserver.net 5.4.0-84-generic #94-Ubuntu SMP Thu Aug 26 20:27:37 UTC 2021 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) server ip : 62.171.164.128 | your ip : 127.0.0.1 safemode OFF > / home / a / home / dev2.destoffenstraat.com / vendor / dompdf / dompdf / src / Renderer / |
Filename | /home/a/home/dev2.destoffenstraat.com/vendor/dompdf/dompdf/src/Renderer/Block.php |
Size | 2.29 kb |
Permission | rw-r--r-- |
Owner | root : root |
Create time | 21-Aug-2025 12:26 |
Last modified | 15-Jan-2025 15:09 |
Last accessed | 22-Aug-2025 21:34 |
Actions | edit | rename | delete | download (gzip) |
View | text | code | image |
<?php
/**
* @package dompdf
* @link https://github.com/dompdf/dompdf
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
namespace Dompdf\Renderer;
use Dompdf\Frame;
use Dompdf\FrameDecorator\Block as BlockFrameDecorator;
/**
* Renders block frames
*
* @package dompdf
*/
class Block extends AbstractRenderer
{
/**
* @param Frame $frame
*/
function render(Frame $frame)
{
$style = $frame->get_style();
$node = $frame->get_node();
$this->_set_opacity($frame->get_opacity($style->opacity));
[$x, $y, $w, $h] = $frame->get_border_box();
if ($node->nodeName === "body") {
// Margins should be fully resolved at this point
$mt = $style->margin_top;
$mb = $style->margin_bottom;
$h = $frame->get_containing_block("h") - $mt - $mb;
}
$border_box = [$x, $y, $w, $h];
// Draw our background, border and content
$this->_render_background($frame, $border_box);
$this->_render_border($frame, $border_box);
$this->_render_outline($frame, $border_box);
$this->addNamedDest($node);
$this->addHyperlink($node, $border_box);
$this->debugBlockLayout($frame, "red", false);
}
/**
* @param Frame $frame
* @param array|string $color
* @param bool $lines
*/
protected function debugBlockLayout(Frame $frame, $color, bool $lines = false): void
{
$options = $this->_dompdf->getOptions();
$debugLayout = $options->getDebugLayout();
if (!$debugLayout) {
return;
}
if ($options->getDebugLayoutBlocks()) {
$this->debugLayout($frame->get_border_box(), $color);
if ($options->getDebugLayoutPaddingBox()) {
$this->debugLayout($frame->get_padding_box(), $color, [0.5, 0.5]);
}
}
if ($lines && $options->getDebugLayoutLines() && $frame instanceof BlockFrameDecorator) {
[$cx, , $cw] = $frame->get_content_box();
foreach ($frame->get_line_boxes() as $line) {
$lw = $cw - $line->left - $line->right;
$this->debugLayout([$cx + $line->left, $line->y, $lw, $line->h], "orange");
}
}
}
}
/**
* @package dompdf
* @link https://github.com/dompdf/dompdf
* @license http://www.gnu.org/copyleft/lesser.html GNU Lesser General Public License
*/
namespace Dompdf\Renderer;
use Dompdf\Frame;
use Dompdf\FrameDecorator\Block as BlockFrameDecorator;
/**
* Renders block frames
*
* @package dompdf
*/
class Block extends AbstractRenderer
{
/**
* @param Frame $frame
*/
function render(Frame $frame)
{
$style = $frame->get_style();
$node = $frame->get_node();
$this->_set_opacity($frame->get_opacity($style->opacity));
[$x, $y, $w, $h] = $frame->get_border_box();
if ($node->nodeName === "body") {
// Margins should be fully resolved at this point
$mt = $style->margin_top;
$mb = $style->margin_bottom;
$h = $frame->get_containing_block("h") - $mt - $mb;
}
$border_box = [$x, $y, $w, $h];
// Draw our background, border and content
$this->_render_background($frame, $border_box);
$this->_render_border($frame, $border_box);
$this->_render_outline($frame, $border_box);
$this->addNamedDest($node);
$this->addHyperlink($node, $border_box);
$this->debugBlockLayout($frame, "red", false);
}
/**
* @param Frame $frame
* @param array|string $color
* @param bool $lines
*/
protected function debugBlockLayout(Frame $frame, $color, bool $lines = false): void
{
$options = $this->_dompdf->getOptions();
$debugLayout = $options->getDebugLayout();
if (!$debugLayout) {
return;
}
if ($options->getDebugLayoutBlocks()) {
$this->debugLayout($frame->get_border_box(), $color);
if ($options->getDebugLayoutPaddingBox()) {
$this->debugLayout($frame->get_padding_box(), $color, [0.5, 0.5]);
}
}
if ($lines && $options->getDebugLayoutLines() && $frame instanceof BlockFrameDecorator) {
[$cx, , $cw] = $frame->get_content_box();
foreach ($frame->get_line_boxes() as $line) {
$lw = $cw - $line->left - $line->right;
$this->debugLayout([$cx + $line->left, $line->y, $lw, $line->h], "orange");
}
}
}
}