mirror of
https://github.com/fergalmoran/ladybird.git
synced 2026-01-06 08:36:15 +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:
committed by
Tim Ledbetter
parent
d2f04b9f04
commit
9fb44cb057
@@ -656,13 +656,13 @@ StyleProperties::ContentDataAndQuoteNestingLevel StyleProperties::content(u32 in
|
||||
auto get_quote_string = [&](bool open, auto depth) {
|
||||
switch (quotes_data.type) {
|
||||
case QuotesData::Type::None:
|
||||
return String {};
|
||||
return FlyString {};
|
||||
case QuotesData::Type::Auto:
|
||||
// FIXME: "A typographically appropriate used value for quotes is automatically chosen by the UA
|
||||
// based on the content language of the element and/or its parent."
|
||||
if (open)
|
||||
return depth == 0 ? "“"_string : "‘"_string;
|
||||
return depth == 0 ? "”"_string : "’"_string;
|
||||
return depth == 0 ? "“"_fly_string : "‘"_fly_string;
|
||||
return depth == 0 ? "”"_fly_string : "’"_fly_string;
|
||||
case QuotesData::Type::Specified:
|
||||
// If the depth is greater than the number of pairs, the last pair is repeated.
|
||||
auto& level = quotes_data.strings[min(depth, quotes_data.strings.size() - 1)];
|
||||
|
||||
Reference in New Issue
Block a user