mirror of
https://github.com/RGBCube/serenity
synced 2025-07-25 17:17:44 +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
|
@ -98,13 +98,13 @@ public:
|
|||
|
||||
static NonnullRefPtr<DOMException> create(const FlyString& name, const FlyString& message)
|
||||
{
|
||||
return adopt(*new DOMException(name, message));
|
||||
return adopt_ref(*new DOMException(name, message));
|
||||
}
|
||||
|
||||
// JS constructor has message first, name second
|
||||
static NonnullRefPtr<DOMException> create_with_global_object(Bindings::WindowObject&, const FlyString& message, const FlyString& name)
|
||||
{
|
||||
return adopt(*new DOMException(name, message));
|
||||
return adopt_ref(*new DOMException(name, message));
|
||||
}
|
||||
|
||||
const FlyString& name() const { return m_name; }
|
||||
|
|
|
@ -26,7 +26,7 @@ const NonnullRefPtr<Document> DOMImplementation::create_html_document(const Stri
|
|||
html_document->set_content_type("text/html");
|
||||
html_document->set_ready_for_post_load_tasks(true);
|
||||
|
||||
auto doctype = adopt(*new DocumentType(html_document));
|
||||
auto doctype = adopt_ref(*new DocumentType(html_document));
|
||||
doctype->set_name("html");
|
||||
html_document->append_child(doctype);
|
||||
|
||||
|
@ -40,7 +40,7 @@ const NonnullRefPtr<Document> DOMImplementation::create_html_document(const Stri
|
|||
auto title_element = create_element(html_document, HTML::TagNames::title, Namespace::HTML);
|
||||
head_element->append_child(title_element);
|
||||
|
||||
auto text_node = adopt(*new Text(html_document, title));
|
||||
auto text_node = adopt_ref(*new Text(html_document, title));
|
||||
title_element->append_child(text_node);
|
||||
}
|
||||
|
||||
|
|
|
@ -22,7 +22,7 @@ public:
|
|||
|
||||
static NonnullRefPtr<DOMImplementation> create(Document& document)
|
||||
{
|
||||
return adopt(*new DOMImplementation(document));
|
||||
return adopt_ref(*new DOMImplementation(document));
|
||||
}
|
||||
|
||||
const NonnullRefPtr<Document> create_html_document(const String& title) const;
|
||||
|
|
|
@ -269,7 +269,7 @@ void Document::set_title(const String& title)
|
|||
}
|
||||
|
||||
title_element->remove_all_children(true);
|
||||
title_element->append_child(adopt(*new Text(*this, title)));
|
||||
title_element->append_child(adopt_ref(*new Text(*this, title)));
|
||||
|
||||
if (auto* page = this->page()) {
|
||||
if (frame() == &page->main_frame())
|
||||
|
@ -433,7 +433,7 @@ void Document::update_style()
|
|||
|
||||
RefPtr<Layout::Node> Document::create_layout_node()
|
||||
{
|
||||
return adopt(*new Layout::InitialContainingBlockBox(*this, CSS::StyleProperties::create()));
|
||||
return adopt_ref(*new Layout::InitialContainingBlockBox(*this, CSS::StyleProperties::create()));
|
||||
}
|
||||
|
||||
void Document::set_link_color(Color color)
|
||||
|
@ -598,17 +598,17 @@ NonnullRefPtr<Element> Document::create_element_ns(const String& namespace_, con
|
|||
|
||||
NonnullRefPtr<DocumentFragment> Document::create_document_fragment()
|
||||
{
|
||||
return adopt(*new DocumentFragment(*this));
|
||||
return adopt_ref(*new DocumentFragment(*this));
|
||||
}
|
||||
|
||||
NonnullRefPtr<Text> Document::create_text_node(const String& data)
|
||||
{
|
||||
return adopt(*new Text(*this, data));
|
||||
return adopt_ref(*new Text(*this, data));
|
||||
}
|
||||
|
||||
NonnullRefPtr<Comment> Document::create_comment(const String& data)
|
||||
{
|
||||
return adopt(*new Comment(*this, data));
|
||||
return adopt_ref(*new Comment(*this, data));
|
||||
}
|
||||
|
||||
NonnullRefPtr<Range> Document::create_range()
|
||||
|
@ -732,10 +732,10 @@ void Document::adopt_node(Node& node)
|
|||
ExceptionOr<NonnullRefPtr<Node>> Document::adopt_node_binding(NonnullRefPtr<Node> node)
|
||||
{
|
||||
if (is<Document>(*node))
|
||||
return DOM ::NotSupportedError::create("Cannot adopt a document into a document");
|
||||
return DOM ::NotSupportedError::create("Cannot adopt_ref a document into a document");
|
||||
|
||||
if (is<ShadowRoot>(*node))
|
||||
return DOM::HierarchyRequestError::create("Cannot adopt a shadow root into a document");
|
||||
return DOM::HierarchyRequestError::create("Cannot adopt_ref a shadow root into a document");
|
||||
|
||||
if (is<DocumentFragment>(*node) && downcast<DocumentFragment>(*node).host())
|
||||
return node;
|
||||
|
|
|
@ -45,7 +45,7 @@ public:
|
|||
|
||||
static NonnullRefPtr<Document> create(const URL& url = "about:blank")
|
||||
{
|
||||
return adopt(*new Document(url));
|
||||
return adopt_ref(*new Document(url));
|
||||
}
|
||||
static NonnullRefPtr<Document> create_with_global_object(Bindings::WindowObject&)
|
||||
{
|
||||
|
|
|
@ -115,35 +115,35 @@ RefPtr<Layout::Node> Element::create_layout_node()
|
|||
VERIFY_NOT_REACHED();
|
||||
break;
|
||||
case CSS::Display::Block:
|
||||
return adopt(*new Layout::BlockBox(document(), this, move(style)));
|
||||
return adopt_ref(*new Layout::BlockBox(document(), this, move(style)));
|
||||
case CSS::Display::Inline:
|
||||
if (style->float_().value_or(CSS::Float::None) != CSS::Float::None)
|
||||
return adopt(*new Layout::BlockBox(document(), this, move(style)));
|
||||
return adopt(*new Layout::InlineNode(document(), *this, move(style)));
|
||||
return adopt_ref(*new Layout::BlockBox(document(), this, move(style)));
|
||||
return adopt_ref(*new Layout::InlineNode(document(), *this, move(style)));
|
||||
case CSS::Display::ListItem:
|
||||
return adopt(*new Layout::ListItemBox(document(), *this, move(style)));
|
||||
return adopt_ref(*new Layout::ListItemBox(document(), *this, move(style)));
|
||||
case CSS::Display::Table:
|
||||
return adopt(*new Layout::TableBox(document(), this, move(style)));
|
||||
return adopt_ref(*new Layout::TableBox(document(), this, move(style)));
|
||||
case CSS::Display::TableRow:
|
||||
return adopt(*new Layout::TableRowBox(document(), this, move(style)));
|
||||
return adopt_ref(*new Layout::TableRowBox(document(), this, move(style)));
|
||||
case CSS::Display::TableCell:
|
||||
return adopt(*new Layout::TableCellBox(document(), this, move(style)));
|
||||
return adopt_ref(*new Layout::TableCellBox(document(), this, move(style)));
|
||||
case CSS::Display::TableRowGroup:
|
||||
case CSS::Display::TableHeaderGroup:
|
||||
case CSS::Display::TableFooterGroup:
|
||||
return adopt(*new Layout::TableRowGroupBox(document(), *this, move(style)));
|
||||
return adopt_ref(*new Layout::TableRowGroupBox(document(), *this, move(style)));
|
||||
case CSS::Display::InlineBlock: {
|
||||
auto inline_block = adopt(*new Layout::BlockBox(document(), this, move(style)));
|
||||
auto inline_block = adopt_ref(*new Layout::BlockBox(document(), this, move(style)));
|
||||
inline_block->set_inline(true);
|
||||
return inline_block;
|
||||
}
|
||||
case CSS::Display::Flex:
|
||||
return adopt(*new Layout::BlockBox(document(), this, move(style)));
|
||||
return adopt_ref(*new Layout::BlockBox(document(), this, move(style)));
|
||||
case CSS::Display::TableColumn:
|
||||
case CSS::Display::TableColumnGroup:
|
||||
case CSS::Display::TableCaption:
|
||||
// FIXME: This is just an incorrect placeholder until we improve table layout support.
|
||||
return adopt(*new Layout::BlockBox(document(), this, move(style)));
|
||||
return adopt_ref(*new Layout::BlockBox(document(), this, move(style)));
|
||||
}
|
||||
VERIFY_NOT_REACHED();
|
||||
}
|
||||
|
|
|
@ -88,157 +88,157 @@ NonnullRefPtr<Element> create_element(Document& document, const FlyString& tag_n
|
|||
// FIXME: Add prefix when we support it.
|
||||
auto qualified_name = QualifiedName(tag_name, {}, namespace_);
|
||||
if (lowercase_tag_name == HTML::TagNames::a)
|
||||
return adopt(*new HTML::HTMLAnchorElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLAnchorElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::area)
|
||||
return adopt(*new HTML::HTMLAreaElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLAreaElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::audio)
|
||||
return adopt(*new HTML::HTMLAudioElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLAudioElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::base)
|
||||
return adopt(*new HTML::HTMLBaseElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLBaseElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::blink)
|
||||
return adopt(*new HTML::HTMLBlinkElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLBlinkElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::body)
|
||||
return adopt(*new HTML::HTMLBodyElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLBodyElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::br)
|
||||
return adopt(*new HTML::HTMLBRElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLBRElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::button)
|
||||
return adopt(*new HTML::HTMLButtonElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLButtonElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::canvas)
|
||||
return adopt(*new HTML::HTMLCanvasElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLCanvasElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::data)
|
||||
return adopt(*new HTML::HTMLDataElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLDataElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::datalist)
|
||||
return adopt(*new HTML::HTMLDataListElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLDataListElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::details)
|
||||
return adopt(*new HTML::HTMLDetailsElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLDetailsElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::dialog)
|
||||
return adopt(*new HTML::HTMLDialogElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLDialogElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::dir)
|
||||
return adopt(*new HTML::HTMLDirectoryElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLDirectoryElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::div)
|
||||
return adopt(*new HTML::HTMLDivElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLDivElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::dl)
|
||||
return adopt(*new HTML::HTMLDListElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLDListElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::embed)
|
||||
return adopt(*new HTML::HTMLEmbedElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLEmbedElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::fieldset)
|
||||
return adopt(*new HTML::HTMLFieldSetElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLFieldSetElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::font)
|
||||
return adopt(*new HTML::HTMLFontElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLFontElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::form)
|
||||
return adopt(*new HTML::HTMLFormElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLFormElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::frame)
|
||||
return adopt(*new HTML::HTMLFrameElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLFrameElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::frameset)
|
||||
return adopt(*new HTML::HTMLFrameSetElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLFrameSetElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::head)
|
||||
return adopt(*new HTML::HTMLHeadElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLHeadElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name.is_one_of(HTML::TagNames::h1, HTML::TagNames::h2, HTML::TagNames::h3, HTML::TagNames::h4, HTML::TagNames::h5, HTML::TagNames::h6))
|
||||
return adopt(*new HTML::HTMLHeadingElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLHeadingElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::hr)
|
||||
return adopt(*new HTML::HTMLHRElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLHRElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::html)
|
||||
return adopt(*new HTML::HTMLHtmlElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLHtmlElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::iframe)
|
||||
return adopt(*new HTML::HTMLIFrameElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLIFrameElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::img)
|
||||
return adopt(*new HTML::HTMLImageElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLImageElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::input)
|
||||
return adopt(*new HTML::HTMLInputElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLInputElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::label)
|
||||
return adopt(*new HTML::HTMLLabelElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLLabelElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::legend)
|
||||
return adopt(*new HTML::HTMLLegendElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLLegendElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::li)
|
||||
return adopt(*new HTML::HTMLLIElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLLIElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::link)
|
||||
return adopt(*new HTML::HTMLLinkElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLLinkElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::map)
|
||||
return adopt(*new HTML::HTMLMapElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLMapElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::marquee)
|
||||
return adopt(*new HTML::HTMLMarqueeElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLMarqueeElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::menu)
|
||||
return adopt(*new HTML::HTMLMenuElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLMenuElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::meta)
|
||||
return adopt(*new HTML::HTMLMetaElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLMetaElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::meter)
|
||||
return adopt(*new HTML::HTMLMeterElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLMeterElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name.is_one_of(HTML::TagNames::ins, HTML::TagNames::del))
|
||||
return adopt(*new HTML::HTMLModElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLModElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::object)
|
||||
return adopt(*new HTML::HTMLObjectElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLObjectElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::ol)
|
||||
return adopt(*new HTML::HTMLOListElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLOListElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::optgroup)
|
||||
return adopt(*new HTML::HTMLOptGroupElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLOptGroupElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::option)
|
||||
return adopt(*new HTML::HTMLOptionElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLOptionElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::output)
|
||||
return adopt(*new HTML::HTMLOutputElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLOutputElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::p)
|
||||
return adopt(*new HTML::HTMLParagraphElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLParagraphElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::param)
|
||||
return adopt(*new HTML::HTMLParamElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLParamElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::picture)
|
||||
return adopt(*new HTML::HTMLPictureElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLPictureElement(document, move(qualified_name)));
|
||||
// NOTE: The obsolete elements "listing" and "xmp" are explicitly mapped to HTMLPreElement in the specification.
|
||||
if (lowercase_tag_name.is_one_of(HTML::TagNames::pre, HTML::TagNames::listing, HTML::TagNames::xmp))
|
||||
return adopt(*new HTML::HTMLPreElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLPreElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::progress)
|
||||
return adopt(*new HTML::HTMLProgressElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLProgressElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name.is_one_of(HTML::TagNames::blockquote, HTML::TagNames::q))
|
||||
return adopt(*new HTML::HTMLQuoteElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLQuoteElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::script)
|
||||
return adopt(*new HTML::HTMLScriptElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLScriptElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::select)
|
||||
return adopt(*new HTML::HTMLSelectElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLSelectElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::slot)
|
||||
return adopt(*new HTML::HTMLSlotElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLSlotElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::source)
|
||||
return adopt(*new HTML::HTMLSourceElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLSourceElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::span)
|
||||
return adopt(*new HTML::HTMLSpanElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLSpanElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::style)
|
||||
return adopt(*new HTML::HTMLStyleElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLStyleElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::caption)
|
||||
return adopt(*new HTML::HTMLTableCaptionElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLTableCaptionElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name.is_one_of(Web::HTML::TagNames::td, Web::HTML::TagNames::th))
|
||||
return adopt(*new HTML::HTMLTableCellElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLTableCellElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name.is_one_of(HTML::TagNames::colgroup, HTML::TagNames::col))
|
||||
return adopt(*new HTML::HTMLTableColElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLTableColElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::table)
|
||||
return adopt(*new HTML::HTMLTableElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLTableElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::tr)
|
||||
return adopt(*new HTML::HTMLTableRowElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLTableRowElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name.is_one_of(HTML::TagNames::tbody, HTML::TagNames::thead, HTML::TagNames::tfoot))
|
||||
return adopt(*new HTML::HTMLTableSectionElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLTableSectionElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::template_)
|
||||
return adopt(*new HTML::HTMLTemplateElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLTemplateElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::textarea)
|
||||
return adopt(*new HTML::HTMLTextAreaElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLTextAreaElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::time)
|
||||
return adopt(*new HTML::HTMLTimeElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLTimeElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::title)
|
||||
return adopt(*new HTML::HTMLTitleElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLTitleElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::track)
|
||||
return adopt(*new HTML::HTMLTrackElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLTrackElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::ul)
|
||||
return adopt(*new HTML::HTMLUListElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLUListElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == HTML::TagNames::video)
|
||||
return adopt(*new HTML::HTMLVideoElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLVideoElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name.is_one_of(
|
||||
HTML::TagNames::article, HTML::TagNames::section, HTML::TagNames::nav, HTML::TagNames::aside, HTML::TagNames::hgroup, HTML::TagNames::header, HTML::TagNames::footer, HTML::TagNames::address, HTML::TagNames::dt, HTML::TagNames::dd, HTML::TagNames::figure, HTML::TagNames::figcaption, HTML::TagNames::main, HTML::TagNames::em, HTML::TagNames::strong, HTML::TagNames::small, HTML::TagNames::s, HTML::TagNames::cite, HTML::TagNames::dfn, HTML::TagNames::abbr, HTML::TagNames::ruby, HTML::TagNames::rt, HTML::TagNames::rp, HTML::TagNames::code, HTML::TagNames::var, HTML::TagNames::samp, HTML::TagNames::kbd, HTML::TagNames::sub, HTML::TagNames::sup, HTML::TagNames::i, HTML::TagNames::b, HTML::TagNames::u, HTML::TagNames::mark, HTML::TagNames::bdi, HTML::TagNames::bdo, HTML::TagNames::wbr, HTML::TagNames::summary, HTML::TagNames::noscript,
|
||||
// Obsolete
|
||||
HTML::TagNames::acronym, HTML::TagNames::basefont, HTML::TagNames::big, HTML::TagNames::center, HTML::TagNames::nobr, HTML::TagNames::noembed, HTML::TagNames::noframes, HTML::TagNames::plaintext, HTML::TagNames::rb, HTML::TagNames::rtc, HTML::TagNames::strike, HTML::TagNames::tt))
|
||||
return adopt(*new HTML::HTMLElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == SVG::TagNames::svg)
|
||||
return adopt(*new SVG::SVGSVGElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new SVG::SVGSVGElement(document, move(qualified_name)));
|
||||
if (lowercase_tag_name == SVG::TagNames::path)
|
||||
return adopt(*new SVG::SVGPathElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new SVG::SVGPathElement(document, move(qualified_name)));
|
||||
|
||||
// FIXME: If name is a valid custom element name, then return HTMLElement.
|
||||
|
||||
return adopt(*new HTML::HTMLUnknownElement(document, move(qualified_name)));
|
||||
return adopt_ref(*new HTML::HTMLUnknownElement(document, move(qualified_name)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -43,7 +43,7 @@ public:
|
|||
|
||||
static NonnullRefPtr<Event> create(const FlyString& event_name)
|
||||
{
|
||||
return adopt(*new Event(event_name));
|
||||
return adopt_ref(*new Event(event_name));
|
||||
}
|
||||
static NonnullRefPtr<Event> create_with_global_object(Bindings::WindowObject&, const FlyString& event_name)
|
||||
{
|
||||
|
|
|
@ -36,7 +36,7 @@ public:
|
|||
|
||||
static NonnullRefPtr<HTMLCollection> create(ParentNode& root, Function<bool(Element const&)> filter)
|
||||
{
|
||||
return adopt(*new HTMLCollection(root, move(filter)));
|
||||
return adopt_ref(*new HTMLCollection(root, move(filter)));
|
||||
}
|
||||
|
||||
~HTMLCollection();
|
||||
|
|
|
@ -354,7 +354,7 @@ NonnullRefPtr<Node> Node::clone_node(Document* document, bool clone_children) co
|
|||
if (is<Element>(this)) {
|
||||
auto& element = *downcast<Element>(this);
|
||||
auto qualified_name = QualifiedName(element.local_name(), element.prefix(), element.namespace_());
|
||||
auto element_copy = adopt(*new Element(*document, move(qualified_name)));
|
||||
auto element_copy = adopt_ref(*new Element(*document, move(qualified_name)));
|
||||
element.for_each_attribute([&](auto& name, auto& value) {
|
||||
element_copy->set_attribute(name, value);
|
||||
});
|
||||
|
@ -370,22 +370,22 @@ NonnullRefPtr<Node> Node::clone_node(Document* document, bool clone_children) co
|
|||
copy = move(document_copy);
|
||||
} else if (is<DocumentType>(this)) {
|
||||
auto document_type = downcast<DocumentType>(this);
|
||||
auto document_type_copy = adopt(*new DocumentType(*document));
|
||||
auto document_type_copy = adopt_ref(*new DocumentType(*document));
|
||||
document_type_copy->set_name(document_type->name());
|
||||
document_type_copy->set_public_id(document_type->public_id());
|
||||
document_type_copy->set_system_id(document_type->system_id());
|
||||
copy = move(document_type_copy);
|
||||
} else if (is<Text>(this)) {
|
||||
auto text = downcast<Text>(this);
|
||||
auto text_copy = adopt(*new Text(*document, text->data()));
|
||||
auto text_copy = adopt_ref(*new Text(*document, text->data()));
|
||||
copy = move(text_copy);
|
||||
} else if (is<Comment>(this)) {
|
||||
auto comment = downcast<Comment>(this);
|
||||
auto comment_copy = adopt(*new Comment(*document, comment->data()));
|
||||
auto comment_copy = adopt_ref(*new Comment(*document, comment->data()));
|
||||
copy = move(comment_copy);
|
||||
} else if (is<ProcessingInstruction>(this)) {
|
||||
auto processing_instruction = downcast<ProcessingInstruction>(this);
|
||||
auto processing_instruction_copy = adopt(*new ProcessingInstruction(*document, processing_instruction->data(), processing_instruction->target()));
|
||||
auto processing_instruction_copy = adopt_ref(*new ProcessingInstruction(*document, processing_instruction->data(), processing_instruction->target()));
|
||||
copy = move(processing_instruction_copy);
|
||||
} else {
|
||||
dbgln("clone_node() not implemented for NodeType {}", (u16)m_type);
|
||||
|
|
|
@ -18,12 +18,12 @@ NonnullRefPtr<Range> Range::create(Window& window)
|
|||
|
||||
NonnullRefPtr<Range> Range::create(Document& document)
|
||||
{
|
||||
return adopt(*new Range(document));
|
||||
return adopt_ref(*new Range(document));
|
||||
}
|
||||
|
||||
NonnullRefPtr<Range> Range::create(Node& start_container, size_t start_offset, Node& end_container, size_t end_offset)
|
||||
{
|
||||
return adopt(*new Range(start_container, start_offset, end_container, end_offset));
|
||||
return adopt_ref(*new Range(start_container, start_offset, end_container, end_offset));
|
||||
}
|
||||
NonnullRefPtr<Range> Range::create_with_global_object(Bindings::WindowObject& window)
|
||||
{
|
||||
|
@ -45,12 +45,12 @@ Range::Range(Node& start_container, size_t start_offset, Node& end_container, si
|
|||
|
||||
NonnullRefPtr<Range> Range::clone_range() const
|
||||
{
|
||||
return adopt(*new Range(const_cast<Node&>(*m_start_container), m_start_offset, const_cast<Node&>(*m_end_container), m_end_offset));
|
||||
return adopt_ref(*new Range(const_cast<Node&>(*m_start_container), m_start_offset, const_cast<Node&>(*m_end_container), m_end_offset));
|
||||
}
|
||||
|
||||
NonnullRefPtr<Range> Range::inverted() const
|
||||
{
|
||||
return adopt(*new Range(const_cast<Node&>(*m_end_container), m_end_offset, const_cast<Node&>(*m_start_container), m_start_offset));
|
||||
return adopt_ref(*new Range(const_cast<Node&>(*m_end_container), m_end_offset, const_cast<Node&>(*m_start_container), m_start_offset));
|
||||
}
|
||||
|
||||
NonnullRefPtr<Range> Range::normalized() const
|
||||
|
|
|
@ -29,7 +29,7 @@ EventTarget* ShadowRoot::get_parent(const Event& event)
|
|||
|
||||
RefPtr<Layout::Node> ShadowRoot::create_layout_node()
|
||||
{
|
||||
return adopt(*new Layout::BlockBox(document(), this, CSS::ComputedValues {}));
|
||||
return adopt_ref(*new Layout::BlockBox(document(), this, CSS::ComputedValues {}));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -20,7 +20,7 @@ Text::~Text()
|
|||
|
||||
RefPtr<Layout::Node> Text::create_layout_node()
|
||||
{
|
||||
return adopt(*new Layout::TextNode(document(), *this));
|
||||
return adopt_ref(*new Layout::TextNode(document(), *this));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -13,12 +13,12 @@ namespace Web::DOM {
|
|||
|
||||
NonnullRefPtr<Timer> Timer::create_interval(Window& window, int milliseconds, JS::Function& callback)
|
||||
{
|
||||
return adopt(*new Timer(window, Type::Interval, milliseconds, callback));
|
||||
return adopt_ref(*new Timer(window, Type::Interval, milliseconds, callback));
|
||||
}
|
||||
|
||||
NonnullRefPtr<Timer> Timer::create_timeout(Window& window, int milliseconds, JS::Function& callback)
|
||||
{
|
||||
return adopt(*new Timer(window, Type::Timeout, milliseconds, callback));
|
||||
return adopt_ref(*new Timer(window, Type::Timeout, milliseconds, callback));
|
||||
}
|
||||
|
||||
Timer::Timer(Window& window, Type type, int milliseconds, JS::Function& callback)
|
||||
|
|
|
@ -20,7 +20,7 @@ namespace Web::DOM {
|
|||
|
||||
NonnullRefPtr<Window> Window::create_with_document(Document& document)
|
||||
{
|
||||
return adopt(*new Window(document));
|
||||
return adopt_ref(*new Window(document));
|
||||
}
|
||||
|
||||
Window::Window(Document& document)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue