From 738147483517a572625cc7089ad5b955faaa9f69 Mon Sep 17 00:00:00 2001 From: Enver Balalic Date: Sun, 3 Apr 2022 21:05:09 +0200 Subject: [PATCH] LibWeb: Don't break text lines if white-space: nowrap If white-space is nowrap then we don't want to break a text_node into multiple line boxes. This fixes the width calculation in the min-content case for white-space: nowrap elements. Before this the min-width would be the width of the biggest line box. --- Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp index fb22f7f0d9..a74235edd3 100644 --- a/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp +++ b/Userland/Libraries/LibWeb/Layout/InlineFormattingContext.cpp @@ -252,7 +252,8 @@ void InlineFormattingContext::generate_line_boxes(LayoutMode layout_mode) case InlineLevelIterator::Item::Type::Text: { auto& text_node = verify_cast(*item.node); - if (line_builder.break_if_needed(layout_mode, item.border_box_width())) { + + if (text_node.computed_values().white_space() != CSS::WhiteSpace::Nowrap && line_builder.break_if_needed(layout_mode, item.border_box_width())) { // If whitespace caused us to break, we swallow the whitespace instead of // putting it on the next line.