michael@0: /* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */ michael@0: /* This Source Code Form is subject to the terms of the Mozilla Public michael@0: * License, v. 2.0. If a copy of the MPL was not distributed with this michael@0: * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ michael@0: michael@0: /* constants for frame state bits and a type to store them in a uint64_t */ michael@0: michael@0: #include "nsFrameState.h" michael@0: michael@0: #include "nsBlockFrame.h" michael@0: #include "nsBoxFrame.h" michael@0: #include "nsBulletFrame.h" michael@0: #include "nsFlexContainerFrame.h" michael@0: #include "nsGfxScrollFrame.h" michael@0: #include "nsIFrame.h" michael@0: #include "nsISVGChildFrame.h" michael@0: #include "nsImageFrame.h" michael@0: #include "nsInlineFrame.h" michael@0: #include "nsPlaceholderFrame.h" michael@0: #include "nsSVGContainerFrame.h" michael@0: #include "nsTableCellFrame.h" michael@0: #include "nsTableRowFrame.h" michael@0: #include "nsTableRowGroupFrame.h" michael@0: #include "nsTextFrame.h" michael@0: michael@0: namespace mozilla { michael@0: michael@0: #ifdef DEBUG michael@0: nsCString michael@0: GetFrameState(nsIFrame* aFrame) michael@0: { michael@0: nsCString result; michael@0: nsAutoTArray groups; michael@0: michael@0: nsFrameState state = aFrame->GetStateBits(); michael@0: michael@0: if (state == nsFrameState(0)) { michael@0: result.AssignLiteral("0"); michael@0: return result; michael@0: } michael@0: michael@0: #define FRAME_STATE_GROUP(name_, class_) \ michael@0: { \ michael@0: class_* frame = do_QueryFrame(aFrame); \ michael@0: if (frame && (groups.IsEmpty() || strcmp(groups.LastElement(), #name_))) {\ michael@0: groups.AppendElement(#name_); \ michael@0: } \ michael@0: } michael@0: #define FRAME_STATE_BIT(group_, value_, name_) \ michael@0: if ((state & NS_FRAME_STATE_BIT(value_)) && groups.Contains(#group_)) { \ michael@0: if (!result.IsEmpty()) { \ michael@0: result.Insert(" | ", 0); \ michael@0: } \ michael@0: result.Insert(#name_, 0); \ michael@0: state = state & ~NS_FRAME_STATE_BIT(value_); \ michael@0: } michael@0: #include "nsFrameStateBits.h" michael@0: #undef FRAME_STATE_GROUP michael@0: #undef FRAME_STATE_BIT michael@0: michael@0: if (state) { michael@0: result.AppendPrintf(" | 0x%0llx", state); michael@0: } michael@0: michael@0: return result; michael@0: } michael@0: michael@0: void michael@0: PrintFrameState(nsIFrame* aFrame) michael@0: { michael@0: printf("%s\n", GetFrameState(aFrame).get()); michael@0: } michael@0: #endif michael@0: michael@0: } // namespace mozilla