LibWeb: Apply the word-spacing css property to Node

This will let us start to begin applying this during
text shaping.
This commit is contained in:
Kostya Farber 2024-10-18 21:00:28 +01:00 committed by Sam Atkins
commit da42c19cb6
Notes: github-actions[bot] 2024-10-22 12:37:23 +00:00
4 changed files with 25 additions and 0 deletions

View file

@ -702,6 +702,22 @@ Variant<LengthOrCalculated, NumberOrCalculated> StyleProperties::tab_size() cons
return NumberOrCalculated { value->as_number().number() };
}
Optional<CSS::LengthOrCalculated> StyleProperties::word_spacing() const
{
auto value = property(CSS::PropertyID::WordSpacing);
if (value->is_math()) {
auto& 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::WhiteSpace> StyleProperties::white_space() const
{
auto value = property(CSS::PropertyID::WhiteSpace);