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 nsCSSPropertyID_h___
10#define nsCSSPropertyID_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 */
21enum nsCSSPropertyID {
22  eCSSProperty_UNKNOWN = -1,
23
24$property_ids
25
26  // Some of the values below could probably overlap with each other
27  // if we had a need for them to do so.
28
29  // Extra values for use in the values of the 'transition-property'
30  // property.
31  eCSSPropertyExtra_no_properties,
32  eCSSPropertyExtra_all_properties,
33
34  // Extra value to represent custom properties (--*).
35  eCSSPropertyExtra_variable,
36};
37
38// MOZ_DBG support is defined in nsCSSProps.h since it depends on
39// nsCSSProps::GetStringValue
40
41const nsCSSPropertyID
42  eCSSProperty_COUNT_no_shorthands = $longhand_count;
43const nsCSSPropertyID
44  eCSSProperty_COUNT = $shorthand_count;
45const nsCSSPropertyID
46  eCSSProperty_COUNT_with_aliases = eCSSPropertyExtra_no_properties;
47
48namespace mozilla {
49
50template<>
51inline PLDHashNumber
52Hash<nsCSSPropertyID>(const nsCSSPropertyID& aValue)
53{
54  return uint32_t(aValue);
55}
56
57} // namespace mozilla
58
59// The "descriptors" that can appear in a @font-face rule.
60// They have the syntax of properties but different value rules.
61enum nsCSSFontDesc {
62  eCSSFontDesc_UNKNOWN = -1,
63#define CSS_FONT_DESC(name_, method_) eCSSFontDesc_##method_,
64#include "nsCSSFontDescList.h"
65#undef CSS_FONT_DESC
66  eCSSFontDesc_COUNT
67};
68
69// The "descriptors" that can appear in a @counter-style rule.
70// They have the syntax of properties but different value rules.
71enum nsCSSCounterDesc {
72  eCSSCounterDesc_UNKNOWN = -1,
73#define CSS_COUNTER_DESC(name_, method_) eCSSCounterDesc_##method_,
74#include "nsCSSCounterDescList.h"
75#undef CSS_COUNTER_DESC
76  eCSSCounterDesc_COUNT
77};
78
79namespace mozilla {
80
81// FIXME: The underlying type of this enum should be uint8_t, but we can't do
82// that because of https://bugs.llvm.org/show_bug.cgi?id=44228.
83enum class CountedUnknownProperty : uint32_t {
84#define COUNTED_UNKNOWN_PROPERTY(name_, method_) method_,
85#include "mozilla/CountedUnknownProperties.h"
86#undef COUNTED_UNKNOWN_PROPERTY
87  Count,
88};
89
90} // namespace mozilla
91
92#endif /* nsCSSPropertyID_h___ */
93