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 /* constants for frame state bits and a type to store them in a uint64_t */
9 #ifndef nsFrameState_h_
10 #define nsFrameState_h_
15 # include "nsString.h"
20 typedef uint64_t nsFrameState_size_t
;
22 #define NS_FRAME_STATE_BIT(n_) (nsFrameState(nsFrameState_size_t(1) << (n_)))
24 enum nsFrameState
: nsFrameState_size_t
{
25 #define FRAME_STATE_BIT(group_, value_, name_) \
26 name_ = NS_FRAME_STATE_BIT(value_),
27 #include "nsFrameStateBits.h"
28 #undef FRAME_STATE_BIT
31 constexpr nsFrameState
operator|(nsFrameState aLeft
, nsFrameState aRight
) {
32 return nsFrameState(nsFrameState_size_t(aLeft
) | nsFrameState_size_t(aRight
));
35 constexpr nsFrameState
operator&(nsFrameState aLeft
, nsFrameState aRight
) {
36 return nsFrameState(nsFrameState_size_t(aLeft
) & nsFrameState_size_t(aRight
));
39 constexpr nsFrameState
& operator|=(nsFrameState
& aLeft
, nsFrameState aRight
) {
40 aLeft
= aLeft
| aRight
;
44 constexpr nsFrameState
& operator&=(nsFrameState
& aLeft
, nsFrameState aRight
) {
45 aLeft
= aLeft
& aRight
;
49 constexpr nsFrameState
operator~(nsFrameState aRight
) {
50 return nsFrameState(~nsFrameState_size_t(aRight
));
53 constexpr nsFrameState
operator^(nsFrameState aLeft
, nsFrameState aRight
) {
54 return nsFrameState(nsFrameState_size_t(aLeft
) ^ nsFrameState_size_t(aRight
));
57 constexpr nsFrameState
& operator^=(nsFrameState
& aLeft
, nsFrameState aRight
) {
58 aLeft
= aLeft
^ aRight
;
62 // Bits 20-31 and 60-63 of the frame state are reserved for implementations.
63 #define NS_FRAME_IMPL_RESERVED nsFrameState(0xF0000000FFF00000)
64 #define NS_FRAME_RESERVED ~NS_FRAME_IMPL_RESERVED
68 nsCString
GetFrameState(nsIFrame
* aFrame
);
69 void PrintFrameState(nsIFrame
* aFrame
);
70 void DebugVerifyFrameStateBits();
72 } // namespace mozilla
74 #endif /* nsFrameState_h_ */