diff --git a/dom/html/nsGenericHTMLElement.cpp b/dom/html/nsGenericHTMLElement.cpp index 66fbca071370..932b80f08f6a 100644 --- a/dom/html/nsGenericHTMLElement.cpp +++ b/dom/html/nsGenericHTMLElement.cpp @@ -1883,26 +1883,9 @@ nsGenericHTMLElement::TouchEventsEnabled(JSContext* /* unused */, JSObject* /* u //---------------------------------------------------------------------- -NS_IMPL_ADDREF_INHERITED(nsGenericHTMLFormElement, nsGenericHTMLElement) -NS_IMPL_RELEASE_INHERITED(nsGenericHTMLFormElement, nsGenericHTMLElement) - -NS_INTERFACE_TABLE_HEAD_CYCLE_COLLECTION_INHERITED(nsGenericHTMLFormElement) - NS_INTERFACE_TABLE_INHERITED(nsGenericHTMLFormElement, - nsIFormControl) -NS_INTERFACE_TABLE_TAIL_INHERITING(nsGenericHTMLElement) - -NS_IMPL_CYCLE_COLLECTION_CLASS(nsGenericHTMLFormElement) -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_BEGIN_INHERITED(nsGenericHTMLFormElement, - nsGenericHTMLElement) - NS_IMPL_CYCLE_COLLECTION_TRAVERSE(mForm) -NS_IMPL_CYCLE_COLLECTION_TRAVERSE_END -NS_IMPL_CYCLE_COLLECTION_UNLINK_BEGIN_INHERITED(nsGenericHTMLFormElement, - nsGenericHTMLElement) - tmp->ClearForm(true); -NS_IMPL_CYCLE_COLLECTION_UNLINK_END - nsGenericHTMLFormElement::nsGenericHTMLFormElement(already_AddRefed& aNodeInfo) : nsGenericHTMLElement(aNodeInfo) + , mForm(nullptr) , mFieldSet(nullptr) { // We should add the NS_EVENT_STATE_ENABLED bit here as needed, but @@ -1920,6 +1903,10 @@ nsGenericHTMLFormElement::~nsGenericHTMLFormElement() NS_ASSERTION(!mForm, "mForm should be null at this point!"); } +NS_IMPL_ISUPPORTS_INHERITED(nsGenericHTMLFormElement, + nsGenericHTMLElement, + nsIFormControl) + nsINode* nsGenericHTMLFormElement::GetScopeChainParent() const { @@ -1999,8 +1986,7 @@ nsresult nsGenericHTMLFormElement::GetForm(nsIDOMHTMLFormElement** aForm) { NS_ENSURE_ARG_POINTER(aForm); - nsRefPtr copy(mForm); - copy.forget(aForm); + NS_IF_ADDREF(*aForm = mForm); return NS_OK; } diff --git a/dom/html/nsGenericHTMLElement.h b/dom/html/nsGenericHTMLElement.h index 4ed09a05811e..1dc8fdea8f61 100644 --- a/dom/html/nsGenericHTMLElement.h +++ b/dom/html/nsGenericHTMLElement.h @@ -1266,9 +1266,6 @@ class nsGenericHTMLFormElement : public nsGenericHTMLElement, public: explicit nsGenericHTMLFormElement(already_AddRefed& aNodeInfo); - NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsGenericHTMLFormElement, - nsGenericHTMLElement) - NS_DECL_ISUPPORTS_INHERITED nsINode* GetScopeChainParent() const override; @@ -1416,7 +1413,7 @@ protected: FocusTristate FocusState(); /** The form that contains this control */ - nsRefPtr mForm; + mozilla::dom::HTMLFormElement* mForm; /* This is a pointer to our closest fieldset parent if any */ mozilla::dom::HTMLFieldSetElement* mFieldSet;