Bug 1269975 part 3 - Make some static arrays in nsCSSPseudoClasses.cpp static members of the class. r=heycam
☠☠ backed out by 9235ed9eac26 ☠ ☠
authorXidorn Quan <quanxunzhen@gmail.com>
Tue, 10 May 2016 13:36:25 +1000
changeset 296724 5321545b938ccdb01d30a1448cb12d73f940e8f3
parent 296723 7e4a2ee61ef3a22433aa16708bc6e89772ba9ed0
child 296725 a55ecedea260452b5c099c668531e1d61a762fba
push id76456
push userxquan@mozilla.com
push dateTue, 10 May 2016 03:37:58 +0000
treeherdermozilla-inbound@4e949692600a [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[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_) \
@@ -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[Type::Count];
+  static bool sPseudoClassEnabled[Type::Count];
 };
 
 #endif /* nsCSSPseudoClasses_h___ */