LibWeb: Add letter-spacing css property to Node

This commit is contained in:
Kostya Farber 2024-10-22 14:21:20 +01:00 committed by Sam Atkins
commit 537cbf55c3
Notes: github-actions[bot] 2024-10-22 14:33:32 +00:00
4 changed files with 26 additions and 1 deletions

View file

@ -687,7 +687,7 @@ Variant<LengthOrCalculated, NumberOrCalculated> StyleProperties::tab_size() cons
{
auto value = property(CSS::PropertyID::TabSize);
if (value->is_math()) {
auto& math_value = value->as_math();
auto const& math_value = value->as_math();
if (math_value.resolves_to_length()) {
return LengthOrCalculated { math_value };
}
@ -724,6 +724,22 @@ Optional<CSS::WhiteSpace> StyleProperties::white_space() const
return keyword_to_white_space(value->to_keyword());
}
Optional<LengthOrCalculated> StyleProperties::letter_spacing() const
{
auto value = property(CSS::PropertyID::LetterSpacing);
if (value->is_math()) {
auto const& math_value = value->as_math();
if (math_value.resolves_to_length()) {
return LengthOrCalculated { math_value };
}
}
if (value->is_length())
return LengthOrCalculated { value->as_length().length() };
return {};
}
Optional<CSS::LineStyle> StyleProperties::line_style(CSS::PropertyID property_id) const
{
auto value = property(property_id);