Bug 1269975 part 3 - Make some static arrays in nsCSSPseudoClasses.cpp static members of the class. r?heycam
MozReview-Commit-ID: 4CRtDgiYKnO
--- a/layout/style/nsCSSPseudoClasses.cpp
+++ b/layout/style/nsCSSPseudoClasses.cpp
@@ -39,24 +39,26 @@ static const nsStaticAtom CSSPseudoClass
NS_STATIC_ATOM(name_##_pseudo_class_buffer, &sPseudoClass_##name_),
#include "nsCSSPseudoClassList.h"
#undef CSS_PSEUDO_CLASS
};
// Flags data for each of the pseudo-classes, which must be separate
// from the previous array since there's no place for it in
// nsStaticAtom.
-static const uint32_t CSSPseudoClasses_flags[] = {
+/* static */ const uint32_t
+nsCSSPseudoClasses::kPseudoClassFlags[Type::Count] = {
#define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
flags_,
#include "nsCSSPseudoClassList.h"
#undef CSS_PSEUDO_CLASS
};
-static bool sPseudoClassEnabled[] = {
+/* static */ bool
+nsCSSPseudoClasses::sPseudoClassEnabled[Type::Count] = {
// If the pseudo class has any "ENABLED_IN" flag set, it is disabled by
// default. Note that, if a pseudo class has pref, whatever its default
// value is, it'll later be changed in nsCSSPseudoClasses::AddRefAtoms()
// If the pseudo class has "ENABLED_IN" flags but doesn't have a pref,
// it is an internal pseudo class which is disabled elsewhere.
#define IS_ENABLED_BY_DEFAULT(flags_) \
(!((flags_) & CSS_PSEUDO_CLASS_ENABLED_MASK))
#define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
@@ -139,13 +141,13 @@ nsCSSPseudoClasses::IsUserActionPseudoCl
aType == Type::active ||
aType == Type::focus;
}
/* static */ uint32_t
nsCSSPseudoClasses::FlagsForPseudoClass(const Type aType)
{
size_t index = static_cast<size_t>(aType);
- NS_ASSERTION(index < ArrayLength(CSSPseudoClasses_flags),
- "argument must be a pseudo-class");
- return CSSPseudoClasses_flags[index];
+ MOZ_ASSERT(index < ArrayLength(kPseudoClassFlags),
+ "argument must be a pseudo-class");
+ return kPseudoClassFlags[index];
}
--- a/layout/style/nsCSSPseudoClasses.h
+++ b/layout/style/nsCSSPseudoClasses.h
@@ -61,11 +61,14 @@ public:
}
static bool IsUserActionPseudoClass(Type aType);
// Should only be used on types other than Count and NotPseudoClass
static void PseudoTypeToString(Type aType, nsAString& aString);
private:
static uint32_t FlagsForPseudoClass(const Type aType);
+
+ static const uint32_t kPseudoClassFlags[Type::Count];
+ static bool sPseudoClassEnabled[Type::Count];
};
#endif /* nsCSSPseudoClasses_h___ */