Line data Source code
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 "nsGridContainerFrame.h"
15 : #include "nsGfxScrollFrame.h"
16 : #include "nsIFrame.h"
17 : #include "nsSVGDisplayableFrame.h"
18 : #include "nsImageFrame.h"
19 : #include "nsInlineFrame.h"
20 : #include "nsPlaceholderFrame.h"
21 : #include "nsRubyTextFrame.h"
22 : #include "nsRubyTextContainerFrame.h"
23 : #include "nsSVGContainerFrame.h"
24 : #include "nsTableCellFrame.h"
25 : #include "nsTableRowFrame.h"
26 : #include "nsTableRowGroupFrame.h"
27 : #include "nsTextFrame.h"
28 :
29 : namespace mozilla {
30 :
31 : #ifdef DEBUG
32 : nsCString
33 0 : GetFrameState(nsIFrame* aFrame)
34 : {
35 0 : nsCString result;
36 0 : AutoTArray<const char*,3> groups;
37 :
38 0 : nsFrameState state = aFrame->GetStateBits();
39 :
40 0 : if (state == nsFrameState(0)) {
41 0 : result.Assign('0');
42 0 : return result;
43 : }
44 :
45 : #define FRAME_STATE_GROUP(name_, class_) \
46 : { \
47 : class_* frame = do_QueryFrame(aFrame); \
48 : if (frame && (groups.IsEmpty() || strcmp(groups.LastElement(), #name_))) {\
49 : groups.AppendElement(#name_); \
50 : } \
51 : }
52 : #define FRAME_STATE_BIT(group_, value_, name_) \
53 : if ((state & NS_FRAME_STATE_BIT(value_)) && groups.Contains(#group_)) { \
54 : if (!result.IsEmpty()) { \
55 : result.Insert(" | ", 0); \
56 : } \
57 : result.Insert(#name_, 0); \
58 : state = state & ~NS_FRAME_STATE_BIT(value_); \
59 : }
60 : #include "nsFrameStateBits.h"
61 : #undef FRAME_STATE_GROUP
62 : #undef FRAME_STATE_BIT
63 :
64 0 : if (state) {
65 0 : result.AppendPrintf(" | 0x%0" PRIx64, static_cast<uint64_t>(state));
66 : }
67 :
68 0 : return result;
69 : }
70 :
71 : void
72 0 : PrintFrameState(nsIFrame* aFrame)
73 : {
74 0 : printf("%s\n", GetFrameState(aFrame).get());
75 0 : }
76 : #endif
77 :
78 : } // namespace mozilla
|