1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 04:17:35 +00:00

LibWeb: Add new UnresolvedStyleValue class

This represents a property value that hasn't been converted to a
"proper" StyleValue yet. That is, it's either a custom property's value,
or a value that includes `var()` references, (or both!) since neither of
those can be fully resolved at parse time.
This commit is contained in:
Sam Atkins 2021-12-03 12:28:14 +00:00 committed by Andreas Kling
parent d2f9d2fe51
commit 000fb5a70d
3 changed files with 45 additions and 0 deletions

View file

@ -169,6 +169,12 @@ TransformationStyleValue const& StyleValue::as_transformation() const
return static_cast<TransformationStyleValue const&>(*this);
}
UnresolvedStyleValue const& StyleValue::as_unresolved() const
{
VERIFY(is_unresolved());
return static_cast<UnresolvedStyleValue const&>(*this);
}
UnsetStyleValue const& StyleValue::as_unset() const
{
VERIFY(is_unset());
@ -492,4 +498,12 @@ String PositionStyleValue::to_string() const
return String::formatted("{} {} {} {}", to_string(m_edge_x), m_offset_x.to_string(), to_string(m_edge_y), m_offset_y.to_string());
}
String UnresolvedStyleValue::to_string() const
{
StringBuilder builder;
for (auto& value : m_values)
builder.append(value.to_string());
return builder.to_string();
}
}