Bug 1449883 - Use `nsStaticAtom* const` instead of `nsStaticAtom**` in SVGTests. r=jwatt
MozReview-Commit-ID: JBqaxfrRNCn
--- a/dom/svg/SVGTests.cpp
+++ b/dom/svg/SVGTests.cpp
@@ -10,21 +10,21 @@
#include "mozilla/dom/SVGSwitchElement.h"
#include "nsCharSeparatedTokenizer.h"
#include "nsStyleUtil.h"
#include "mozilla/Preferences.h"
namespace mozilla {
namespace dom {
-nsStaticAtom** SVGTests::sStringListNames[3] =
+nsStaticAtom* const SVGTests::sStringListNames[3] =
{
- &nsGkAtoms::requiredFeatures,
- &nsGkAtoms::requiredExtensions,
- &nsGkAtoms::systemLanguage,
+ nsGkAtoms::requiredFeatures,
+ nsGkAtoms::requiredExtensions,
+ nsGkAtoms::systemLanguage,
};
SVGTests::SVGTests()
{
mStringListAttributes[LANGUAGE].SetIsCommaSeparated(true);
}
already_AddRefed<DOMSVGStringList>
@@ -54,17 +54,17 @@ SVGTests::HasExtension(const nsAString&
return nsSVGFeatures::HasExtension(aExtension,
AsSVGElement()->IsInChromeDocument());
}
bool
SVGTests::IsConditionalProcessingAttribute(const nsAtom* aAttribute) const
{
for (uint32_t i = 0; i < ArrayLength(sStringListNames); i++) {
- if (aAttribute == *sStringListNames[i]) {
+ if (aAttribute == sStringListNames[i]) {
return true;
}
}
return false;
}
int32_t
SVGTests::GetBestLanguagePreferenceRank(const nsAString& aAcceptLangs) const
@@ -174,44 +174,44 @@ SVGTests::PassesConditionalProcessingTes
}
bool
SVGTests::ParseConditionalProcessingAttribute(nsAtom* aAttribute,
const nsAString& aValue,
nsAttrValue& aResult)
{
for (uint32_t i = 0; i < ArrayLength(sStringListNames); i++) {
- if (aAttribute == *sStringListNames[i]) {
+ if (aAttribute == sStringListNames[i]) {
nsresult rv = mStringListAttributes[i].SetValue(aValue);
if (NS_FAILED(rv)) {
mStringListAttributes[i].Clear();
}
MaybeInvalidate();
return true;
}
}
return false;
}
void
SVGTests::UnsetAttr(const nsAtom* aAttribute)
{
for (uint32_t i = 0; i < ArrayLength(sStringListNames); i++) {
- if (aAttribute == *sStringListNames[i]) {
+ if (aAttribute == sStringListNames[i]) {
mStringListAttributes[i].Clear();
MaybeInvalidate();
return;
}
}
}
-nsAtom*
+nsStaticAtom*
SVGTests::GetAttrName(uint8_t aAttrEnum) const
{
- return *sStringListNames[aAttrEnum];
+ return sStringListNames[aAttrEnum];
}
void
SVGTests::GetAttrValue(uint8_t aAttrEnum, nsAttrValue& aValue) const
{
MOZ_ASSERT(aAttrEnum < ArrayLength(sStringListNames),
"aAttrEnum out of range");
aValue.SetTo(mStringListAttributes[aAttrEnum], nullptr);
--- a/dom/svg/SVGTests.h
+++ b/dom/svg/SVGTests.h
@@ -80,17 +80,17 @@ public:
const nsAString& aValue,
nsAttrValue& aResult);
/**
* Unsets a conditional processing attribute.
*/
void UnsetAttr(const nsAtom* aAttribute);
- nsAtom* GetAttrName(uint8_t aAttrEnum) const;
+ nsStaticAtom* GetAttrName(uint8_t aAttrEnum) const;
void GetAttrValue(uint8_t aAttrEnum, nsAttrValue &aValue) const;
void MaybeInvalidate();
// WebIDL
already_AddRefed<DOMSVGStringList> RequiredFeatures();
already_AddRefed<DOMSVGStringList> RequiredExtensions();
already_AddRefed<DOMSVGStringList> SystemLanguage();
@@ -104,17 +104,17 @@ public:
}
protected:
virtual ~SVGTests() {}
private:
enum { FEATURES, EXTENSIONS, LANGUAGE };
SVGStringList mStringListAttributes[3];
- static nsStaticAtom** sStringListNames[3];
+ static nsStaticAtom* const sStringListNames[3];
};
NS_DEFINE_STATIC_IID_ACCESSOR(SVGTests, MOZILLA_DOMSVGTESTS_IID)
} // namespace dom
} // namespace mozilla
#endif // mozilla_dom_SVGTests_h
--- a/dom/svg/nsSVGElement.cpp
+++ b/dom/svg/nsSVGElement.cpp
@@ -2380,32 +2380,32 @@ nsSVGElement::GetStringListInfo()
{
return StringListAttributesInfo(nullptr, nullptr, 0);
}
nsAttrValue
nsSVGElement::WillChangeStringList(bool aIsConditionalProcessingAttribute,
uint8_t aAttrEnum)
{
- nsAtom* name;
+ nsStaticAtom* name;
if (aIsConditionalProcessingAttribute) {
nsCOMPtr<SVGTests> tests(do_QueryInterface(static_cast<nsIDOMElement*>(this)));
name = tests->GetAttrName(aAttrEnum);
} else {
name = GetStringListInfo().mStringListInfo[aAttrEnum].mName;
}
return WillChangeValue(name);
}
void
nsSVGElement::DidChangeStringList(bool aIsConditionalProcessingAttribute,
uint8_t aAttrEnum,
const nsAttrValue& aEmptyOrOldValue)
{
- nsAtom* name;
+ nsStaticAtom* name;
nsAttrValue newValue;
nsCOMPtr<SVGTests> tests;
if (aIsConditionalProcessingAttribute) {
tests = do_QueryObject(this);
name = tests->GetAttrName(aAttrEnum);
tests->GetAttrValue(aAttrEnum, newValue);
} else {