1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 19:07:34 +00:00

Everywhere: Rename to_{string => deprecated_string}() where applicable

This will make it easier to support both string types at the same time
while we convert code, and tracking down remaining uses.

One big exception is Value::to_string() in LibJS, where the name is
dictated by the ToString AO.
This commit is contained in:
Linus Groh 2022-12-06 01:12:49 +00:00 committed by Andreas Kling
parent 6e19ab2bbc
commit 57dc179b1f
597 changed files with 1973 additions and 1972 deletions

View file

@ -41,10 +41,10 @@ Angle Angle::percentage_of(Percentage const& percentage) const
return Angle { percentage.as_fraction() * m_value, m_type };
}
DeprecatedString Angle::to_string() const
DeprecatedString Angle::to_deprecated_string() const
{
if (is_calculated())
return m_calculated_style->to_string();
return m_calculated_style->to_deprecated_string();
return DeprecatedString::formatted("{}{}", m_value, unit_name());
}

View file

@ -33,7 +33,7 @@ public:
bool is_calculated() const { return m_type == Type::Calculated; }
NonnullRefPtr<CalculatedStyleValue> calculated_style_value() const;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
float to_degrees() const;
bool operator==(Angle const& other) const
@ -57,6 +57,6 @@ template<>
struct AK::Formatter<Web::CSS::Angle> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::Angle const& angle)
{
return Formatter<StringView>::format(builder, angle.to_string());
return Formatter<StringView>::format(builder, angle.to_deprecated_string());
}
};

View file

@ -56,9 +56,9 @@ DeprecatedString CSSFontFaceRule::serialized() const
// 2. The result of invoking serialize a comma-separated list on performing serialize a URL or serialize a LOCAL for each source on the source list.
serialize_a_comma_separated_list(builder, m_font_face.sources(), [&](FontFace::Source source) {
if (source.url.cannot_be_a_base_url()) {
serialize_a_url(builder, source.url.to_string());
serialize_a_url(builder, source.url.to_deprecated_string());
} else {
serialize_a_local(builder, source.url.to_string());
serialize_a_local(builder, source.url.to_deprecated_string());
}
// NOTE: No spec currently exists for format()
@ -106,7 +106,7 @@ DeprecatedString CSSFontFaceRule::serialized() const
// 12. A single SPACE (U+0020), followed by the string "}", i.e., RIGHT CURLY BRACKET (U+007D).
builder.append(" }"sv);
return builder.to_string();
return builder.to_deprecated_string();
}
}

View file

@ -60,7 +60,7 @@ DeprecatedString CSSImportRule::serialized() const
// 2. The result of performing serialize a URL on the rules location.
// FIXME: Look into the correctness of this serialization
builder.append("url("sv);
builder.append(m_url.to_string());
builder.append(m_url.to_deprecated_string());
builder.append(')');
// FIXME: 3. If the rules associated media list is not empty, a single SPACE (U+0020) followed by the result of performing serialize a media query list on the media list.
@ -68,7 +68,7 @@ DeprecatedString CSSImportRule::serialized() const
// 4. The string ";", i.e., SEMICOLON (U+003B).
builder.append(';');
return builder.to_string();
return builder.to_deprecated_string();
}
void CSSImportRule::resource_did_fail()

View file

@ -27,7 +27,7 @@ public:
AK::URL const& url() const { return m_url; }
// FIXME: This should return only the specified part of the url. eg, "stuff/foo.css", not "https://example.com/stuff/foo.css".
DeprecatedString href() const { return m_url.to_string(); }
DeprecatedString href() const { return m_url.to_deprecated_string(); }
bool has_import_result() const { return !m_style_sheet; }
CSSStyleSheet* loaded_style_sheet() { return m_style_sheet; }

View file

@ -63,7 +63,7 @@ DeprecatedString CSSMediaRule::serialized() const
// 5. A newline, followed by the string "}", i.e., RIGHT CURLY BRACKET (U+007D)
builder.append("\n}"sv);
return builder.to_string();
return builder.to_deprecated_string();
}
}

View file

@ -201,7 +201,7 @@ DeprecatedString CSSStyleDeclaration::get_property_value(StringView property_nam
auto maybe_property = property(property_id);
if (!maybe_property.has_value())
return {};
return maybe_property->value->to_string();
return maybe_property->value->to_deprecated_string();
}
// https://drafts.csswg.org/cssom/#dom-cssstyledeclaration-getpropertypriority
@ -265,7 +265,7 @@ static DeprecatedString serialize_a_css_declaration(CSS::PropertyID property, De
builder.append(';');
// 7. Return s.
return builder.to_string();
return builder.to_deprecated_string();
}
// https://www.w3.org/TR/cssom/#serialize-a-css-declaration-block
@ -291,7 +291,7 @@ DeprecatedString PropertyOwningCSSStyleDeclaration::serialized() const
// FIXME: 4. Shorthand loop: For each shorthand in shorthands, follow these substeps: ...
// 5. Let value be the result of invoking serialize a CSS value of declaration.
auto value = declaration.value->to_string();
auto value = declaration.value->to_deprecated_string();
// 6. Let serialized declaration be the result of invoking serialize a CSS declaration with property name property, value value,
// and the important flag set if declaration has its important flag set.
@ -307,7 +307,7 @@ DeprecatedString PropertyOwningCSSStyleDeclaration::serialized() const
// 4. Return list joined with " " (U+0020).
StringBuilder builder;
builder.join(' ', list);
return builder.to_string();
return builder.to_deprecated_string();
}
static CSS::PropertyID property_id_from_name(StringView name)
@ -340,7 +340,7 @@ JS::ThrowCompletionOr<JS::Value> CSSStyleDeclaration::internal_get(JS::PropertyK
if (property_id == CSS::PropertyID::Invalid)
return Base::internal_get(name, receiver);
if (auto maybe_property = property(property_id); maybe_property.has_value())
return { js_string(vm(), maybe_property->value->to_string()) };
return { js_string(vm(), maybe_property->value->to_deprecated_string()) };
return { js_string(vm(), DeprecatedString::empty()) };
}

View file

@ -55,7 +55,7 @@ DeprecatedString CSSStyleRule::serialized() const
// 4. If decls and rules are both null, append " }" to s (i.e. a single SPACE (U+0020) followed by RIGHT CURLY BRACKET (U+007D)) and return s.
if (decls.is_null() && rules.is_null()) {
builder.append(" }"sv);
return builder.to_string();
return builder.to_deprecated_string();
}
// 5. If rules is null:
@ -67,7 +67,7 @@ DeprecatedString CSSStyleRule::serialized() const
// 3. Append " }" to s (i.e. a single SPACE (U+0020) followed by RIGHT CURLY BRACKET (U+007D)).
builder.append(" }"sv);
// 4. Return s.
return builder.to_string();
return builder.to_deprecated_string();
}
// FIXME: 6. Otherwise:

View file

@ -26,7 +26,7 @@ CSSStyleSheet::CSSStyleSheet(JS::Realm& realm, CSSRuleList& rules, MediaList& me
set_prototype(&Bindings::ensure_web_prototype<Bindings::CSSStyleSheetPrototype>(realm, "CSSStyleSheet"));
if (location.has_value())
set_location(location->to_string());
set_location(location->to_deprecated_string());
for (auto& rule : *m_rules)
rule.set_parent_style_sheet(this);

View file

@ -25,7 +25,7 @@ CSSSupportsRule::CSSSupportsRule(JS::Realm& realm, NonnullRefPtr<Supports>&& sup
DeprecatedString CSSSupportsRule::condition_text() const
{
return m_supports->to_string();
return m_supports->to_deprecated_string();
}
void CSSSupportsRule::set_condition_text(DeprecatedString text)
@ -54,7 +54,7 @@ DeprecatedString CSSSupportsRule::serialized() const
}
builder.append("\n}"sv);
return builder.to_string();
return builder.to_deprecated_string();
}
}

View file

@ -8,7 +8,7 @@
namespace Web::CSS {
DeprecatedString Display::to_string() const
DeprecatedString Display::to_deprecated_string() const
{
StringBuilder builder;
switch (m_type) {
@ -99,7 +99,7 @@ DeprecatedString Display::to_string() const
}
break;
};
return builder.to_string();
return builder.to_deprecated_string();
}
}

View file

@ -16,7 +16,7 @@ public:
Display() = default;
~Display() = default;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
bool operator==(Display const& other) const
{

View file

@ -40,10 +40,10 @@ Frequency Frequency::percentage_of(Percentage const& percentage) const
return Frequency { percentage.as_fraction() * m_value, m_type };
}
DeprecatedString Frequency::to_string() const
DeprecatedString Frequency::to_deprecated_string() const
{
if (is_calculated())
return m_calculated_style->to_string();
return m_calculated_style->to_deprecated_string();
return DeprecatedString::formatted("{}{}", m_value, unit_name());
}

View file

@ -30,7 +30,7 @@ public:
bool is_calculated() const { return m_type == Type::Calculated; }
NonnullRefPtr<CalculatedStyleValue> calculated_style_value() const;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
float to_hertz() const;
bool operator==(Frequency const& other) const
@ -54,6 +54,6 @@ template<>
struct AK::Formatter<Web::CSS::Frequency> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::Frequency const& frequency)
{
return Formatter<StringView>::format(builder, frequency.to_string());
return Formatter<StringView>::format(builder, frequency.to_deprecated_string());
}
};

View file

@ -33,12 +33,12 @@ GridTrackPlacement::GridTrackPlacement()
{
}
DeprecatedString GridTrackPlacement::to_string() const
DeprecatedString GridTrackPlacement::to_deprecated_string() const
{
StringBuilder builder;
if (is_auto()) {
builder.append("auto"sv);
return builder.to_string();
return builder.to_deprecated_string();
}
if (is_span()) {
builder.append("span"sv);
@ -51,7 +51,7 @@ DeprecatedString GridTrackPlacement::to_string() const
if (has_line_name()) {
builder.append(m_line_name);
}
return builder.to_string();
return builder.to_deprecated_string();
}
}

View file

@ -36,7 +36,7 @@ public:
Type type() const { return m_type; }
DeprecatedString line_name() const { return m_line_name; }
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
bool operator==(GridTrackPlacement const& other) const
{
return m_type == other.type() && m_span_count_or_position == other.raw_value();

View file

@ -44,13 +44,13 @@ GridSize GridSize::make_auto()
return GridSize(CSS::Length::make_auto());
}
DeprecatedString GridSize::to_string() const
DeprecatedString GridSize::to_deprecated_string() const
{
switch (m_type) {
case Type::Length:
return m_length.to_string();
return m_length.to_deprecated_string();
case Type::Percentage:
return m_percentage.to_string();
return m_percentage.to_deprecated_string();
case Type::FlexibleLength:
return DeprecatedString::formatted("{}fr", m_flexible_length);
}
@ -68,15 +68,15 @@ GridMinMax::GridMinMax(GridSize min_grid_size, GridSize max_grid_size)
{
}
DeprecatedString GridMinMax::to_string() const
DeprecatedString GridMinMax::to_deprecated_string() const
{
StringBuilder builder;
builder.append("minmax("sv);
builder.appendff("{}", m_min_grid_size.to_string());
builder.appendff("{}", m_min_grid_size.to_deprecated_string());
builder.append(", "sv);
builder.appendff("{}", m_max_grid_size.to_string());
builder.appendff("{}", m_max_grid_size.to_deprecated_string());
builder.append(")"sv);
return builder.to_string();
return builder.to_deprecated_string();
}
GridRepeat::GridRepeat(GridTrackSizeList grid_track_size_list, int repeat_count)
@ -96,7 +96,7 @@ GridRepeat::GridRepeat()
{
}
DeprecatedString GridRepeat::to_string() const
DeprecatedString GridRepeat::to_deprecated_string() const
{
StringBuilder builder;
builder.append("repeat("sv);
@ -114,9 +114,9 @@ DeprecatedString GridRepeat::to_string() const
VERIFY_NOT_REACHED();
}
builder.append(", "sv);
builder.appendff("{}", m_grid_track_size_list.to_string());
builder.appendff("{}", m_grid_track_size_list.to_deprecated_string());
builder.append(")"sv);
return builder.to_string();
return builder.to_deprecated_string();
}
ExplicitGridTrack::ExplicitGridTrack(CSS::GridMinMax grid_minmax)
@ -137,15 +137,15 @@ ExplicitGridTrack::ExplicitGridTrack(CSS::GridSize grid_size)
{
}
DeprecatedString ExplicitGridTrack::to_string() const
DeprecatedString ExplicitGridTrack::to_deprecated_string() const
{
switch (m_type) {
case Type::MinMax:
return m_grid_minmax.to_string();
return m_grid_minmax.to_deprecated_string();
case Type::Repeat:
return m_grid_repeat.to_string();
return m_grid_repeat.to_deprecated_string();
case Type::Default:
return m_grid_size.to_string();
return m_grid_size.to_deprecated_string();
default:
VERIFY_NOT_REACHED();
}
@ -168,7 +168,7 @@ GridTrackSizeList GridTrackSizeList::make_auto()
return GridTrackSizeList();
}
DeprecatedString GridTrackSizeList::to_string() const
DeprecatedString GridTrackSizeList::to_deprecated_string() const
{
StringBuilder builder;
auto print_line_names = [&](size_t index) -> void {
@ -186,7 +186,7 @@ DeprecatedString GridTrackSizeList::to_string() const
print_line_names(i);
builder.append(" "sv);
}
builder.append(m_track_list[i].to_string());
builder.append(m_track_list[i].to_deprecated_string());
if (i < m_track_list.size() - 1)
builder.append(" "sv);
}
@ -194,7 +194,7 @@ DeprecatedString GridTrackSizeList::to_string() const
builder.append(" "sv);
print_line_names(m_track_list.size());
}
return builder.to_string();
return builder.to_deprecated_string();
}
}

