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

LibWeb: Use Unicode data for CSS text-transform property

Previously it was only transforming ASCII characters.
This commit is contained in:
Karol Kosek 2022-05-01 22:36:54 +02:00 committed by Linus Groh
parent 8ed4ec9bc4
commit ae28e3ff5c
2 changed files with 4 additions and 2 deletions

View file

@ -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" "" "")

View file

@ -4,6 +4,7 @@
* SPDX-License-Identifier: BSD-2-Clause
*/
#include <LibUnicode/CharacterTypes.h>
#include <LibWeb/DOM/Document.h>
#include <LibWeb/HTML/HTMLHtmlElement.h>
#include <LibWeb/Layout/BlockContainer.h>
@ -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()) };