Bug 793196. Speed up hasAttribute string munging of the attr name. r=sicking
authorBoris Zbarsky <bzbarsky@mit.edu>
Sat, 22 Sep 2012 22:04:54 -0400
changeset 107944 8e4eaae128c431f7b63ef14369243498dc945915
parent 107943 57fe0a88997c503668fd0bb153ee8c8af10d7938
child 107945 415f11a2bb1ae06e7bf912c48a4e7df43ca52bcf
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewerssicking
bugs793196
milestone18.0a1
Bug 793196. Speed up hasAttribute string munging of the attr name. r=sicking
content/base/src/nsGenericElement.cpp
--- a/content/base/src/nsGenericElement.cpp
+++ b/content/base/src/nsGenericElement.cpp
@@ -1155,18 +1155,21 @@ nsGenericElement::GetElementsByTagNameNS
   return NS_OK;
 }
 
 nsresult
 nsGenericElement::HasAttribute(const nsAString& aName, bool* aReturn)
 {
   NS_ENSURE_ARG_POINTER(aReturn);
 
-  const nsAttrName* name = InternalGetExistingAttrNameFromQName(aName);
-  *aReturn = (name != nullptr);
+  const nsAttrValue* val =
+    mAttrsAndChildren.GetAttr(aName,
+                              IsHTML() && IsInHTMLDocument() ?
+                                eIgnoreCase : eCaseMatters);
+  *aReturn = (val != nullptr);
 
   return NS_OK;
 }
 
 nsresult
 nsGenericElement::HasAttributeNS(const nsAString& aNamespaceURI,
                                  const nsAString& aLocalName,
                                  bool* aReturn)