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

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.
This commit is contained in:
Andreas Kling 2019-11-19 19:21:47 +01:00
parent 1fe2cca439
commit 5a04472470

View file

@ -25,7 +25,7 @@ StringView LineBoxFragment::text() const
{
if (!is<LayoutText>(layout_node()))
return {};
return to<LayoutText>(layout_node()).node().data().substring_view(m_start, m_length);
return to<LayoutText>(layout_node()).text_for_rendering().substring_view(m_start, m_length);
}
int LineBoxFragment::text_index_at(float x) const