mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-12-08 06:09:58 +00:00
LibWeb: Simplify handling of font-family
We know `parse_comma_separated_value_list` always returns a `StyleValueList`
This commit is contained in:
parent
0595d52be2
commit
11a9b5a67b
Notes:
github-actions[bot]
2025-12-01 10:18:39 +00:00
Author: https://github.com/Calme1709
Commit: 11a9b5a67b
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/6972
Reviewed-by: https://github.com/AtkinsSJ ✅
2 changed files with 18 additions and 41 deletions
|
|
@ -2865,9 +2865,7 @@ RefPtr<StyleValue const> Parser::parse_font_value(TokenStream<ComponentValue>& t
|
|||
RefPtr<StyleValue const> Parser::parse_font_family_value(TokenStream<ComponentValue>& tokens)
|
||||
{
|
||||
// [ <family-name> | <generic-family> ]#
|
||||
// FIXME: We currently require font-family to always be a list, even with one item.
|
||||
// Maybe change that?
|
||||
auto result = parse_comma_separated_value_list(tokens, [this](auto& inner_tokens) -> RefPtr<StyleValue const> {
|
||||
return parse_comma_separated_value_list(tokens, [this](auto& inner_tokens) -> RefPtr<StyleValue const> {
|
||||
inner_tokens.discard_whitespace();
|
||||
|
||||
// <generic-family>
|
||||
|
|
@ -2883,15 +2881,6 @@ RefPtr<StyleValue const> Parser::parse_font_family_value(TokenStream<ComponentVa
|
|||
// <family-name>
|
||||
return parse_family_name_value(inner_tokens);
|
||||
});
|
||||
|
||||
if (!result)
|
||||
return nullptr;
|
||||
|
||||
if (result->is_value_list())
|
||||
return result.release_nonnull();
|
||||
|
||||
// It's a single value, so wrap it in a list - see FIXME above.
|
||||
return StyleValueList::create(StyleValueVector { result.release_nonnull() }, StyleValueList::Separator::Comma);
|
||||
}
|
||||
|
||||
RefPtr<StyleValue const> Parser::parse_font_language_override_value(TokenStream<ComponentValue>& tokens)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue