layout/style/nsStyleStructFwd.h

branch
TOR_BUG_3246
changeset 6
8bccb770b82d
equal deleted inserted replaced
-1:000000000000 0:0b66b35a2982
1 /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
2 /* This Source Code Form is subject to the terms of the Mozilla Public
3 * License, v. 2.0. If a copy of the MPL was not distributed with this
4 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */
5
6 /*
7 * Forward declarations to avoid including all of nsStyleStruct.h.
8 */
9
10 #ifndef nsStyleStructFwd_h_
11 #define nsStyleStructFwd_h_
12
13 enum nsStyleStructID {
14
15 /*
16 * Define the constants eStyleStruct_Font, etc.
17 *
18 * The C++ standard, section 7.2, guarantees that enums begin with 0 and
19 * increase by 1.
20 *
21 * We separate the IDs of Reset and Inherited structs so that we can use
22 * the IDs as indices (offset by nsStyleStructID_*_Start) into arrays of
23 * one type or the other.
24 */
25
26 nsStyleStructID_Inherited_Start = 0,
27 // a dummy value so the value after it is the same as ..._Inherited_Start
28 nsStyleStructID_DUMMY1 = nsStyleStructID_Inherited_Start - 1,
29
30 #define STYLE_STRUCT_INHERITED(name, checkdata_cb) \
31 eStyleStruct_##name,
32 #define STYLE_STRUCT_RESET(name, checkdata_cb)
33 #include "nsStyleStructList.h"
34 #undef STYLE_STRUCT_INHERITED
35 #undef STYLE_STRUCT_RESET
36
37 nsStyleStructID_Reset_Start,
38 // a dummy value so the value after it is the same as ..._Reset_Start
39 nsStyleStructID_DUMMY2 = nsStyleStructID_Reset_Start - 1,
40
41 #define STYLE_STRUCT_RESET(name, checkdata_cb) \
42 eStyleStruct_##name,
43 #define STYLE_STRUCT_INHERITED(name, checkdata_cb)
44 #include "nsStyleStructList.h"
45 #undef STYLE_STRUCT_INHERITED
46 #undef STYLE_STRUCT_RESET
47
48 // one past the end; length of 0-based list
49 nsStyleStructID_Length,
50
51 nsStyleStructID_Inherited_Count =
52 nsStyleStructID_Reset_Start - nsStyleStructID_Inherited_Start,
53 nsStyleStructID_Reset_Count =
54 nsStyleStructID_Length - nsStyleStructID_Reset_Start,
55
56 // An ID used for properties that are not in style structs. This is
57 // used only in some users of nsStyleStructID, such as
58 // nsCSSProps::kSIDTable, including some that store SIDs in a bitfield,
59 // such as nsCSSCompressedDataBlock::mStyleBits.
60 eStyleStruct_BackendOnly = nsStyleStructID_Length
61
62 };
63
64 // A bit corresponding to each struct ID
65 #define NS_STYLE_INHERIT_BIT(sid_) (1 << uint64_t(eStyleStruct_##sid_))
66
67 #endif /* nsStyleStructFwd_h_ */

mercurial