Bug 1181907 (Part 2) - Make nsCSSProperty hashable. r=heycam a=ritu
☠☠ backed out by ada03589e5ea ☠ ☠
authorSeth Fowler <mark.seth.fowler@gmail.com>
Wed, 26 Aug 2015 18:19:34 -0700
changeset 289176 97526d372199ca11d57c45959b853cc448a25dbd
parent 289175 4929041d9806546e5d20f498f02248d784b7309e
child 289177 77513059a6e4425a19d1c803fcb8225522c375d6
push id5067
push userraliiev@mozilla.com
push dateMon, 21 Sep 2015 14:04:52 +0000
treeherdermozilla-beta@14221ffe5b2f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersheycam, ritu
bugs1181907
milestone42.0a2
Bug 1181907 (Part 2) - Make nsCSSProperty hashable. r=heycam a=ritu
layout/style/nsCSSProperty.h
--- a/layout/style/nsCSSProperty.h
+++ b/layout/style/nsCSSProperty.h
@@ -3,16 +3,18 @@
  * License, v. 2.0. If a copy of the MPL was not distributed with this
  * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
 
 /* enum types for CSS properties and their values */
  
 #ifndef nsCSSProperty_h___
 #define nsCSSProperty_h___
 
+#include <nsHashKeys.h>
+
 /*
    Declare the enum list using the magic of preprocessing
    enum values are "eCSSProperty_foo" (where foo is the property)
 
    To change the list of properties, see nsCSSPropList.h
 
  */
 enum nsCSSProperty {
@@ -59,16 +61,27 @@ enum nsCSSProperty {
   // Extra dummy values for nsCSSParser internal use.
   eCSSPropertyExtra_x_none_value,
   eCSSPropertyExtra_x_auto_value,
 
   // Extra value to represent custom properties (--*).
   eCSSPropertyExtra_variable
 };
 
+namespace mozilla {
+
+template<>
+inline PLDHashNumber
+Hash<nsCSSProperty>(const nsCSSProperty& aValue)
+{
+  return uint32_t(aValue);
+}
+
+} // namespace mozilla
+
 // The "descriptors" that can appear in a @font-face rule.
 // They have the syntax of properties but different value rules.
 enum nsCSSFontDesc {
   eCSSFontDesc_UNKNOWN = -1,
 #define CSS_FONT_DESC(name_, method_) eCSSFontDesc_##method_,
 #include "nsCSSFontDescList.h"
 #undef CSS_FONT_DESC
   eCSSFontDesc_COUNT