mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 19:07:35 +00:00
AK: Rename adopt() to adopt_ref()
This makes it more symmetrical with adopt_own() (which is used to create a NonnullOwnPtr from the result of a naked new.)
This commit is contained in:
parent
b3db01e20e
commit
b91c49364d
228 changed files with 461 additions and 461 deletions
|
@ -27,7 +27,7 @@ class CanvasRenderingContext2D
|
|||
public:
|
||||
using WrapperType = Bindings::CanvasRenderingContext2DWrapper;
|
||||
|
||||
static NonnullRefPtr<CanvasRenderingContext2D> create(HTMLCanvasElement& element) { return adopt(*new CanvasRenderingContext2D(element)); }
|
||||
static NonnullRefPtr<CanvasRenderingContext2D> create(HTMLCanvasElement& element) { return adopt_ref(*new CanvasRenderingContext2D(element)); }
|
||||
~CanvasRenderingContext2D();
|
||||
|
||||
void set_fill_style(String);
|
||||
|
|
|
@ -39,7 +39,7 @@ void GlobalEventHandlers::set_event_handler_attribute(const FlyString& name, HTM
|
|||
|
||||
RefPtr<DOM::EventListener> listener;
|
||||
if (!value.callback.is_null()) {
|
||||
listener = adopt(*new DOM::EventListener(move(value.callback)));
|
||||
listener = adopt_ref(*new DOM::EventListener(move(value.callback)));
|
||||
} else {
|
||||
StringBuilder builder;
|
||||
builder.appendff("function {}(event) {{\n{}\n}}", name, value.string);
|
||||
|
@ -51,7 +51,7 @@ void GlobalEventHandlers::set_event_handler_attribute(const FlyString& name, HTM
|
|||
}
|
||||
auto* function = JS::ScriptFunction::create(self.script_execution_context()->interpreter().global_object(), name, program->body(), program->parameters(), program->function_length(), nullptr, false, false);
|
||||
VERIFY(function);
|
||||
listener = adopt(*new DOM::EventListener(JS::make_handle(static_cast<JS::Function*>(function))));
|
||||
listener = adopt_ref(*new DOM::EventListener(JS::make_handle(static_cast<JS::Function*>(function))));
|
||||
}
|
||||
if (listener) {
|
||||
for (auto& registered_listener : self.listeners()) {
|
||||
|
|
|
@ -20,7 +20,7 @@ HTMLBRElement::~HTMLBRElement()
|
|||
|
||||
RefPtr<Layout::Node> HTMLBRElement::create_layout_node()
|
||||
{
|
||||
return adopt(*new Layout::BreakNode(document(), *this));
|
||||
return adopt_ref(*new Layout::BreakNode(document(), *this));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -42,7 +42,7 @@ RefPtr<Layout::Node> HTMLCanvasElement::create_layout_node()
|
|||
auto style = document().style_resolver().resolve_style(*this);
|
||||
if (style->display() == CSS::Display::None)
|
||||
return nullptr;
|
||||
return adopt(*new Layout::CanvasBox(document(), *this, move(style)));
|
||||
return adopt_ref(*new Layout::CanvasBox(document(), *this, move(style)));
|
||||
}
|
||||
|
||||
CanvasRenderingContext2D* HTMLCanvasElement::get_context(String type)
|
||||
|
|
|
@ -24,7 +24,7 @@ HTMLIFrameElement::~HTMLIFrameElement()
|
|||
RefPtr<Layout::Node> HTMLIFrameElement::create_layout_node()
|
||||
{
|
||||
auto style = document().style_resolver().resolve_style(*this);
|
||||
return adopt(*new Layout::FrameBox(document(), *this, move(style)));
|
||||
return adopt_ref(*new Layout::FrameBox(document(), *this, move(style)));
|
||||
}
|
||||
|
||||
void HTMLIFrameElement::parse_attribute(const FlyString& name, const String& value)
|
||||
|
|
|
@ -69,7 +69,7 @@ RefPtr<Layout::Node> HTMLImageElement::create_layout_node()
|
|||
auto style = document().style_resolver().resolve_style(*this);
|
||||
if (style->display() == CSS::Display::None)
|
||||
return nullptr;
|
||||
return adopt(*new Layout::ImageBox(document(), *this, move(style), m_image_loader));
|
||||
return adopt_ref(*new Layout::ImageBox(document(), *this, move(style), m_image_loader));
|
||||
}
|
||||
|
||||
const Gfx::Bitmap* HTMLImageElement::bitmap() const
|
||||
|
|
|
@ -53,16 +53,16 @@ RefPtr<Layout::Node> HTMLInputElement::create_layout_node()
|
|||
return nullptr;
|
||||
|
||||
if (type().equals_ignoring_case("submit") || type().equals_ignoring_case("button"))
|
||||
return adopt(*new Layout::ButtonBox(document(), *this, move(style)));
|
||||
return adopt_ref(*new Layout::ButtonBox(document(), *this, move(style)));
|
||||
|
||||
if (type() == "checkbox")
|
||||
return adopt(*new Layout::CheckBox(document(), *this, move(style)));
|
||||
return adopt_ref(*new Layout::CheckBox(document(), *this, move(style)));
|
||||
|
||||
if (type() == "radio")
|
||||
return adopt(*new Layout::RadioButton(document(), *this, move(style)));
|
||||
return adopt_ref(*new Layout::RadioButton(document(), *this, move(style)));
|
||||
|
||||
create_shadow_tree_if_needed();
|
||||
auto layout_node = adopt(*new Layout::BlockBox(document(), this, move(style)));
|
||||
auto layout_node = adopt_ref(*new Layout::BlockBox(document(), this, move(style)));
|
||||
layout_node->set_inline(true);
|
||||
return layout_node;
|
||||
}
|
||||
|
@ -105,13 +105,13 @@ void HTMLInputElement::create_shadow_tree_if_needed()
|
|||
return;
|
||||
|
||||
// FIXME: This assumes that we want a text box. Is that always true?
|
||||
auto shadow_root = adopt(*new DOM::ShadowRoot(document(), *this));
|
||||
auto shadow_root = adopt_ref(*new DOM::ShadowRoot(document(), *this));
|
||||
auto initial_value = attribute(HTML::AttributeNames::value);
|
||||
if (initial_value.is_null())
|
||||
initial_value = String::empty();
|
||||
auto element = document().create_element(HTML::TagNames::div);
|
||||
element->set_attribute(HTML::AttributeNames::style, "white-space: pre");
|
||||
m_text_node = adopt(*new DOM::Text(document(), initial_value));
|
||||
m_text_node = adopt_ref(*new DOM::Text(document(), initial_value));
|
||||
m_text_node->set_always_editable(true);
|
||||
element->append_child(*m_text_node);
|
||||
shadow_root->append_child(move(element));
|
||||
|
|
|
@ -25,7 +25,7 @@ RefPtr<Layout::Node> HTMLLabelElement::create_layout_node()
|
|||
if (style->display() == CSS::Display::None)
|
||||
return nullptr;
|
||||
|
||||
auto layout_node = adopt(*new Layout::Label(document(), this, move(style)));
|
||||
auto layout_node = adopt_ref(*new Layout::Label(document(), this, move(style)));
|
||||
layout_node->set_inline(true);
|
||||
return layout_node;
|
||||
}
|
||||
|
|
|
@ -50,7 +50,7 @@ RefPtr<Layout::Node> HTMLObjectElement::create_layout_node()
|
|||
if (style->display() == CSS::Display::None)
|
||||
return nullptr;
|
||||
if (m_image_loader.has_image())
|
||||
return adopt(*new Layout::ImageBox(document(), *this, move(style), m_image_loader));
|
||||
return adopt_ref(*new Layout::ImageBox(document(), *this, move(style), m_image_loader));
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
|
|
|
@ -12,7 +12,7 @@ namespace Web::HTML {
|
|||
HTMLTemplateElement::HTMLTemplateElement(DOM::Document& document, QualifiedName qualified_name)
|
||||
: HTMLElement(document, move(qualified_name))
|
||||
{
|
||||
m_content = adopt(*new DOM::DocumentFragment(appropriate_template_contents_owner_document(document)));
|
||||
m_content = adopt_ref(*new DOM::DocumentFragment(appropriate_template_contents_owner_document(document)));
|
||||
m_content->set_host(*this);
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,7 @@ RefPtr<ImageData> ImageData::create_with_size(JS::GlobalObject& global_object, i
|
|||
auto bitmap = Gfx::Bitmap::create_wrapper(Gfx::BitmapFormat::RGBA8888, Gfx::IntSize(width, height), 1, width * sizeof(u32), (u32*)data->data());
|
||||
if (!bitmap)
|
||||
return nullptr;
|
||||
return adopt(*new ImageData(bitmap.release_nonnull(), move(data_handle)));
|
||||
return adopt_ref(*new ImageData(bitmap.release_nonnull(), move(data_handle)));
|
||||
}
|
||||
|
||||
ImageData::ImageData(NonnullRefPtr<Gfx::Bitmap> bitmap, JS::Handle<JS::Uint8ClampedArray> data)
|
||||
|
|
|
@ -313,13 +313,13 @@ void HTMLDocumentParser::handle_initial(HTMLToken& token)
|
|||
}
|
||||
|
||||
if (token.is_comment()) {
|
||||
auto comment = adopt(*new DOM::Comment(document(), token.m_comment_or_character.data.to_string()));
|
||||
auto comment = adopt_ref(*new DOM::Comment(document(), token.m_comment_or_character.data.to_string()));
|
||||
document().append_child(move(comment));
|
||||
return;
|
||||
}
|
||||
|
||||
if (token.is_doctype()) {
|
||||
auto doctype = adopt(*new DOM::DocumentType(document()));
|
||||
auto doctype = adopt_ref(*new DOM::DocumentType(document()));
|
||||
doctype->set_name(token.m_doctype.name.to_string());
|
||||
doctype->set_public_id(token.m_doctype.public_identifier.to_string());
|
||||
doctype->set_system_id(token.m_doctype.system_identifier.to_string());
|
||||
|
@ -343,7 +343,7 @@ void HTMLDocumentParser::handle_before_html(HTMLToken& token)
|
|||
}
|
||||
|
||||
if (token.is_comment()) {
|
||||
auto comment = adopt(*new DOM::Comment(document(), token.m_comment_or_character.data.to_string()));
|
||||
auto comment = adopt_ref(*new DOM::Comment(document(), token.m_comment_or_character.data.to_string()));
|
||||
document().append_child(move(comment));
|
||||
return;
|
||||
}
|
||||
|
@ -518,7 +518,7 @@ void HTMLDocumentParser::insert_comment(HTMLToken& token)
|
|||
{
|
||||
auto data = token.m_comment_or_character.data.to_string();
|
||||
auto adjusted_insertion_location = find_appropriate_place_for_inserting_node();
|
||||
adjusted_insertion_location.parent->insert_before(adopt(*new DOM::Comment(document(), data)), adjusted_insertion_location.insert_before_sibling);
|
||||
adjusted_insertion_location.parent->insert_before(adopt_ref(*new DOM::Comment(document(), data)), adjusted_insertion_location.insert_before_sibling);
|
||||
}
|
||||
|
||||
void HTMLDocumentParser::handle_in_head(HTMLToken& token)
|
||||
|
@ -703,7 +703,7 @@ DOM::Text* HTMLDocumentParser::find_character_insertion_node()
|
|||
return nullptr;
|
||||
if (adjusted_insertion_location.parent->last_child() && adjusted_insertion_location.parent->last_child()->is_text())
|
||||
return downcast<DOM::Text>(adjusted_insertion_location.parent->last_child());
|
||||
auto new_text_node = adopt(*new DOM::Text(document(), ""));
|
||||
auto new_text_node = adopt_ref(*new DOM::Text(document(), ""));
|
||||
adjusted_insertion_location.parent->append_child(new_text_node);
|
||||
return new_text_node;
|
||||
}
|
||||
|
@ -830,7 +830,7 @@ void HTMLDocumentParser::handle_after_body(HTMLToken& token)
|
|||
if (token.is_comment()) {
|
||||
auto data = token.m_comment_or_character.data.to_string();
|
||||
auto& insertion_location = m_stack_of_open_elements.first();
|
||||
insertion_location.append_child(adopt(*new DOM::Comment(document(), data)));
|
||||
insertion_location.append_child(adopt_ref(*new DOM::Comment(document(), data)));
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -866,7 +866,7 @@ void HTMLDocumentParser::handle_after_body(HTMLToken& token)
|
|||
void HTMLDocumentParser::handle_after_after_body(HTMLToken& token)
|
||||
{
|
||||
if (token.is_comment()) {
|
||||
auto comment = adopt(*new DOM::Comment(document(), token.m_comment_or_character.data.to_string()));
|
||||
auto comment = adopt_ref(*new DOM::Comment(document(), token.m_comment_or_character.data.to_string()));
|
||||
document().append_child(move(comment));
|
||||
return;
|
||||
}
|
||||
|
@ -2748,7 +2748,7 @@ void HTMLDocumentParser::handle_after_frameset(HTMLToken& token)
|
|||
void HTMLDocumentParser::handle_after_after_frameset(HTMLToken& token)
|
||||
{
|
||||
if (token.is_comment()) {
|
||||
auto comment = adopt(*new DOM::Comment(document(), token.m_comment_or_character.data.to_string()));
|
||||
auto comment = adopt_ref(*new DOM::Comment(document(), token.m_comment_or_character.data.to_string()));
|
||||
document().append_child(move(comment));
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -11,7 +11,7 @@ namespace Web::HTML {
|
|||
|
||||
NonnullRefPtr<SubmitEvent> SubmitEvent::create(const FlyString& event_name, RefPtr<HTMLElement> submitter)
|
||||
{
|
||||
return adopt(*new SubmitEvent(event_name, move(submitter)));
|
||||
return adopt_ref(*new SubmitEvent(event_name, move(submitter)));
|
||||
}
|
||||
|
||||
SubmitEvent::SubmitEvent(const FlyString& event_name, RefPtr<HTMLElement> submitter)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue