1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-27 21:57:35 +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

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