Bug 1269975 part 3 - Make some static arrays in nsCSSPseudoClasses.cpp static members of the class. r=heycam
authorXidorn Quan <quanxunzhen@gmail.com>
Tue, 10 May 2016 18:44:05 +1000
changeset 296815 d0769e80038115a28d497bcdc1166ae216f46747
parent 296814 7754dd0b76b008f5164a3f8cf6bba6cb36e794c3
child 296816 e29698cb0cf5ab1c3e16eab9fc0099ab06cba7d5
push id30247
push userkwierso@gmail.com
push dateTue, 10 May 2016 22:20:29 +0000
treeherdermozilla-central@674a55274378 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam
bugs1269975
milestone49.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1269975 part 3 - Make some static arrays in nsCSSPseudoClasses.cpp static members of the class. r=heycam MozReview-Commit-ID: 4CRtDgiYKnO
layout/style/nsCSSPseudoClasses.cpp
layout/style/nsCSSPseudoClasses.h
--- 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[] = {
 #define CSS_PSEUDO_CLASS(name_, value_, flags_, pref_) \
   flags_,
 #include "nsCSSPseudoClassList.h"
 #undef CSS_PSEUDO_CLASS
 };
 
-static bool sPseudoClassEnabled[] = {
+/* static */ bool
+nsCSSPseudoClasses::sPseudoClassEnabled[] = {
 // 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_) \
@@ -140,13 +142,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[size_t(Type::Count)];
+  static bool sPseudoClassEnabled[size_t(Type::Count)];
 };
 
 #endif /* nsCSSPseudoClasses_h___ */