gecko-dev/layout/generic/nsFrameState.cpp
Ryan VanderMeulen a19bf3acbf Backed out 5 changesets (bug 965022) for mochitest-2 failures on a CLOSED TREE.
Backed out changeset 7f68752ffe1e (bug 965022)
Backed out changeset 24251d4da019 (bug 965022)
Backed out changeset a34ae046c947 (bug 965022)
Backed out changeset f747fd154739 (bug 965022)
Backed out changeset f076faf3c282 (bug 965022)
2014-08-26 16:02:37 -04:00

76 lines
2.4 KiB
C++

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