Bug 1839315: part 4) Link from `SheetLoadData::mWasAlternate` to spec. r=emilio DONTBUILD
[gecko.git] / layout / style / nsStyleStructFwd.h
blob5187a764b9776a6de191405dd324152a9485e7dd
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/. */
7 /*
8 * Forward declarations to avoid including all of nsStyleStruct.h.
9 */
11 #ifndef nsStyleStructFwd_h_
12 #define nsStyleStructFwd_h_
14 namespace mozilla {
16 enum class StyleStructID : uint32_t {
18 * Define the constants eStyleStruct_Font, etc.
20 * The C++ standard, section 7.2, guarantees that enums begin with 0 and
21 * increase by 1.
23 * Note that we rely on the inherited structs being before the rest in
24 * ComputedStyle.
26 #define STYLE_STRUCT_INHERITED(name) name,
27 #define STYLE_STRUCT_RESET(name)
28 #include "nsStyleStructList.h"
29 #undef STYLE_STRUCT_INHERITED
30 #undef STYLE_STRUCT_RESET
32 #define STYLE_STRUCT_RESET(name) name,
33 #define STYLE_STRUCT_INHERITED(name)
34 #include "nsStyleStructList.h"
35 #undef STYLE_STRUCT_INHERITED
36 #undef STYLE_STRUCT_RESET
39 struct StyleStructConstants {
40 static const uint32_t kStyleStructCount =
41 #define STYLE_STRUCT_RESET(name) 1 +
42 #define STYLE_STRUCT_INHERITED(name) 1 +
43 #include "nsStyleStructList.h"
44 #undef STYLE_STRUCT_INHERITED
45 #undef STYLE_STRUCT_RESET
48 static const uint32_t kInheritedStyleStructCount =
49 #define STYLE_STRUCT_RESET(name)
50 #define STYLE_STRUCT_INHERITED(name) 1 +
51 #include "nsStyleStructList.h"
52 #undef STYLE_STRUCT_INHERITED
53 #undef STYLE_STRUCT_RESET
56 static const uint32_t kResetStyleStructCount =
57 #define STYLE_STRUCT_RESET(name) 1 +
58 #define STYLE_STRUCT_INHERITED(name)
59 #include "nsStyleStructList.h"
60 #undef STYLE_STRUCT_INHERITED
61 #undef STYLE_STRUCT_RESET
64 static_assert(kStyleStructCount <= 32, "Bitmasks must be bigger!");
66 static const uint32_t kAllStructsMask = (1 << kStyleStructCount) - 1;
67 static const uint32_t kInheritedStructsMask =
68 (1 << kInheritedStyleStructCount) - 1;
69 static const uint32_t kResetStructsMask =
70 kAllStructsMask & (~kInheritedStructsMask);
72 static uint32_t BitFor(StyleStructID aID) {
73 return 1 << static_cast<uint32_t>(aID);
77 } // namespace mozilla
79 #endif /* nsStyleStructFwd_h_ */