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 107835 8e4eaae128c431f7b63ef14369243498dc945915
parent 107834 57fe0a88997c503668fd0bb153ee8c8af10d7938
child 107836 415f11a2bb1ae06e7bf912c48a4e7df43ca52bcf
push id15233
push userbzbarsky@mozilla.com
push dateSun, 23 Sep 2012 02:05:20 +0000
treeherdermozilla-inbound@415f11a2bb1a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerssicking
bugs793196
milestone18.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
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)