1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 08:08:12 +00:00

LibHTML: Implement the <br> element for line breaking

The <br> element will produce a special LayoutBreak node in the layout
tree, which forces a break in the line layout whenever encountered.

This patch also makes LayoutBlock use the current line-height as the
minimum effective height for each line box. This ensures that having
multiple <br> elements in a row doesn't create 0-height line boxes.
This commit is contained in:
Andreas Kling 2019-10-12 13:47:49 +02:00
parent bf79b198f6
commit 6242459c0f
9 changed files with 89 additions and 1 deletions

View file

@ -54,10 +54,12 @@ void LayoutBlock::layout_inline_children()
child.split_into_lines(*this);
});
int min_line_height = style().line_height();
int content_height = 0;
for (auto& line_box : m_line_boxes) {
int max_height = 0;
int max_height = min_line_height;
for (auto& fragment : line_box.fragments()) {
max_height = max(max_height, fragment.rect().height());
}