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/. */
6 /* constants for frame state bits and a type to store them in a uint64_t */
8 #include "nsFrameState.h"
10 #include "nsBlockFrame.h"
11 #include "nsBoxFrame.h"
12 #include "nsBulletFrame.h"
13 #include "nsFlexContainerFrame.h"
14 #include "nsGfxScrollFrame.h"
16 #include "nsISVGChildFrame.h"
17 #include "nsImageFrame.h"
18 #include "nsInlineFrame.h"
19 #include "nsPlaceholderFrame.h"
20 #include "nsSVGContainerFrame.h"
21 #include "nsTableCellFrame.h"
22 #include "nsTableRowFrame.h"
23 #include "nsTableRowGroupFrame.h"
24 #include "nsTextFrame.h"
30 GetFrameState(nsIFrame
* aFrame
)
33 nsAutoTArray
<const char*,3> groups
;
35 nsFrameState state
= aFrame
->GetStateBits();
37 if (state
== nsFrameState(0)) {
42 #define FRAME_STATE_GROUP(name_, class_) \
44 class_* frame = do_QueryFrame(aFrame); \
45 if (frame && (groups.IsEmpty() || strcmp(groups.LastElement(), #name_))) {\
46 groups.AppendElement(#name_); \
49 #define FRAME_STATE_BIT(group_, value_, name_) \
50 if ((state & NS_FRAME_STATE_BIT(value_)) && groups.Contains(#group_)) { \
51 if (!result.IsEmpty()) { \
52 result.Insert(" | ", 0); \
54 result.Insert(#name_, 0); \
55 state = state & ~NS_FRAME_STATE_BIT(value_); \
57 #include "nsFrameStateBits.h"
58 #undef FRAME_STATE_GROUP
59 #undef FRAME_STATE_BIT
62 result
.AppendPrintf(" | 0x%0llx", state
);
69 PrintFrameState(nsIFrame
* aFrame
)
71 printf("%s\n", GetFrameState(aFrame
).get());
75 } // namespace mozilla