mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-01 13:49:16 +00:00
LibWeb: Parse and propagate white-space-trim
CSS property
This commit is contained in:
parent
50bdd2cb85
commit
9480b1fc5c
Notes:
github-actions[bot]
2025-05-29 10:06:01 +00:00
Author: https://github.com/Calme1709
Commit: 9480b1fc5c
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/4832
Reviewed-by: https://github.com/AtkinsSJ
Reviewed-by: https://github.com/gmta ✅
14 changed files with 151 additions and 7 deletions
|
@ -836,6 +836,38 @@ WhiteSpaceCollapse ComputedProperties::white_space_collapse() const
|
|||
return keyword_to_white_space_collapse(value.to_keyword()).release_value();
|
||||
}
|
||||
|
||||
WhiteSpaceTrimData ComputedProperties::white_space_trim() const
|
||||
{
|
||||
auto const& value = property(PropertyID::WhiteSpaceTrim);
|
||||
|
||||
if (value.is_keyword() && value.to_keyword() == Keyword::None)
|
||||
return WhiteSpaceTrimData {};
|
||||
|
||||
if (value.is_value_list()) {
|
||||
auto white_space_trim_data = WhiteSpaceTrimData {};
|
||||
|
||||
for (auto const& value : value.as_value_list().values()) {
|
||||
switch (value->as_keyword().keyword()) {
|
||||
case Keyword::DiscardBefore:
|
||||
white_space_trim_data.discard_before = true;
|
||||
break;
|
||||
case Keyword::DiscardAfter:
|
||||
white_space_trim_data.discard_after = true;
|
||||
break;
|
||||
case Keyword::DiscardInner:
|
||||
white_space_trim_data.discard_inner = true;
|
||||
break;
|
||||
default:
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
}
|
||||
|
||||
return white_space_trim_data;
|
||||
}
|
||||
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
||||
Optional<LengthOrCalculated> ComputedProperties::letter_spacing() const
|
||||
{
|
||||
auto const& value = property(PropertyID::LetterSpacing);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue