Bug 1288590: Use GetAttrInfoAt in ServoBindings.cpp. r=bholley
authorEmilio Cobos Álvarez <ecoal95@gmail.com>
Thu, 21 Jul 2016 19:43:38 -0700
changeset 332011 78313fb0c8f96140689286778bf040282f2c8100
parent 332010 11e5869e834d8813f1d32da0aeeb5ed664c2c91c
child 332012 fba6db64d336d8145e605a1304d266a5162bdd49
push id9858
push userjlund@mozilla.com
push dateMon, 01 Aug 2016 14:37:10 +0000
treeherdermozilla-aurora@203106ef6cb6 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersbholley
bugs1288590
milestone50.0a1
Bug 1288590: Use GetAttrInfoAt in ServoBindings.cpp. r=bholley MozReview-Commit-ID: 5tglYnx8pJk
layout/style/ServoBindings.cpp
layout/style/ServoElementSnapshot.h
--- a/layout/style/ServoBindings.cpp
+++ b/layout/style/ServoBindings.cpp
@@ -208,24 +208,22 @@ DoMatch(Implementor* aElement, nsIAtom* 
 {
   if (aNS) {
     int32_t ns = nsContentUtils::NameSpaceManager()->GetNameSpaceID(aNS);
     NS_ENSURE_TRUE(ns != kNameSpaceID_Unknown, false);
     const nsAttrValue* value = aElement->GetParsedAttr(aName, ns);
     return value && aMatch(value);
   }
   // No namespace means any namespace - we have to check them all. :-(
-  const nsAttrName* attrName;
-  for (uint32_t i = 0; (attrName = aElement->GetAttrNameAt(i)); ++i) {
-    if (attrName->LocalName() != aName) {
+  nsAttrInfo attrInfo;
+  for (uint32_t i = 0; (attrInfo = aElement->GetAttrInfoAt(i)); ++i) {
+    if (attrInfo.mName->LocalName() != aName) {
       continue;
     }
-    const nsAttrValue* value =
-      aElement->GetParsedAttr(attrName->LocalName(), attrName->NamespaceID());
-    if (aMatch(value)) {
+    if (aMatch(attrInfo.mValue)) {
       return true;
     }
   }
   return false;
 }
 
 // Work around our overly-restrictive static analysis. This can be removed once
 // bug 1281935 lands.
--- a/layout/style/ServoElementSnapshot.h
+++ b/layout/style/ServoElementSnapshot.h
@@ -6,16 +6,17 @@
 
 #ifndef mozilla_ServoElementSnapshot_h
 #define mozilla_ServoElementSnapshot_h
 
 #include "mozilla/EventStates.h"
 #include "mozilla/TypedEnumBits.h"
 #include "nsAttrName.h"
 #include "nsAttrValue.h"
+#include "nsAttrInfo.h"
 #include "nsChangeHint.h"
 #include "nsIAtom.h"
 
 namespace mozilla {
 
 namespace dom {
 class Element;
 } // namespace dom
@@ -110,22 +111,22 @@ public:
 
   nsRestyleHint ExplicitRestyleHint() { return mExplicitRestyleHint; }
 
   nsChangeHint ExplicitChangeHint() { return mExplicitChangeHint; }
 
   /**
    * Needed methods for attribute matching.
    */
-  const nsAttrName* GetAttrNameAt(uint32_t aIndex) const
+  nsAttrInfo GetAttrInfoAt(uint32_t aIndex) const
   {
     if (aIndex >= mAttrs.Length()) {
-      return nullptr;
+      return nsAttrInfo(nullptr, nullptr);
     }
-    return &mAttrs[aIndex].mName;
+    return nsAttrInfo(&mAttrs[aIndex].mName, &mAttrs[aIndex].mValue);
   }
 
   const nsAttrValue* GetParsedAttr(nsIAtom* aLocalName) const
   {
     return GetParsedAttr(aLocalName, kNameSpaceID_None);
   }
 
   const nsAttrValue* GetParsedAttr(nsIAtom* aLocalName,