mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-23 21:01:08 +00:00
Bug 1377999 - Make HTML Element to adapt the DOMArena changes r=smaug
Differential Revision: https://phabricator.services.mozilla.com/D57699 --HG-- extra : moz-landing-system : lando
This commit is contained in:
parent
053f3e648d
commit
2d1f2db82e
@ -23,8 +23,10 @@
|
||||
nsGenericHTMLElement* NS_NewHTMLAudioElement(
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser) {
|
||||
RefPtr<mozilla::dom::NodeInfo> nodeInfo(aNodeInfo);
|
||||
auto* nim = nodeInfo->NodeInfoManager();
|
||||
mozilla::dom::HTMLAudioElement* element =
|
||||
new mozilla::dom::HTMLAudioElement(std::move(aNodeInfo));
|
||||
new (nim) mozilla::dom::HTMLAudioElement(nodeInfo.forget());
|
||||
element->Init();
|
||||
return element;
|
||||
}
|
||||
@ -36,7 +38,8 @@ nsresult HTMLAudioElement::Clone(mozilla::dom::NodeInfo* aNodeInfo,
|
||||
nsINode** aResult) const {
|
||||
*aResult = nullptr;
|
||||
RefPtr<mozilla::dom::NodeInfo> ni(aNodeInfo);
|
||||
HTMLAudioElement* it = new HTMLAudioElement(ni.forget());
|
||||
auto* nim = ni->NodeInfoManager();
|
||||
HTMLAudioElement* it = new (nim) HTMLAudioElement(ni.forget());
|
||||
it->Init();
|
||||
nsCOMPtr<nsINode> kungFuDeathGrip = it;
|
||||
nsresult rv = const_cast<HTMLAudioElement*>(this)->CopyInnerTo(it);
|
||||
|
@ -13,11 +13,13 @@
|
||||
nsGenericHTMLElement* NS_NewHTMLDialogElement(
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser) {
|
||||
RefPtr<mozilla::dom::NodeInfo> nodeInfo(aNodeInfo);
|
||||
auto* nim = nodeInfo->NodeInfoManager();
|
||||
if (!mozilla::dom::HTMLDialogElement::IsDialogEnabled()) {
|
||||
return new mozilla::dom::HTMLUnknownElement(std::move(aNodeInfo));
|
||||
return new (nim) mozilla::dom::HTMLUnknownElement(nodeInfo.forget());
|
||||
}
|
||||
|
||||
return new mozilla::dom::HTMLDialogElement(std::move(aNodeInfo));
|
||||
return new (nim) mozilla::dom::HTMLDialogElement(nodeInfo.forget());
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -47,7 +47,9 @@ JSObject* HTMLElement::WrapNode(JSContext* aCx,
|
||||
nsGenericHTMLElement* NS_NewHTMLElement(
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser) {
|
||||
return new mozilla::dom::HTMLElement(std::move(aNodeInfo));
|
||||
RefPtr<mozilla::dom::NodeInfo> nodeInfo(aNodeInfo);
|
||||
auto* nim = nodeInfo->NodeInfoManager();
|
||||
return new (nim) mozilla::dom::HTMLElement(nodeInfo.forget());
|
||||
}
|
||||
|
||||
// Distinct from the above in order to have function pointer that compared
|
||||
@ -55,5 +57,7 @@ nsGenericHTMLElement* NS_NewHTMLElement(
|
||||
nsGenericHTMLElement* NS_NewCustomElement(
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser) {
|
||||
return new mozilla::dom::HTMLElement(std::move(aNodeInfo));
|
||||
RefPtr<mozilla::dom::NodeInfo> nodeInfo(aNodeInfo);
|
||||
auto* nim = nodeInfo->NodeInfoManager();
|
||||
return new (nim) mozilla::dom::HTMLElement(nodeInfo.forget());
|
||||
}
|
||||
|
@ -674,7 +674,8 @@ already_AddRefed<HTMLImageElement> HTMLImageElement::Image(
|
||||
RefPtr<mozilla::dom::NodeInfo> nodeInfo = doc->NodeInfoManager()->GetNodeInfo(
|
||||
nsGkAtoms::img, nullptr, kNameSpaceID_XHTML, ELEMENT_NODE);
|
||||
|
||||
RefPtr<HTMLImageElement> img = new HTMLImageElement(nodeInfo.forget());
|
||||
auto* nim = nodeInfo->NodeInfoManager();
|
||||
RefPtr<HTMLImageElement> img = new (nim) HTMLImageElement(nodeInfo.forget());
|
||||
|
||||
if (aWidth.WasPassed()) {
|
||||
img->SetWidth(aWidth.Value(), aError);
|
||||
|
@ -1066,8 +1066,8 @@ nsresult HTMLInputElement::Clone(dom::NodeInfo* aNodeInfo,
|
||||
nsINode** aResult) const {
|
||||
*aResult = nullptr;
|
||||
|
||||
RefPtr<HTMLInputElement> it = new HTMLInputElement(
|
||||
do_AddRef(aNodeInfo), NOT_FROM_PARSER, FromClone::yes);
|
||||
RefPtr<HTMLInputElement> it = new (aNodeInfo->NodeInfoManager())
|
||||
HTMLInputElement(do_AddRef(aNodeInfo), NOT_FROM_PARSER, FromClone::yes);
|
||||
|
||||
nsresult rv = const_cast<HTMLInputElement*>(this)->CopyInnerTo(it);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -160,8 +160,8 @@ HTMLMenuItemElement::~HTMLMenuItemElement() = default;
|
||||
nsresult HTMLMenuItemElement::Clone(dom::NodeInfo* aNodeInfo,
|
||||
nsINode** aResult) const {
|
||||
*aResult = nullptr;
|
||||
RefPtr<HTMLMenuItemElement> it =
|
||||
new HTMLMenuItemElement(do_AddRef(aNodeInfo), NOT_FROM_PARSER);
|
||||
RefPtr<HTMLMenuItemElement> it = new (aNodeInfo->NodeInfoManager())
|
||||
HTMLMenuItemElement(do_AddRef(aNodeInfo), NOT_FROM_PARSER);
|
||||
nsresult rv = const_cast<HTMLMenuItemElement*>(this)->CopyInnerTo(it);
|
||||
if (NS_SUCCEEDED(rv)) {
|
||||
switch (mType) {
|
||||
|
@ -306,7 +306,9 @@ already_AddRefed<HTMLOptionElement> HTMLOptionElement::Option(
|
||||
RefPtr<mozilla::dom::NodeInfo> nodeInfo = doc->NodeInfoManager()->GetNodeInfo(
|
||||
nsGkAtoms::option, nullptr, kNameSpaceID_XHTML, ELEMENT_NODE);
|
||||
|
||||
RefPtr<HTMLOptionElement> option = new HTMLOptionElement(nodeInfo.forget());
|
||||
auto* nim = nodeInfo->NodeInfoManager();
|
||||
RefPtr<HTMLOptionElement> option =
|
||||
new (nim) HTMLOptionElement(nodeInfo.forget());
|
||||
|
||||
if (!aText.IsEmpty()) {
|
||||
// Create a new text node and append it to the option
|
||||
|
@ -12,7 +12,9 @@
|
||||
nsGenericHTMLElement* NS_NewHTMLPictureElement(
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser) {
|
||||
return new mozilla::dom::HTMLPictureElement(std::move(aNodeInfo));
|
||||
RefPtr<mozilla::dom::NodeInfo> nodeInfo(aNodeInfo);
|
||||
auto* nim = nodeInfo->NodeInfoManager();
|
||||
return new (nim) mozilla::dom::HTMLPictureElement(nodeInfo.forget());
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -80,8 +80,8 @@ nsresult HTMLScriptElement::Clone(dom::NodeInfo* aNodeInfo,
|
||||
nsINode** aResult) const {
|
||||
*aResult = nullptr;
|
||||
|
||||
HTMLScriptElement* it =
|
||||
new HTMLScriptElement(do_AddRef(aNodeInfo), NOT_FROM_PARSER);
|
||||
HTMLScriptElement* it = new (aNodeInfo->NodeInfoManager())
|
||||
HTMLScriptElement(do_AddRef(aNodeInfo), NOT_FROM_PARSER);
|
||||
|
||||
nsCOMPtr<nsINode> kungFuDeathGrip = it;
|
||||
nsresult rv = const_cast<HTMLScriptElement*>(this)->CopyInnerTo(it);
|
||||
|
@ -15,7 +15,9 @@
|
||||
nsGenericHTMLElement* NS_NewHTMLSlotElement(
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser) {
|
||||
return new mozilla::dom::HTMLSlotElement(std::move(aNodeInfo));
|
||||
RefPtr<mozilla::dom::NodeInfo> nodeInfo(std::move(aNodeInfo));
|
||||
auto* nim = nodeInfo->NodeInfoManager();
|
||||
return new (nim) mozilla::dom::HTMLSlotElement(nodeInfo.forget());
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -107,8 +107,8 @@ NS_IMPL_ISUPPORTS_CYCLE_COLLECTION_INHERITED(HTMLTextAreaElement,
|
||||
nsresult HTMLTextAreaElement::Clone(dom::NodeInfo* aNodeInfo,
|
||||
nsINode** aResult) const {
|
||||
*aResult = nullptr;
|
||||
RefPtr<HTMLTextAreaElement> it =
|
||||
new HTMLTextAreaElement(do_AddRef(aNodeInfo));
|
||||
RefPtr<HTMLTextAreaElement> it = new (aNodeInfo->NodeInfoManager())
|
||||
HTMLTextAreaElement(do_AddRef(aNodeInfo));
|
||||
|
||||
nsresult rv = const_cast<HTMLTextAreaElement*>(this)->CopyInnerTo(it);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
@ -42,7 +42,9 @@ extern mozilla::LazyLogModule gTextTrackLog;
|
||||
nsGenericHTMLElement* NS_NewHTMLTrackElement(
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser) {
|
||||
return new mozilla::dom::HTMLTrackElement(std::move(aNodeInfo));
|
||||
RefPtr<mozilla::dom::NodeInfo> nodeInfo(aNodeInfo);
|
||||
auto* nim = nodeInfo->NodeInfoManager();
|
||||
return new (nim) mozilla::dom::HTMLTrackElement(nodeInfo.forget());
|
||||
}
|
||||
|
||||
namespace mozilla {
|
||||
|
@ -38,8 +38,10 @@
|
||||
nsGenericHTMLElement* NS_NewHTMLVideoElement(
|
||||
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
||||
mozilla::dom::FromParser aFromParser) {
|
||||
RefPtr<mozilla::dom::NodeInfo> nodeInfo(aNodeInfo);
|
||||
auto* nim = nodeInfo->NodeInfoManager();
|
||||
mozilla::dom::HTMLVideoElement* element =
|
||||
new mozilla::dom::HTMLVideoElement(std::move(aNodeInfo));
|
||||
new (nim) mozilla::dom::HTMLVideoElement(nodeInfo.forget());
|
||||
element->Init();
|
||||
return element;
|
||||
}
|
||||
@ -80,7 +82,8 @@ nsresult HTMLVideoElement::Clone(mozilla::dom::NodeInfo* aNodeInfo,
|
||||
nsINode** aResult) const {
|
||||
*aResult = nullptr;
|
||||
RefPtr<mozilla::dom::NodeInfo> ni(aNodeInfo);
|
||||
HTMLVideoElement* it = new HTMLVideoElement(ni.forget());
|
||||
auto* nim = ni->NodeInfoManager();
|
||||
HTMLVideoElement* it = new (nim) HTMLVideoElement(ni.forget());
|
||||
it->Init();
|
||||
nsCOMPtr<nsINode> kungFuDeathGrip = it;
|
||||
nsresult rv = const_cast<HTMLVideoElement*>(this)->CopyInnerTo(it);
|
||||
|
@ -2826,7 +2826,8 @@ void nsGenericHTMLElement::SetInnerText(const nsAString& aValue) {
|
||||
RefPtr<mozilla::dom::NodeInfo> ni =
|
||||
NodeInfo()->NodeInfoManager()->GetNodeInfo(
|
||||
nsGkAtoms::br, nullptr, kNameSpaceID_XHTML, ELEMENT_NODE);
|
||||
RefPtr<HTMLBRElement> br = new HTMLBRElement(ni.forget());
|
||||
auto* nim = ni->NodeInfoManager();
|
||||
RefPtr<HTMLBRElement> br = new (nim) HTMLBRElement(ni.forget());
|
||||
AppendChildTo(br, true);
|
||||
} else {
|
||||
str.Append(*s);
|
||||
|
@ -95,7 +95,7 @@ nsresult DetailsFrame::CreateAnonymousContent(
|
||||
|
||||
RefPtr<NodeInfo> nodeInfo = nodeInfoManager->GetNodeInfo(
|
||||
nsGkAtoms::summary, nullptr, kNameSpaceID_XHTML, nsINode::ELEMENT_NODE);
|
||||
mDefaultSummary = new HTMLSummaryElement(nodeInfo.forget());
|
||||
mDefaultSummary = new (nodeInfoManager) HTMLSummaryElement(nodeInfo.forget());
|
||||
|
||||
nsAutoString defaultSummaryText;
|
||||
nsContentUtils::GetMaybeLocalizedString(
|
||||
|
Loading…
Reference in New Issue
Block a user