View file

@ -52,7 +52,7 @@ public:
return (m_type == Type::Length && !m_length.is_auto()) || is_percentage();
}
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
bool operator==(GridSize const& other) const
{
return m_type == other.type()
@ -78,7 +78,7 @@ public:
GridSize min_grid_size() const& { return m_min_grid_size; }
GridSize max_grid_size() const& { return m_max_grid_size; }
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
bool operator==(GridMinMax const& other) const
{
return m_min_grid_size == other.min_grid_size()
@ -100,7 +100,7 @@ public:
Vector<CSS::ExplicitGridTrack> track_list() const { return m_track_list; }
Vector<Vector<DeprecatedString>> line_names() const { return m_line_names; }
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
bool operator==(GridTrackSizeList const& other) const
{
return m_line_names == other.line_names() && m_track_list == other.track_list();
@ -133,7 +133,7 @@ public:
GridTrackSizeList grid_track_size_list() const& { return m_grid_track_size_list; }
Type type() const& { return m_type; }
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
bool operator==(GridRepeat const& other) const
{
if (m_type != other.type())
@ -183,7 +183,7 @@ public:
Type type() const { return m_type; }
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
bool operator==(ExplicitGridTrack const& other) const
{
if (is_repeat() && other.is_repeat())

View file

@ -112,10 +112,10 @@ float Length::to_px(Layout::Node const& layout_node) const
return to_px(viewport_rect, layout_node.font().pixel_metrics(), layout_node.computed_values().font_size(), root_element->layout_node()->computed_values().font_size());
}
DeprecatedString Length::to_string() const
DeprecatedString Length::to_deprecated_string() const
{
if (is_calculated())
return m_calculated_style->to_string();
return m_calculated_style->to_deprecated_string();
if (is_auto())
return "auto";
return DeprecatedString::formatted("{}{}", m_value, unit_name());

View file

@ -116,7 +116,7 @@ public:
}
}
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
// We have a RefPtr<CalculatedStyleValue> member, but can't include the header StyleValue.h as it includes
// this file already. To break the cyclic dependency, we must move all method definitions out.
@ -139,6 +139,6 @@ template<>
struct AK::Formatter<Web::CSS::Length> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::Length const& length)
{
return Formatter<StringView>::format(builder, length.to_string());
return Formatter<StringView>::format(builder, length.to_deprecated_string());
}
};

View file

@ -49,7 +49,7 @@ DeprecatedString MediaList::item(u32 index) const
if (!is_supported_property_index(index))
return {};
return m_media[index].to_string();
return m_media[index].to_deprecated_string();
}
// https://www.w3.org/TR/cssom-1/#dom-medialist-appendmedium
@ -70,7 +70,7 @@ void MediaList::delete_medium(DeprecatedString medium)
if (!m)
return;
m_media.remove_all_matching([&](auto& existing) -> bool {
return m->to_string() == existing->to_string();
return m->to_deprecated_string() == existing->to_deprecated_string();
});
// FIXME: If nothing was removed, then throw a NotFoundError exception.
}
@ -100,7 +100,7 @@ JS::Value MediaList::item_value(size_t index) const
{
if (index >= m_media.size())
return JS::js_undefined();
return JS::js_string(vm(), m_media[index].to_string());
return JS::js_string(vm(), m_media[index].to_deprecated_string());
}
}

View file

@ -20,13 +20,13 @@ NonnullRefPtr<MediaQuery> MediaQuery::create_not_all()
return adopt_ref(*media_query);
}
DeprecatedString MediaFeatureValue::to_string() const
DeprecatedString MediaFeatureValue::to_deprecated_string() const
{
return m_value.visit(
[](ValueID const& ident) { return DeprecatedString { string_from_value_id(ident) }; },
[](Length const& length) { return length.to_string(); },
[](Ratio const& ratio) { return ratio.to_string(); },
[](Resolution const& resolution) { return resolution.to_string(); },
[](Length const& length) { return length.to_deprecated_string(); },
[](Ratio const& ratio) { return ratio.to_deprecated_string(); },
[](Resolution const& resolution) { return resolution.to_deprecated_string(); },
[](float number) { return DeprecatedString::number(number); });
}
@ -40,7 +40,7 @@ bool MediaFeatureValue::is_same_type(MediaFeatureValue const& other) const
[&](float) { return other.is_number(); });
}
DeprecatedString MediaFeature::to_string() const
DeprecatedString MediaFeature::to_deprecated_string() const
{
auto comparison_string = [](Comparison comparison) -> StringView {
switch (comparison) {
@ -62,16 +62,16 @@ DeprecatedString MediaFeature::to_string() const
case Type::IsTrue:
return string_from_media_feature_id(m_id);
case Type::ExactValue:
return DeprecatedString::formatted("{}:{}", string_from_media_feature_id(m_id), m_value->to_string());
return DeprecatedString::formatted("{}:{}", string_from_media_feature_id(m_id), m_value->to_deprecated_string());
case Type::MinValue:
return DeprecatedString::formatted("min-{}:{}", string_from_media_feature_id(m_id), m_value->to_string());
return DeprecatedString::formatted("min-{}:{}", string_from_media_feature_id(m_id), m_value->to_deprecated_string());
case Type::MaxValue:
return DeprecatedString::formatted("max-{}:{}", string_from_media_feature_id(m_id), m_value->to_string());
return DeprecatedString::formatted("max-{}:{}", string_from_media_feature_id(m_id), m_value->to_deprecated_string());
case Type::Range:
if (!m_range->right_comparison.has_value())
return DeprecatedString::formatted("{} {} {}", m_range->left_value.to_string(), comparison_string(m_range->left_comparison), string_from_media_feature_id(m_id));
return DeprecatedString::formatted("{} {} {}", m_range->left_value.to_deprecated_string(), comparison_string(m_range->left_comparison), string_from_media_feature_id(m_id));
return DeprecatedString::formatted("{} {} {} {} {}", m_range->left_value.to_string(), comparison_string(m_range->left_comparison), string_from_media_feature_id(m_id), comparison_string(*m_range->right_comparison), m_range->right_value->to_string());
return DeprecatedString::formatted("{} {} {} {} {}", m_range->left_value.to_deprecated_string(), comparison_string(m_range->left_comparison), string_from_media_feature_id(m_id), comparison_string(*m_range->right_comparison), m_range->right_value->to_deprecated_string());
}
VERIFY_NOT_REACHED();
@ -275,17 +275,17 @@ NonnullOwnPtr<MediaCondition> MediaCondition::from_or_list(NonnullOwnPtrVector<M
return adopt_own(*result);
}
DeprecatedString MediaCondition::to_string() const
DeprecatedString MediaCondition::to_deprecated_string() const
{
StringBuilder builder;
builder.append('(');
switch (type) {
case Type::Single:
builder.append(feature->to_string());
builder.append(feature->to_deprecated_string());
break;
case Type::Not:
builder.append("not "sv);
builder.append(conditions.first().to_string());
builder.append(conditions.first().to_deprecated_string());
break;
case Type::And:
builder.join(" and "sv, conditions);
@ -298,7 +298,7 @@ DeprecatedString MediaCondition::to_string() const
break;
}
builder.append(')');
return builder.to_string();
return builder.to_deprecated_string();
}
MatchResult MediaCondition::evaluate(HTML::Window const& window) const
@ -318,7 +318,7 @@ MatchResult MediaCondition::evaluate(HTML::Window const& window) const
VERIFY_NOT_REACHED();
}
DeprecatedString MediaQuery::to_string() const
DeprecatedString MediaQuery::to_deprecated_string() const
{
StringBuilder builder;
@ -332,10 +332,10 @@ DeprecatedString MediaQuery::to_string() const
}
if (m_media_condition) {
builder.append(m_media_condition->to_string());
builder.append(m_media_condition->to_deprecated_string());
}
return builder.to_string();
return builder.to_deprecated_string();
}
bool MediaQuery::evaluate(HTML::Window const& window)
@ -389,7 +389,7 @@ DeprecatedString serialize_a_media_query_list(NonnullRefPtrVector<MediaQuery> co
// appear in the media query list, and then serialize the list.
StringBuilder builder;
builder.join(", "sv, media_queries);
return builder.to_string();
return builder.to_deprecated_string();
}
bool is_media_feature_name(StringView name)

View file

@ -47,7 +47,7 @@ public:
{
}
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
bool is_ident() const { return m_value.has<ValueID>(); }
bool is_length() const { return m_value.has<Length>(); }
@ -146,7 +146,7 @@ public:
}
bool evaluate(HTML::Window const&) const;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
private:
enum class Type {
@ -202,7 +202,7 @@ struct MediaCondition {
static NonnullOwnPtr<MediaCondition> from_or_list(NonnullOwnPtrVector<MediaCondition>&&);
MatchResult evaluate(HTML::Window const&) const;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
private:
MediaCondition() = default;
@ -241,7 +241,7 @@ public:
bool matches() const { return m_matches; }
bool evaluate(HTML::Window const&);
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
private:
MediaQuery() = default;
@ -270,7 +270,7 @@ template<>
struct Formatter<Web::CSS::MediaFeature> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::MediaFeature const& media_feature)
{
return Formatter<StringView>::format(builder, media_feature.to_string());
return Formatter<StringView>::format(builder, media_feature.to_deprecated_string());
}
};
@ -278,7 +278,7 @@ template<>
struct Formatter<Web::CSS::MediaCondition> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::MediaCondition const& media_condition)
{
return Formatter<StringView>::format(builder, media_condition.to_string());
return Formatter<StringView>::format(builder, media_condition.to_deprecated_string());
}
};
@ -286,7 +286,7 @@ template<>
struct Formatter<Web::CSS::MediaQuery> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::MediaQuery const& media_query)
{
return Formatter<StringView>::format(builder, media_query.to_string());
return Formatter<StringView>::format(builder, media_query.to_deprecated_string());
}
};

View file

