Bug 534136 Part 3: Optimize atom-using code for the fact that atoms store 16bit strings. Also take advantage of new nsAtomString API. r=bz

This commit is contained in:
Jonas Sicking
2010-03-08 07:45:00 -08:00
parent 6859a5ac8e
commit 6b5d698011
41 changed files with 120 additions and 196 deletions

View File

@@ -4265,8 +4265,7 @@ nsGenericElement::AddScriptEventListener(nsIAtom* aEventName,
const nsAttrName*
nsGenericElement::InternalGetExistingAttrNameFromQName(const nsAString& aStr) const
{
return mAttrsAndChildren.GetExistingAttrNameFromQName(
NS_ConvertUTF16toUTF8(aStr));
return mAttrsAndChildren.GetExistingAttrNameFromQName(aStr);
}
nsresult
@@ -4423,12 +4422,11 @@ nsGenericElement::SetAttrAndNotify(PRInt32 aNamespaceID,
nsMutationEvent mutation(PR_TRUE, NS_MUTATION_ATTRMODIFIED);
nsAutoString attrName;
aName->ToString(attrName);
nsCOMPtr<nsIDOMAttr> attrNode;
nsAutoString ns;
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNamespaceID, ns);
GetAttributeNodeNS(ns, attrName, getter_AddRefs(attrNode));
GetAttributeNodeNS(ns, nsDependentAtomString(aName),
getter_AddRefs(attrNode));
mutation.mRelatedNode = attrNode;
mutation.mAttrName = aName;
@@ -4626,11 +4624,10 @@ nsGenericElement::UnsetAttr(PRInt32 aNameSpaceID, nsIAtom* aName,
// Grab the attr node if needed before we remove it from the attr map
nsCOMPtr<nsIDOMAttr> attrNode;
if (hasMutationListeners) {
nsAutoString attrName;
aName->ToString(attrName);
nsAutoString ns;
nsContentUtils::NameSpaceManager()->GetNameSpaceURI(aNameSpaceID, ns);
GetAttributeNodeNS(ns, attrName, getter_AddRefs(attrNode));
GetAttributeNodeNS(ns, nsDependentAtomString(aName),
getter_AddRefs(attrNode));
}
// Clear binding to nsIDOMNamedNodeMap