Skip to content

Commit

Permalink
Fix body rendering when border is applied
Browse files Browse the repository at this point in the history
The block reflower resolves width, height, margins, and insets (`top`,
`right`, `bottom`, `left`). Any case of unresolved margin values should
be fixed in the reflower, so `length_in_pt` and `float` casts are
unnecessary here.

Fixes #2939
  • Loading branch information
Mellthas authored and bsweeney committed Sep 15, 2022
1 parent fe4e904 commit 7456bb0
Showing 1 changed file with 4 additions and 6 deletions.
10 changes: 4 additions & 6 deletions src/Renderer/Block.php
Expand Up @@ -32,12 +32,10 @@ function render(Frame $frame)
[$x, $y, $w, $h] = $frame->get_border_box();

if ($node->nodeName === "body") {
$h = $frame->get_containing_block("h") - (float)$style->length_in_pt([
$style->margin_top,
$style->border_top_width,
$style->border_bottom_width,
$style->margin_bottom],
(float)$style->length_in_pt($style->width));
// 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];
Expand Down

0 comments on commit 7456bb0

Please sign in to comment.