From 1294cfb55cbf950b3fba0c8d5a6c2c308f4858b1 Mon Sep 17 00:00:00 2001 From: Aliaksandr Kalenik Date: Sun, 21 Jan 2024 22:53:54 +0100 Subject: [PATCH] LibWeb: Find font that has whitespace glyph in first_available_font() Fixes https://github.com/SerenityOS/serenity/issues/22853 --- ...t-available-font-should-include-whitespace.html | 14 ++++++++++++++ ...ailable-font-should-include-whitespace-ref.html | 9 +++++++++ Userland/Libraries/LibWeb/Layout/Node.h | 5 ++--- 3 files changed, 25 insertions(+), 3 deletions(-) create mode 100644 Tests/LibWeb/Ref/first-available-font-should-include-whitespace.html create mode 100644 Tests/LibWeb/Ref/reference/first-available-font-should-include-whitespace-ref.html diff --git a/Tests/LibWeb/Ref/first-available-font-should-include-whitespace.html b/Tests/LibWeb/Ref/first-available-font-should-include-whitespace.html new file mode 100644 index 0000000000..953524e9bd --- /dev/null +++ b/Tests/LibWeb/Ref/first-available-font-should-include-whitespace.html @@ -0,0 +1,14 @@ +
hello friends diff --git a/Tests/LibWeb/Ref/reference/first-available-font-should-include-whitespace-ref.html b/Tests/LibWeb/Ref/reference/first-available-font-should-include-whitespace-ref.html new file mode 100644 index 0000000000..ee87e9c201 --- /dev/null +++ b/Tests/LibWeb/Ref/reference/first-available-font-should-include-whitespace-ref.html @@ -0,0 +1,9 @@ +
hello friends diff --git a/Userland/Libraries/LibWeb/Layout/Node.h b/Userland/Libraries/LibWeb/Layout/Node.h index a1549ffaaa..d13482e5db 100644 --- a/Userland/Libraries/LibWeb/Layout/Node.h +++ b/Userland/Libraries/LibWeb/Layout/Node.h @@ -306,9 +306,8 @@ inline NodeWithStyle* Node::parent() inline Gfx::Font const& NodeWithStyle::first_available_font() const { // https://drafts.csswg.org/css-fonts/#first-available-font - // FIXME: Should be be the first font for which the character U+0020 (space) instead of - // any first font in the list - return computed_values().font_list().first(); + // First font for which the character U+0020 (space) is not excluded by a unicode-range + return computed_values().font_list().font_for_code_point(' '); } }