NonCustomCSSPropertyId.h.in (2790B)
1 /* -*- Mode: C++; tab-width: 8; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ 2 /* vim: set ts=8 sts=2 et sw=2 tw=80: */ 3 /* This Source Code Form is subject to the terms of the Mozilla Public 4 * License, v. 2.0. If a copy of the MPL was not distributed with this 5 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ 6 7 /* enum types for CSS properties and their values */ 8 9 #ifndef NonCustomCSSPropertyId_h___ 10 #define NonCustomCSSPropertyId_h___ 11 12 #include <nsHashKeys.h> 13 14 /* 15 Declare the enum list using the magic of preprocessing 16 enum values are "eCSSProperty_foo" (where foo is the property) 17 18 To change the list of properties, see ServoCSSPropList.h 19 20 */ 21 enum NonCustomCSSPropertyId : uint16_t { 22 $property_ids 23 24 // Some of the values below could probably overlap with each other 25 // if we had a need for them to do so. 26 27 // Extra value to represent custom properties (--*). 28 eCSSPropertyExtra_variable, 29 30 eCSSProperty_UNKNOWN, 31 32 // Only needed for IPC serialization helper, should never be used in code. 33 eCSSProperty_INVALID, 34 }; 35 36 // MOZ_DBG support is defined in nsCSSProps.h since it depends on 37 // nsCSSProps::GetStringValue 38 39 static_assert(static_cast<uint64_t>($longhand_first) == 0); 40 41 const NonCustomCSSPropertyId 42 eCSSProperty_FIRST = NonCustomCSSPropertyId(0); 43 const NonCustomCSSPropertyId 44 eCSSProperty_COUNT_no_shorthands = $longhand_count; 45 const NonCustomCSSPropertyId 46 eCSSProperty_COUNT = $shorthand_count; 47 const NonCustomCSSPropertyId 48 eCSSProperty_COUNT_with_aliases = eCSSPropertyExtra_variable; 49 50 namespace mozilla { 51 52 template<> 53 inline PLDHashNumber 54 Hash<NonCustomCSSPropertyId>(const NonCustomCSSPropertyId& aValue) 55 { 56 return uint32_t(aValue); 57 } 58 59 } // namespace mozilla 60 61 // The "descriptors" that can appear in a @font-face rule. 62 // They have the syntax of properties but different value rules. 63 enum nsCSSFontDesc { 64 eCSSFontDesc_UNKNOWN = -1, 65 #define CSS_FONT_DESC(name_, method_) eCSSFontDesc_##method_, 66 #include "nsCSSFontDescList.h" 67 #undef CSS_FONT_DESC 68 eCSSFontDesc_COUNT 69 }; 70 71 // The "descriptors" that can appear in a @counter-style rule. 72 // They have the syntax of properties but different value rules. 73 enum nsCSSCounterDesc { 74 eCSSCounterDesc_UNKNOWN = -1, 75 #define CSS_COUNTER_DESC(name_, method_) eCSSCounterDesc_##method_, 76 #include "nsCSSCounterDescList.h" 77 #undef CSS_COUNTER_DESC 78 eCSSCounterDesc_COUNT 79 }; 80 81 namespace mozilla { 82 83 // FIXME: The underlying type of this enum should be uint8_t, but we can't do 84 // that because of https://bugs.llvm.org/show_bug.cgi?id=44228. 85 enum class CountedUnknownProperty : uint32_t { 86 #define COUNTED_UNKNOWN_PROPERTY(name_, method_) method_, 87 #include "mozilla/CountedUnknownProperties.h" 88 #undef COUNTED_UNKNOWN_PROPERTY 89 Count, 90 }; 91 92 } // namespace mozilla 93 94 #endif /* NonCustomCSSPropertyId_h___ */