1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 12:28:12 +00:00

LibWeb: Replace incorrect uses of AK::is_ascii_space()

This commit is contained in:
Linus Groh 2022-10-01 18:14:32 +01:00 committed by Andreas Kling
parent 87ac38c78b
commit fb21271334
4 changed files with 10 additions and 12 deletions

View file

@ -17,6 +17,7 @@
#include <LibWeb/HTML/ImageData.h>
#include <LibWeb/HTML/Path2D.h>
#include <LibWeb/HTML/TextMetrics.h>
#include <LibWeb/Infra/CharacterTypes.h>
#include <LibWeb/Layout/TextNode.h>
#include <LibWeb/Platform/FontPlugin.h>
#include <LibWeb/WebIDL/ExceptionOr.h>
@ -393,11 +394,9 @@ CanvasRenderingContext2D::PreparedText CanvasRenderingContext2D::prepare_text(St
}
// 2. Replace all ASCII whitespace in text with U+0020 SPACE characters.
// NOTE: This also replaces vertical tabs with space even though WHATWG
// doesn't consider it as whitespace.
StringBuilder builder { text.length() };
for (auto c : text) {
builder.append(is_ascii_space(c) ? ' ' : c);
builder.append(Infra::is_ascii_whitespace(c) ? ' ' : c);
}
String replaced_text = builder.build();