LibWeb: Only preserve full whitspace for white-space: pre{,-wrap}

This commit is contained in:
Andreas Kling 2020-12-18 11:04:29 +01:00
commit 18f1f4e1a2
Notes: sideshowbarker 2024-07-19 00:46:00 +09:00

View file

@ -61,8 +61,13 @@ const String& TextNode::text_for_style(const CSS::StyleProperties& style) const
{
static String one_space = " ";
if (is_all_whitespace(dom_node().data())) {
if (style.white_space().value_or(CSS::WhiteSpace::Normal) == CSS::WhiteSpace::Normal)
switch (style.white_space().value_or(CSS::WhiteSpace::Normal)) {
case CSS::WhiteSpace::Pre:
case CSS::WhiteSpace::PreWrap:
break;
default:
return one_space;
}
}
return dom_node().data();
}