if (NS_FORM_INPUT_CHECKBOX == type) { if (nsnull != mWidget) { nsICheckButton* checkbox = nsnull; if (NS_OK == mWidget->QueryInterface(kICheckButtonIID,(void**)&checkbox)) { checkbox->SetState(aValue); NS_RELEASE(checkbox); return NS_OK; } } } else if (NS_FORM_INPUT_RADIO == type) { if (nsnull != mWidget) { nsIRadioButton* radio = nsnull; if (NS_OK == mWidget->QueryInterface(kIRadioIID,(void**)&radio)) { radio->SetState(aValue); NS_RELEASE(radio); return NS_OK; } }
if ((NS_FORM_INPUT_CHECKBOX == type) || (NS_FORM_INPUT_RADIO == type)) { nsAutoString value; value = (aValue) ? "1" : "0"; mInner.SetAttribute("checked", value, PR_TRUE);
nsHTMLInputElement::SetChecked(PRBool aValue){  PRInt32 type;  GetType(&type);  if (NS_FORM_INPUT_CHECKBOX == type) {    if (nsnull != mWidget) {      nsICheckButton* checkbox = nsnull;      if (NS_OK == mWidget->QueryInterface(kICheckButtonIID,(void**)&checkbox)) {        checkbox->SetState(aValue);         NS_RELEASE(checkbox);        return NS_OK;      }    }  } else if (NS_FORM_INPUT_RADIO == type) {    if (nsnull != mWidget) {      nsIRadioButton* radio = nsnull;      if (NS_OK == mWidget->QueryInterface(kIRadioIID,(void**)&radio)) {        radio->SetState(aValue);         NS_RELEASE(radio);        return NS_OK;      }    }  }     nsAutoString empty;                                                 if (aValue) {                                                         return mInner.SetAttribute(nsHTMLAtoms::checked, empty, PR_TRUE);   } else {                                                                mInner.UnsetAttribute(nsHTMLAtoms::checked, PR_TRUE);                 return NS_OK;                                                     }                                                                 }