2015-05-03 19:32:37 +00:00
|
|
|
/* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* vim: set ts=8 sts=2 et sw=2 tw=80: */
|
2012-05-21 11:12:37 +00:00
|
|
|
/* This Source Code Form is subject to the terms of the Mozilla Public
|
|
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
2010-06-19 18:44:43 +00:00
|
|
|
|
2021-10-04 20:51:25 +00:00
|
|
|
#include "mozilla/dom/HTMLElement.h"
|
2021-10-04 20:51:28 +00:00
|
|
|
|
|
|
|
#include "mozilla/dom/CustomElementRegistry.h"
|
2012-11-22 11:09:57 +00:00
|
|
|
#include "mozilla/dom/HTMLElementBinding.h"
|
2023-01-04 13:08:39 +00:00
|
|
|
#include "mozilla/EventDispatcher.h"
|
2012-12-21 14:06:50 +00:00
|
|
|
#include "nsContentUtils.h"
|
2011-08-11 13:29:50 +00:00
|
|
|
|
2020-11-04 17:04:01 +00:00
|
|
|
namespace mozilla::dom {
|
2010-06-19 18:44:43 +00:00
|
|
|
|
2018-09-21 20:45:49 +00:00
|
|
|
HTMLElement::HTMLElement(already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo)
|
2021-10-04 20:51:28 +00:00
|
|
|
: nsGenericHTMLFormElement(std::move(aNodeInfo)) {
|
2018-03-16 15:26:09 +00:00
|
|
|
if (NodeInfo()->Equals(nsGkAtoms::bdi)) {
|
2022-06-07 23:09:52 +00:00
|
|
|
AddStatesSilently(ElementState::HAS_DIR_ATTR_LIKE_AUTO);
|
2018-03-16 15:26:09 +00:00
|
|
|
}
|
2010-06-19 18:44:43 +00:00
|
|
|
}
|
|
|
|
|
2021-10-04 20:51:28 +00:00
|
|
|
NS_IMPL_CYCLE_COLLECTION_INHERITED(HTMLElement, nsGenericHTMLFormElement)
|
|
|
|
|
|
|
|
// QueryInterface implementation for HTMLElement
|
|
|
|
|
|
|
|
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION(HTMLElement)
|
|
|
|
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIFormControl, GetElementInternals())
|
2021-11-04 09:49:32 +00:00
|
|
|
NS_INTERFACE_MAP_ENTRY_TEAROFF(nsIConstraintValidation, GetElementInternals())
|
2021-10-04 20:51:28 +00:00
|
|
|
NS_INTERFACE_MAP_END_INHERITING(nsGenericHTMLFormElement)
|
|
|
|
|
|
|
|
NS_IMPL_ADDREF_INHERITED(HTMLElement, nsGenericHTMLFormElement)
|
|
|
|
NS_IMPL_RELEASE_INHERITED(HTMLElement, nsGenericHTMLFormElement)
|
|
|
|
|
2012-12-21 14:06:50 +00:00
|
|
|
NS_IMPL_ELEMENT_CLONE(HTMLElement)
|
2010-06-19 18:44:43 +00:00
|
|
|
|
Bug 1117172 part 3. Change the wrappercached WrapObject methods to allow passing in aGivenProto. r=peterv
The only manual changes here are to BindingUtils.h, BindingUtils.cpp,
Codegen.py, Element.cpp, IDBFileRequest.cpp, IDBObjectStore.cpp,
dom/workers/Navigator.cpp, WorkerPrivate.cpp, DeviceStorageRequestChild.cpp,
Notification.cpp, nsGlobalWindow.cpp, MessagePort.cpp, nsJSEnvironment.cpp,
Sandbox.cpp, XPCConvert.cpp, ExportHelpers.cpp, and DataStoreService.cpp. The
rest of this diff was generated by running the following commands:
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObjectInternal\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapNode\((?:aCx|cx|aContext|aCtx|js))\)/\1, aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(WrapObject\(JSContext *\* *(?:aCx|cx|aContext|aCtx|js))\)/\1, JS::Handle<JSObject*> aGivenProto)/g'
find . -name "*.h" -o -name "*.cpp" | xargs perl -pi -e 'BEGIN { $/ = undef } s/(Binding(?:_workers)?::Wrap\((?:aCx|cx|aContext|aCtx|js), [^,)]+)\)/\1, aGivenProto)/g'
2015-03-19 14:13:33 +00:00
|
|
|
JSObject* HTMLElement::WrapNode(JSContext* aCx,
|
|
|
|
JS::Handle<JSObject*> aGivenProto) {
|
2018-06-25 21:20:54 +00:00
|
|
|
return dom::HTMLElement_Binding::Wrap(aCx, this, aGivenProto);
|
2012-11-22 11:09:57 +00:00
|
|
|
}
|
2012-12-21 14:06:50 +00:00
|
|
|
|
2023-01-04 13:08:39 +00:00
|
|
|
void HTMLElement::GetEventTargetParent(EventChainPreVisitor& aVisitor) {
|
|
|
|
if (IsDisabledForEvents(aVisitor.mEvent)) {
|
|
|
|
// Do not process any DOM events if the element is disabled
|
|
|
|
aVisitor.mCanHandle = false;
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
nsGenericHTMLFormElement::GetEventTargetParent(aVisitor);
|
|
|
|
}
|
|
|
|
|
2023-01-06 18:17:05 +00:00
|
|
|
nsINode* HTMLElement::GetScopeChainParent() const {
|
|
|
|
if (IsFormAssociatedCustomElements()) {
|
|
|
|
auto* form = GetFormInternal();
|
|
|
|
if (form) {
|
|
|
|
return form;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return nsGenericHTMLFormElement::GetScopeChainParent();
|
|
|
|
}
|
|
|
|
|
2021-11-04 09:49:32 +00:00
|
|
|
nsresult HTMLElement::BindToTree(BindContext& aContext, nsINode& aParent) {
|
|
|
|
nsresult rv = nsGenericHTMLFormElement::BindToTree(aContext, aParent);
|
|
|
|
NS_ENSURE_SUCCESS(rv, rv);
|
|
|
|
|
|
|
|
UpdateBarredFromConstraintValidation();
|
|
|
|
return rv;
|
|
|
|
}
|
|
|
|
|
|
|
|
void HTMLElement::UnbindFromTree(bool aNullParent) {
|
|
|
|
nsGenericHTMLFormElement::UnbindFromTree(aNullParent);
|
|
|
|
|
|
|
|
UpdateBarredFromConstraintValidation();
|
|
|
|
}
|
|
|
|
|
2021-10-04 20:51:28 +00:00
|
|
|
void HTMLElement::SetCustomElementDefinition(
|
|
|
|
CustomElementDefinition* aDefinition) {
|
2021-10-25 20:43:10 +00:00
|
|
|
nsGenericHTMLFormElement::SetCustomElementDefinition(aDefinition);
|
2021-10-04 20:51:28 +00:00
|
|
|
// Always create an ElementInternal for form-associated custom element as the
|
|
|
|
// Form related implementation lives in ElementInternal which implements
|
|
|
|
// nsIFormControl. It is okay for the attachElementInternal API as there is a
|
|
|
|
// separated flag for whether attachElementInternal is called.
|
|
|
|
if (aDefinition && !aDefinition->IsCustomBuiltIn() &&
|
|
|
|
aDefinition->mFormAssociated) {
|
|
|
|
CustomElementData* data = GetCustomElementData();
|
|
|
|
MOZ_ASSERT(data);
|
|
|
|
data->GetOrCreateElementInternals(this);
|
2021-10-25 20:43:10 +00:00
|
|
|
|
|
|
|
// This is for the case that script constructs a custom element directly,
|
|
|
|
// e.g. via new MyCustomElement(), where the upgrade steps won't be ran to
|
|
|
|
// update the disabled state in UpdateFormOwner().
|
|
|
|
if (data->mState == CustomElementData::State::eCustom) {
|
|
|
|
UpdateDisabledState(true);
|
|
|
|
}
|
2021-10-04 20:51:28 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// https://html.spec.whatwg.org/commit-snapshots/53bc3803433e1c817918b83e8a84f3db900031dd/#dom-attachinternals
|
|
|
|
already_AddRefed<ElementInternals> HTMLElement::AttachInternals(
|
|
|
|
ErrorResult& aRv) {
|
|
|
|
CustomElementData* ceData = GetCustomElementData();
|
|
|
|
|
|
|
|
// 1. If element's is value is not null, then throw a "NotSupportedError"
|
|
|
|
// DOMException.
|
|
|
|
if (nsAtom* isAtom = ceData ? ceData->GetIs(this) : nullptr) {
|
|
|
|
aRv.ThrowNotSupportedError(nsPrintfCString(
|
|
|
|
"Cannot attach ElementInternals to a customized built-in element "
|
|
|
|
"'%s'",
|
|
|
|
NS_ConvertUTF16toUTF8(isAtom->GetUTF16String()).get()));
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 2. Let definition be the result of looking up a custom element definition
|
|
|
|
// given element's node document, its namespace, its local name, and null
|
|
|
|
// as is value.
|
|
|
|
nsAtom* nameAtom = NodeInfo()->NameAtom();
|
|
|
|
CustomElementDefinition* definition = nullptr;
|
|
|
|
if (ceData) {
|
|
|
|
definition = ceData->GetCustomElementDefinition();
|
|
|
|
|
|
|
|
// If the definition is null, the element possible hasn't yet upgraded.
|
|
|
|
// Fallback to use LookupCustomElementDefinition to find its definition.
|
|
|
|
if (!definition) {
|
|
|
|
definition = nsContentUtils::LookupCustomElementDefinition(
|
|
|
|
NodeInfo()->GetDocument(), nameAtom, NodeInfo()->NamespaceID(),
|
|
|
|
ceData->GetCustomElementType());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
// 3. If definition is null, then throw an "NotSupportedError" DOMException.
|
|
|
|
if (!definition) {
|
|
|
|
aRv.ThrowNotSupportedError(nsPrintfCString(
|
|
|
|
"Cannot attach ElementInternals to a non-custom element '%s'",
|
|
|
|
NS_ConvertUTF16toUTF8(nameAtom->GetUTF16String()).get()));
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 4. If definition's disable internals is true, then throw a
|
|
|
|
// "NotSupportedError" DOMException.
|
|
|
|
if (definition->mDisableInternals) {
|
|
|
|
aRv.ThrowNotSupportedError(nsPrintfCString(
|
|
|
|
"AttachInternal() to '%s' is disabled by disabledFeatures",
|
|
|
|
NS_ConvertUTF16toUTF8(nameAtom->GetUTF16String()).get()));
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
// If this is not a custom element, i.e. ceData is nullptr, we are unable to
|
|
|
|
// find a definition and should return earlier above.
|
|
|
|
MOZ_ASSERT(ceData);
|
|
|
|
|
|
|
|
// 5. If element's attached internals is true, then throw an
|
|
|
|
// "NotSupportedError" DOMException.
|
|
|
|
if (ceData->HasAttachedInternals()) {
|
|
|
|
aRv.ThrowNotSupportedError(nsPrintfCString(
|
|
|
|
"AttachInternals() has already been called from '%s'",
|
|
|
|
NS_ConvertUTF16toUTF8(nameAtom->GetUTF16String()).get()));
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 6. If element's custom element state is not "precustomized" or "custom",
|
|
|
|
// then throw a "NotSupportedError" DOMException.
|
|
|
|
if (ceData->mState != CustomElementData::State::ePrecustomized &&
|
|
|
|
ceData->mState != CustomElementData::State::eCustom) {
|
|
|
|
aRv.ThrowNotSupportedError(
|
|
|
|
R"(Custom element state is not "precustomized" or "custom".)");
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
// 7. Set element's attached internals to true.
|
|
|
|
ceData->AttachedInternals();
|
|
|
|
|
|
|
|
// 8. Create a new ElementInternals instance targeting element, and return it.
|
|
|
|
return do_AddRef(ceData->GetOrCreateElementInternals(this));
|
|
|
|
}
|
|
|
|
|
2021-10-28 10:29:38 +00:00
|
|
|
void HTMLElement::AfterClearForm(bool aUnbindOrDelete) {
|
|
|
|
// No need to enqueue formAssociated callback if we aren't releasing or
|
|
|
|
// unbinding from tree, UpdateFormOwner() will handle it.
|
|
|
|
if (aUnbindOrDelete) {
|
|
|
|
MOZ_ASSERT(IsFormAssociatedElement());
|
|
|
|
nsContentUtils::EnqueueLifecycleCallback(
|
|
|
|
ElementCallbackType::eFormAssociated, this, {});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-04 20:51:28 +00:00
|
|
|
void HTMLElement::UpdateFormOwner() {
|
|
|
|
MOZ_ASSERT(IsFormAssociatedElement());
|
|
|
|
|
|
|
|
// If @form is set, the element *has* to be in a composed document,
|
|
|
|
// otherwise it wouldn't be possible to find an element with the
|
|
|
|
// corresponding id. If @form isn't set, the element *has* to have a parent,
|
|
|
|
// otherwise it wouldn't be possible to find a form ancestor. We should not
|
|
|
|
// call UpdateFormOwner if none of these conditions are fulfilled.
|
|
|
|
if (HasAttr(kNameSpaceID_None, nsGkAtoms::form) ? IsInComposedDoc()
|
|
|
|
: !!GetParent()) {
|
2021-10-28 10:29:38 +00:00
|
|
|
UpdateFormOwner(true, nullptr);
|
2021-10-04 20:51:28 +00:00
|
|
|
}
|
|
|
|
UpdateFieldSet(true);
|
2021-10-25 20:43:10 +00:00
|
|
|
UpdateDisabledState(true);
|
2021-11-04 09:49:32 +00:00
|
|
|
UpdateBarredFromConstraintValidation();
|
2021-10-25 20:43:10 +00:00
|
|
|
}
|
|
|
|
|
2023-01-04 13:08:39 +00:00
|
|
|
bool HTMLElement::IsDisabledForEvents(WidgetEvent* aEvent) {
|
|
|
|
if (IsFormAssociatedElement()) {
|
|
|
|
return IsElementDisabledForEvents(aEvent, GetPrimaryFrame());
|
|
|
|
}
|
|
|
|
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2023-04-21 08:56:27 +00:00
|
|
|
void HTMLElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName,
|
|
|
|
const nsAttrValue* aValue,
|
|
|
|
const nsAttrValue* aOldValue,
|
|
|
|
nsIPrincipal* aMaybeScriptedPrincipal,
|
|
|
|
bool aNotify) {
|
2021-11-04 09:49:32 +00:00
|
|
|
if (aNameSpaceID == kNameSpaceID_None &&
|
|
|
|
(aName == nsGkAtoms::disabled || aName == nsGkAtoms::readonly)) {
|
|
|
|
if (aName == nsGkAtoms::disabled) {
|
|
|
|
// This *has* to be called *before* validity state check because
|
|
|
|
// UpdateBarredFromConstraintValidation depend on our disabled state.
|
|
|
|
UpdateDisabledState(aNotify);
|
|
|
|
}
|
|
|
|
UpdateBarredFromConstraintValidation();
|
2021-10-25 20:43:10 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
return nsGenericHTMLFormElement::AfterSetAttr(
|
|
|
|
aNameSpaceID, aName, aValue, aOldValue, aMaybeScriptedPrincipal, aNotify);
|
2021-10-04 20:51:28 +00:00
|
|
|
}
|
|
|
|
|
2022-06-07 23:09:52 +00:00
|
|
|
ElementState HTMLElement::IntrinsicState() const {
|
|
|
|
ElementState state = nsGenericHTMLFormElement::IntrinsicState();
|
2021-11-26 11:47:40 +00:00
|
|
|
if (ElementInternals* internals = GetElementInternals()) {
|
|
|
|
if (internals->IsCandidateForConstraintValidation()) {
|
|
|
|
if (internals->IsValid()) {
|
2022-06-07 23:09:53 +00:00
|
|
|
state |= ElementState::VALID | ElementState::USER_VALID;
|
2021-11-26 11:47:40 +00:00
|
|
|
} else {
|
2022-06-07 23:09:53 +00:00
|
|
|
state |= ElementState::INVALID | ElementState::USER_INVALID;
|
2021-11-26 11:47:40 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return state;
|
|
|
|
}
|
|
|
|
|
2021-10-04 20:51:28 +00:00
|
|
|
void HTMLElement::SetFormInternal(HTMLFormElement* aForm, bool aBindToTree) {
|
|
|
|
ElementInternals* internals = GetElementInternals();
|
|
|
|
MOZ_ASSERT(internals);
|
|
|
|
internals->SetForm(aForm);
|
|
|
|
}
|
|
|
|
|
|
|
|
HTMLFormElement* HTMLElement::GetFormInternal() const {
|
|
|
|
ElementInternals* internals = GetElementInternals();
|
|
|
|
MOZ_ASSERT(internals);
|
|
|
|
return internals->GetForm();
|
|
|
|
}
|
|
|
|
|
|
|
|
void HTMLElement::SetFieldSetInternal(HTMLFieldSetElement* aFieldset) {
|
|
|
|
ElementInternals* internals = GetElementInternals();
|
|
|
|
MOZ_ASSERT(internals);
|
|
|
|
internals->SetFieldSet(aFieldset);
|
|
|
|
}
|
|
|
|
|
|
|
|
HTMLFieldSetElement* HTMLElement::GetFieldSetInternal() const {
|
|
|
|
ElementInternals* internals = GetElementInternals();
|
|
|
|
MOZ_ASSERT(internals);
|
|
|
|
return internals->GetFieldSet();
|
|
|
|
}
|
|
|
|
|
|
|
|
bool HTMLElement::CanBeDisabled() const { return IsFormAssociatedElement(); }
|
|
|
|
|
|
|
|
bool HTMLElement::DoesReadOnlyApply() const {
|
|
|
|
return IsFormAssociatedElement();
|
|
|
|
}
|
|
|
|
|
2021-10-25 20:43:11 +00:00
|
|
|
void HTMLElement::UpdateDisabledState(bool aNotify) {
|
|
|
|
bool oldState = IsDisabled();
|
|
|
|
nsGenericHTMLFormElement::UpdateDisabledState(aNotify);
|
|
|
|
if (oldState != IsDisabled()) {
|
|
|
|
MOZ_ASSERT(IsFormAssociatedElement());
|
|
|
|
LifecycleCallbackArgs args;
|
|
|
|
args.mDisabled = !oldState;
|
|
|
|
nsContentUtils::EnqueueLifecycleCallback(ElementCallbackType::eFormDisabled,
|
|
|
|
this, args);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-28 10:29:38 +00:00
|
|
|
void HTMLElement::UpdateFormOwner(bool aBindToTree, Element* aFormIdElement) {
|
|
|
|
HTMLFormElement* oldForm = GetFormInternal();
|
|
|
|
nsGenericHTMLFormElement::UpdateFormOwner(aBindToTree, aFormIdElement);
|
|
|
|
HTMLFormElement* newForm = GetFormInternal();
|
|
|
|
if (newForm != oldForm) {
|
|
|
|
LifecycleCallbackArgs args;
|
|
|
|
args.mForm = newForm;
|
|
|
|
nsContentUtils::EnqueueLifecycleCallback(
|
|
|
|
ElementCallbackType::eFormAssociated, this, args);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-10-04 20:51:28 +00:00
|
|
|
bool HTMLElement::IsFormAssociatedElement() const {
|
|
|
|
CustomElementData* data = GetCustomElementData();
|
2022-05-19 08:29:21 +00:00
|
|
|
return data && data->IsFormAssociated();
|
2021-10-04 20:51:28 +00:00
|
|
|
}
|
|
|
|
|
2021-11-04 09:49:32 +00:00
|
|
|
void HTMLElement::FieldSetDisabledChanged(bool aNotify) {
|
|
|
|
// This *has* to be called *before* UpdateBarredFromConstraintValidation
|
|
|
|
// because this function depend on our disabled state.
|
|
|
|
nsGenericHTMLFormElement::FieldSetDisabledChanged(aNotify);
|
|
|
|
|
|
|
|
UpdateBarredFromConstraintValidation();
|
|
|
|
}
|
|
|
|
|
2021-10-04 20:51:28 +00:00
|
|
|
ElementInternals* HTMLElement::GetElementInternals() const {
|
|
|
|
CustomElementData* data = GetCustomElementData();
|
|
|
|
if (!data || !data->IsFormAssociated()) {
|
|
|
|
// If the element is not a form associated custom element, it should not be
|
|
|
|
// able to be QueryInterfaced to nsIFormControl and could not perform
|
|
|
|
// the form operation, either, so we return nullptr here.
|
|
|
|
return nullptr;
|
|
|
|
}
|
|
|
|
|
|
|
|
return data->GetElementInternals();
|
|
|
|
}
|
|
|
|
|
2021-11-04 09:49:32 +00:00
|
|
|
void HTMLElement::UpdateBarredFromConstraintValidation() {
|
|
|
|
CustomElementData* data = GetCustomElementData();
|
|
|
|
if (data && data->IsFormAssociated()) {
|
|
|
|
ElementInternals* internals = data->GetElementInternals();
|
|
|
|
MOZ_ASSERT(internals);
|
|
|
|
internals->UpdateBarredFromConstraintValidation();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-04 17:04:01 +00:00
|
|
|
} // namespace mozilla::dom
|
2012-12-21 14:06:50 +00:00
|
|
|
|
|
|
|
// Here, we expand 'NS_IMPL_NS_NEW_HTML_ELEMENT()' by hand.
|
|
|
|
// (Calling the macro directly (with no args) produces compiler warnings.)
|
|
|
|
nsGenericHTMLElement* NS_NewHTMLElement(
|
2014-06-20 02:01:40 +00:00
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
2012-12-21 14:06:50 +00:00
|
|
|
mozilla::dom::FromParser aFromParser) {
|
2020-03-17 14:53:08 +00:00
|
|
|
RefPtr<mozilla::dom::NodeInfo> nodeInfo(aNodeInfo);
|
|
|
|
auto* nim = nodeInfo->NodeInfoManager();
|
|
|
|
return new (nim) mozilla::dom::HTMLElement(nodeInfo.forget());
|
2012-12-21 14:06:50 +00:00
|
|
|
}
|
2017-07-04 08:00:03 +00:00
|
|
|
|
|
|
|
// Distinct from the above in order to have function pointer that compared
|
|
|
|
// unequal to a function pointer to the above.
|
|
|
|
nsGenericHTMLElement* NS_NewCustomElement(
|
|
|
|
already_AddRefed<mozilla::dom::NodeInfo>&& aNodeInfo,
|
|
|
|
mozilla::dom::FromParser aFromParser) {
|
2020-03-17 14:53:08 +00:00
|
|
|
RefPtr<mozilla::dom::NodeInfo> nodeInfo(aNodeInfo);
|
|
|
|
auto* nim = nodeInfo->NodeInfoManager();
|
|
|
|
return new (nim) mozilla::dom::HTMLElement(nodeInfo.forget());
|
2017-07-04 08:00:03 +00:00
|
|
|
}
|