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 ((nsLayoutAtoms::onclick == aAttribute) || (nsLayoutAtoms::ondblclick == aAttribute) || (nsLayoutAtoms::onmousedown == aAttribute) || (nsLayoutAtoms::onmouseup == aAttribute) || (nsLayoutAtoms::onmouseover == aAttribute) || (nsLayoutAtoms::onmouseout == aAttribute)) AddScriptEventListener(aAttribute, aValue, kIDOMMouseListenerIID); else if ((nsLayoutAtoms::onkeydown == aAttribute) || (nsLayoutAtoms::onkeyup == aAttribute) || (nsLayoutAtoms::onkeypress == aAttribute)) AddScriptEventListener(aAttribute, aValue, kIDOMKeyListenerIID); else if (nsLayoutAtoms::onmousemove == aAttribute) AddScriptEventListener(aAttribute, aValue, kIDOMMouseMotionListenerIID); else if (nsLayoutAtoms::onload == aAttribute) AddScriptEventListener(nsLayoutAtoms::onload, aValue, kIDOMLoadListenerIID); else if ((nsLayoutAtoms::onunload == aAttribute) || (nsLayoutAtoms::onabort == aAttribute) || (nsLayoutAtoms::onerror == aAttribute)) AddScriptEventListener(aAttribute, aValue, kIDOMLoadListenerIID); else if ((nsLayoutAtoms::onfocus == aAttribute) || (nsLayoutAtoms::onblur == aAttribute)) AddScriptEventListener(aAttribute, aValue, kIDOMFocusListenerIID); else if ((nsLayoutAtoms::onsubmit == aAttribute) || (nsLayoutAtoms::onreset == aAttribute) || (nsLayoutAtoms::onchange == aAttribute) || (nsLayoutAtoms::onselect == aAttribute)) AddScriptEventListener(aAttribute, aValue, kIDOMFormListenerIID); else if (nsLayoutAtoms::onpaint == aAttribute || nsLayoutAtoms::onresize == aAttribute || nsLayoutAtoms::onscroll == aAttribute) AddScriptEventListener(aAttribute, aValue, kIDOMPaintListenerIID); else if (nsLayoutAtoms::oninput == aAttribute) AddScriptEventListener(aAttribute, aValue, kIDOMFormListenerIID); }  nsHTMLValue val; nsIHTMLContent* htmlContent;  result = mContent->QueryInterface(kIHTMLContentIID, (void **)&htmlContent); if (NS_OK != result) { return result; } if (NS_CONTENT_ATTR_NOT_THERE != htmlContent->StringToAttribute(aAttribute, aValue, val)) {  result = SetHTMLAttribute(aAttribute, val, aNotify); NS_RELEASE(htmlContent); return result; } else { if (ParseCommonAttribute(aAttribute, aValue, val)) {  result = SetHTMLAttribute(aAttribute, val, aNotify); NS_RELEASE(htmlContent); return result; } if (0 == aValue.Length()) { val.SetEmptyValue(); result = SetHTMLAttribute(aAttribute, val, aNotify); NS_RELEASE(htmlContent); return result; }   nsAutoString strValue; result = GetAttribute(aNameSpaceID, aAttribute, strValue); if ((NS_CONTENT_ATTR_NOT_THERE != result) && aValue.Equals(strValue)) { NS_RELEASE(htmlContent); return NS_OK; }  if (aNotify && (nsnull != mDocument)) { mDocument->BeginUpdate(); }   PRBool  impact = NS_STYLE_HINT_NONE; htmlContent->GetMappedAttributeImpact(aAttribute, impact);  if (nsnull != mDocument) { nsIHTMLStyleSheet*  sheet = GetAttrStyleSheet(mDocument); if (nsnull != sheet) { result = sheet->SetAttributeFor(aAttribute, aValue, (NS_STYLE_HINT_CONTENT < impact), htmlContent, mAttributes); NS_RELEASE(sheet); } } else { result = EnsureWritableAttributes(htmlContent, mAttributes, PR_TRUE); if (nsnull != mAttributes) { PRInt32   count; result = mAttributes->SetAttributeFor(aAttribute, aValue, (NS_STYLE_HINT_CONTENT < impact), htmlContent, nsnull, count); if (0 == count) { ReleaseAttributes(mAttributes); } } } } NS_RELEASE(htmlContent);  if (aNotify && (nsnull != mDocument)) { result = mDocument->AttributeChanged(mContent, aNameSpaceID, aAttribute, NS_STYLE_HINT_UNKNOWN); mDocument->EndUpdate(); }  return result; }
  nsresult SetAttribute(const nsAReadableString& aName, const nsAReadableString& aValue)  {    return nsGenericHTMLElement::SetAttribute(aName, aValue);  }