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

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
parent b322452ef4
commit 18f1f4e1a2

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();
}