nsresult HTMLMenuItemElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName, const nsAttrValue* aValue, bool aNotify) { if (aNameSpaceID == kNameSpaceID_None) { if ((aName == nsGkAtoms::radiogroup || aName == nsGkAtoms::type) && mType == CMD_TYPE_RADIO && !mParserCreating) { if (IsInDoc() && GetParent()) { AddedToRadioGroup(); } } // Checked must be set no matter what type of menuitem it is, since // GetChecked() must reflect the new value if (aName == nsGkAtoms::checked && !mCheckedDirty) { if (mParserCreating) { mShouldInitChecked = true; } else { InitChecked(); } } } return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue, aNotify); }
nsresult HTMLMenuItemElement::BindToTree(nsIDocument* aDocument, nsIContent* aParent, nsIContent* aBindingParent) { nsresult rv = nsGenericHTMLElement::BindToTree(aDocument, aParent, aBindingParent); if (NS_SUCCEEDED(rv) && aDocument && mType == CMD_TYPE_RADIO) { AddedToRadioGroup(); } return rv; }
nsresult HTMLMenuItemElement::AfterSetAttr(int32_t aNameSpaceID, nsAtom* aName, const nsAttrValue* aValue, const nsAttrValue* aOldValue, nsIPrincipal* aSubjectPrincipal, bool aNotify) { if (aNameSpaceID == kNameSpaceID_None) { // Handle type changes first, since some of the later conditions in this // method look at mType and want to see the new value. if (aName == nsGkAtoms::type) { if (aValue) { mType = aValue->GetEnumValue(); } else { mType = kMenuItemDefaultType->value; } } if ((aName == nsGkAtoms::radiogroup || aName == nsGkAtoms::type) && mType == CMD_TYPE_RADIO && !mParserCreating) { if (IsInUncomposedDoc() && GetParent()) { AddedToRadioGroup(); } } // Checked must be set no matter what type of menuitem it is, since // GetChecked() must reflect the new value if (aName == nsGkAtoms::checked && !mCheckedDirty) { if (mParserCreating) { mShouldInitChecked = true; } else { InitChecked(); } } } return nsGenericHTMLElement::AfterSetAttr(aNameSpaceID, aName, aValue, aOldValue, aSubjectPrincipal, aNotify); }