AK: Rename Utf16View::trim_whitespace() to ::trim_ascii_whitespace()

This reflects the naming of String::trim_ascii_whitespace() and better
indicates what exactly we're trimming.
This commit is contained in:
Jelle Raaijmakers 2025-07-23 20:56:44 +02:00 committed by Tim Flynn
commit b1c3ce807b
Notes: github-actions[bot] 2025-07-24 11:19:36 +00:00
3 changed files with 4 additions and 4 deletions

View file

@ -71,7 +71,7 @@ Optional<ParseFirstNumberResult<T>> parse_first_number(Utf16View const& string,
if (string.has_ascii_storage())
return parse_first_number<T>(string.bytes(), trim_whitespace, base);
auto trimmed_string = trim_whitespace == TrimWhitespace::Yes ? string.trim_whitespace() : string;
auto trimmed_string = trim_whitespace == TrimWhitespace::Yes ? string.trim_ascii_whitespace() : string;
return from_chars<char16_t, T>(trimmed_string.utf16_span().data(), trimmed_string.length_in_code_units(), base);
}
@ -107,7 +107,7 @@ Optional<T> parse_number(Utf16View const& string, TrimWhitespace trim_whitespace
if (string.has_ascii_storage())
return parse_number<T>(string.bytes(), trim_whitespace, base);
auto trimmed_string = trim_whitespace == TrimWhitespace::Yes ? string.trim_whitespace() : string;
auto trimmed_string = trim_whitespace == TrimWhitespace::Yes ? string.trim_ascii_whitespace() : string;
auto result = parse_first_number<T>(trimmed_string, TrimWhitespace::No, base);
if (!result.has_value())

View file

@ -381,7 +381,7 @@ public:
return substring_view(substring_start, substring_length);
}
[[nodiscard]] constexpr Utf16View trim_whitespace(TrimMode mode = TrimMode::Both) const
[[nodiscard]] constexpr Utf16View trim_ascii_whitespace(TrimMode mode = TrimMode::Both) const
{
static constexpr Utf16View white_space { u" \n\t\v\f\r", 6uz };
return trim(white_space, mode);

View file

@ -512,7 +512,7 @@ enum class FontSizeMode : u8 {
bool command_font_size_action(DOM::Document& document, Utf16View const& value)
{
// 1. Strip leading and trailing whitespace from value.
auto resulting_value = value.trim_whitespace();
auto resulting_value = value.trim_ascii_whitespace();
// 2. If value is not a valid floating point number, and would not be a valid floating point number if a single
// leading "+" character were stripped, return false.