mirror of
https://github.com/LadybirdBrowser/ladybird.git
synced 2025-08-06 16:19:23 +00:00
LibWeb/CSS: Make StringStyleValue hold a FlyString
We already have a FlyString of its value from parsing, and most users also want a FlyString from it, so let's use that instead of converting backwards and forwards. The two users that did want a String are: - Quotes, which make sense as FlyString instead, so I've converted that. - Animation names, which should probably be FlyString too, but the code currently also allows for other kinds of StyleValue, and I don't want to dive into this right now to figure out if that's needed or not.
This commit is contained in:
parent
d2f04b9f04
commit
9fb44cb057
Notes:
sideshowbarker
2024-07-18 02:44:48 +09:00
Author: https://github.com/AtkinsSJ
Commit: 9fb44cb057
Pull-request: https://github.com/LadybirdBrowser/ladybird/pull/681
Reviewed-by: https://github.com/tcl3 ✅
5 changed files with 15 additions and 14 deletions
|
@ -2912,7 +2912,7 @@ RefPtr<StyleValue> Parser::parse_string_value(TokenStream<ComponentValue>& token
|
|||
auto peek = tokens.peek_token();
|
||||
if (peek.is(Token::Type::String)) {
|
||||
(void)tokens.next_token();
|
||||
return StringStyleValue::create(peek.token().string().to_string());
|
||||
return StringStyleValue::create(peek.token().string());
|
||||
}
|
||||
|
||||
return nullptr;
|
||||
|
@ -4761,7 +4761,7 @@ RefPtr<StyleValue> Parser::parse_font_family_value(TokenStream<ComponentValue>&
|
|||
(void)tokens.next_token(); // String
|
||||
if (!next_is_comma_or_eof())
|
||||
return nullptr;
|
||||
font_families.append(StringStyleValue::create(peek.token().string().to_string()));
|
||||
font_families.append(StringStyleValue::create(peek.token().string()));
|
||||
(void)tokens.next_token(); // Comma
|
||||
continue;
|
||||
}
|
||||
|
@ -7088,7 +7088,7 @@ Optional<Parser::PropertyAndValue> Parser::parse_css_value_for_properties(Readon
|
|||
|
||||
if (peek_token.is(Token::Type::String)) {
|
||||
if (auto property = any_property_accepts_type(property_ids, ValueType::String); property.has_value())
|
||||
return PropertyAndValue { *property, StringStyleValue::create(tokens.next_token().token().string().to_string()) };
|
||||
return PropertyAndValue { *property, StringStyleValue::create(tokens.next_token().token().string()) };
|
||||
}
|
||||
|
||||
if (auto property = any_property_accepts_type(property_ids, ValueType::Url); property.has_value()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue