1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-28 14:07:45 +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

@ -97,7 +97,7 @@ JS_DEFINE_NATIVE_FUNCTION(LocationObject::href_getter)
// FIXME: 1. If this's relevant Document is non-null and its origin is not same origin-domain with the entry settings object's origin, then throw a "SecurityError" DOMException.
// 2. Return this's url, serialized.
return JS::js_string(vm, location_object->url().to_string());
return JS::js_string(vm, location_object->url().to_deprecated_string());
}
// https://html.spec.whatwg.org/multipage/history.html#the-location-interface:dom-location-href-2

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);

View file

@ -111,7 +111,7 @@ DeprecatedString Crypto::random_uuid() const
builder.appendff("{:02x}{:02x}-", bytes[6], bytes[7]);
builder.appendff("{:02x}{:02x}-", bytes[8], bytes[9]);
builder.appendff("{:02x}{:02x}{:02x}{:02x}{:02x}{:02x}", bytes[10], bytes[11], bytes[12], bytes[13], bytes[14], bytes[15]);
return builder.to_string();
return builder.to_deprecated_string();
}
void Crypto::visit_edges(Cell::Visitor& visitor)

View file

@ -73,7 +73,7 @@ WebIDL::ExceptionOr<void> CharacterData::replace_data(size_t offset, size_t coun
builder.append(this->data().substring_view(0, offset));
builder.append(data);
builder.append(this->data().substring_view(offset + count));
m_data = builder.to_string();
m_data = builder.to_deprecated_string();
// 8. For each live range whose start node is node and start offset is greater than offset but less than or equal to offset plus count, set its start offset to offset.
for (auto& range : Range::live_ranges()) {

View file

@ -663,7 +663,7 @@ DeprecatedString Document::title() const
last_was_space = false;
}
}
return builder.to_string();
return builder.to_deprecated_string();
}
void Document::set_title(DeprecatedString const& title)
@ -1595,7 +1595,7 @@ DeprecatedString Document::dump_dom_tree_as_json() const
serialize_tree_as_json(json);
MUST(json.finish());
return builder.to_string();
return builder.to_deprecated_string();
}
// https://html.spec.whatwg.org/multipage/semantics.html#has-a-style-sheet-that-is-blocking-scripts

View file

@ -108,8 +108,8 @@ public:
void update_base_element(Badge<HTML::HTMLBaseElement>);
JS::GCPtr<HTML::HTMLBaseElement> first_base_element_with_href_in_tree_order() const;
DeprecatedString url_string() const { return m_url.to_string(); }
DeprecatedString document_uri() const { return m_url.to_string(); }
DeprecatedString url_string() const { return m_url.to_deprecated_string(); }
DeprecatedString document_uri() const { return m_url.to_deprecated_string(); }
HTML::Origin origin() const;
void set_origin(HTML::Origin const& origin);

View file

@ -315,7 +315,7 @@ JS::GCPtr<Layout::Node> Element::create_layout_node_for_display_type(DOM::Docume
return document.heap().allocate_without_realm<Layout::InlineNode>(document, element, move(style));
if (display.is_flex_inside())
return document.heap().allocate_without_realm<Layout::BlockContainer>(document, element, move(style));
dbgln_if(LIBWEB_CSS_DEBUG, "FIXME: Support display: {}", display.to_string());
dbgln_if(LIBWEB_CSS_DEBUG, "FIXME: Support display: {}", display.to_deprecated_string());
return document.heap().allocate_without_realm<Layout::InlineNode>(document, element, move(style));
}

View file

@ -386,7 +386,7 @@ WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(FlyString
builder.appendff("function {}(event) {{\n{}\n}}", name, body);
}
auto source_text = builder.to_string();
auto source_text = builder.to_deprecated_string();
auto parser = JS::Parser(JS::Lexer(source_text));
@ -454,7 +454,7 @@ WebIDL::CallbackType* EventTarget::get_current_value_of_event_handler(FlyString
// 6. Return scope. (NOTE: Not necessary)
auto* function = JS::ECMAScriptFunctionObject::create(realm, name, builder.to_string(), program->body(), program->parameters(), program->function_length(), scope, nullptr, JS::FunctionKind::Normal, program->is_strict_mode(), program->might_need_arguments_object(), is_arrow_function);
auto* function = JS::ECMAScriptFunctionObject::create(realm, name, builder.to_deprecated_string(), program->body(), program->parameters(), program->function_length(), scope, nullptr, JS::FunctionKind::Normal, program->is_strict_mode(), program->might_need_arguments_object(), is_arrow_function);
VERIFY(function);
// 10. Remove settings object's realm execution context from the JavaScript execution context stack.

View file

@ -105,7 +105,7 @@ void Node::visit_edges(Cell::Visitor& visitor)
DeprecatedString Node::base_uri() const
{
// Return thiss node documents document base URL, serialized.
return document().base_url().to_string();
return document().base_url().to_deprecated_string();
}
const HTML::HTMLAnchorElement* Node::enclosing_link_element() const
@ -142,7 +142,7 @@ DeprecatedString Node::descendant_text_content() const
builder.append(text_node.data());
return IterationDecision::Continue;
});
return builder.to_string();
return builder.to_deprecated_string();
}
// https://dom.spec.whatwg.org/#dom-node-textcontent
@ -1318,7 +1318,7 @@ DeprecatedString Node::debug_description() const
for (auto const& class_name : element.class_names())
builder.appendff(".{}", class_name);
}
return builder.to_string();
return builder.to_deprecated_string();
}
// https://dom.spec.whatwg.org/#concept-node-length

View file

@ -18,7 +18,7 @@ Position::Position(Node& node, unsigned offset)
{
}
DeprecatedString Position::to_string() const
DeprecatedString Position::to_deprecated_string() const
{
if (!node())
return DeprecatedString::formatted("DOM::Position(nullptr, {})", offset());

View file

@ -35,7 +35,7 @@ public:
return m_node.ptr() == other.m_node.ptr() && m_offset == other.m_offset;
}
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
private:
JS::Handle<Node> m_node;
@ -49,7 +49,7 @@ template<>
struct Formatter<Web::DOM::Position> : Formatter<StringView> {
ErrorOr<void> format(FormatBuilder& builder, Web::DOM::Position const& value)
{
return Formatter<StringView>::format(builder, value.to_string());
return Formatter<StringView>::format(builder, value.to_deprecated_string());
}
};

View file

@ -516,7 +516,7 @@ WebIDL::ExceptionOr<i16> Range::compare_point(Node const& node, u32 offset) cons
}
// https://dom.spec.whatwg.org/#dom-range-stringifier
DeprecatedString Range::to_string() const
DeprecatedString Range::to_deprecated_string() const
{
// 1. Let s be the empty string.
StringBuilder builder;
@ -541,7 +541,7 @@ DeprecatedString Range::to_string() const
builder.append(static_cast<Text const&>(*end_container()).data().substring_view(0, end_offset()));
// 6. Return s.
return builder.to_string();
return builder.to_deprecated_string();
}
// https://dom.spec.whatwg.org/#dom-range-extractcontents

View file

@ -78,7 +78,7 @@ public:
WebIDL::ExceptionOr<void> insert_node(JS::NonnullGCPtr<Node>);
WebIDL::ExceptionOr<void> surround_contents(JS::NonnullGCPtr<Node> new_parent);
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
static HashTable<Range*>& live_ranges();

View file

@ -455,7 +455,7 @@ static WebIDL::ExceptionOr<DeprecatedString> serialize_element_attributes(DOM::E
}
// 4. Return the value of result.
return result.to_string();
return result.to_deprecated_string();
}
// https://w3c.github.io/DOM-Parsing/#xml-serializing-an-element-node
@ -524,7 +524,7 @@ static WebIDL::ExceptionOr<DeprecatedString> serialize_element(DOM::Element cons
qualified_name.append(element.local_name());
// 4. Append the value of qualified name to markup.
markup.append(qualified_name.to_string());
markup.append(qualified_name.to_deprecated_string());
}
// 12. Otherwise, inherited ns is not equal to ns (the node's own namespace is different from the context namespace of its parent). Run these sub-steps:
@ -561,7 +561,7 @@ static WebIDL::ExceptionOr<DeprecatedString> serialize_element(DOM::Element cons
}
// 3. Append the value of qualified name to markup.
markup.append(qualified_name.to_string());
markup.append(qualified_name.to_deprecated_string());
}
// 5. Otherwise, if prefix is not null, then:
@ -577,7 +577,7 @@ static WebIDL::ExceptionOr<DeprecatedString> serialize_element(DOM::Element cons
qualified_name.appendff("{}:{}", prefix, element.local_name());
// 4. Append the value of qualified name to markup.
markup.append(qualified_name.to_string());
markup.append(qualified_name.to_deprecated_string());
// 5. Append the following to markup, in the order listed:
// 1. " " (U+0020 SPACE);
@ -618,7 +618,7 @@ static WebIDL::ExceptionOr<DeprecatedString> serialize_element(DOM::Element cons
inherited_ns = ns;
// 4. Append the value of qualified name to markup.
markup.append(qualified_name.to_string());
markup.append(qualified_name.to_deprecated_string());
// 5. Append the following to markup, in the order listed:
// 1. " " (U+0020 SPACE);
@ -641,7 +641,7 @@ static WebIDL::ExceptionOr<DeprecatedString> serialize_element(DOM::Element cons
qualified_name.append(element.local_name());
inherited_ns = ns;
markup.append(qualified_name.to_string());
markup.append(qualified_name.to_deprecated_string());
}
}
@ -671,7 +671,7 @@ static WebIDL::ExceptionOr<DeprecatedString> serialize_element(DOM::Element cons
// 17. If the value of skip end tag is true, then return the value of markup and skip the remaining steps. The node is a leaf-node.
if (skip_end_tag)
return markup.to_string();
return markup.to_deprecated_string();
// 18. If ns is the HTML namespace, and the node's localName matches the string "template", then this is a template element.
if (ns == Namespace::HTML && element.local_name() == HTML::TagNames::template_) {
@ -691,13 +691,13 @@ static WebIDL::ExceptionOr<DeprecatedString> serialize_element(DOM::Element cons
markup.append("</"sv);
// 2. The value of qualified name;
markup.append(qualified_name.to_string());
markup.append(qualified_name.to_deprecated_string());
// 3. ">" (U+003E GREATER-THAN SIGN).
markup.append('>');
// 21. Return the value of markup.
return markup.to_string();
return markup.to_deprecated_string();
}
// https://w3c.github.io/DOM-Parsing/#xml-serializing-a-document-node
@ -717,7 +717,7 @@ static WebIDL::ExceptionOr<DeprecatedString> serialize_document(DOM::Document co
serialized_document.append(TRY(serialize_node_to_xml_string_impl(*child, namespace_, namespace_prefix_map, prefix_index, require_well_formed)));
// 3. Return the value of serialized document.
return serialized_document.to_string();
return serialized_document.to_deprecated_string();
}
// https://w3c.github.io/DOM-Parsing/#xml-serializing-a-comment-node
@ -774,7 +774,7 @@ static WebIDL::ExceptionOr<DeprecatedString> serialize_document_fragment(DOM::Do
markup.append(TRY(serialize_node_to_xml_string_impl(*child, namespace_, namespace_prefix_map, prefix_index, require_well_formed)));
// 3. Return the value of markup.
return markup.to_string();
return markup.to_deprecated_string();
}
// https://w3c.github.io/DOM-Parsing/#xml-serializing-a-documenttype-node
@ -840,7 +840,7 @@ static WebIDL::ExceptionOr<DeprecatedString> serialize_document_type(DOM::Docume
markup.append('>');
// 11. Return the value of markup.
return markup.to_string();
return markup.to_deprecated_string();
}
// https://w3c.github.io/DOM-Parsing/#dfn-xml-serializing-a-processinginstruction-node
@ -881,7 +881,7 @@ static WebIDL::ExceptionOr<DeprecatedString> serialize_processing_instruction(DO
markup.append("?>"sv);
// 4. Return the value of markup.
return markup.to_string();
return markup.to_deprecated_string();
}
}

View file

@ -113,7 +113,7 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho
builder.append('.');
builder.append(class_name);
}
identifier = builder.to_string();
identifier = builder.to_deprecated_string();
}
StringView nonbox_color_on = ""sv;
@ -264,7 +264,7 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho
builder.appendff("start: {}, length: {}, rect: {}\n",
fragment.start(),
fragment.length(),
fragment.absolute_rect().to_string());
fragment.absolute_rect().to_deprecated_string());
if (is<Layout::TextNode>(fragment.layout_node())) {
for (size_t i = 0; i < indent; ++i)
builder.append(" "sv);
@ -283,7 +283,7 @@ void dump_tree(StringBuilder& builder, Layout::Node const& layout_node, bool sho
};
Vector<NameAndValue> properties;
verify_cast<DOM::Element>(*layout_node.dom_node()).computed_css_values()->for_each_property([&](auto property_id, auto& value) {
properties.append({ CSS::string_from_property_id(property_id), value.to_string() });
properties.append({ CSS::string_from_property_id(property_id), value.to_deprecated_string() });
});
quick_sort(properties, [](auto& a, auto& b) { return a.name < b.name; });
@ -602,7 +602,7 @@ void dump_font_face_rule(StringBuilder& builder, CSS::CSSFontFaceRule const& rul
builder.append("unicode-ranges:\n"sv);
for (auto const& unicode_range : font_face.unicode_ranges()) {
indent(builder, indent_levels + 2);
builder.appendff("{}\n", unicode_range.to_string());
builder.appendff("{}\n", unicode_range.to_deprecated_string());
}
}
@ -642,14 +642,14 @@ void dump_style_rule(StringBuilder& builder, CSS::CSSStyleRule const& rule, int
auto& style_declaration = verify_cast<CSS::PropertyOwningCSSStyleDeclaration>(rule.declaration());
for (auto& property : style_declaration.properties()) {
indent(builder, indent_levels);
builder.appendff(" {}: '{}'", CSS::string_from_property_id(property.property_id), property.value->to_string());
builder.appendff(" {}: '{}'", CSS::string_from_property_id(property.property_id), property.value->to_deprecated_string());
if (property.important == CSS::Important::Yes)
builder.append(" \033[31;1m!important\033[0m"sv);
builder.append('\n');
}
for (auto& property : style_declaration.custom_properties()) {
indent(builder, indent_levels);
builder.appendff(" {}: '{}'", property.key, property.value.value->to_string());
builder.appendff(" {}: '{}'", property.key, property.value.value->to_deprecated_string());
if (property.value.important == CSS::Important::Yes)
builder.append(" \033[31;1m!important\033[0m"sv);
builder.append('\n');

View file

@ -162,7 +162,7 @@ JS::NonnullGCPtr<JS::Promise> consume_body(JS::Realm& realm, BodyMixin const& ob
// 4. Let steps be to return the result of package data with the first argument given, type, and objects MIME type.
auto steps = [&realm, &object, type](JS::Value value) -> WebIDL::ExceptionOr<JS::Value> {
VERIFY(value.is_string());
auto bytes = TRY_OR_RETURN_OOM(realm, ByteBuffer::copy(value.as_string().string().bytes()));
auto bytes = TRY_OR_RETURN_OOM(realm, ByteBuffer::copy(value.as_string().deprecated_string().bytes()));
return package_data(realm, move(bytes), type, object.mime_type_impl());
};

View file

@ -87,7 +87,7 @@ WebIDL::ExceptionOr<Infrastructure::BodyWithType> extract_body(JS::Realm& realm,
},
[&](JS::Handle<URL::URLSearchParams> const& url_search_params) -> WebIDL::ExceptionOr<void> {
// Set source to the result of running the application/x-www-form-urlencoded serializer with objects list.
source = url_search_params->to_string().to_byte_buffer();
source = url_search_params->to_deprecated_string().to_byte_buffer();
// Set type to `application/x-www-form-urlencoded;charset=UTF-8`.
type = TRY_OR_RETURN_OOM(realm, ByteBuffer::copy("application/x-www-form-urlencoded;charset=UTF-8"sv.bytes()));
return {};

View file

@ -69,7 +69,7 @@ DeprecatedString collect_an_http_quoted_string(GenericLexer& lexer, HttpQuotedSt
// 6. If the extract-value flag is set, then return value.
if (extract_value == HttpQuotedStringExtractValue::Yes)
return value.to_string();
return value.to_deprecated_string();
// 7. Return the code points from positionStart to position, inclusive, within input.
auto position = lexer.tell();

View file

@ -63,7 +63,7 @@ ErrorOr<DeprecatedString> convert_line_endings_to_native(DeprecatedString const&
TRY(result.try_append(lexer.consume_until(is_any_of("\n\r"sv))));
}
// 5. Return result.
return result.to_string();
return result.to_deprecated_string();
}
// https://w3c.github.io/FileAPI/#process-blob-parts

View file

@ -512,7 +512,7 @@ DeprecatedString BrowsingContext::selected_text() const
builder.append(text.substring(0, selection.end().index_in_node));
}
return builder.to_string();
return builder.to_deprecated_string();
}
void BrowsingContext::select_all()

View file

@ -28,7 +28,7 @@ public:
DeprecatedString fill_style() const
{
return my_drawing_state().fill_style.to_string();
return my_drawing_state().fill_style.to_deprecated_string();
}
void set_stroke_style(DeprecatedString style)
@ -39,7 +39,7 @@ public:
DeprecatedString stroke_style() const
{
return my_drawing_state().stroke_style.to_string();
return my_drawing_state().stroke_style.to_deprecated_string();
}
JS::NonnullGCPtr<CanvasGradient> create_radial_gradient(double x0, double y0, double r0, double x1, double y1, double r1)

View file

@ -31,7 +31,7 @@ JS::NonnullGCPtr<DOM::Document> DOMParser::parse_from_string(DeprecatedString co
{
// 1. Let document be a new Document, whose content type is type and url is this's relevant global object's associated Document's URL.
auto document = DOM::Document::create(realm(), verify_cast<HTML::Window>(relevant_global_object(*this)).associated_document().url());
document->set_content_type(Bindings::idl_enum_to_string(type));
document->set_content_type(Bindings::idl_enum_to_deprecated_string(type));
// 2. Switch on type:
if (type == Bindings::DOMParserSupportedType::Text_Html) {

View file

@ -74,7 +74,7 @@ Vector<DOMStringMap::NameValuePair> DOMStringMap::get_name_value_pairs() const
builder.append(current_character);
}
list.append({ builder.to_string(), value });
list.append({ builder.to_deprecated_string(), value });
});
// 4. Return list.
@ -139,7 +139,7 @@ WebIDL::ExceptionOr<void> DOMStringMap::set_value_of_new_named_property(Deprecat
builder.append(current_character);
}
auto data_name = builder.to_string();
auto data_name = builder.to_deprecated_string();
// FIXME: 4. If name does not match the XML Name production, throw an "InvalidCharacterError" DOMException.
@ -176,7 +176,7 @@ bool DOMStringMap::delete_existing_named_property(DeprecatedString const& name)
}
// Remove an attribute by name given name and the DOMStringMap's associated element.
auto data_name = builder.to_string();
auto data_name = builder.to_deprecated_string();
m_associated_element->remove_attribute(data_name);
// The spec doesn't have the step. This indicates that the deletion was successful.

View file

@ -94,7 +94,7 @@ DeprecatedString HTMLBaseElement::href() const
return url;
// 5. Return the serialization of urlRecord.
return url_record.to_string();
return url_record.to_deprecated_string();
}
// https://html.spec.whatwg.org/multipage/semantics.html#dom-base-href

View file

@ -177,7 +177,7 @@ DeprecatedString HTMLCanvasElement::to_data_url(DeprecatedString const& type, [[
if (type != "image/png")
return {};
auto encoded_bitmap = Gfx::PNGWriter::encode(*m_bitmap);
return AK::URL::create_with_data(type, encode_base64(encoded_bitmap), true).to_string();
return AK::URL::create_with_data(type, encode_base64(encoded_bitmap), true).to_deprecated_string();
}
void HTMLCanvasElement::present()

View file

@ -157,7 +157,7 @@ DeprecatedString HTMLElement::inner_text()
};
recurse(*layout_node());
return builder.to_string();
return builder.to_deprecated_string();
}
// // https://drafts.csswg.org/cssom-view/#dom-htmlelement-offsettop

View file

@ -158,7 +158,7 @@ DeprecatedString HTMLFormElement::action() const
// Return the current URL if the action attribute is null or an empty string
if (value.is_null() || value.is_empty()) {
return document().url().to_string();
return document().url().to_deprecated_string();
}
return value;

View file

@ -504,7 +504,7 @@ void HTMLHyperlinkElementUtils::follow_the_hyperlink(Optional<DeprecatedString>
auto url = source->active_document()->parse_url(href());
// 10. If that is successful, let URL be the resulting URL string.
auto url_string = url.to_string();
auto url_string = url.to_deprecated_string();
// 11. Otherwise, if parsing the URL failed, the user agent may report the
// error to the user in a user-agent-specific manner, may queue an element
@ -519,7 +519,7 @@ void HTMLHyperlinkElementUtils::follow_the_hyperlink(Optional<DeprecatedString>
url_builder.append(url_string);
url_builder.append(*hyperlink_suffix);
url_string = url_builder.to_string();
url_string = url_builder.to_deprecated_string();
}
// FIXME: 13. Let request be a new request whose URL is URL and whose

View file

@ -352,7 +352,7 @@ Optional<DeprecatedString> HTMLInputElement::placeholder_value() const
if (ch != '\r' && ch != '\n')
builder.append(ch);
}
placeholder = builder.to_string();
placeholder = builder.to_deprecated_string();
}
return placeholder;
@ -477,7 +477,7 @@ DeprecatedString HTMLInputElement::value_sanitization_algorithm(DeprecatedString
if (!(c == '\r' || c == '\n'))
builder.append(c);
}
return builder.to_string();
return builder.to_deprecated_string();
}
} else if (type_state() == HTMLInputElement::TypeAttributeState::URL) {
// Strip newlines from the value, then strip leading and trailing ASCII whitespace from the value.

View file

@ -36,7 +36,7 @@ void HTMLObjectElement::parse_attribute(FlyString const& name, DeprecatedString
DeprecatedString HTMLObjectElement::data() const
{
auto data = attribute(HTML::AttributeNames::data);
return document().parse_url(data).to_string();
return document().parse_url(data).to_deprecated_string();
}
JS::GCPtr<Layout::Node> HTMLObjectElement::create_layout_node(NonnullRefPtr<CSS::StyleProperties> style)

View file

@ -361,7 +361,7 @@ void HTMLScriptElement::prepare_script()
if (m_script_type == ScriptType::Classic) {
// 1. Let script be the result of creating a classic script using source text, settings object, base URL, and options.
// FIXME: Pass options.
auto script = ClassicScript::create(m_document->url().to_string(), source_text, settings_object, base_url, m_source_line_number);
auto script = ClassicScript::create(m_document->url().to_deprecated_string(), source_text, settings_object, base_url, m_source_line_number);
// 2. Mark as ready el given script.
mark_as_ready(Result(move(script)));
@ -373,7 +373,7 @@ void HTMLScriptElement::prepare_script()
// 2. Fetch an inline module script graph, given source text, base URL, settings object, options, and with the following steps given result:
// FIXME: Pass options
fetch_inline_module_script_graph(m_document->url().to_string(), source_text, base_url, document().relevant_settings_object(), [this](auto const* result) {
fetch_inline_module_script_graph(m_document->url().to_deprecated_string(), source_text, base_url, document().relevant_settings_object(), [this](auto const* result) {
// 1. Mark as ready el given result.
if (!result)
mark_as_ready(ResultState::Null {});
@ -510,7 +510,7 @@ void HTMLScriptElement::resource_did_load()
}
}
auto script = ClassicScript::create(resource()->url().to_string(), data, document().relevant_settings_object(), AK::URL());
auto script = ClassicScript::create(resource()->url().to_deprecated_string(), data, document().relevant_settings_object(), AK::URL());
// When the chosen algorithm asynchronously completes, set the script's script to the result. At that time, the script is ready.
mark_as_ready(Result(script));

View file

@ -89,7 +89,7 @@ public:
result.append(DeprecatedString::number(port()));
}
// 6. Return result
return result.to_string();
return result.to_deprecated_string();
}
// https://html.spec.whatwg.org/multipage/origin.html#concept-origin-effective-domain

View file

@ -109,7 +109,7 @@ JS::GCPtr<DOM::Attr> prescan_get_attribute(DOM::Document& document, ByteBuffer c
} else if (input[position] == '\t' || input[position] == '\n' || input[position] == '\f' || input[position] == '\r' || input[position] == ' ')
goto spaces;
else if (input[position] == '/' || input[position] == '>')
return *DOM::Attr::create(document, attribute_name.to_string(), "");
return *DOM::Attr::create(document, attribute_name.to_deprecated_string(), "");
else
attribute_name.append_as_lowercase(input[position]);
++position;
@ -121,7 +121,7 @@ spaces:
if (!prescan_skip_whitespace_and_slashes(input, position))
return {};
if (input[position] != '=')
return DOM::Attr::create(document, attribute_name.to_string(), "");
return DOM::Attr::create(document, attribute_name.to_deprecated_string(), "");
++position;
value:
@ -134,13 +134,13 @@ value:
++position;
for (; !prescan_should_abort(input, position); ++position) {
if (input[position] == quote_character)
return DOM::Attr::create(document, attribute_name.to_string(), attribute_value.to_string());
return DOM::Attr::create(document, attribute_name.to_deprecated_string(), attribute_value.to_deprecated_string());
else
attribute_value.append_as_lowercase(input[position]);
}
return {};
} else if (input[position] == '>')
return DOM::Attr::create(document, attribute_name.to_string(), "");
return DOM::Attr::create(document, attribute_name.to_deprecated_string(), "");
else
attribute_value.append_as_lowercase(input[position]);
@ -150,7 +150,7 @@ value:
for (; !prescan_should_abort(input, position); ++position) {
if (input[position] == '\t' || input[position] == '\n' || input[position] == '\f' || input[position] == '\r' || input[position] == ' ' || input[position] == '>')
return DOM::Attr::create(document, attribute_name.to_string(), attribute_value.to_string());
return DOM::Attr::create(document, attribute_name.to_deprecated_string(), attribute_value.to_deprecated_string());
else
attribute_value.append_as_lowercase(input[position]);
}

View file

@ -170,7 +170,7 @@ void HTMLParser::run()
break;
auto& token = optional_token.value();
dbgln_if(HTML_PARSER_DEBUG, "[{}] {}", insertion_mode_name(), token.to_string());
dbgln_if(HTML_PARSER_DEBUG, "[{}] {}", insertion_mode_name(), token.to_deprecated_string());
// https://html.spec.whatwg.org/multipage/parsing.html#tree-construction-dispatcher
// As each token is emitted from the tokenizer, the user agent must follow the appropriate steps from the following list, known as the tree construction dispatcher:
@ -954,7 +954,7 @@ void HTMLParser::flush_character_insertions()
{
if (m_character_insertion_builder.is_empty())
return;
m_character_insertion_node->set_data(m_character_insertion_builder.to_string());
m_character_insertion_node->set_data(m_character_insertion_builder.to_deprecated_string());
m_character_insertion_node->parent()->children_changed();
m_character_insertion_builder.clear();
}
@ -3604,7 +3604,7 @@ DeprecatedString HTMLParser::serialize_html_fragment(DOM::Node const& node)
else
builder.append(ch);
}
return builder.to_string();
return builder.to_deprecated_string();
};
// 2. Let s be a string, and initialize it to the empty string.
@ -3752,7 +3752,7 @@ DeprecatedString HTMLParser::serialize_html_fragment(DOM::Node const& node)
});
// 5. Return s.
return builder.to_string();
return builder.to_deprecated_string();
}
// https://html.spec.whatwg.org/multipage/common-microsyntaxes.html#current-dimension-value

