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

LibWeb: Move white-space into LayoutStyle

This commit is contained in:
Andreas Kling 2020-06-24 16:37:44 +02:00
parent bc178ee743
commit 6b334e02e6
6 changed files with 45 additions and 5 deletions

View file

@ -244,6 +244,25 @@ CSS::TextAlign StyleProperties::text_align() const
return CSS::TextAlign::Left;
}
Optional<CSS::WhiteSpace> StyleProperties::white_space() const
{
auto value = property(CSS::PropertyID::WhiteSpace);
if (!value.has_value() || !value.value()->is_string())
return {};
auto string = value.value()->to_string();
if (string == "normal")
return CSS::WhiteSpace::Normal;
if (string == "nowrap")
return CSS::WhiteSpace::Nowrap;
if (string == "pre")
return CSS::WhiteSpace::Pre;
if (string == "pre-line")
return CSS::WhiteSpace::PreLine;
if (string == "pre-wrap")
return CSS::WhiteSpace::PreWrap;
return {};
}
CSS::Display StyleProperties::display() const
{
auto display = string_or_fallback(CSS::PropertyID::Display, "inline");