@ -69,7 +69,7 @@ public:
return { Type::Number, m_value / other.m_value };
}
DeprecatedString to_string() const
DeprecatedString to_deprecated_string() const
{
if (m_type == Type::IntegerWithExplicitSign)
return DeprecatedString::formatted("{:+}", m_value);
@ -91,6 +91,6 @@ template<>
struct AK::Formatter<Web::CSS::Number> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::Number const& number)
{
return Formatter<StringView>::format(builder, number.to_string());
return Formatter<StringView>::format(builder, number.to_deprecated_string());
}
};

View file

@ -17,7 +17,7 @@ Block::Block(Token token, Vector<ComponentValue>&& values)
Block::~Block() = default;
DeprecatedString Block::to_string() const
DeprecatedString Block::to_deprecated_string() const
{
StringBuilder builder;
@ -25,7 +25,7 @@ DeprecatedString Block::to_string() const
builder.join(' ', m_values);
builder.append(m_token.bracket_mirror_string());
return builder.to_string();
return builder.to_deprecated_string();
}
}

View file

@ -32,7 +32,7 @@ public:
Vector<ComponentValue> const& values() const { return m_values; }
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
private:
Block(Token, Vector<ComponentValue>&&);

View file

@ -26,12 +26,12 @@ ComponentValue::ComponentValue(NonnullRefPtr<Block> block)
ComponentValue::~ComponentValue() = default;
DeprecatedString ComponentValue::to_string() const
DeprecatedString ComponentValue::to_deprecated_string() const
{
return m_value.visit(
[](Token const& token) { return token.to_string(); },
[](NonnullRefPtr<Block> const& block) { return block->to_string(); },
[](NonnullRefPtr<Function> const& function) { return function->to_string(); });
[](Token const& token) { return token.to_deprecated_string(); },
[](NonnullRefPtr<Block> const& block) { return block->to_deprecated_string(); },
[](NonnullRefPtr<Function> const& function) { return function->to_deprecated_string(); });
}
DeprecatedString ComponentValue::to_debug_string() const
@ -41,10 +41,10 @@ DeprecatedString ComponentValue::to_debug_string() const
return DeprecatedString::formatted("Token: {}", token.to_debug_string());
},
[](NonnullRefPtr<Block> const& block) {
return DeprecatedString::formatted("Block: {}", block->to_string());
return DeprecatedString::formatted("Block: {}", block->to_deprecated_string());
},
[](NonnullRefPtr<Function> const& function) {
return DeprecatedString::formatted("Function: {}", function->to_string());
return DeprecatedString::formatted("Function: {}", function->to_deprecated_string());
});
}

View file

@ -33,7 +33,7 @@ public:
Token const& token() const { return m_value.get<Token>(); }
operator Token() const { return m_value.get<Token>(); }
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
DeprecatedString to_debug_string() const;
private:
@ -45,6 +45,6 @@ template<>
struct AK::Formatter<Web::CSS::Parser::ComponentValue> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::Parser::ComponentValue const& component_value)
{
return Formatter<StringView>::format(builder, component_value.to_string());
return Formatter<StringView>::format(builder, component_value.to_deprecated_string());
}
};

View file

@ -19,7 +19,7 @@ Declaration::Declaration(FlyString name, Vector<ComponentValue> values, Importan
Declaration::~Declaration() = default;
DeprecatedString Declaration::to_string() const
DeprecatedString Declaration::to_deprecated_string() const
{
StringBuilder builder;
@ -30,7 +30,7 @@ DeprecatedString Declaration::to_string() const
if (m_important == Important::Yes)
builder.append(" !important"sv);
return builder.to_string();
return builder.to_deprecated_string();
}
}

View file

@ -22,7 +22,7 @@ public:
Vector<ComponentValue> const& values() const { return m_values; }
Important importance() const { return m_important; }
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
private:
FlyString m_name;

View file

@ -24,20 +24,20 @@ DeclarationOrAtRule::DeclarationOrAtRule(Declaration declaration)
DeclarationOrAtRule::~DeclarationOrAtRule() = default;
DeprecatedString DeclarationOrAtRule::to_string() const
DeprecatedString DeclarationOrAtRule::to_deprecated_string() const
{
StringBuilder builder;
switch (m_type) {
default:
case DeclarationType::At:
builder.append(m_at->to_string());
builder.append(m_at->to_deprecated_string());
break;
case DeclarationType::Declaration:
builder.append(m_declaration->to_string());
builder.append(m_declaration->to_deprecated_string());
break;
}
return builder.to_string();
return builder.to_deprecated_string();
}
}

View file

@ -37,7 +37,7 @@ public:
return *m_declaration;
}
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
private:
DeclarationType m_type;

View file

@ -18,7 +18,7 @@ Function::Function(FlyString name, Vector<ComponentValue>&& values)
Function::~Function() = default;
DeprecatedString Function::to_string() const
DeprecatedString Function::to_deprecated_string() const
{
StringBuilder builder;
@ -27,7 +27,7 @@ DeprecatedString Function::to_string() const
builder.join(' ', m_values);
builder.append(')');
return builder.to_string();
return builder.to_deprecated_string();
}
}

View file

@ -28,7 +28,7 @@ public:
StringView name() const { return m_name; }
Vector<ComponentValue> const& values() const { return m_values; }
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
private:
Function(FlyString name, Vector<ComponentValue>&& values);

View file

@ -562,7 +562,7 @@ Parser::ParseErrorOr<Selector::SimpleSelector> Parser::parse_pseudo_simple_selec
}
// FIXME: Support multiple, comma-separated, language ranges.
Vector<FlyString> languages;
languages.append(pseudo_function.values().first().token().to_string());
languages.append(pseudo_function.values().first().token().to_deprecated_string());
return Selector::SimpleSelector {
.type = Selector::SimpleSelector::Type::PseudoClass,
.value = Selector::SimpleSelector::PseudoClass {
@ -1395,7 +1395,7 @@ Optional<Supports::Feature> Parser::parse_supports_feature(TokenStream<Component
if (auto declaration = consume_a_declaration(block_tokens); declaration.has_value()) {
transaction.commit();
return Supports::Feature {
Supports::Declaration { declaration->to_string() }
Supports::Declaration { declaration->to_deprecated_string() }
};
}
}
@ -1405,10 +1405,10 @@ Optional<Supports::Feature> Parser::parse_supports_feature(TokenStream<Component
// FIXME: Parsing and then converting back to a string is weird.
StringBuilder builder;
for (auto const& item : first_token.function().values())
builder.append(item.to_string());
builder.append(item.to_deprecated_string());
transaction.commit();
return Supports::Feature {
Supports::Selector { builder.to_string() }
Supports::Selector { builder.to_deprecated_string() }
};
}
@ -1425,13 +1425,13 @@ Optional<GeneralEnclosed> Parser::parse_general_enclosed(TokenStream<ComponentVa
// `[ <function-token> <any-value>? ) ]`
if (first_token.is_function()) {
transaction.commit();
return GeneralEnclosed { first_token.to_string() };
return GeneralEnclosed { first_token.to_deprecated_string() };
}
// `( <any-value>? )`
if (first_token.is_block() && first_token.block().is_paren()) {
transaction.commit();
return GeneralEnclosed { first_token.to_string() };
return GeneralEnclosed { first_token.to_deprecated_string() };
}
return {};
@ -3385,7 +3385,7 @@ Optional<UnicodeRange> Parser::parse_unicode_range(TokenStream<ComponentValue>&
return DeprecatedString::formatted("{:+}", int_value);
}
return component_value.to_string();
return component_value.to_deprecated_string();
};
auto create_unicode_range = [&](StringView text, auto& local_transaction) -> Optional<UnicodeRange> {
@ -3920,13 +3920,13 @@ Optional<Color> Parser::parse_color(ComponentValue const& component_value)
serialization_builder.append(cv.token().dimension_unit());
// 5. If serialization consists of fewer than six characters, prepend zeros (U+0030) so that it becomes six characters.
serialization = serialization_builder.to_string();
serialization = serialization_builder.to_deprecated_string();
if (serialization_builder.length() < 6) {
StringBuilder builder;
for (size_t i = 0; i < (6 - serialization_builder.length()); i++)
builder.append('0');
builder.append(serialization_builder.string_view());
serialization = builder.to_string();
serialization = builder.to_deprecated_string();
}
}
// 3. Otherwise, cv is an <ident-token>; let serialization be cvs value.

View file

@ -20,7 +20,7 @@ Rule::Rule(Rule::Type type, FlyString name, Vector<ComponentValue> prelude, RefP
Rule::~Rule() = default;
DeprecatedString Rule::to_string() const
DeprecatedString Rule::to_deprecated_string() const
{
StringBuilder builder;
@ -32,11 +32,11 @@ DeprecatedString Rule::to_string() const
builder.join(' ', m_prelude);
if (m_block)
builder.append(m_block->to_string());
builder.append(m_block->to_deprecated_string());
else
builder.append(';');
return builder.to_string();
return builder.to_deprecated_string();
}
}

View file

@ -41,7 +41,7 @@ public:
RefPtr<Block const> block() const { return m_block; }
StringView at_rule_name() const { return m_at_rule_name; }
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
private:
Rule(Type, FlyString name, Vector<ComponentValue> prelude, RefPtr<Block>);

View file

@ -11,7 +11,7 @@
namespace Web::CSS::Parser {
DeprecatedString Token::to_string() const
DeprecatedString Token::to_deprecated_string() const
{
StringBuilder builder;

View file

@ -145,7 +145,7 @@ public:
DeprecatedString bracket_string() const;
DeprecatedString bracket_mirror_string() const;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
DeprecatedString to_debug_string() const;
Position const& start_position() const { return m_start_position; }

View file

@ -237,7 +237,7 @@ Tokenizer::Tokenizer(StringView input, DeprecatedString const& encoding)
last_was_carriage_return = false;
}
});
return builder.to_string();
return builder.to_deprecated_string();
};
m_decoded_input = filter_code_points(input, encoding);
@ -367,7 +367,7 @@ Token Tokenizer::create_value_token(Token::Type type, u32 value)
// FIXME: Avoid temporary StringBuilder here
StringBuilder builder;
builder.append_code_point(value);
token.m_value = builder.to_string();
token.m_value = builder.to_deprecated_string();
return token;
}
@ -400,7 +400,7 @@ u32 Tokenizer::consume_escaped_code_point()
}
// Interpret the hex digits as a hexadecimal number.
auto unhexed = strtoul(builder.to_string().characters(), nullptr, 16);
auto unhexed = strtoul(builder.to_deprecated_string().characters(), nullptr, 16);
// If this number is zero, or is for a surrogate, or is greater than the maximum allowed
// code point, return U+FFFD REPLACEMENT CHARACTER (<28>).
if (unhexed == 0 || is_unicode_surrogate(unhexed) || is_greater_than_maximum_allowed_code_point(unhexed)) {
@ -617,7 +617,7 @@ DeprecatedString Tokenizer::consume_an_ident_sequence()
break;
}
return result.to_string();
return result.to_deprecated_string();
}
// https://www.w3.org/TR/css-syntax-3/#consume-url-token
@ -640,7 +640,7 @@ Token Tokenizer::consume_a_url_token()
consume_as_much_whitespace_as_possible();
auto make_token = [&]() {
token.m_value = builder.to_string();
token.m_value = builder.to_deprecated_string();
return token;
};
@ -931,7 +931,7 @@ Token Tokenizer::consume_string_token(u32 ending_code_point)
StringBuilder builder;
auto make_token = [&]() {
token.m_value = builder.to_string();
token.m_value = builder.to_deprecated_string();
return token;
};

View file

