From 0bbe4a681c461ee62439b01f5c488a6db47b1f39 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emilio=20Cobos=20=C3=81lvarez?= Date: Thu, 21 Jul 2016 19:43:38 -0700 Subject: [PATCH] Bug 1288590: Use GetAttrInfoAt in ServoBindings.cpp. r=bholley MozReview-Commit-ID: 5tglYnx8pJk --- layout/style/ServoBindings.cpp | 10 ++++------ layout/style/ServoElementSnapshot.h | 7 ++++--- 2 files changed, 8 insertions(+), 9 deletions(-) diff --git a/layout/style/ServoBindings.cpp b/layout/style/ServoBindings.cpp index c3b1b41562de..2de6340d7d5c 100644 --- a/layout/style/ServoBindings.cpp +++ b/layout/style/ServoBindings.cpp @@ -213,14 +213,12 @@ DoMatch(Implementor* aElement, nsIAtom* aNS, nsIAtom* aName, MatchFn aMatch) 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; } } diff --git a/layout/style/ServoElementSnapshot.h b/layout/style/ServoElementSnapshot.h index 9042f69053a6..34cc22b01c51 100644 --- a/layout/style/ServoElementSnapshot.h +++ b/layout/style/ServoElementSnapshot.h @@ -11,6 +11,7 @@ #include "mozilla/TypedEnumBits.h" #include "nsAttrName.h" #include "nsAttrValue.h" +#include "nsAttrInfo.h" #include "nsChangeHint.h" #include "nsIAtom.h" @@ -115,12 +116,12 @@ public: /** * 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