Bumping manifests a=b2g-bump
[gecko.git] / layout / generic / nsFrameState.cpp
blob61ee67d442bf147f7470381932aeec53b1473076
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"
15 #include "nsIFrame.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"
26 namespace mozilla {
28 #ifdef DEBUG
29 nsCString
30 GetFrameState(nsIFrame* aFrame)
32 nsCString result;
33 nsAutoTArray<const char*,3> groups;
35 nsFrameState state = aFrame->GetStateBits();
37 if (state == nsFrameState(0)) {
38 result.Assign('0');
39 return result;
42 #define FRAME_STATE_GROUP(name_, class_) \
43 { \
44 class_* frame = do_QueryFrame(aFrame); \
45 if (frame && (groups.IsEmpty() || strcmp(groups.LastElement(), #name_))) {\
46 groups.AppendElement(#name_); \
47 } \
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); \
53 } \
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
61 if (state) {
62 result.AppendPrintf(" | 0x%0llx", state);
65 return result;
68 void
69 PrintFrameState(nsIFrame* aFrame)
71 printf("%s\n", GetFrameState(aFrame).get());
73 #endif
75 } // namespace mozilla