diff --git a/Userland/Libraries/LibWeb/DOM/DOMTokenList.cpp b/Userland/Libraries/LibWeb/DOM/DOMTokenList.cpp index 653215b746..fa75e738fb 100644 --- a/Userland/Libraries/LibWeb/DOM/DOMTokenList.cpp +++ b/Userland/Libraries/LibWeb/DOM/DOMTokenList.cpp @@ -5,11 +5,11 @@ * SPDX-License-Identifier: BSD-2-Clause */ -#include #include #include #include #include +#include #include namespace { @@ -234,7 +234,7 @@ WebIDL::ExceptionOr DOMTokenList::validate_token(StringView token) const { if (token.is_empty()) return WebIDL::SyntaxError::create(realm(), "Non-empty DOM tokens are not allowed"); - if (any_of(token, is_ascii_space)) + if (any_of(token, Infra::is_ascii_whitespace)) return WebIDL::InvalidCharacterError::create(realm(), "DOM tokens containing ASCII whitespace are not allowed"); return {}; } diff --git a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp index 8e716b708e..fc2aa0df6b 100644 --- a/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp +++ b/Userland/Libraries/LibWeb/HTML/CanvasRenderingContext2D.cpp @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -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(); diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp index 7ec96151e9..094359962a 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLEncodingDetection.cpp @@ -12,6 +12,7 @@ #include #include #include +#include #include namespace Web::HTML { @@ -50,8 +51,7 @@ Optional extract_character_encoding_from_meta_element(String const& lexer.ignore(charset_index.value() + 7); lexer.ignore_while([](char c) { - // FIXME: Not the exact same ASCII whitespace. The spec does not include vertical tab (\v). - return is_ascii_space(c); + return Infra::is_ascii_whitespace(c); }); if (lexer.peek() != '=') @@ -64,8 +64,7 @@ Optional extract_character_encoding_from_meta_element(String const& lexer.ignore(); lexer.ignore_while([](char c) { - // FIXME: Not the exact same ASCII whitespace. The spec does not include vertical tab (\v). - return is_ascii_space(c); + return Infra::is_ascii_whitespace(c); }); if (lexer.is_eof()) @@ -90,8 +89,7 @@ Optional extract_character_encoding_from_meta_element(String const& } auto encoding = lexer.consume_until([](char c) { - // FIXME: Not the exact same ASCII whitespace. The spec does not include vertical tab (\v). - return is_ascii_space(c) || c == ';'; + return Infra::is_ascii_whitespace(c) || c == ';'; }); return TextCodec::get_standardized_encoding(encoding); } diff --git a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp index 325dfd1b96..34389a6ae6 100644 --- a/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp +++ b/Userland/Libraries/LibWeb/HTML/Parser/HTMLParser.cpp @@ -28,6 +28,7 @@ #include #include #include +#include #include #include @@ -3668,7 +3669,7 @@ RefPtr parse_dimension_value(StringView string) auto position = input.begin(); // 3. Skip ASCII whitespace within input given position. - while (position != input.end() && is_ascii_space(*position)) + while (position != input.end() && Infra::is_ascii_whitespace(*position)) ++position; // 4. If position is past the end of input or the code point at position within input is not an ASCII digit,