From ae28e3ff5ca6c682705a0d299e70e17800077dec Mon Sep 17 00:00:00 2001 From: Karol Kosek Date: Sun, 1 May 2022 22:36:54 +0200 Subject: [PATCH] LibWeb: Use Unicode data for CSS text-transform property Previously it was only transforming ASCII characters. --- Userland/Libraries/LibWeb/CMakeLists.txt | 1 + Userland/Libraries/LibWeb/Painting/PaintableBox.cpp | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Userland/Libraries/LibWeb/CMakeLists.txt b/Userland/Libraries/LibWeb/CMakeLists.txt index 63797e2515..35a57f6733 100644 --- a/Userland/Libraries/LibWeb/CMakeLists.txt +++ b/Userland/Libraries/LibWeb/CMakeLists.txt @@ -380,6 +380,7 @@ set(GENERATED_SOURCES serenity_lib(LibWeb web) target_link_libraries(LibWeb LibCore LibJS LibMarkdown LibGemini LibGUI LibGfx LibTextCodec LibProtocol LibImageDecoderClient LibWasm LibXML) +link_with_unicode_data(LibWeb) function(libweb_js_wrapper class) cmake_parse_arguments(PARSE_ARGV 1 LIBWEB_WRAPPER "ITERABLE" "" "") diff --git a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp index 94250a753f..d6fc8ccebd 100644 --- a/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp +++ b/Userland/Libraries/LibWeb/Painting/PaintableBox.cpp @@ -4,6 +4,7 @@ * SPDX-License-Identifier: BSD-2-Clause */ +#include #include #include #include @@ -381,9 +382,9 @@ static void paint_text_fragment(PaintContext& context, Layout::TextNode const& t auto text = text_node.text_for_rendering(); auto text_transform = text_node.computed_values().text_transform(); if (text_transform == CSS::TextTransform::Uppercase) - text = text_node.text_for_rendering().to_uppercase(); + text = Unicode::to_unicode_uppercase_full(text_node.text_for_rendering()); if (text_transform == CSS::TextTransform::Lowercase) - text = text_node.text_for_rendering().to_lowercase(); + text = Unicode::to_unicode_lowercase_full(text_node.text_for_rendering()); Gfx::FloatPoint baseline_start { fragment_absolute_rect.x(), fragment_absolute_rect.y() + fragment.baseline() }; Utf8View view { text.substring_view(fragment.start(), fragment.length()) };