if (nsHTMLAtoms::style == aAttribute) { if (mDocument) { nsHTMLValue parsedValue; ParseStyleAttribute(aValue, parsedValue); result = SetHTMLAttribute(aAttribute, parsedValue, aNotify); } else { result = SetHTMLAttribute(aAttribute, nsHTMLValue(aValue), aNotify); } return result; } else {  if (IsEventName(aAttribute)) { AddScriptEventListener(aAttribute, aValue); } }  nsHTMLValue val;  nsAutoString strValue; PRBool modification = PR_TRUE;  if (NS_CONTENT_ATTR_NOT_THERE != StringToAttribute(aAttribute, aValue, val)) {  return SetHTMLAttribute(aAttribute, val, aNotify); } else { if (ParseCommonAttribute(aAttribute, aValue, val)) {  return SetHTMLAttribute(aAttribute, val, aNotify); }  if (aValue.IsEmpty()) { val.SetEmptyValue(); return SetHTMLAttribute(aAttribute, val, aNotify); }   result = GetAttr(aNameSpaceID, aAttribute, strValue); if ((NS_CONTENT_ATTR_NOT_THERE != result) && aValue.Equals(strValue)) { return NS_OK; }  modification = (result != NS_CONTENT_ATTR_NOT_THERE);  if (aNotify && (nsnull != mDocument)) { mDocument->BeginUpdate();  mDocument->AttributeWillChange(this, aNameSpaceID, aAttribute); }   PRBool  impact = NS_STYLE_HINT_NONE; PRInt32 modHint = modification ? PRInt32(nsIDOMMutationEvent::MODIFICATION) : PRInt32(nsIDOMMutationEvent::ADDITION); GetMappedAttributeImpact(aAttribute, modHint, impact);  nsCOMPtr<nsIHTMLStyleSheet> sheet(dont_AddRef(GetAttrStyleSheet(mDocument))); if (sheet) { result = sheet->SetAttributeFor(aAttribute, aValue, (NS_STYLE_HINT_CONTENT < impact), this, mAttributes); } else { result = EnsureWritableAttributes(this, mAttributes, PR_TRUE); if (mAttributes) { PRInt32   count; result = mAttributes->SetAttributeFor(aAttribute, aValue, (NS_STYLE_HINT_CONTENT < impact), this, nsnull, count); if (0 == count) { ReleaseAttributes(mAttributes); } } } }  if (mDocument) { nsCOMPtr<nsIBindingManager> bindingManager; mDocument->GetBindingManager(getter_AddRefs(bindingManager)); nsCOMPtr<nsIXBLBinding> binding; bindingManager->GetBinding(this, getter_AddRefs(binding)); if (binding) binding->AttributeChanged(aAttribute, aNameSpaceID, PR_FALSE);  if (nsGenericElement::HasMutationListeners(this, NS_EVENT_BITS_MUTATION_ATTRMODIFIED)) { nsCOMPtr<nsIDOMEventTarget> node(do_QueryInterface(NS_STATIC_CAST(nsIContent *, this))); nsMutationEvent mutation; mutation.eventStructType = NS_MUTATION_EVENT; mutation.message = NS_MUTATION_ATTRMODIFIED; mutation.mTarget = node;  nsAutoString attrName; aAttribute->ToString(attrName); nsCOMPtr<nsIDOMAttr> attrNode; GetAttributeNode(attrName, getter_AddRefs(attrNode)); mutation.mRelatedNode = attrNode;  mutation.mAttrName = aAttribute; if (!strValue.IsEmpty()) mutation.mPrevAttrValue = getter_AddRefs(NS_NewAtom(strValue)); if (!aValue.IsEmpty()) mutation.mNewAttrValue = getter_AddRefs(NS_NewAtom(aValue)); if (modification) mutation.mAttrChange = nsIDOMMutationEvent::MODIFICATION; else mutation.mAttrChange = nsIDOMMutationEvent::ADDITION; nsEventStatus status = nsEventStatus_eIgnore; HandleDOMEvent(nsnull, &mutation, nsnull, NS_EVENT_FLAG_INIT, &status); }  if (aNotify) { PRInt32 modHint = modification ? PRInt32(nsIDOMMutationEvent::MODIFICATION) : PRInt32(nsIDOMMutationEvent::ADDITION); mDocument->AttributeChanged(this, aNameSpaceID, aAttribute, modHint, NS_STYLE_HINT_UNKNOWN); mDocument->EndUpdate(); } }  return result; }
  nsresult SetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,                   const nsAString& aValue, PRBool aNotify)  {    return SetAttr(aNameSpaceID, aName, nsnull, aValue, aNotify);  }