Line data Source code
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 : /* constants for frame state bits and a type to store them in a uint64_t */
7 :
8 : #ifndef nsFrameState_h_
9 : #define nsFrameState_h_
10 :
11 : #include <stdint.h>
12 :
13 : #ifdef DEBUG
14 : #include "nsString.h"
15 :
16 : class nsIFrame;
17 : #endif
18 :
19 : typedef uint64_t nsFrameState_size_t;
20 :
21 : #define NS_FRAME_STATE_BIT(n_) (nsFrameState(nsFrameState_size_t(1) << (n_)))
22 :
23 : enum nsFrameState : nsFrameState_size_t {
24 : #define FRAME_STATE_BIT(group_, value_, name_) \
25 : name_ = NS_FRAME_STATE_BIT(value_),
26 : #include "nsFrameStateBits.h"
27 : #undef FRAME_STATE_BIT
28 : };
29 :
30 32774 : inline nsFrameState operator|(nsFrameState aLeft, nsFrameState aRight)
31 : {
32 32774 : return nsFrameState(nsFrameState_size_t(aLeft) | nsFrameState_size_t(aRight));
33 : }
34 :
35 249567 : inline nsFrameState operator&(nsFrameState aLeft, nsFrameState aRight)
36 : {
37 249567 : return nsFrameState(nsFrameState_size_t(aLeft) & nsFrameState_size_t(aRight));
38 : }
39 :
40 13837 : inline nsFrameState& operator|=(nsFrameState& aLeft, nsFrameState aRight)
41 : {
42 13837 : aLeft = aLeft | aRight;
43 13837 : return aLeft;
44 : }
45 :
46 8655 : inline nsFrameState& operator&=(nsFrameState& aLeft, nsFrameState aRight)
47 : {
48 8655 : aLeft = aLeft & aRight;
49 8655 : return aLeft;
50 : }
51 :
52 8655 : inline nsFrameState operator~(nsFrameState aRight)
53 : {
54 8655 : return nsFrameState(~nsFrameState_size_t(aRight));
55 : }
56 :
57 : inline nsFrameState operator^(nsFrameState aLeft, nsFrameState aRight)
58 : {
59 : return nsFrameState(nsFrameState_size_t(aLeft) ^ nsFrameState_size_t(aRight));
60 : }
61 :
62 : inline nsFrameState& operator^=(nsFrameState& aLeft, nsFrameState aRight)
63 : {
64 : aLeft = aLeft ^ aRight;
65 : return aLeft;
66 : }
67 :
68 : // Bits 20-31 and 60-63 of the frame state are reserved for implementations.
69 : #define NS_FRAME_IMPL_RESERVED nsFrameState(0xF0000000FFF00000)
70 : #define NS_FRAME_RESERVED ~NS_FRAME_IMPL_RESERVED
71 :
72 : namespace mozilla {
73 : #ifdef DEBUG
74 : nsCString GetFrameState(nsIFrame* aFrame);
75 : void PrintFrameState(nsIFrame* aFrame);
76 : #endif
77 : } // namespace mozilla
78 :
79 : #endif /* nsFrameState_h_ */
|