function reflow(&$parent, &$context) { // Check if there are any boxes in parent's line box if ($parent->line_box_empty()) { // The very first whitespace in the line box should not affect neither height nor baseline of the line box; // because following boxes can be smaller that assumed whitespace height // Example: <br>[whitespace]<img height="2" width="2"><br>; whitespace can overextend this line $this->width = 0; $this->height = 0; } elseif (is_a($parent->last_in_line(), "WhitespaceBox")) { // Duplicate whitespace boxes should not offset further content and affect the line box length $this->width = 0; $this->height = 0; } elseif ($this->maybe_line_break($parent, $context)) { $this->width = 0; $this->height = 0; } parent::reflow($parent, $context); }