void HTMLImageElement::UpdateFormOwner() { if (!mForm) { mForm = FindAncestorForm(); } if (mForm && !HasFlag(ADDED_TO_FORM)) { // Now we need to add ourselves to the form nsAutoString nameVal, idVal; GetAttr(kNameSpaceID_None, nsGkAtoms::name, nameVal); GetAttr(kNameSpaceID_None, nsGkAtoms::id, idVal); SetFlags(ADDED_TO_FORM); mForm->AddImageElement(this); if (!nameVal.IsEmpty()) { mForm->AddImageElementToTable(this, nameVal); } if (!idVal.IsEmpty()) { mForm->AddImageElementToTable(this, idVal); } } }
void HTMLImageElement::UnbindFromTree(bool aDeep, bool aNullParent) { if (mForm) { if (aNullParent || !FindAncestorForm(mForm)) { ClearForm(true); } else { UnsetFlags(MAYBE_ORPHAN_FORM_ELEMENT); } } if (mInDocResponsiveContent) { nsIDocument* doc = GetOurOwnerDoc(); MOZ_ASSERT(doc); if (doc) { doc->RemoveResponsiveContent(this); mInDocResponsiveContent = false; } } if (GetParent() && GetParent()->IsHTMLElement(nsGkAtoms::picture) && HTMLPictureElement::IsPictureEnabled()) { // Being removed from picture re-triggers selection, even if we // weren't using a <source> peer if (aNullParent) { QueueImageLoadTask(true); } } nsImageLoadingContent::UnbindFromTree(aDeep, aNullParent); nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent); }
NS_IMETHODIMP nsHTMLSharedElement::GetForm(nsIDOMHTMLFormElement** aForm) { NS_IF_ADDREF(*aForm = FindAncestorForm()); return NS_OK; }
void HTMLImageElement::UnbindFromTree(bool aDeep, bool aNullParent) { if (mForm) { if (aNullParent || !FindAncestorForm(mForm)) { ClearForm(true); } else { UnsetFlags(MAYBE_ORPHAN_FORM_ELEMENT); } } nsImageLoadingContent::UnbindFromTree(aDeep, aNullParent); nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent); }
void HTMLImageElement::UnbindFromTree(bool aDeep, bool aNullParent) { if (mForm) { if (aNullParent || !FindAncestorForm(mForm)) { ClearForm(true); } else { UnsetFlags(MAYBE_ORPHAN_FORM_ELEMENT); } } if (aNullParent && nsINode::GetParentNode()->Tag() == nsGkAtoms::picture && HTMLPictureElement::IsPictureEnabled()) { // Being removed from picture re-triggers selection, even if we // weren't using a <source> peer QueueImageLoadTask(); } nsImageLoadingContent::UnbindFromTree(aDeep, aNullParent); nsGenericHTMLElement::UnbindFromTree(aDeep, aNullParent); }