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 /* constants for frame state bits and a type to store them in a uint64_t */ 8 9 #ifndef nsFrameState_h_ 10 #define nsFrameState_h_ 11 12 #include <stdint.h> 13 14 #ifdef DEBUG 15 #include "nsString.h" 16 17 class nsIFrame; 18 #endif 19 20 typedef uint64_t nsFrameState_size_t; 21 22 #define NS_FRAME_STATE_BIT(n_) (nsFrameState(nsFrameState_size_t(1) << (n_))) 23 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 29 }; 30 31 inline nsFrameState operator|(nsFrameState aLeft, nsFrameState aRight) { 32 return nsFrameState(nsFrameState_size_t(aLeft) | nsFrameState_size_t(aRight)); 33 } 34 35 inline nsFrameState operator&(nsFrameState aLeft, nsFrameState aRight) { 36 return nsFrameState(nsFrameState_size_t(aLeft) & nsFrameState_size_t(aRight)); 37 } 38 39 inline nsFrameState& operator|=(nsFrameState& aLeft, nsFrameState aRight) { 40 aLeft = aLeft | aRight; 41 return aLeft; 42 } 43 44 inline nsFrameState& operator&=(nsFrameState& aLeft, nsFrameState aRight) { 45 aLeft = aLeft & aRight; 46 return aLeft; 47 } 48 49 inline nsFrameState operator~(nsFrameState aRight) { 50 return nsFrameState(~nsFrameState_size_t(aRight)); 51 } 52 53 inline nsFrameState operator^(nsFrameState aLeft, nsFrameState aRight) { 54 return nsFrameState(nsFrameState_size_t(aLeft) ^ nsFrameState_size_t(aRight)); 55 } 56 57 inline nsFrameState& operator^=(nsFrameState& aLeft, nsFrameState aRight) { 58 aLeft = aLeft ^ aRight; 59 return aLeft; 60 } 61 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 65 66 namespace mozilla { 67 #ifdef DEBUG 68 nsCString GetFrameState(nsIFrame* aFrame); 69 void PrintFrameState(nsIFrame* aFrame); 70 #endif 71 } // namespace mozilla 72 73 #endif /* nsFrameState_h_ */ 74