View file

@ -8,7 +8,7 @@
namespace Web::HTML {
DeprecatedString HTMLToken::to_string() const
DeprecatedString HTMLToken::to_deprecated_string() const
{
StringBuilder builder;
@ -70,7 +70,7 @@ DeprecatedString HTMLToken::to_string() const
builder.appendff("@{}:{}-{}:{}", m_start_position.line, m_start_position.column, m_end_position.line, m_end_position.column);
}
return builder.to_string();
return builder.to_deprecated_string();
}
}

View file

@ -315,7 +315,7 @@ public:
Type type() const { return m_type; }
DeprecatedString to_string() const;
DeprecatedString to_deprecated_string() const;
Position const& start_position() const { return m_start_position; }
Position const& end_position() const { return m_end_position; }

View file

@ -2887,7 +2887,7 @@ void HTMLTokenizer::restore_to(Utf8CodePointIterator const& new_iterator)
DeprecatedString HTMLTokenizer::consume_current_builder()
{
auto string = m_current_builder.to_string();
auto string = m_current_builder.to_deprecated_string();
m_current_builder.clear();
return string;
}

View file

@ -53,7 +53,7 @@ JS::NonnullGCPtr<ClassicScript> ClassicScript::create(DeprecatedString filename,
// 11. If result is a list of errors, then:
if (result.is_error()) {
auto& parse_error = result.error().first();
dbgln_if(HTML_SCRIPT_DEBUG, "ClassicScript: Failed to parse: {}", parse_error.to_string());
dbgln_if(HTML_SCRIPT_DEBUG, "ClassicScript: Failed to parse: {}", parse_error.to_deprecated_string());
// FIXME: 1. Set script's parse error and its error to rethrow to result[0].
// We do not have parse error as it would currently go unused.
@ -90,7 +90,7 @@ JS::Completion ClassicScript::run(RethrowErrors rethrow_errors)
// 5. If script's error to rethrow is not null, then set evaluationStatus to Completion { [[Type]]: throw, [[Value]]: script's error to rethrow, [[Target]]: empty }.
if (m_error_to_rethrow.has_value()) {
evaluation_status = vm.throw_completion<JS::SyntaxError>(m_error_to_rethrow.value().to_string());
evaluation_status = vm.throw_completion<JS::SyntaxError>(m_error_to_rethrow.value().to_deprecated_string());
} else {
auto timer = Core::ElapsedTimer::start_new();

View file

@ -74,7 +74,7 @@ template<>
struct Traits<Web::HTML::ModuleLocationTuple> : public GenericTraits<Web::HTML::ModuleLocationTuple> {
static unsigned hash(Web::HTML::ModuleLocationTuple const& tuple)
{
return pair_int_hash(tuple.url().to_string().hash(), tuple.type().hash());
return pair_int_hash(tuple.url().to_deprecated_string().hash(), tuple.type().hash());
}
};

View file

@ -57,7 +57,7 @@ JS::GCPtr<JavaScriptModuleScript> JavaScriptModuleScript::create(DeprecatedStrin
// 8. If result is a list of errors, then:
if (result.is_error()) {
auto& parse_error = result.error().first();
dbgln("JavaScriptModuleScript: Failed to parse: {}", parse_error.to_string());
dbgln("JavaScriptModuleScript: Failed to parse: {}", parse_error.to_deprecated_string());
// FIXME: 1. Set script's parse error to result[0].

View file

@ -71,7 +71,7 @@ void SyntaxHighlighter::rehighlight(Palette const& palette)
auto token = tokenizer.next_token();
if (!token.has_value() || token.value().is_end_of_file())
break;
dbgln_if(SYNTAX_HIGHLIGHTING_DEBUG, "(HTML::SyntaxHighlighter) got token of type {}", token->to_string());
dbgln_if(SYNTAX_HIGHLIGHTING_DEBUG, "(HTML::SyntaxHighlighter) got token of type {}", token->to_deprecated_string());
if (token->is_start_tag()) {
if (token->tag_name() == "script"sv) {

View file

@ -247,7 +247,7 @@ void Worker::run_a_worker(AK::URL& url, EnvironmentSettingsObject& outside_setti
// Asynchronously complete the perform the fetch steps with response.
dbgln_if(WEB_WORKER_DEBUG, "WebWorker: Script ready!");
auto script = ClassicScript::create(url.to_string(), data, *m_inner_settings, AK::URL());
auto script = ClassicScript::create(url.to_deprecated_string(), data, *m_inner_settings, AK::URL());
// NOTE: Steps 15-31 below pick up after step 14 in the main context, steps 1-10 above
// are only for validation when used in a top-level case (ie: from a Window)

Some files were not shown because too many files have changed in this diff Show more