diff options
author | Andreas Kling <kling@serenityos.org> | 2022-01-23 01:34:26 +0100 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2022-01-23 01:36:13 +0100 |
commit | b60e19fd3406dec707c4933d840286526e4058d1 (patch) | |
tree | bf327cf4431a00f5685cf3cc5891f7230b746485 /Userland/Libraries/LibWeb/Layout/LineBuilder.cpp | |
parent | 093a598c8721ecaaeac6d4686a01a1d8b5a8caf6 (diff) | |
download | serenity-b60e19fd3406dec707c4933d840286526e4058d1.zip |
LibWeb: Make LineBuilder assign height to empty line boxes
This ensures that <br> produces empty line boxes with the line-height
property as their height.
Diffstat (limited to 'Userland/Libraries/LibWeb/Layout/LineBuilder.cpp')
-rw-r--r-- | Userland/Libraries/LibWeb/Layout/LineBuilder.cpp | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp b/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp index 606ded8c7a..69d317f3ef 100644 --- a/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp +++ b/Userland/Libraries/LibWeb/Layout/LineBuilder.cpp @@ -12,7 +12,7 @@ namespace Web::Layout { LineBuilder::LineBuilder(InlineFormattingContext& context) : m_context(context) { - begin_new_line(); + begin_new_line(false); } LineBuilder::~LineBuilder() @@ -25,12 +25,13 @@ void LineBuilder::break_line() { update_last_line(); m_context.containing_block().line_boxes().append(LineBox()); - begin_new_line(); + begin_new_line(true); } -void LineBuilder::begin_new_line() +void LineBuilder::begin_new_line(bool increment_y) { - m_current_y += m_max_height_on_current_line; + if (increment_y) + m_current_y += max(m_max_height_on_current_line, m_context.containing_block().line_height()); auto space = m_context.available_space_for_line(m_current_y); m_available_width_for_current_line = space.right - space.left; m_max_height_on_current_line = 0; |