mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 14:07:46 +00:00
LibWeb: Port CSS::UnicodeRange to new Strings
This commit is contained in:
parent
316092d185
commit
fc3540c4b1
3 changed files with 8 additions and 8 deletions
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2021, Sam Atkins <atkinssj@serenityos.org>
|
* Copyright (c) 2021-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -131,7 +131,7 @@ void serialize_a_local(StringBuilder& builder, StringView path)
|
||||||
void serialize_unicode_ranges(StringBuilder& builder, Vector<UnicodeRange> const& unicode_ranges)
|
void serialize_unicode_ranges(StringBuilder& builder, Vector<UnicodeRange> const& unicode_ranges)
|
||||||
{
|
{
|
||||||
serialize_a_comma_separated_list(builder, unicode_ranges, [&](UnicodeRange unicode_range) {
|
serialize_a_comma_separated_list(builder, unicode_ranges, [&](UnicodeRange unicode_range) {
|
||||||
serialize_a_string(builder, unicode_range.to_deprecated_string());
|
serialize_a_string(builder, unicode_range.to_string().release_value_but_fixme_should_propagate_errors());
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (c) 2022, Sam Atkins <atkinssj@serenityos.org>
|
* Copyright (c) 2022-2023, Sam Atkins <atkinssj@serenityos.org>
|
||||||
*
|
*
|
||||||
* SPDX-License-Identifier: BSD-2-Clause
|
* SPDX-License-Identifier: BSD-2-Clause
|
||||||
*/
|
*/
|
||||||
|
@ -7,7 +7,7 @@
|
||||||
#pragma once
|
#pragma once
|
||||||
|
|
||||||
#include <AK/Assertions.h>
|
#include <AK/Assertions.h>
|
||||||
#include <AK/DeprecatedString.h>
|
#include <AK/String.h>
|
||||||
|
|
||||||
namespace Web::CSS {
|
namespace Web::CSS {
|
||||||
|
|
||||||
|
@ -29,11 +29,11 @@ public:
|
||||||
return m_min_code_point <= code_point && code_point <= m_max_code_point;
|
return m_min_code_point <= code_point && code_point <= m_max_code_point;
|
||||||
}
|
}
|
||||||
|
|
||||||
DeprecatedString to_deprecated_string() const
|
ErrorOr<String> to_string() const
|
||||||
{
|
{
|
||||||
if (m_min_code_point == m_max_code_point)
|
if (m_min_code_point == m_max_code_point)
|
||||||
return DeprecatedString::formatted("U+{:x}", m_min_code_point);
|
return String::formatted("U+{:x}", m_min_code_point);
|
||||||
return DeprecatedString::formatted("U+{:x}-{:x}", m_min_code_point, m_max_code_point);
|
return String::formatted("U+{:x}-{:x}", m_min_code_point, m_max_code_point);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -606,7 +606,7 @@ void dump_font_face_rule(StringBuilder& builder, CSS::CSSFontFaceRule const& rul
|
||||||
builder.append("unicode-ranges:\n"sv);
|
builder.append("unicode-ranges:\n"sv);
|
||||||
for (auto const& unicode_range : font_face.unicode_ranges()) {
|
for (auto const& unicode_range : font_face.unicode_ranges()) {
|
||||||
indent(builder, indent_levels + 2);
|
indent(builder, indent_levels + 2);
|
||||||
builder.appendff("{}\n", unicode_range.to_deprecated_string());
|
builder.appendff("{}\n", unicode_range.to_string().release_value_but_fixme_should_propagate_errors());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue