From d79ab32850b3f93b0e710bc81a9cb7662e0ad585 Mon Sep 17 00:00:00 2001 From: Dana Burkart Date: Sun, 10 Oct 2021 22:41:00 -0700 Subject: [PATCH] LibWeb: Consider empty fragments the same as whitespace in LineBox When computing whether whitespace should be collapsed or not, we have to consider empty fragments, since
will produce an empty fragment to force a line break. LineBox::is_empty_or_ends_in_whitespace() is amended to look at the length of the last fragment, and return true if it is 0. --- Userland/Libraries/LibWeb/Layout/LineBox.cpp | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Userland/Libraries/LibWeb/Layout/LineBox.cpp b/Userland/Libraries/LibWeb/Layout/LineBox.cpp index 894344fe5c..de4d900ad4 100644 --- a/Userland/Libraries/LibWeb/Layout/LineBox.cpp +++ b/Userland/Libraries/LibWeb/Layout/LineBox.cpp @@ -61,6 +61,8 @@ bool LineBox::is_empty_or_ends_in_whitespace() const { if (m_fragments.is_empty()) return true; + if (m_fragments.last().length() == 0) + return true; return m_fragments.last().ends_in_whitespace(); }