Skip to content

Commit

Permalink
Stop generated table frame reflow after paging
Browse files Browse the repository at this point in the history
When a generated frame is paged it's children are removed from the frame. If the generated frame is styled `display: table` the first child will be a table row group. Since table child frames are always expected to be associated with a table this causes an exception.

When a table row group's parent frame is a generated frame and the frame no longer has a parent after paging Dompdf will halt further processing of the frame.

fixes 3334
  • Loading branch information
bsweeney committed Feb 21, 2024
1 parent e1d262b commit 987ce80
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/FrameReflower/TableRowGroup.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ function reflow(BlockFrameDecorator $block = null)
/** @var TableRowGroupFrameDecorator */
$frame = $this->_frame;
$page = $frame->get_root();
$parent = $frame->get_parent();
$dompdf_generated = $parent->get_frame()->get_node()->nodeName === "dompdf_generated";

// Counters and generated content
$this->_set_content();
Expand All @@ -55,6 +57,10 @@ function reflow(BlockFrameDecorator $block = null)
}
}

if ($page->is_full() && $dompdf_generated && $frame->get_parent() === null) {
return;
}

$table = TableFrameDecorator::find_parent_table($frame);
if ($table === null) {
throw new Exception("Parent table not found for table row group");
Expand Down

0 comments on commit 987ce80

Please sign in to comment.