Coverage Report

Created: 2018-09-25 14:53

/work/obj-fuzz/dist/include/nsStyleStructFwd.h
Line
Count
Source (jump to first uncovered line)
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
/*
8
 * Forward declarations to avoid including all of nsStyleStruct.h.
9
 */
10
11
#ifndef nsStyleStructFwd_h_
12
#define nsStyleStructFwd_h_
13
14
namespace mozilla {
15
16
enum class StyleStructID : uint32_t {
17
/*
18
 * Define the constants eStyleStruct_Font, etc.
19
 *
20
 * The C++ standard, section 7.2, guarantees that enums begin with 0 and
21
 * increase by 1.
22
 *
23
 * Note that we rely on the inherited structs being before the rest in
24
 * ComputedStyle.
25
 */
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
31
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
37
};
38
39
struct StyleStructConstants
40
{
41
  static const uint32_t kStyleStructCount =
42
#define STYLE_STRUCT_RESET(name) 1 +
43
#define STYLE_STRUCT_INHERITED(name) 1 +
44
#include "nsStyleStructList.h"
45
#undef STYLE_STRUCT_INHERITED
46
#undef STYLE_STRUCT_RESET
47
    0;
48
49
  static const uint32_t kInheritedStyleStructCount =
50
#define STYLE_STRUCT_RESET(name)
51
#define STYLE_STRUCT_INHERITED(name) 1 +
52
#include "nsStyleStructList.h"
53
#undef STYLE_STRUCT_INHERITED
54
#undef STYLE_STRUCT_RESET
55
    0;
56
57
  static const uint32_t kResetStyleStructCount =
58
#define STYLE_STRUCT_RESET(name) 1 +
59
#define STYLE_STRUCT_INHERITED(name)
60
#include "nsStyleStructList.h"
61
#undef STYLE_STRUCT_INHERITED
62
#undef STYLE_STRUCT_RESET
63
    0;
64
65
  static_assert(kStyleStructCount <= 32, "Bitmasks must be bigger!");
66
67
  static const uint32_t kAllStructsMask = (1 << kStyleStructCount) - 1;
68
  static const uint32_t kInheritedStructsMask = (1 << kInheritedStyleStructCount) - 1;
69
  static const uint32_t kResetStructsMask = kAllStructsMask & (~kInheritedStructsMask);
70
71
  static uint32_t BitFor(StyleStructID aID)
72
0
  {
73
0
    return 1 << static_cast<uint32_t>(aID);
74
0
  }
75
};
76
77
} // namespace mozilla
78
79
#endif /* nsStyleStructFwd_h_ */