1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-25 06:07:34 +00:00

LibWeb: Repeat last available quote-type, instead of looping them all

I misunderstood this part of the spec before.
This commit is contained in:
Sam Atkins 2023-09-18 15:28:40 +01:00 committed by Andreas Kling
parent 2d8b2328fd
commit d431aeed04

View file

@ -659,10 +659,11 @@ CSS::ContentData StyleProperties::content() const
// FIXME: "A typographically appropriate used value for quotes is automatically chosen by the UA // 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." // based on the content language of the element and/or its parent."
if (open) if (open)
return depth % 2 ? ""_string : ""_string; return depth == 0 ? ""_string : ""_string;
return depth % 2 ? ""_string : ""_string; return depth == 0 ? ""_string : ""_string;
case QuotesData::Type::Specified: case QuotesData::Type::Specified:
auto& level = quotes_data.strings[depth % quotes_data.strings.size()]; // 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)];
return open ? level[0] : level[1]; return open ? level[0] : level[1];
} }
VERIFY_NOT_REACHED(); VERIFY_NOT_REACHED();