@ -31,7 +31,7 @@ public:
float value() const { return m_value; }
float as_fraction() const { return m_value * 0.01f; }
DeprecatedString to_string() const
DeprecatedString to_deprecated_string() const
{
return DeprecatedString::formatted("{}%", m_value);
}
@ -128,12 +128,12 @@ public:
});
}
DeprecatedString to_string() const
DeprecatedString to_deprecated_string() const
{
if (is_percentage())
return m_value.template get<Percentage>().to_string();
return m_value.template get<Percentage>().to_deprecated_string();
return m_value.template get<T>().to_string();
return m_value.template get<T>().to_deprecated_string();
}
bool operator==(PercentageOr<T> const& other) const
@ -231,7 +231,7 @@ template<>
struct AK::Formatter<Web::CSS::Percentage> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::Percentage const& percentage)
{
return Formatter<StringView>::format(builder, percentage.to_string());
return Formatter<StringView>::format(builder, percentage.to_deprecated_string());
}
};
@ -239,7 +239,7 @@ template<>
struct AK::Formatter<Web::CSS::AnglePercentage> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::AnglePercentage const& angle_percentage)
{
return Formatter<StringView>::format(builder, angle_percentage.to_string());
return Formatter<StringView>::format(builder, angle_percentage.to_deprecated_string());
}
};
@ -247,7 +247,7 @@ template<>
struct AK::Formatter<Web::CSS::FrequencyPercentage> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::FrequencyPercentage const& frequency_percentage)
{
return Formatter<StringView>::format(builder, frequency_percentage.to_string());
return Formatter<StringView>::format(builder, frequency_percentage.to_deprecated_string());
}
};
@ -255,7 +255,7 @@ template<>
struct AK::Formatter<Web::CSS::LengthPercentage> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::LengthPercentage const& length_percentage)
{
return Formatter<StringView>::format(builder, length_percentage.to_string());
return Formatter<StringView>::format(builder, length_percentage.to_deprecated_string());
}
};
@ -263,6 +263,6 @@ template<>
struct AK::Formatter<Web::CSS::TimePercentage> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::TimePercentage const& time_percentage)
{
return Formatter<StringView>::format(builder, time_percentage.to_string());
return Formatter<StringView>::format(builder, time_percentage.to_deprecated_string());
}
};

View file

@ -22,7 +22,7 @@ bool Ratio::is_degenerate() const
|| !isfinite(m_second_value) || m_second_value == 0;
}
DeprecatedString Ratio::to_string() const
DeprecatedString Ratio::to_deprecated_string() const
{
return DeprecatedString::formatted("{} / {}", m_first_value, m_second_value);
}

View file

@ -17,7 +17,7 @@ public:
float value() const { return m_first_value / m_second_value; }
bool is_degenerate() const;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
private:
float m_first_value { 0 };

View file

@ -21,7 +21,7 @@ Resolution::Resolution(float value, Type type)
{
}
DeprecatedString Resolution::to_string() const
DeprecatedString Resolution::to_deprecated_string() const
{
return DeprecatedString::formatted("{}{}", m_value, unit_name());
}

View file

@ -24,7 +24,7 @@ public:
Resolution(int value, Type type);
Resolution(float value, Type type);
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
float to_dots_per_pixel() const;
bool operator==(Resolution const& other) const

View file

@ -275,7 +275,7 @@ DeprecatedString Selector::SimpleSelector::serialize() const
dbgln("FIXME: Unsupported simple selector serialization for type {}", to_underlying(type));
break;
}
return s.to_string();
return s.to_deprecated_string();
}
// https://www.w3.org/TR/cssom/#serialize-a-selector
@ -333,7 +333,7 @@ DeprecatedString Selector::serialize() const
}
}
return s.to_string();
return s.to_deprecated_string();
}
// https://www.w3.org/TR/cssom/#serialize-a-group-of-selectors
@ -342,7 +342,7 @@ DeprecatedString serialize_a_group_of_selectors(NonnullRefPtrVector<Selector> co
// To serialize a group of selectors serialize each selector in the group of selectors and then serialize a comma-separated list of these serializations.
StringBuilder builder;
builder.join(", "sv, selectors);
return builder.to_string();
return builder.to_deprecated_string();
}
Optional<Selector::PseudoElement> pseudo_element_from_string(StringView name)

View file

@ -80,7 +80,7 @@ public:
result.appendff("{}", offset);
// 5. Return result.
return result.to_string();
return result.to_deprecated_string();
}
};

View file

@ -113,7 +113,7 @@ void serialize_a_url(StringBuilder& builder, StringView url)
// To serialize a URL means to create a string represented by "url(",
// followed by the serialization of the URL as a string, followed by ")".
builder.append("url("sv);
serialize_a_string(builder, url.to_string());
serialize_a_string(builder, url.to_deprecated_string());
builder.append(')');
}
@ -123,7 +123,7 @@ void serialize_a_local(StringBuilder& builder, StringView path)
// To serialize a LOCAL means to create a string represented by "local(",
// followed by the serialization of the LOCAL as a string, followed by ")".
builder.append("local("sv);
serialize_a_string(builder, path.to_string());
serialize_a_string(builder, path.to_deprecated_string());
builder.append(')');
}
@ -131,7 +131,7 @@ void serialize_a_local(StringBuilder& builder, StringView path)
void serialize_unicode_ranges(StringBuilder& builder, Vector<UnicodeRange> const& unicode_ranges)
{
serialize_a_comma_separated_list(builder, unicode_ranges, [&](UnicodeRange unicode_range) {
serialize_a_string(builder, unicode_range.to_string());
serialize_a_string(builder, unicode_range.to_deprecated_string());
});
}
@ -151,42 +151,42 @@ DeprecatedString escape_a_character(u32 character)
{
StringBuilder builder;
escape_a_character(builder, character);
return builder.to_string();
return builder.to_deprecated_string();
}
DeprecatedString escape_a_character_as_code_point(u32 character)
{
StringBuilder builder;
escape_a_character_as_code_point(builder, character);
return builder.to_string();
return builder.to_deprecated_string();
}
DeprecatedString serialize_an_identifier(StringView ident)
{
StringBuilder builder;
serialize_an_identifier(builder, ident);
return builder.to_string();
return builder.to_deprecated_string();
}
DeprecatedString serialize_a_string(StringView string)
{
StringBuilder builder;
serialize_a_string(builder, string);
return builder.to_string();
return builder.to_deprecated_string();
}
DeprecatedString serialize_a_url(StringView url)
{
StringBuilder builder;
serialize_a_url(builder, url);
return builder.to_string();
return builder.to_deprecated_string();
}
DeprecatedString serialize_a_srgb_value(Color color)
{
StringBuilder builder;
serialize_a_srgb_value(builder, color);
return builder.to_string();
return builder.to_deprecated_string();
}
}

View file

@ -74,20 +74,20 @@ bool Size::contains_percentage() const
}
}
DeprecatedString Size::to_string() const
DeprecatedString Size::to_deprecated_string() const
{
switch (m_type) {
case Type::Auto:
return "auto";
case Type::Length:
case Type::Percentage:
return m_length_percentage.to_string();
return m_length_percentage.to_deprecated_string();
case Type::MinContent:
return "min-content";
case Type::MaxContent:
return "max-content";
case Type::FitContent:
return DeprecatedString::formatted("fit-content({})", m_length_percentage.to_string());
return DeprecatedString::formatted("fit-content({})", m_length_percentage.to_deprecated_string());
case Type::None:
return "none";
}

View file

@ -63,7 +63,7 @@ public:
return m_length_percentage.length();
}
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
private:
Size(Type type, LengthPercentage);
@ -78,6 +78,6 @@ template<>
struct AK::Formatter<Web::CSS::Size> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::Size const& size)
{
return Formatter<StringView>::format(builder, size.to_string());
return Formatter<StringView>::format(builder, size.to_deprecated_string());
}
};

View file

@ -1168,7 +1168,7 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
if (family.is_identifier()) {
found_font = find_generic_font(family.to_identifier());
} else if (family.is_string()) {
found_font = find_font(family.to_string());
found_font = find_font(family.to_deprecated_string());
}
if (found_font)
break;
@ -1176,7 +1176,7 @@ void StyleComputer::compute_font(StyleProperties& style, DOM::Element const* ele
} else if (family_value->is_identifier()) {
found_font = find_generic_font(family_value->to_identifier());
} else if (family_value->is_string()) {
found_font = find_font(family_value->to_string());
found_font = find_font(family_value->to_deprecated_string());
}
if (!found_font) {
@ -1477,7 +1477,7 @@ void StyleComputer::load_fonts_from_sheet(CSSStyleSheet const& sheet)
continue;
LoadRequest request;
auto url = m_document.parse_url(candidate_url.value().to_string());
auto url = m_document.parse_url(candidate_url.value().to_deprecated_string());
auto loader = make<FontLoader>(const_cast<StyleComputer&>(*this), font_face.font_family(), move(url));
const_cast<StyleComputer&>(*this).m_loaded_fonts.set(font_face.font_family(), move(loader));
}

View file

@ -81,7 +81,7 @@ CSS::Size StyleProperties::size_value(CSS::PropertyID id) const
}
// FIXME: Support `fit-content(<length>)`
dbgln("FIXME: Unsupported size value: `{}`, treating as `auto`", value->to_string());
dbgln("FIXME: Unsupported size value: `{}`, treating as `auto`", value->to_deprecated_string());
return CSS::Size::make_auto();
}
@ -201,13 +201,13 @@ float StyleProperties::opacity() const
if (maybe_percentage.has_value())
unclamped_opacity = maybe_percentage->as_fraction();
else
dbgln("Unable to resolve calc() as opacity (percentage): {}", value->to_string());
dbgln("Unable to resolve calc() as opacity (percentage): {}", value->to_deprecated_string());
} else {
auto maybe_number = value->as_calculated().resolve_number();
if (maybe_number.has_value())
unclamped_opacity = maybe_number.value();
else
dbgln("Unable to resolve calc() as opacity (number): {}", value->to_string());
dbgln("Unable to resolve calc() as opacity (number): {}", value->to_deprecated_string());
}
} else if (value->is_percentage()) {
unclamped_opacity = value->as_percentage().percentage().as_fraction();
@ -498,24 +498,24 @@ CSS::ContentData StyleProperties::content() const
StringBuilder builder;
for (auto const& item : content_style_value.content().values()) {
if (item.is_string()) {
builder.append(item.to_string());
builder.append(item.to_deprecated_string());
} else {
// TODO: Implement quotes, counters, images, and other things.
}
}
content_data.type = ContentData::Type::String;
content_data.data = builder.to_string();
content_data.data = builder.to_deprecated_string();
if (content_style_value.has_alt_text()) {
StringBuilder alt_text_builder;
for (auto const& item : content_style_value.alt_text()->values()) {
if (item.is_string()) {
alt_text_builder.append(item.to_string());
alt_text_builder.append(item.to_deprecated_string());
} else {
// TODO: Implement counters
}
}
content_data.alt_text = alt_text_builder.to_string();
content_data.alt_text = alt_text_builder.to_deprecated_string();
}
return content_data;
@ -608,7 +608,7 @@ Vector<CSS::TextDecorationLine> StyleProperties::text_decoration_line() const
if (value->is_identifier() && value->to_identifier() == ValueID::None)
return {};
dbgln("FIXME: Unsupported value for text-decoration-line: {}", value->to_string());
dbgln("FIXME: Unsupported value for text-decoration-line: {}", value->to_deprecated_string());
return {};
}

View file

