From d431aeed0400966ed0b72bc8484ec84aa86a4dd1 Mon Sep 17 00:00:00 2001 From: Sam Atkins Date: Mon, 18 Sep 2023 15:28:40 +0100 Subject: [PATCH] LibWeb: Repeat last available quote-type, instead of looping them all I misunderstood this part of the spec before. --- Userland/Libraries/LibWeb/CSS/StyleProperties.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp index 94c1167cac..fbf6815762 100644 --- a/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp +++ b/Userland/Libraries/LibWeb/CSS/StyleProperties.cpp @@ -659,10 +659,11 @@ CSS::ContentData StyleProperties::content() const // 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 % 2 ? "“"_string : "‘"_string; - return depth % 2 ? "”"_string : "’"_string; + return depth == 0 ? "“"_string : "‘"_string; + return depth == 0 ? "”"_string : "’"_string; 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]; } VERIFY_NOT_REACHED();