Bug 1288590: Use GetAttrInfoAt in ServoBindings.cpp. r=bholley

MozReview-Commit-ID: 5tglYnx8pJk
This commit is contained in:
Emilio Cobos Álvarez 2016-07-21 19:43:38 -07:00
Родитель ba64988f2f
Коммит 0bbe4a681c
2 изменённых файлов: 8 добавлений и 9 удалений

Просмотреть файл

@ -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;
}
}

Просмотреть файл

@ -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