From 5a04472470ecb76dec4bb16d22205b2f023a865d Mon Sep 17 00:00:00 2001 From: Andreas Kling Date: Tue, 19 Nov 2019 19:21:47 +0100 Subject: [PATCH] LibHTML: Fix bug in removal of trailing whitespace from line boxes This code was using the text from the DOM as a reference for how much whitespace to remove from the end of a line box. Since the DOM may contain uncollapsed whitespace, it would sometimes be out of sync with the collapsed text used by the rest of the layout system. --- Libraries/LibHTML/Layout/LineBoxFragment.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Libraries/LibHTML/Layout/LineBoxFragment.cpp b/Libraries/LibHTML/Layout/LineBoxFragment.cpp index 40c88e1764..b49595a65d 100644 --- a/Libraries/LibHTML/Layout/LineBoxFragment.cpp +++ b/Libraries/LibHTML/Layout/LineBoxFragment.cpp @@ -25,7 +25,7 @@ StringView LineBoxFragment::text() const { if (!is(layout_node())) return {}; - return to(layout_node()).node().data().substring_view(m_start, m_length); + return to(layout_node()).text_for_rendering().substring_view(m_start, m_length); } int LineBoxFragment::text_index_at(float x) const