@ -313,16 +313,16 @@ BackgroundStyleValue::BackgroundStyleValue(
VERIFY(!m_color->is_value_list());
}
DeprecatedString BackgroundStyleValue::to_string() const
DeprecatedString BackgroundStyleValue::to_deprecated_string() const
{
if (m_layer_count == 1) {
return DeprecatedString::formatted("{} {} {} {} {} {} {} {}", m_color->to_string(), m_image->to_string(), m_position->to_string(), m_size->to_string(), m_repeat->to_string(), m_attachment->to_string(), m_origin->to_string(), m_clip->to_string());
return DeprecatedString::formatted("{} {} {} {} {} {} {} {}", m_color->to_deprecated_string(), m_image->to_deprecated_string(), m_position->to_deprecated_string(), m_size->to_deprecated_string(), m_repeat->to_deprecated_string(), m_attachment->to_deprecated_string(), m_origin->to_deprecated_string(), m_clip->to_deprecated_string());
}
auto get_layer_value_string = [](NonnullRefPtr<StyleValue> const& style_value, size_t index) {
if (style_value->is_value_list())
return style_value->as_value_list().value_at(index, true)->to_string();
return style_value->to_string();
return style_value->as_value_list().value_at(index, true)->to_deprecated_string();
return style_value->to_deprecated_string();
};
StringBuilder builder;
@ -330,11 +330,11 @@ DeprecatedString BackgroundStyleValue::to_string() const
if (i)
builder.append(", "sv);
if (i == m_layer_count - 1)
builder.appendff("{} ", m_color->to_string());
builder.appendff("{} ", m_color->to_deprecated_string());
builder.appendff("{} {} {} {} {} {} {}", get_layer_value_string(m_image, i), get_layer_value_string(m_position, i), get_layer_value_string(m_size, i), get_layer_value_string(m_repeat, i), get_layer_value_string(m_attachment, i), get_layer_value_string(m_origin, i), get_layer_value_string(m_clip, i));
}
return builder.to_string();
return builder.to_deprecated_string();
}
bool BackgroundStyleValue::equals(StyleValue const& other) const
@ -352,7 +352,7 @@ bool BackgroundStyleValue::equals(StyleValue const& other) const
&& m_clip->equals(typed_other.m_clip);
}
DeprecatedString BackgroundRepeatStyleValue::to_string() const
DeprecatedString BackgroundRepeatStyleValue::to_deprecated_string() const
{
return DeprecatedString::formatted("{} {}", CSS::to_string(m_repeat_x), CSS::to_string(m_repeat_y));
}
@ -365,9 +365,9 @@ bool BackgroundRepeatStyleValue::equals(StyleValue const& other) const
return m_repeat_x == typed_other.m_repeat_x && m_repeat_y == typed_other.m_repeat_y;
}
DeprecatedString BackgroundSizeStyleValue::to_string() const
DeprecatedString BackgroundSizeStyleValue::to_deprecated_string() const
{
return DeprecatedString::formatted("{} {}", m_size_x.to_string(), m_size_y.to_string());
return DeprecatedString::formatted("{} {}", m_size_x.to_deprecated_string(), m_size_y.to_deprecated_string());
}
bool BackgroundSizeStyleValue::equals(StyleValue const& other) const
@ -378,9 +378,9 @@ bool BackgroundSizeStyleValue::equals(StyleValue const& other) const
return m_size_x == typed_other.m_size_x && m_size_y == typed_other.m_size_y;
}
DeprecatedString BorderStyleValue::to_string() const
DeprecatedString BorderStyleValue::to_deprecated_string() const
{
return DeprecatedString::formatted("{} {} {}", m_border_width->to_string(), m_border_style->to_string(), m_border_color->to_string());
return DeprecatedString::formatted("{} {} {}", m_border_width->to_deprecated_string(), m_border_style->to_deprecated_string(), m_border_color->to_deprecated_string());
}
bool BorderStyleValue::equals(StyleValue const& other) const
@ -393,11 +393,11 @@ bool BorderStyleValue::equals(StyleValue const& other) const
&& m_border_color->equals(typed_other.m_border_color);
}
DeprecatedString BorderRadiusStyleValue::to_string() const
DeprecatedString BorderRadiusStyleValue::to_deprecated_string() const
{
if (m_horizontal_radius == m_vertical_radius)
return m_horizontal_radius.to_string();
return DeprecatedString::formatted("{} / {}", m_horizontal_radius.to_string(), m_vertical_radius.to_string());
return m_horizontal_radius.to_deprecated_string();
return DeprecatedString::formatted("{} / {}", m_horizontal_radius.to_deprecated_string(), m_vertical_radius.to_deprecated_string());
}
bool BorderRadiusStyleValue::equals(StyleValue const& other) const
@ -410,9 +410,9 @@ bool BorderRadiusStyleValue::equals(StyleValue const& other) const
&& m_vertical_radius == typed_other.m_vertical_radius;
}
DeprecatedString BorderRadiusShorthandStyleValue::to_string() const
DeprecatedString BorderRadiusShorthandStyleValue::to_deprecated_string() const
{
return DeprecatedString::formatted("{} {} {} {} / {} {} {} {}", m_top_left->horizontal_radius().to_string(), m_top_right->horizontal_radius().to_string(), m_bottom_right->horizontal_radius().to_string(), m_bottom_left->horizontal_radius().to_string(), m_top_left->vertical_radius().to_string(), m_top_right->vertical_radius().to_string(), m_bottom_right->vertical_radius().to_string(), m_bottom_left->vertical_radius().to_string());
return DeprecatedString::formatted("{} {} {} {} / {} {} {} {}", m_top_left->horizontal_radius().to_deprecated_string(), m_top_right->horizontal_radius().to_deprecated_string(), m_bottom_right->horizontal_radius().to_deprecated_string(), m_bottom_left->horizontal_radius().to_deprecated_string(), m_top_left->vertical_radius().to_deprecated_string(), m_top_right->vertical_radius().to_deprecated_string(), m_bottom_right->vertical_radius().to_deprecated_string(), m_bottom_left->vertical_radius().to_deprecated_string());
}
bool BorderRadiusShorthandStyleValue::equals(StyleValue const& other) const
@ -615,9 +615,9 @@ void CalculatedStyleValue::CalculationResult::divide_by(CalculationResult const&
});
}
DeprecatedString CalculatedStyleValue::to_string() const
DeprecatedString CalculatedStyleValue::to_deprecated_string() const
{
return DeprecatedString::formatted("calc({})", m_expression->to_string());
return DeprecatedString::formatted("calc({})", m_expression->to_deprecated_string());
}
bool CalculatedStyleValue::equals(StyleValue const& other) const
@ -625,81 +625,81 @@ bool CalculatedStyleValue::equals(StyleValue const& other) const
if (type() != other.type())
return false;
// This is a case where comparing the strings actually makes sense.
return to_string() == other.to_string();
return to_deprecated_string() == other.to_deprecated_string();
}
DeprecatedString CalculatedStyleValue::CalcNumberValue::to_string() const
DeprecatedString CalculatedStyleValue::CalcNumberValue::to_deprecated_string() const
{
return value.visit(
[](Number const& number) { return DeprecatedString::number(number.value()); },
[](NonnullOwnPtr<CalcNumberSum> const& sum) { return DeprecatedString::formatted("({})", sum->to_string()); });
[](NonnullOwnPtr<CalcNumberSum> const& sum) { return DeprecatedString::formatted("({})", sum->to_deprecated_string()); });
}
DeprecatedString CalculatedStyleValue::CalcValue::to_string() const
DeprecatedString CalculatedStyleValue::CalcValue::to_deprecated_string() const
{
return value.visit(
[](Number const& number) { return DeprecatedString::number(number.value()); },
[](NonnullOwnPtr<CalcSum> const& sum) { return DeprecatedString::formatted("({})", sum->to_string()); },
[](auto const& v) { return v.to_string(); });
[](NonnullOwnPtr<CalcSum> const& sum) { return DeprecatedString::formatted("({})", sum->to_deprecated_string()); },
[](auto const& v) { return v.to_deprecated_string(); });
}
DeprecatedString CalculatedStyleValue::CalcSum::to_string() const
DeprecatedString CalculatedStyleValue::CalcSum::to_deprecated_string() const
{
StringBuilder builder;
builder.append(first_calc_product->to_string());
builder.append(first_calc_product->to_deprecated_string());
for (auto const& item : zero_or_more_additional_calc_products)
builder.append(item.to_string());
return builder.to_string();
builder.append(item.to_deprecated_string());
return builder.to_deprecated_string();
}
DeprecatedString CalculatedStyleValue::CalcNumberSum::to_string() const
DeprecatedString CalculatedStyleValue::CalcNumberSum::to_deprecated_string() const
{
StringBuilder builder;
builder.append(first_calc_number_product->to_string());
builder.append(first_calc_number_product->to_deprecated_string());
for (auto const& item : zero_or_more_additional_calc_number_products)
builder.append(item.to_string());
return builder.to_string();
builder.append(item.to_deprecated_string());
return builder.to_deprecated_string();
}
DeprecatedString CalculatedStyleValue::CalcProduct::to_string() const
DeprecatedString CalculatedStyleValue::CalcProduct::to_deprecated_string() const
{
StringBuilder builder;
builder.append(first_calc_value.to_string());
builder.append(first_calc_value.to_deprecated_string());
for (auto const& item : zero_or_more_additional_calc_values)
builder.append(item.to_string());
return builder.to_string();
builder.append(item.to_deprecated_string());
return builder.to_deprecated_string();
}
DeprecatedString CalculatedStyleValue::CalcSumPartWithOperator::to_string() const
DeprecatedString CalculatedStyleValue::CalcSumPartWithOperator::to_deprecated_string() const
{
return DeprecatedString::formatted(" {} {}", op == SumOperation::Add ? "+"sv : "-"sv, value->to_string());
return DeprecatedString::formatted(" {} {}", op == SumOperation::Add ? "+"sv : "-"sv, value->to_deprecated_string());
}
DeprecatedString CalculatedStyleValue::CalcProductPartWithOperator::to_string() const
DeprecatedString CalculatedStyleValue::CalcProductPartWithOperator::to_deprecated_string() const
{
auto value_string = value.visit(
[](CalcValue const& v) { return v.to_string(); },
[](CalcNumberValue const& v) { return v.to_string(); });
[](CalcValue const& v) { return v.to_deprecated_string(); },
[](CalcNumberValue const& v) { return v.to_deprecated_string(); });
return DeprecatedString::formatted(" {} {}", op == ProductOperation::Multiply ? "*"sv : "/"sv, value_string);
}
DeprecatedString CalculatedStyleValue::CalcNumberProduct::to_string() const
DeprecatedString CalculatedStyleValue::CalcNumberProduct::to_deprecated_string() const
{
StringBuilder builder;
builder.append(first_calc_number_value.to_string());
builder.append(first_calc_number_value.to_deprecated_string());
for (auto const& item : zero_or_more_additional_calc_number_values)
builder.append(item.to_string());
return builder.to_string();
builder.append(item.to_deprecated_string());
return builder.to_deprecated_string();
}
DeprecatedString CalculatedStyleValue::CalcNumberProductPartWithOperator::to_string() const
DeprecatedString CalculatedStyleValue::CalcNumberProductPartWithOperator::to_deprecated_string() const
{
return DeprecatedString::formatted(" {} {}", op == ProductOperation::Multiply ? "*"sv : "/"sv, value.to_string());
return DeprecatedString::formatted(" {} {}", op == ProductOperation::Multiply ? "*"sv : "/"sv, value.to_deprecated_string());
}
DeprecatedString CalculatedStyleValue::CalcNumberSumPartWithOperator::to_string() const
DeprecatedString CalculatedStyleValue::CalcNumberSumPartWithOperator::to_deprecated_string() const
{
return DeprecatedString::formatted(" {} {}", op == SumOperation::Add ? "+"sv : "-"sv, value->to_string());
return DeprecatedString::formatted(" {} {}", op == SumOperation::Add ? "+"sv : "-"sv, value->to_deprecated_string());
}
Optional<Angle> CalculatedStyleValue::resolve_angle() const
@ -1149,7 +1149,7 @@ CalculatedStyleValue::CalculationResult CalculatedStyleValue::CalcNumberSumPartW
return value->resolve(layout_node, percentage_basis);
}
DeprecatedString ColorStyleValue::to_string() const
DeprecatedString ColorStyleValue::to_deprecated_string() const
{
return serialize_a_srgb_value(m_color);
}
@ -1161,11 +1161,11 @@ bool ColorStyleValue::equals(StyleValue const& other) const
return m_color == other.as_color().m_color;
}
DeprecatedString ContentStyleValue::to_string() const
DeprecatedString ContentStyleValue::to_deprecated_string() const
{
if (has_alt_text())
return DeprecatedString::formatted("{} / {}", m_content->to_string(), m_alt_text->to_string());
return m_content->to_string();
return DeprecatedString::formatted("{} / {}", m_content->to_deprecated_string(), m_alt_text->to_deprecated_string());
return m_content->to_deprecated_string();
}
bool ContentStyleValue::equals(StyleValue const& other) const
@ -1223,7 +1223,7 @@ float Filter::Color::resolved_amount() const
return 1.0f;
}
DeprecatedString FilterValueListStyleValue::to_string() const
DeprecatedString FilterValueListStyleValue::to_deprecated_string() const
{
StringBuilder builder {};
bool first = true;
@ -1234,13 +1234,13 @@ DeprecatedString FilterValueListStyleValue::to_string() const
[&](Filter::Blur const& blur) {
builder.append("blur("sv);
if (blur.radius.has_value())
builder.append(blur.radius->to_string());
builder.append(blur.radius->to_deprecated_string());
},
[&](Filter::DropShadow const& drop_shadow) {
builder.appendff("drop-shadow({} {}"sv,
drop_shadow.offset_x, drop_shadow.offset_y);
if (drop_shadow.radius.has_value())
builder.appendff(" {}", drop_shadow.radius->to_string());
builder.appendff(" {}", drop_shadow.radius->to_deprecated_string());
if (drop_shadow.color.has_value()) {
builder.append(' ');
serialize_a_srgb_value(builder, *drop_shadow.color);
@ -1251,7 +1251,7 @@ DeprecatedString FilterValueListStyleValue::to_string() const
if (hue_rotate.angle.has_value()) {
hue_rotate.angle->visit(
[&](Angle const& angle) {
builder.append(angle.to_string());
builder.append(angle.to_deprecated_string());
},
[&](auto&) {
builder.append('0');
@ -1281,12 +1281,12 @@ DeprecatedString FilterValueListStyleValue::to_string() const
}
}());
if (color.amount.has_value())
builder.append(color.amount->to_string());
builder.append(color.amount->to_deprecated_string());
});
builder.append(')');
first = false;
}
return builder.to_string();
return builder.to_deprecated_string();
}
static bool operator==(Filter::Blur const& a, Filter::Blur const& b)
@ -1347,9 +1347,9 @@ bool FilterValueListStyleValue::equals(StyleValue const& other) const
return true;
}
DeprecatedString FlexStyleValue::to_string() const
DeprecatedString FlexStyleValue::to_deprecated_string() const
{
return DeprecatedString::formatted("{} {} {}", m_grow->to_string(), m_shrink->to_string(), m_basis->to_string());
return DeprecatedString::formatted("{} {} {}", m_grow->to_deprecated_string(), m_shrink->to_deprecated_string(), m_basis->to_deprecated_string());
}
bool FlexStyleValue::equals(StyleValue const& other) const
@ -1362,9 +1362,9 @@ bool FlexStyleValue::equals(StyleValue const& other) const
&& m_basis->equals(typed_other.m_basis);
}
DeprecatedString FlexFlowStyleValue::to_string() const
DeprecatedString FlexFlowStyleValue::to_deprecated_string() const
{
return DeprecatedString::formatted("{} {}", m_flex_direction->to_string(), m_flex_wrap->to_string());
return DeprecatedString::formatted("{} {}", m_flex_direction->to_deprecated_string(), m_flex_wrap->to_deprecated_string());
}
bool FlexFlowStyleValue::equals(StyleValue const& other) const
@ -1376,9 +1376,9 @@ bool FlexFlowStyleValue::equals(StyleValue const& other) const
&& m_flex_wrap->equals(typed_other.m_flex_wrap);
}
DeprecatedString FontStyleValue::to_string() const
DeprecatedString FontStyleValue::to_deprecated_string() const
{
return DeprecatedString::formatted("{} {} {} / {} {}", m_font_style->to_string(), m_font_weight->to_string(), m_font_size->to_string(), m_line_height->to_string(), m_font_families->to_string());
return DeprecatedString::formatted("{} {} {} / {} {}", m_font_style->to_deprecated_string(), m_font_weight->to_deprecated_string(), m_font_size->to_deprecated_string(), m_line_height->to_deprecated_string(), m_font_families->to_deprecated_string());
}
bool FontStyleValue::equals(StyleValue const& other) const
@ -1400,11 +1400,11 @@ bool FrequencyStyleValue::equals(StyleValue const& other) const
return m_frequency == other.as_frequency().m_frequency;
}
DeprecatedString GridTrackPlacementShorthandStyleValue::to_string() const
DeprecatedString GridTrackPlacementShorthandStyleValue::to_deprecated_string() const
{
if (m_end->grid_track_placement().is_auto())
return DeprecatedString::formatted("{}", m_start->grid_track_placement().to_string());
return DeprecatedString::formatted("{} / {}", m_start->grid_track_placement().to_string(), m_end->grid_track_placement().to_string());
return DeprecatedString::formatted("{}", m_start->grid_track_placement().to_deprecated_string());
return DeprecatedString::formatted("{} / {}", m_start->grid_track_placement().to_deprecated_string(), m_end->grid_track_placement().to_deprecated_string());
}
bool GridTrackPlacementShorthandStyleValue::equals(StyleValue const& other) const
@ -1416,9 +1416,9 @@ bool GridTrackPlacementShorthandStyleValue::equals(StyleValue const& other) cons
&& m_end->equals(typed_other.m_end);
}
DeprecatedString GridTrackPlacementStyleValue::to_string() const
DeprecatedString GridTrackPlacementStyleValue::to_deprecated_string() const
{
return m_grid_track_placement.to_string();
return m_grid_track_placement.to_deprecated_string();
}
bool GridTrackPlacementStyleValue::equals(StyleValue const& other) const
@ -1429,9 +1429,9 @@ bool GridTrackPlacementStyleValue::equals(StyleValue const& other) const
return m_grid_track_placement == typed_other.grid_track_placement();
}
DeprecatedString GridTrackSizeStyleValue::to_string() const
DeprecatedString GridTrackSizeStyleValue::to_deprecated_string() const
{
return m_grid_track_size_list.to_string();
return m_grid_track_size_list.to_deprecated_string();
}
bool GridTrackSizeStyleValue::equals(StyleValue const& other) const
@ -1442,7 +1442,7 @@ bool GridTrackSizeStyleValue::equals(StyleValue const& other) const
return m_grid_track_size_list == typed_other.grid_track_size_list();
}
DeprecatedString IdentifierStyleValue::to_string() const
DeprecatedString IdentifierStyleValue::to_deprecated_string() const
{
return CSS::string_from_value_id(m_id);
}
@ -1706,9 +1706,9 @@ Gfx::Bitmap const* ImageStyleValue::bitmap(size_t frame_index) const
return resource()->bitmap(frame_index);
}
DeprecatedString ImageStyleValue::to_string() const
DeprecatedString ImageStyleValue::to_deprecated_string() const
{
return serialize_a_url(m_url.to_string());
return serialize_a_url(m_url.to_deprecated_string());
}
bool ImageStyleValue::equals(StyleValue const& other) const
@ -1746,22 +1746,22 @@ static void serialize_color_stop_list(StringBuilder& builder, auto const& color_
builder.append(", "sv);
if (element.transition_hint.has_value()) {
builder.appendff("{}, "sv, element.transition_hint->value.to_string());
builder.appendff("{}, "sv, element.transition_hint->value.to_deprecated_string());
}
serialize_a_srgb_value(builder, element.color_stop.color);
for (auto position : Array { &element.color_stop.position, &element.color_stop.second_position }) {
if (position->has_value())
builder.appendff(" {}"sv, (*position)->to_string());
builder.appendff(" {}"sv, (*position)->to_deprecated_string());
}
first = false;
}
}
DeprecatedString LinearGradientStyleValue::to_string() const
DeprecatedString LinearGradientStyleValue::to_deprecated_string() const
{
StringBuilder builder;
auto side_or_corner_to_string = [](SideOrCorner value) {
auto side_or_corner_to_deprecated_string = [](SideOrCorner value) {
switch (value) {
case SideOrCorner::Top:
return "top"sv;
@ -1791,15 +1791,15 @@ DeprecatedString LinearGradientStyleValue::to_string() const
builder.append("linear-gradient("sv);
m_direction.visit(
[&](SideOrCorner side_or_corner) {
builder.appendff("{}{}, "sv, m_gradient_type == GradientType::Standard ? "to "sv : ""sv, side_or_corner_to_string(side_or_corner));
builder.appendff("{}{}, "sv, m_gradient_type == GradientType::Standard ? "to "sv : ""sv, side_or_corner_to_deprecated_string(side_or_corner));
},
[&](Angle const& angle) {
builder.appendff("{}, "sv, angle.to_string());
builder.appendff("{}, "sv, angle.to_deprecated_string());
});
serialize_color_stop_list(builder, m_color_stop_list);
builder.append(")"sv);
return builder.to_string();
return builder.to_deprecated_string();
}
static bool operator==(LinearGradientStyleValue::GradientDirection const& a, LinearGradientStyleValue::GradientDirection const& b)
@ -1947,7 +1947,7 @@ void PositionValue::serialize(StringBuilder& builder) const
}());
},
[&](LengthPercentage length_percentage) {
builder.append(length_percentage.to_string());
builder.append(length_percentage.to_deprecated_string());
});
builder.append(' ');
if (has_relative_edges)
@ -1968,7 +1968,7 @@ void PositionValue::serialize(StringBuilder& builder) const
}());
},
[&](LengthPercentage length_percentage) {
builder.append(length_percentage.to_string());
builder.append(length_percentage.to_deprecated_string());
});
}
@ -1981,7 +1981,7 @@ bool PositionValue::operator==(PositionValue const& other) const
&& variant_equals(vertical_position, other.vertical_position));
}
DeprecatedString RadialGradientStyleValue::to_string() const
DeprecatedString RadialGradientStyleValue::to_deprecated_string() const
{
StringBuilder builder;
if (is_repeating())
@ -2006,8 +2006,8 @@ DeprecatedString RadialGradientStyleValue::to_string() const
}
}());
},
[&](CircleSize const& circle_size) { builder.append(circle_size.radius.to_string()); },
[&](EllipseSize const& ellipse_size) { builder.appendff("{} {}", ellipse_size.radius_a.to_string(), ellipse_size.radius_b.to_string()); });
[&](CircleSize const& circle_size) { builder.append(circle_size.radius.to_deprecated_string()); },
[&](EllipseSize const& ellipse_size) { builder.appendff("{} {}", ellipse_size.radius_a.to_deprecated_string(), ellipse_size.radius_b.to_deprecated_string()); });
if (m_position != PositionValue::center()) {
builder.appendff(" at "sv);
@ -2017,7 +2017,7 @@ DeprecatedString RadialGradientStyleValue::to_string() const
builder.append(", "sv);
serialize_color_stop_list(builder, m_color_stop_list);
builder.append(')');
return builder.to_string();
return builder.to_deprecated_string();
}
Gfx::FloatSize RadialGradientStyleValue::resolve_size(Layout::Node const& node, Gfx::FloatPoint center, Gfx::FloatRect const& size) const
@ -2181,7 +2181,7 @@ void RadialGradientStyleValue::paint(PaintContext& context, Gfx::IntRect const&
Painting::paint_radial_gradient(context, dest_rect, m_resolved->data, m_resolved->center.to_rounded<int>(), m_resolved->gradient_size);
}
DeprecatedString ConicGradientStyleValue::to_string() const
DeprecatedString ConicGradientStyleValue::to_deprecated_string() const
{
StringBuilder builder;
if (is_repeating())
@ -2190,7 +2190,7 @@ DeprecatedString ConicGradientStyleValue::to_string() const
bool has_from_angle = false;
bool has_at_position = false;
if ((has_from_angle = m_from_angle.to_degrees() != 0))
builder.appendff("from {}", m_from_angle.to_string());
builder.appendff("from {}", m_from_angle.to_deprecated_string());
if ((has_at_position = m_position != PositionValue::center())) {
if (has_from_angle)
builder.append(' ');
@ -2201,7 +2201,7 @@ DeprecatedString ConicGradientStyleValue::to_string() const
builder.append(", "sv);
serialize_color_stop_list(builder, m_color_stop_list);
builder.append(')');
return builder.to_string();
return builder.to_deprecated_string();
}
void ConicGradientStyleValue::resolve_for_size(Layout::Node const& node, Gfx::FloatSize const& size) const
@ -2250,9 +2250,9 @@ bool LengthStyleValue::equals(StyleValue const& other) const
return m_length == other.as_length().m_length;
}
DeprecatedString ListStyleStyleValue::to_string() const
DeprecatedString ListStyleStyleValue::to_deprecated_string() const
{
return DeprecatedString::formatted("{} {} {}", m_position->to_string(), m_image->to_string(), m_style_type->to_string());
return DeprecatedString::formatted("{} {} {}", m_position->to_deprecated_string(), m_image->to_deprecated_string(), m_style_type->to_deprecated_string());
}
bool ListStyleStyleValue::equals(StyleValue const& other) const
@ -2265,7 +2265,7 @@ bool ListStyleStyleValue::equals(StyleValue const& other) const
&& m_style_type->equals(typed_other.m_style_type);
}
DeprecatedString NumericStyleValue::to_string() const
DeprecatedString NumericStyleValue::to_deprecated_string() const
{
return m_value.visit(
[](float value) {
@ -2287,9 +2287,9 @@ bool NumericStyleValue::equals(StyleValue const& other) const
return m_value.get<float>() == other.as_numeric().m_value.get<float>();
}
DeprecatedString OverflowStyleValue::to_string() const
DeprecatedString OverflowStyleValue::to_deprecated_string() const
{
return DeprecatedString::formatted("{} {}", m_overflow_x->to_string(), m_overflow_y->to_string());
return DeprecatedString::formatted("{} {}", m_overflow_x->to_deprecated_string(), m_overflow_y->to_deprecated_string());
}
bool OverflowStyleValue::equals(StyleValue const& other) const
@ -2301,9 +2301,9 @@ bool OverflowStyleValue::equals(StyleValue const& other) const
&& m_overflow_y->equals(typed_other.m_overflow_y);
}
DeprecatedString PercentageStyleValue::to_string() const
DeprecatedString PercentageStyleValue::to_deprecated_string() const
{
return m_percentage.to_string();
return m_percentage.to_deprecated_string();
}
bool PercentageStyleValue::equals(StyleValue const& other) const
@ -2313,9 +2313,9 @@ bool PercentageStyleValue::equals(StyleValue const& other) const
return m_percentage == other.as_percentage().m_percentage;
}
DeprecatedString PositionStyleValue::to_string() const
DeprecatedString PositionStyleValue::to_deprecated_string() const
{
auto to_string = [](PositionEdge edge) {
auto to_deprecated_string = [](PositionEdge edge) {
switch (edge) {
case PositionEdge::Left:
return "left";
@ -2329,7 +2329,7 @@ DeprecatedString PositionStyleValue::to_string() const
VERIFY_NOT_REACHED();
};
return DeprecatedString::formatted("{} {} {} {}", to_string(m_edge_x), m_offset_x.to_string(), to_string(m_edge_y), m_offset_y.to_string());
return DeprecatedString::formatted("{} {} {} {}", to_deprecated_string(m_edge_x), m_offset_x.to_deprecated_string(), to_deprecated_string(m_edge_y), m_offset_y.to_deprecated_string());
}
bool PositionStyleValue::equals(StyleValue const& other) const
@ -2343,7 +2343,7 @@ bool PositionStyleValue::equals(StyleValue const& other) const
&& m_offset_y == typed_other.m_offset_y;
}
DeprecatedString RectStyleValue::to_string() const
DeprecatedString RectStyleValue::to_deprecated_string() const
{
return DeprecatedString::formatted("rect({} {} {} {})", m_rect.top_edge, m_rect.right_edge, m_rect.bottom_edge, m_rect.left_edge);
}
@ -2363,13 +2363,13 @@ bool ResolutionStyleValue::equals(StyleValue const& other) const
return m_resolution == other.as_resolution().m_resolution;
}
DeprecatedString ShadowStyleValue::to_string() const
DeprecatedString ShadowStyleValue::to_deprecated_string() const
{
StringBuilder builder;
builder.appendff("{} {} {} {} {}", m_color.to_string(), m_offset_x.to_string(), m_offset_y.to_string(), m_blur_radius.to_string(), m_spread_distance.to_string());
builder.appendff("{} {} {} {} {}", m_color.to_deprecated_string(), m_offset_x.to_deprecated_string(), m_offset_y.to_deprecated_string(), m_blur_radius.to_deprecated_string(), m_spread_distance.to_deprecated_string());
if (m_placement == ShadowPlacement::Inner)
builder.append(" inset"sv);
return builder.to_string();
return builder.to_deprecated_string();
}
bool ShadowStyleValue::equals(StyleValue const& other) const
@ -2392,9 +2392,9 @@ bool StringStyleValue::equals(StyleValue const& other) const
return m_string == other.as_string().m_string;
}
DeprecatedString TextDecorationStyleValue::to_string() const
DeprecatedString TextDecorationStyleValue::to_deprecated_string() const
{
return DeprecatedString::formatted("{} {} {} {}", m_line->to_string(), m_thickness->to_string(), m_style->to_string(), m_color->to_string());
return DeprecatedString::formatted("{} {} {} {}", m_line->to_deprecated_string(), m_thickness->to_deprecated_string(), m_style->to_deprecated_string(), m_color->to_deprecated_string());
}
bool TextDecorationStyleValue::equals(StyleValue const& other) const
@ -2415,7 +2415,7 @@ bool TimeStyleValue::equals(StyleValue const& other) const
return m_time == other.as_time().m_time;
}
DeprecatedString TransformationStyleValue::to_string() const
DeprecatedString TransformationStyleValue::to_deprecated_string() const
{
StringBuilder builder;
builder.append(CSS::to_string(m_transform_function));
@ -2423,7 +2423,7 @@ DeprecatedString TransformationStyleValue::to_string() const
builder.join(", "sv, m_values);
builder.append(')');
return builder.to_string();
return builder.to_deprecated_string();
}
bool TransformationStyleValue::equals(StyleValue const& other) const
@ -2442,12 +2442,12 @@ bool TransformationStyleValue::equals(StyleValue const& other) const
return true;
}
DeprecatedString UnresolvedStyleValue::to_string() const
DeprecatedString UnresolvedStyleValue::to_deprecated_string() const
{
StringBuilder builder;
for (auto& value : m_values)
builder.append(value.to_string());
return builder.to_string();
builder.append(value.to_deprecated_string());
return builder.to_deprecated_string();
}
bool UnresolvedStyleValue::equals(StyleValue const& other) const
@ -2455,7 +2455,7 @@ bool UnresolvedStyleValue::equals(StyleValue const& other) const
if (type() != other.type())
return false;
// This is a case where comparing the strings actually makes sense.
return to_string() == other.to_string();
return to_deprecated_string() == other.to_deprecated_string();
}
bool UnsetStyleValue::equals(StyleValue const& other) const
@ -2463,7 +2463,7 @@ bool UnsetStyleValue::equals(StyleValue const& other) const
return type() == other.type();
}
DeprecatedString StyleValueList::to_string() const
DeprecatedString StyleValueList::to_deprecated_string() const
{
DeprecatedString separator = "";
switch (m_separator) {

View file

@ -403,7 +403,7 @@ public:
virtual Length to_length() const { VERIFY_NOT_REACHED(); }
virtual float to_number() const { return 0; }
virtual float to_integer() const { return 0; }
virtual DeprecatedString to_string() const = 0;
virtual DeprecatedString to_deprecated_string() const = 0;
bool operator==(StyleValue const& other) const { return equals(other); }
@ -426,7 +426,7 @@ public:
Angle const& angle() const { return m_angle; }
virtual DeprecatedString to_string() const override { return m_angle.to_string(); }
virtual DeprecatedString to_deprecated_string() const override { return m_angle.to_deprecated_string(); }
virtual bool equals(StyleValue const& other) const override
{
@ -472,7 +472,7 @@ public:
NonnullRefPtr<StyleValue> repeat() const { return m_repeat; }
NonnullRefPtr<StyleValue> size() const { return m_size; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -509,7 +509,7 @@ public:
Repeat repeat_x() const { return m_repeat_x; }
Repeat repeat_y() const { return m_repeat_y; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -536,7 +536,7 @@ public:
LengthPercentage size_x() const { return m_size_x; }
LengthPercentage size_y() const { return m_size_y; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -566,7 +566,7 @@ public:
NonnullRefPtr<StyleValue> border_style() const { return m_border_style; }
NonnullRefPtr<StyleValue> border_color() const { return m_border_color; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -598,7 +598,7 @@ public:
LengthPercentage const& vertical_radius() const { return m_vertical_radius; }
bool is_elliptical() const { return m_is_elliptical; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -630,7 +630,7 @@ public:
NonnullRefPtr<BorderRadiusStyleValue> bottom_right() const { return m_bottom_right; }
NonnullRefPtr<BorderRadiusStyleValue> bottom_left() const { return m_bottom_left; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -702,14 +702,14 @@ public:
struct CalcNumberValue {
Variant<Number, NonnullOwnPtr<CalcNumberSum>> value;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
};
struct CalcValue {
Variant<Number, Angle, Frequency, Length, Percentage, Time, NonnullOwnPtr<CalcSum>> value;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
bool contains_percentage() const;
@ -724,7 +724,7 @@ public:
NonnullOwnPtr<CalcProduct> first_calc_product;
NonnullOwnPtrVector<CalcSumPartWithOperator> zero_or_more_additional_calc_products;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
@ -739,7 +739,7 @@ public:
NonnullOwnPtr<CalcNumberProduct> first_calc_number_product;
NonnullOwnPtrVector<CalcNumberSumPartWithOperator> zero_or_more_additional_calc_number_products;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
};
@ -748,7 +748,7 @@ public:
CalcValue first_calc_value;
NonnullOwnPtrVector<CalcProductPartWithOperator> zero_or_more_additional_calc_values;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
bool contains_percentage() const;
@ -762,7 +762,7 @@ public:
SumOperation op;
NonnullOwnPtr<CalcProduct> value;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
bool contains_percentage() const;
@ -772,7 +772,7 @@ public:
ProductOperation op;
Variant<CalcValue, CalcNumberValue> value;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
@ -783,7 +783,7 @@ public:
CalcNumberValue first_calc_number_value;
NonnullOwnPtrVector<CalcNumberProductPartWithOperator> zero_or_more_additional_calc_number_values;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
};
@ -792,7 +792,7 @@ public:
ProductOperation op;
CalcNumberValue value;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
};
@ -805,7 +805,7 @@ public:
SumOperation op;
NonnullOwnPtr<CalcNumberProduct> value;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
Optional<ResolvedType> resolved_type() const;
CalculationResult resolve(Layout::Node const*, PercentageBasis const& percentage_basis) const;
};
@ -815,7 +815,7 @@ public:
return adopt_ref(*new CalculatedStyleValue(move(calc_sum), resolved_type));
}
DeprecatedString to_string() const override;
DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
ResolvedType resolved_type() const { return m_resolved_type; }
NonnullOwnPtr<CalcSum> const& expression() const { return m_expression; }
@ -864,7 +864,7 @@ public:
virtual ~ColorStyleValue() override = default;
Color color() const { return m_color; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool has_color() const override { return true; }
virtual Color to_color(Layout::NodeWithStyle const&) const override { return m_color; }
@ -891,7 +891,7 @@ public:
bool has_alt_text() const { return !m_alt_text.is_null(); }
StyleValueList const* alt_text() const { return m_alt_text; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -917,7 +917,7 @@ public:
Vector<FilterFunction> const& filter_value_list() const { return m_filter_value_list; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
virtual ~FilterValueListStyleValue() override = default;
@ -948,7 +948,7 @@ public:
NonnullRefPtr<StyleValue> shrink() const { return m_shrink; }
NonnullRefPtr<StyleValue> basis() const { return m_basis; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -979,7 +979,7 @@ public:
NonnullRefPtr<StyleValue> flex_direction() const { return m_flex_direction; }
NonnullRefPtr<StyleValue> flex_wrap() const { return m_flex_wrap; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1005,7 +1005,7 @@ public:
NonnullRefPtr<StyleValue> line_height() const { return m_line_height; }
NonnullRefPtr<StyleValue> font_families() const { return m_font_families; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1037,7 +1037,7 @@ public:
Frequency const& frequency() const { return m_frequency; }
virtual DeprecatedString to_string() const override { return m_frequency.to_string(); }
virtual DeprecatedString to_deprecated_string() const override { return m_frequency.to_deprecated_string(); }
virtual bool equals(StyleValue const& other) const override;
private:
@ -1056,7 +1056,7 @@ public:
virtual ~GridTrackPlacementStyleValue() override = default;
CSS::GridTrackPlacement const& grid_track_placement() const { return m_grid_track_placement; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1084,7 +1084,7 @@ public:
NonnullRefPtr<GridTrackPlacementStyleValue> start() const { return m_start; }
NonnullRefPtr<GridTrackPlacementStyleValue> end() const { return m_end; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1108,7 +1108,7 @@ public:
CSS::GridTrackSizeList grid_track_size_list() const { return m_grid_track_size_list; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1136,7 +1136,7 @@ public:
virtual CSS::ValueID to_identifier() const override { return m_id; }
virtual bool has_color() const override;
virtual Color to_color(Layout::NodeWithStyle const& node) const override;
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1170,7 +1170,7 @@ public:
static NonnullRefPtr<ImageStyleValue> create(AK::URL const& url) { return adopt_ref(*new ImageStyleValue(url)); }
virtual ~ImageStyleValue() override = default;
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
virtual void load_any_resources(DOM::Document&) override;
@ -1238,7 +1238,7 @@ public:
return adopt_ref(*new RadialGradientStyleValue(ending_shape, size, position, move(color_stop_list), repeating));
}
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
void paint(PaintContext&, Gfx::IntRect const& dest_rect, CSS::ImageRendering) const override;
@ -1293,7 +1293,7 @@ public:
return adopt_ref(*new ConicGradientStyleValue(from_angle, position, move(color_stop_list), repeating));
}
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
void paint(PaintContext&, Gfx::IntRect const& dest_rect, CSS::ImageRendering) const override;
@ -1355,7 +1355,7 @@ public:
return adopt_ref(*new LinearGradientStyleValue(direction, move(color_stop_list), type, repeating));
}
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual ~LinearGradientStyleValue() override = default;
virtual bool equals(StyleValue const& other) const override;
@ -1405,7 +1405,7 @@ public:
}
virtual ~InheritStyleValue() override = default;
DeprecatedString to_string() const override { return "inherit"; }
DeprecatedString to_deprecated_string() const override { return "inherit"; }
virtual bool equals(StyleValue const& other) const override;
private:
@ -1424,7 +1424,7 @@ public:
}
virtual ~InitialStyleValue() override = default;
DeprecatedString to_string() const override { return "initial"; }
DeprecatedString to_deprecated_string() const override { return "initial"; }
virtual bool equals(StyleValue const& other) const override;
private:
@ -1444,7 +1444,7 @@ public:
virtual bool has_auto() const override { return m_length.is_auto(); }
virtual bool has_length() const override { return true; }
virtual bool has_identifier() const override { return has_auto(); }
virtual DeprecatedString to_string() const override { return m_length.to_string(); }
virtual DeprecatedString to_deprecated_string() const override { return m_length.to_deprecated_string(); }
virtual Length to_length() const override { return m_length; }
virtual ValueID to_identifier() const override { return has_auto() ? ValueID::Auto : ValueID::Invalid; }
virtual NonnullRefPtr<StyleValue> absolutized(Gfx::IntRect const& viewport_rect, Gfx::FontPixelMetrics const& font_metrics, float font_size, float root_font_size) const override;
@ -1475,7 +1475,7 @@ public:
NonnullRefPtr<StyleValue> image() const { return m_image; }
NonnullRefPtr<StyleValue> style_type() const { return m_style_type; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1521,7 +1521,7 @@ public:
virtual bool has_integer() const override { return m_value.has<i64>(); }
virtual float to_integer() const override { return m_value.get<i64>(); }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1545,7 +1545,7 @@ public:
NonnullRefPtr<StyleValue> overflow_x() const { return m_overflow_x; }
NonnullRefPtr<StyleValue> overflow_y() const { return m_overflow_y; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1571,7 +1571,7 @@ public:
Percentage const& percentage() const { return m_percentage; }
Percentage& percentage() { return m_percentage; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1597,7 +1597,7 @@ public:
PositionEdge edge_y() const { return m_edge_y; }
LengthPercentage const& offset_y() const { return m_offset_y; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1626,7 +1626,7 @@ public:
Resolution const& resolution() const { return m_resolution; }
virtual DeprecatedString to_string() const override { return m_resolution.to_string(); }
virtual DeprecatedString to_deprecated_string() const override { return m_resolution.to_deprecated_string(); }
virtual bool equals(StyleValue const& other) const override;
private:
@ -1655,7 +1655,7 @@ public:
Length const& spread_distance() const { return m_spread_distance; }
ShadowPlacement placement() const { return m_placement; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1688,7 +1688,7 @@ public:
}
virtual ~StringStyleValue() override = default;
DeprecatedString to_string() const override { return m_string; }
DeprecatedString to_deprecated_string() const override { return m_string; }
virtual bool equals(StyleValue const& other) const override;
private:
@ -1718,7 +1718,7 @@ public:
NonnullRefPtr<StyleValue> style() const { return m_style; }
NonnullRefPtr<StyleValue> color() const { return m_color; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1751,7 +1751,7 @@ public:
Time const& time() const { return m_time; }
virtual DeprecatedString to_string() const override { return m_time.to_string(); }
virtual DeprecatedString to_deprecated_string() const override { return m_time.to_deprecated_string(); }
virtual bool equals(StyleValue const& other) const override;
private:
@ -1775,7 +1775,7 @@ public:
CSS::TransformFunction transform_function() const { return m_transform_function; }
NonnullRefPtrVector<StyleValue> values() const { return m_values; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1798,7 +1798,7 @@ public:
}
virtual ~UnresolvedStyleValue() override = default;
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
Vector<Parser::ComponentValue> const& values() const { return m_values; }
@ -1825,7 +1825,7 @@ public:
}
virtual ~UnsetStyleValue() override = default;
DeprecatedString to_string() const override { return "unset"; }
DeprecatedString to_deprecated_string() const override { return "unset"; }
virtual bool equals(StyleValue const& other) const override;
private:
@ -1852,7 +1852,7 @@ public:
return m_values[i];
}
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool equals(StyleValue const& other) const override;
private:
@ -1873,7 +1873,7 @@ public:
virtual ~RectStyleValue() override = default;
EdgeRect rect() const { return m_rect; }
virtual DeprecatedString to_string() const override;
virtual DeprecatedString to_deprecated_string() const override;
virtual bool has_rect() const override { return true; }
virtual EdgeRect to_rect() const override { return m_rect; }
virtual bool equals(StyleValue const& other) const override;
@ -1894,6 +1894,6 @@ template<>
struct AK::Formatter<Web::CSS::StyleValue> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::StyleValue const& style_value)
{
return Formatter<StringView>::format(builder, style_value.to_string());
return Formatter<StringView>::format(builder, style_value.to_deprecated_string());
}
};

View file

@ -73,33 +73,34 @@ bool Supports::Feature::evaluate() const
});
}
DeprecatedString Supports::Declaration::to_string() const
DeprecatedString Supports::Declaration::to_deprecated_string() const
{
return DeprecatedString::formatted("({})", declaration);
}
DeprecatedString Supports::Selector::to_string() const
DeprecatedString Supports::Selector::to_deprecated_string() const
{
return DeprecatedString::formatted("selector({})", selector);
}
DeprecatedString Supports::Feature::to_string() const
DeprecatedString Supports::Feature::to_deprecated_string() const
{
return value.visit([](auto& it) { return it.to_string(); });
return value.visit([](auto& it) { return it.to_deprecated_string(); });
}
DeprecatedString Supports::InParens::to_string() const
DeprecatedString Supports::InParens::to_deprecated_string() const
{
return value.visit(
[](NonnullOwnPtr<Condition> const& condition) -> DeprecatedString { return DeprecatedString::formatted("({})", condition->to_string()); },
[](auto& it) -> DeprecatedString { return it.to_string(); });
[](NonnullOwnPtr<Condition> const& condition) -> DeprecatedString { return DeprecatedString::formatted("({})", condition->to_deprecated_string()); },
[](Supports::Feature const& it) -> DeprecatedString { return it.to_deprecated_string(); },
[](GeneralEnclosed const& it) -> DeprecatedString { return it.to_string(); });
}
DeprecatedString Supports::Condition::to_string() const
DeprecatedString Supports::Condition::to_deprecated_string() const
{
switch (type) {
case Type::Not:
return DeprecatedString::formatted("not {}", children.first().to_string());
return DeprecatedString::formatted("not {}", children.first().to_deprecated_string());
case Type::And:
return DeprecatedString::join(" and "sv, children);
case Type::Or:
@ -108,9 +109,9 @@ DeprecatedString Supports::Condition::to_string() const
VERIFY_NOT_REACHED();
}
DeprecatedString Supports::to_string() const
DeprecatedString Supports::to_deprecated_string() const
{
return m_condition->to_string();
return m_condition->to_deprecated_string();
}
}

View file

@ -24,19 +24,19 @@ public:
struct Declaration {
DeprecatedString declaration;
bool evaluate() const;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
};
struct Selector {
DeprecatedString selector;
bool evaluate() const;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
};
struct Feature {
Variant<Declaration, Selector> value;
bool evaluate() const;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
};
struct Condition;
@ -44,7 +44,7 @@ public:
Variant<NonnullOwnPtr<Condition>, Feature, GeneralEnclosed> value;
bool evaluate() const;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
};
struct Condition {
@ -57,7 +57,7 @@ public:
Vector<InParens> children;
bool evaluate() const;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
};
static NonnullRefPtr<Supports> create(NonnullOwnPtr<Condition>&& condition)
@ -66,7 +66,7 @@ public:
}
bool matches() const { return m_matches; }
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
private:
Supports(NonnullOwnPtr<Condition>&&);
@ -81,6 +81,6 @@ template<>
struct AK::Formatter<Web::CSS::Supports::InParens> : AK::Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::Supports::InParens const& in_parens)
{
return Formatter<StringView>::format(builder, in_parens.to_string());
return Formatter<StringView>::format(builder, in_parens.to_deprecated_string());
}
};

View file

@ -40,10 +40,10 @@ Time Time::percentage_of(Percentage const& percentage) const
return Time { percentage.as_fraction() * m_value, m_type };
}
DeprecatedString Time::to_string() const
DeprecatedString Time::to_deprecated_string() const
{
if (is_calculated())
return m_calculated_style->to_string();
return m_calculated_style->to_deprecated_string();
return DeprecatedString::formatted("{}{}", m_value, unit_name());
}

View file

@ -31,7 +31,7 @@ public:
bool is_calculated() const { return m_type == Type::Calculated; }
NonnullRefPtr<CalculatedStyleValue> calculated_style_value() const;
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
float to_seconds() const;
bool operator==(Time const& other) const
@ -55,6 +55,6 @@ template<>
struct AK::Formatter<Web::CSS::Time> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::CSS::Time const& time)
{
return Formatter<StringView>::format(builder, time.to_string());
return Formatter<StringView>::format(builder, time.to_deprecated_string());
}
};

View file

@ -29,7 +29,7 @@ public:
return m_min_code_point <= code_point && code_point <= m_max_code_point;
}
DeprecatedString to_string() const
DeprecatedString to_deprecated_string() const
{
if (m_min_code_point == m_max_code_point)
return DeprecatedString::formatted("U+{:x}", m_min_code_point);