/** * Remove a child frame * * @param Frame $child * @param boolean $update_node Whether or not to remove the DOM node * * @throws DOMPDF_Exception * @return Frame The removed child frame */ function remove_child(Frame $child, $update_node = true) { if ($child->_parent !== $this) { throw new DOMPDF_Exception("Child not found in this frame"); } if ($update_node) { $this->_node->removeChild($child->_node); } if ($child === $this->_first_child) { $this->_first_child = $child->_next_sibling; } if ($child === $this->_last_child) { $this->_last_child = $child->_prev_sibling; } if ($child->_prev_sibling) { $child->_prev_sibling->_next_sibling = $child->_next_sibling; } if ($child->_next_sibling) { $child->_next_sibling->_prev_sibling = $child->_prev_sibling; } $child->_next_sibling = null; $child->_prev_sibling = null; $child->_parent = null; return $child; }