nsRepeatState nsXFormsRepeatElement::UpdateRepeatState(nsIDOMNode *aParent) { // If the repeat is attribute based, then it is generated by anonymous // content. In that case its repeat type is eType_NotApplicable. Otherwise, // calculate the repeat state using the normal logic. nsRepeatState repeatState = eType_Unknown; if (aParent) { PRBool isAttributeBased = PR_FALSE; nsresult rv = mElement->HasAttributeNS(NS_LITERAL_STRING(NS_NAMESPACE_MOZ_XFORMS_TYPE), NS_LITERAL_STRING("attrBased"), &isAttributeBased); if (NS_SUCCEEDED(rv)) { // if repeat is attribute based, it won't go through the normal // attribute change processing, so should set the mIsAttributeBased // variable here mIsAttributeBased = isAttributeBased; if (isAttributeBased) { repeatState = eType_NotApplicable; SetRepeatState(repeatState); return repeatState; } } } return nsXFormsStubElement::UpdateRepeatState(aParent); }
NS_IMETHODIMP nsXFormsControlStub::WillChangeDocument(nsIDOMDocument *aNewDocument) { // This control is moving to another document or just plain getting removed // from its current document. In either case, we know that we don't care // about the bind-ready notification we might have been waiting on. nsCOMPtr<nsIXFormsContextControl> ctxtControl; GetAbortedBindListContainer(getter_AddRefs(ctxtControl)); if (ctxtControl) { ctxtControl->AddRemoveAbortedControl(this, PR_FALSE); } // If we are in the middle of getting set up in the current document then // then we need to make sure that if other controls getting set up in // the current document are depending on this control to help them, that // we remove that dependency. PRInt32 arraySize = mAbortedBindList.Count(); if (arraySize) { for (PRInt32 i = 0; i < arraySize; ++i) { nsCOMPtr<nsIXFormsControl> control = mAbortedBindList.ObjectAt(i); control->SetAbortedBindListContainer(nsnull); } mAbortedBindList.Clear(); } SetRepeatState(eType_Unknown); ResetHelpAndHint(PR_FALSE); return NS_OK; }
NS_IMETHODIMP nsXFormsControlStub::WillChangeParent(nsIDOMElement *aNewParent) { nsCOMPtr<nsIXFormsContextControl> ctxtControl; GetAbortedBindListContainer(getter_AddRefs(ctxtControl)); if (ctxtControl) { ctxtControl->AddRemoveAbortedControl(this, PR_FALSE); } SetRepeatState(eType_Unknown); return NS_OK; }
NS_IMETHODIMP nsXFormsItemSetElement::WillChangeParent(nsIDOMElement *aNewParent) { SetRepeatState(eType_Unknown); return NS_OK; }