|
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 #include "nsFrameState.h" |
|
9 |
|
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" |
|
25 |
|
26 namespace mozilla { |
|
27 |
|
28 #ifdef DEBUG |
|
29 nsCString |
|
30 GetFrameState(nsIFrame* aFrame) |
|
31 { |
|
32 nsCString result; |
|
33 nsAutoTArray<const char*,3> groups; |
|
34 |
|
35 nsFrameState state = aFrame->GetStateBits(); |
|
36 |
|
37 if (state == nsFrameState(0)) { |
|
38 result.AssignLiteral("0"); |
|
39 return result; |
|
40 } |
|
41 |
|
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 } \ |
|
48 } |
|
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_); \ |
|
56 } |
|
57 #include "nsFrameStateBits.h" |
|
58 #undef FRAME_STATE_GROUP |
|
59 #undef FRAME_STATE_BIT |
|
60 |
|
61 if (state) { |
|
62 result.AppendPrintf(" | 0x%0llx", state); |
|
63 } |
|
64 |
|
65 return result; |
|
66 } |
|
67 |
|
68 void |
|
69 PrintFrameState(nsIFrame* aFrame) |
|
70 { |
|
71 printf("%s\n", GetFrameState(aFrame).get()); |
|
72 } |
|
73 #endif |
|
74 |
|
75 } // namespace mozilla |