nsHTMLInputElement::SetChecked(PRBool aValue)
nsHTMLInputElement::SetChecked(PRBool aChecked)
nsHTMLInputElement::SetChecked(PRBool aValue){  SET_BOOLBIT(mBitField, BF_CHECKED_CHANGED, PR_TRUE);  //  // Set the value  //  SET_BOOLBIT(mBitField, BF_CHECKED, aValue);  //  // Notify the frame  //  // No need to flush here since if there's no frame for this input at  // this point we don't care about creating one, once it's created  // the frame will do the right thing.  PRInt32 type;  GetType(&type);  nsIFormControlFrame* formControlFrame = GetFormControlFrame(PR_FALSE);  if (formControlFrame) {    nsCOMPtr<nsIPresContext> presContext;    GetPresContext(this, getter_AddRefs(presContext));    if (type == NS_FORM_INPUT_CHECKBOX) {      nsICheckboxControlFrame* checkboxFrame = nsnull;      CallQueryInterface(formControlFrame, &checkboxFrame);      if (checkboxFrame) {        checkboxFrame->OnChecked(presContext, aValue);      }    } else if (type == NS_FORM_INPUT_RADIO) {      // the value is being toggled      nsAutoString val; val.AssignWithConversion(aValue ? "1" : "0");      formControlFrame->SetProperty(presContext, nsHTMLAtoms::checked, val);    }  }  else if (type == NS_FORM_INPUT_RADIO) {    SetPresStateChecked(this, aValue);    nsAutoString name;    GetName(name);    nsCOMPtr<nsIDOMHTMLFormElement> formElement;    if (NS_SUCCEEDED(GetForm(getter_AddRefs(formElement))) && formElement) {      nsCOMPtr<nsIDOMHTMLCollection> controls;      nsresult rv = formElement->GetElements(getter_AddRefs(controls));      if (controls) {        PRUint32 numControls;        controls->GetLength(&numControls);        for (PRUint32 i = 0; i < numControls; i++) {          nsCOMPtr<nsIDOMNode> elementNode;          controls->Item(i, getter_AddRefs(elementNode));          if (elementNode) {            nsCOMPtr<nsIDOMHTMLInputElement>              inputElement(do_QueryInterface(elementNode));            if (inputElement && inputElement.get() !=              NS_STATIC_CAST(nsIDOMHTMLInputElement *, this)) {              nsAutoString childName;              rv = inputElement->GetName(childName);              if (NS_SUCCEEDED(rv)) {                if (name == childName) {                  nsCOMPtr<nsIHTMLContent>                    htmlContent(do_QueryInterface(inputElement));                  SetPresStateChecked(htmlContent, PR_FALSE);                }              }            }          }        }      }    }  }  else if (type == NS_FORM_INPUT_CHECKBOX) {    if (GET_BOOLBIT(mBitField, BF_CHECKED))      SetAttr(kNameSpaceID_None, nsHTMLAtoms::inputCheckedPseudo,              NS_LITERAL_STRING(""), PR_TRUE);    else      UnsetAttr(kNameSpaceID_None, nsHTMLAtoms::inputCheckedPseudo, PR_TRUE);  }  return NS_OK;}