bug 103925 - general reflow debugging capability. sr=attinasi, r=alexsavulov

This commit is contained in:
karnaze%netscape.com 2001-10-29 01:43:59 +00:00
Родитель 45d8a09764
Коммит 16dee217fc
78 изменённых файлов: 1346 добавлений и 48 удалений

Просмотреть файл

@ -1225,6 +1225,7 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsComboboxControlFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
aStatus = NS_FRAME_COMPLETE;

Просмотреть файл

@ -281,6 +281,7 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsFieldSetFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
// Initialize OUT parameter
aStatus = NS_FRAME_COMPLETE;

Просмотреть файл

@ -371,6 +371,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsFileControlFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
aStatus = NS_FRAME_COMPLETE;

Просмотреть файл

@ -516,6 +516,7 @@ nsFormControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsFormControlFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
if (!mDidInit) {
mPresContext = aPresContext;

Просмотреть файл

@ -601,6 +601,7 @@ nsGfxButtonControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsGfxButtonControlFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
// The mFormFrame is set in the initial reflow within nsHTMLButtonControlFrame
nsresult rv = NS_OK;

Просмотреть файл

@ -698,6 +698,7 @@ nsGfxCheckboxControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsGfxCheckboxControlFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
nsresult rv = nsFormControlFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
COMPARE_QUIRK_SIZE("nsGfxCheckboxControlFrame", 13, 13)

Просмотреть файл

@ -466,6 +466,7 @@ nsGfxRadioControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsGfxRadioControlFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
nsresult rv = nsNativeFormControlFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);

Просмотреть файл

@ -559,6 +559,7 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsHTMLButtonControlFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);

Просмотреть файл

@ -299,6 +299,7 @@ nsImageControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsImageControlFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);
// add ourself as an nsIFormControlFrame

Просмотреть файл

@ -332,6 +332,7 @@ NS_IMETHODIMP nsIsIndexFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsIsIndexFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
// The Areaframe takes care of all our reflow
// (except for when style is used to change its size?)

Просмотреть файл

@ -111,6 +111,7 @@ nsLegendFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsLegendFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
if (eReflowReason_Initial == aReflowState.reason) {
mPresContext = aPresContext;
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);

Просмотреть файл

@ -616,6 +616,7 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsListControlFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
REFLOW_COUNTER_REQUEST();
aStatus = NS_FRAME_COMPLETE;

Просмотреть файл

@ -126,6 +126,7 @@ BRFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("BRFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aMetrics, aStatus);
if (aMetrics.maxElementSize) {
aMetrics.maxElementSize->width = 0;
aMetrics.maxElementSize->height = 0;

Просмотреть файл

@ -598,7 +598,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsBlockFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aMetrics, aStatus);
#ifdef DEBUG
if (gNoisyReflow) {
IndentBy(stdout, gNoiseIndent);

Просмотреть файл

@ -1329,6 +1329,7 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsBulletFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aMetrics, aStatus);
if (eReflowReason_Incremental == aReflowState.reason) {
nsIReflowCommand::ReflowType type;
aReflowState.reflowCommand->GetType(type);

Просмотреть файл

@ -218,6 +218,7 @@ nsFirstLetterFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aReflowStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsFirstLetterFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aMetrics, aReflowStatus);
nsresult rv = NS_OK;
// Grab overflow list

Просмотреть файл

@ -107,9 +107,9 @@ void ForceDrawFrame(nsIPresContext* aPresContext, nsFrame * aFrame);
static void RefreshContentFrames(nsIPresContext* aPresContext, nsIContent * aStartContent, nsIContent * aEndContent);
#endif
#include "prenv.h"
//----------------------------------------------------------------------
// start nsIFrameDebug
#ifdef NS_DEBUG
static PRBool gShowFrameBorders = PR_FALSE;
@ -219,9 +219,8 @@ nsIFrameDebug::RootFrameList(nsIPresContext* aPresContext, FILE* out, PRInt32 aI
}
}
}
#endif
//----------------------------------------------------------------------
// end nsIFrameDebug
nsresult
NS_NewEmptyFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
@ -4185,4 +4184,583 @@ nsFrame::VerifyDirtyBitSet(nsIFrame* aFrameList)
}
// Start Display Reflow
#ifdef DEBUG
DR_cookie::DR_cookie(nsIFrame* aFrame,
const nsHTMLReflowState& aReflowState,
nsHTMLReflowMetrics& aMetrics,
nsReflowStatus& aStatus)
:mFrame(aFrame), mReflowState(aReflowState), mMetrics(aMetrics), mStatus(aStatus)
{
mValue = nsFrame::DisplayReflowEnter(mFrame, mReflowState);
}
DR_cookie::~DR_cookie()
{
nsFrame::DisplayReflowExit(mFrame, mMetrics, mStatus, mValue);
}
void DR_DestroyArrayContents(nsVoidArray& aArray)
{
PRInt32 numElements = aArray.Count();
for (PRInt32 i = numElements - 1; i >= 0; i--) {
delete aArray.ElementAt(i);
}
}
struct DR_FrameTypeInfo;
struct DR_FrameTreeNode;
struct DR_Rule;
struct DR_State
{
DR_State();
~DR_State();
void Init();
void AddFrameTypeInfo(nsIAtom* aFrameType,
char* aFrameNameAbbrev,
char* aFrameName);
DR_FrameTypeInfo* GetFrameTypeInfo(nsIAtom* aFrameType);
DR_FrameTypeInfo* GetFrameTypeInfo(char* aFrameName);
void InitFrameTypeTable();
DR_FrameTreeNode* CreateTreeNode(nsIFrame* aFrame,
const nsHTMLReflowState& aReflowState);
void FindMatchingRule(DR_FrameTreeNode& aNode);
PRBool RuleMatches(DR_Rule& aRule,
DR_FrameTreeNode& aNode);
PRBool GetToken(FILE* aFile,
char* aBuf);
DR_Rule* ParseRule(FILE* aFile);
void ParseRulesFile();
void AddRule(nsVoidArray& aRules,
DR_Rule& aRule);
PRBool IsWhiteSpace(int c);
PRBool GetNumber(char* aBuf,
PRInt32& aNumber);
void PrettyUC(nscoord aSize,
char* aBuf);
void DisplayFrameTypeInfo(nsIFrame* aFrame,
PRInt32 aIndent);
void DeleteTreeNode(DR_FrameTreeNode& aNode);
PRBool mInited;
PRBool mActive;
PRInt32 mCount;
nsVoidArray mWildRules;
PRInt32 mAssert;
PRInt32 mIndentStart;
PRBool mIndentUndisplayedFrames;
nsVoidArray mFrameTypeTable;
// reflow specific state
nsVoidArray mFrameTreeLeaves;
};
static DR_State DR_state; // the one and only DR_State
struct DR_RulePart
{
DR_RulePart(nsIAtom* aFrameType) : mFrameType(aFrameType), mNext(0) {}
void Destroy();
nsIAtom* mFrameType;
DR_RulePart* mNext;
};
void DR_RulePart::Destroy()
{
if (mNext) {
mNext->Destroy();
}
delete this;
}
struct DR_Rule
{
DR_Rule() : mLength(0), mTarget(nsnull), mDisplay(PR_FALSE) {}
~DR_Rule() { if (mTarget) mTarget->Destroy(); }
void AddPart(nsIAtom* aFrameType);
PRUint32 mLength;
DR_RulePart* mTarget;
PRBool mDisplay;
};
void DR_Rule::AddPart(nsIAtom* aFrameType)
{
DR_RulePart* newPart = new DR_RulePart(aFrameType);
newPart->mNext = mTarget;
mTarget = newPart;
mLength++;
}
struct DR_FrameTypeInfo
{
DR_FrameTypeInfo(nsIAtom* aFrmeType, char* aFrameNameAbbrev, char* aFrameName);
~DR_FrameTypeInfo() { DR_DestroyArrayContents(mRules); }
nsIAtom* mType;
char mNameAbbrev[16];
char mName[32];
nsVoidArray mRules;
};
DR_FrameTypeInfo::DR_FrameTypeInfo(nsIAtom* aFrameType,
char* aFrameNameAbbrev,
char* aFrameName)
{
mType = aFrameType;
strcpy(mNameAbbrev, aFrameNameAbbrev);
strcpy(mName, aFrameName);
}
struct DR_FrameTreeNode
{
DR_FrameTreeNode(nsIFrame* aFrame, DR_FrameTreeNode* aParent) : mFrame(aFrame), mParent(aParent), mDisplay(0), mIndent(0) {}
nsIFrame* mFrame;
DR_FrameTreeNode* mParent;
PRBool mDisplay;
PRUint32 mIndent;
};
// DR_State implementation
DR_State::DR_State()
: mInited(PR_FALSE), mActive(PR_FALSE), mCount(0), mAssert(-1), mIndentStart(0), mIndentUndisplayedFrames(PR_FALSE)
{}
void DR_State::Init()
{
char* env = PR_GetEnv("GECKO_DISPLAY_REFLOW_ASSERT");
PRInt32 num;
if (env) {
if (GetNumber(env, num))
mAssert = num;
else
printf("GECKO_DISPLAY_REFLOW_ASSERT - invalid value = %s", env);
}
env = PR_GetEnv("GECKO_DISPLAY_REFLOW_INDENT_START");
if (env) {
if (GetNumber(env, num))
mIndentStart = num;
else
printf("GECKO_DISPLAY_REFLOW_INDENT_START - invalid value = %s", env);
}
env = PR_GetEnv("GECKO_DISPLAY_REFLOW_INDENT_UNDISPLAYED_FRAMES");
if (env) {
if (GetNumber(env, num))
mIndentUndisplayedFrames = num;
else
printf("GECKO_DISPLAY_REFLOW_INDENT_UNDISPLAYED_FRAMES - invalid value = %s", env);
}
InitFrameTypeTable();
ParseRulesFile();
mInited = PR_TRUE;
}
DR_State::~DR_State()
{
DR_DestroyArrayContents(mWildRules);
DR_DestroyArrayContents(mFrameTreeLeaves);
DR_DestroyArrayContents(mFrameTypeTable);
}
PRBool DR_State::GetNumber(char* aBuf,
PRInt32& aNumber)
{
if (sscanf(aBuf, "%d", &aNumber) > 0)
return PR_TRUE;
else
return PR_FALSE;
}
PRBool DR_State::IsWhiteSpace(int c) {
return (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r');
}
PRBool DR_State::GetToken(FILE* aFile,
char* aBuf)
{
PRBool haveToken = PR_FALSE;
aBuf[0] = 0;
// get the 1st non whitespace char
int c = -1;
for (c = getc(aFile); (c > 0) && IsWhiteSpace(c); c = getc(aFile)) {
}
if (c > 0) {
haveToken = PR_TRUE;
aBuf[0] = c;
// get everything up to the next whitespace char
PRInt32 cX;
for (cX = 1, c = getc(aFile); ; cX++, c = getc(aFile)) {
if (c < 0) { // EOF
ungetc(' ', aFile);
break;
}
else {
if (IsWhiteSpace(c)) {
break;
}
else {
aBuf[cX] = c;
}
}
}
aBuf[cX] = 0;
}
return haveToken;
}
DR_Rule* DR_State::ParseRule(FILE* aFile)
{
char buf[128];
PRInt32 doDisplay;
DR_Rule* rule = nsnull;
while (GetToken(aFile, buf)) {
if (GetNumber(buf, doDisplay)) {
if (rule) {
rule->mDisplay = (PRBool)doDisplay;
break;
}
else {
printf("unexpected token - %s \n", buf);
}
}
else {
if (!rule) {
rule = new DR_Rule;
}
if (strcmp(buf, "*") == 0) {
rule->AddPart(nsnull);
}
else {
DR_FrameTypeInfo* info = GetFrameTypeInfo(buf);
if (info) {
rule->AddPart(info->mType);
}
else {
printf("invalid frame type - %s \n", buf);
}
}
}
}
return rule;
}
void DR_State::AddRule(nsVoidArray& aRules,
DR_Rule& aRule)
{
PRInt32 numRules = aRules.Count();
for (PRInt32 ruleX = 0; ruleX < numRules; ruleX++) {
DR_Rule* rule = (DR_Rule*)aRules.ElementAt(ruleX);
NS_ASSERTION(rule, "program error");
if (aRule.mLength > rule->mLength) {
aRules.InsertElementAt(&aRule, ruleX);
return;
}
}
aRules.AppendElement(&aRule);
}
void DR_State::ParseRulesFile()
{
char* path = PR_GetEnv("GECKO_DISPLAY_REFLOW_RULES_FILE");
if (path) {
FILE* inFile = fopen(path, "r");
if (inFile) {
for (DR_Rule* rule = ParseRule(inFile); rule; rule = ParseRule(inFile)) {
if (rule->mTarget) {
nsIAtom* fType = rule->mTarget->mFrameType;
if (fType) {
DR_FrameTypeInfo* info = GetFrameTypeInfo(fType);
if (info) {
AddRule(info->mRules, *rule);
}
}
else {
AddRule(mWildRules, *rule);
}
mActive = PR_TRUE;
}
}
}
}
}
void DR_State::AddFrameTypeInfo(nsIAtom* aFrameType,
char* aFrameNameAbbrev,
char* aFrameName)
{
mFrameTypeTable.AppendElement(new DR_FrameTypeInfo(aFrameType, aFrameNameAbbrev, aFrameName));
}
DR_FrameTypeInfo* DR_State::GetFrameTypeInfo(nsIAtom* aFrameType)
{
PRInt32 numEntries = mFrameTypeTable.Count();
for (PRInt32 i = 0; i < numEntries; i++) {
DR_FrameTypeInfo* info = (DR_FrameTypeInfo*)mFrameTypeTable.ElementAt(i);
if (info && (info->mType == aFrameType)) {
return info;
}
}
return nsnull;
}
DR_FrameTypeInfo* DR_State::GetFrameTypeInfo(char* aFrameName)
{
PRInt32 numEntries = mFrameTypeTable.Count();
for (PRInt32 i = 0; i < numEntries; i++) {
DR_FrameTypeInfo* info = (DR_FrameTypeInfo*)mFrameTypeTable.ElementAt(i);
if (info && ((strcmp(aFrameName, info->mName) == 0) || (strcmp(aFrameName, info->mNameAbbrev) == 0))) {
return info;
}
}
return nsnull;
}
void DR_State::InitFrameTypeTable()
{
AddFrameTypeInfo(nsLayoutAtoms::areaFrame, "area", "area");
AddFrameTypeInfo(nsLayoutAtoms::blockFrame, "block", "block");
AddFrameTypeInfo(nsLayoutAtoms::brFrame, "br", "br");
AddFrameTypeInfo(nsLayoutAtoms::bulletFrame, "bullet", "bullet");
AddFrameTypeInfo(nsLayoutAtoms::gfxButtonControlFrame, "button", "gfxButtonControl");
AddFrameTypeInfo(nsLayoutAtoms::htmlFrameInnerFrame, "frameI", "htmlFrameInner");
AddFrameTypeInfo(nsLayoutAtoms::htmlFrameOuterFrame, "frameO", "htmlFrameOuter");
AddFrameTypeInfo(nsLayoutAtoms::imageFrame, "img", "image");
AddFrameTypeInfo(nsLayoutAtoms::inlineFrame, "inline", "inline");
AddFrameTypeInfo(nsLayoutAtoms::letterFrame, "letter", "letter");
AddFrameTypeInfo(nsLayoutAtoms::lineFrame, "line", "line");
AddFrameTypeInfo(nsLayoutAtoms::listControlFrame, "select", "select");
AddFrameTypeInfo(nsLayoutAtoms::objectFrame, "obj", "object");
AddFrameTypeInfo(nsLayoutAtoms::pageFrame, "page", "page");
AddFrameTypeInfo(nsLayoutAtoms::placeholderFrame, "place", "placeholder");
AddFrameTypeInfo(nsLayoutAtoms::positionedInlineFrame, "posInline", "positionedInline");
AddFrameTypeInfo(nsLayoutAtoms::canvasFrame, "canvas", "canvas");
AddFrameTypeInfo(nsLayoutAtoms::rootFrame, "root", "root");
AddFrameTypeInfo(nsLayoutAtoms::scrollFrame, "scroll", "scroll");
AddFrameTypeInfo(nsLayoutAtoms::tableCaptionFrame, "caption", "tableCaption");
AddFrameTypeInfo(nsLayoutAtoms::tableCellFrame, "cell", "tableCell");
AddFrameTypeInfo(nsLayoutAtoms::tableColFrame, "col", "tableCol");
AddFrameTypeInfo(nsLayoutAtoms::tableColGroupFrame, "colG", "tableColGroup");
AddFrameTypeInfo(nsLayoutAtoms::tableFrame, "tbl", "table");
AddFrameTypeInfo(nsLayoutAtoms::tableOuterFrame, "tblO", "tableOuter");
AddFrameTypeInfo(nsLayoutAtoms::tableRowGroupFrame, "rowG", "tableRowGroup");
AddFrameTypeInfo(nsLayoutAtoms::tableRowFrame, "row", "tableRow");
AddFrameTypeInfo(nsLayoutAtoms::textInputFrame, "textCtl", "textInput");
AddFrameTypeInfo(nsLayoutAtoms::textFrame, "text", "text");
AddFrameTypeInfo(nsLayoutAtoms::viewportFrame, "VP", "viewport");
AddFrameTypeInfo(nsnull, "unknown", "unknown");
}
void DR_State::DisplayFrameTypeInfo(nsIFrame* aFrame,
PRInt32 aIndent)
{
nsCOMPtr<nsIAtom> fType;
aFrame->GetFrameType(getter_AddRefs(fType));
DR_FrameTypeInfo* frameTypeInfo = GetFrameTypeInfo(fType);
if (frameTypeInfo) {
for (PRInt32 i = 0; i < aIndent; i++) {
printf(" ");
}
printf("%s %p ", frameTypeInfo->mNameAbbrev, aFrame);
}
}
PRBool DR_State::RuleMatches(DR_Rule& aRule,
DR_FrameTreeNode& aNode)
{
NS_ASSERTION(aRule.mTarget, "program error");
DR_RulePart* rulePart;
DR_FrameTreeNode* parentNode;
for (rulePart = aRule.mTarget->mNext, parentNode = aNode.mParent;
rulePart && parentNode;
rulePart = rulePart->mNext, parentNode = parentNode->mParent) {
if (rulePart->mFrameType) {
if (parentNode->mFrame) {
nsCOMPtr<nsIAtom> fNodeType;
parentNode->mFrame->GetFrameType(getter_AddRefs(fNodeType));
if (rulePart->mFrameType != fNodeType) {
return PR_FALSE;
}
}
else NS_ASSERTION(PR_FALSE, "program error");
}
// else wild card match
}
return PR_TRUE;
}
void DR_State::FindMatchingRule(DR_FrameTreeNode& aNode)
{
if (!aNode.mFrame) {
NS_ASSERTION(PR_FALSE, "invalid DR_FrameTreeNode \n");
return;
}
PRBool matchingRule = PR_FALSE;
nsCOMPtr<nsIAtom> fType;
aNode.mFrame->GetFrameType(getter_AddRefs(fType));
DR_FrameTypeInfo* info = GetFrameTypeInfo(fType.get());
NS_ASSERTION(info, "program error");
PRInt32 numRules = info->mRules.Count();
for (PRInt32 ruleX = 0; ruleX < numRules; ruleX++) {
DR_Rule* rule = (DR_Rule*)info->mRules.ElementAt(ruleX);
if (rule && RuleMatches(*rule, aNode)) {
aNode.mDisplay = rule->mDisplay;
matchingRule = PR_TRUE;
break;
}
}
if (!matchingRule) {
PRInt32 numWildRules = mWildRules.Count();
for (PRInt32 ruleX = 0; ruleX < numWildRules; ruleX++) {
DR_Rule* rule = (DR_Rule*)mWildRules.ElementAt(ruleX);
if (rule && RuleMatches(*rule, aNode)) {
aNode.mDisplay = rule->mDisplay;
break;
}
}
}
if (aNode.mParent) {
aNode.mIndent = aNode.mParent->mIndent;
if (aNode.mDisplay || mIndentUndisplayedFrames) {
aNode.mIndent++;
}
}
}
DR_FrameTreeNode* DR_State::CreateTreeNode(nsIFrame* aFrame,
const nsHTMLReflowState& aReflowState)
{
// find the frame of the parent reflow state (usually just the parent of aFrame)
const nsHTMLReflowState* parentRS = aReflowState.parentReflowState;
nsIFrame* parentFrame = (parentRS) ? parentRS->frame : nsnull;
// find the parent tree node leaf
DR_FrameTreeNode* parentNode = nsnull;
DR_FrameTreeNode* lastLeaf = (DR_FrameTreeNode*)mFrameTreeLeaves.ElementAt(mFrameTreeLeaves.Count() - 1);
if (lastLeaf) {
for (parentNode = lastLeaf; parentNode && (parentNode->mFrame != parentFrame); parentNode = parentNode->mParent) {
}
}
DR_FrameTreeNode* newNode = new DR_FrameTreeNode(aFrame, parentNode);
FindMatchingRule(*newNode);
if (lastLeaf == parentNode) {
mFrameTreeLeaves.RemoveElementAt(mFrameTreeLeaves.Count() - 1);
}
mFrameTreeLeaves.AppendElement(newNode);
mCount++;
return newNode;
}
void DR_State::PrettyUC(nscoord aSize,
char* aBuf)
{
if (NS_UNCONSTRAINEDSIZE == aSize) {
strcpy(aBuf, "UC");
}
else {
sprintf(aBuf, "%d", aSize);
}
}
void DR_State::DeleteTreeNode(DR_FrameTreeNode& aNode)
{
mFrameTreeLeaves.RemoveElement(&aNode);
PRInt32 numLeaves = mFrameTreeLeaves.Count();
if ((0 == numLeaves) || (aNode.mParent != (DR_FrameTreeNode*)mFrameTreeLeaves.ElementAt(numLeaves - 1))) {
mFrameTreeLeaves.AppendElement(aNode.mParent);
}
// delete the tree node
delete &aNode;
}
void* nsFrame::DisplayReflowEnter(nsIFrame* aFrame,
const nsHTMLReflowState& aReflowState)
{
if (!DR_state.mInited) DR_state.Init();
if (!DR_state.mActive) return nsnull;
NS_ASSERTION(aFrame, "invalid call");
DR_FrameTreeNode* treeNode = DR_state.CreateTreeNode(aFrame, aReflowState);
if (treeNode->mDisplay) {
DR_state.DisplayFrameTypeInfo(aFrame, treeNode->mIndent);
char width[16];
char height[16];
DR_state.PrettyUC(aReflowState.availableWidth, width);
DR_state.PrettyUC(aReflowState.availableHeight, height);
printf("r=%d a=%s,%s ", aReflowState.reason, width, height);
DR_state.PrettyUC(aReflowState.mComputedWidth, width);
DR_state.PrettyUC(aReflowState.mComputedHeight, height);
printf("c=%s,%s ", width, height);
nsIFrame* inFlow;
aFrame->GetPrevInFlow(&inFlow);
if (inFlow) {
printf("pif=%p ", inFlow);
}
aFrame->GetNextInFlow(&inFlow);
if (inFlow) {
printf("nif=%p ", inFlow);
}
printf("cnt=%d \n", DR_state.mCount);
}
return treeNode;
}
void nsFrame::DisplayReflowExit(nsIFrame* aFrame,
nsHTMLReflowMetrics& aMetrics,
nsReflowStatus aStatus,
void* aFrameTreeNode)
{
if (!DR_state.mActive) return;
NS_ASSERTION(aFrame, "DisplayReflowExit - invalid call");
if (!aFrameTreeNode) return;
DR_FrameTreeNode* treeNode = (DR_FrameTreeNode*)aFrameTreeNode;
if (treeNode->mDisplay) {
DR_state.DisplayFrameTypeInfo(aFrame, treeNode->mIndent);
char width[16];
char height[16];
DR_state.PrettyUC(aMetrics.width, width);
DR_state.PrettyUC(aMetrics.height, height);
printf("d=%s,%s ", width, height);
if (aMetrics.maxElementSize) {
DR_state.PrettyUC(aMetrics.maxElementSize->width, width);
printf("me=%s ", width);
}
if (aMetrics.mFlags & NS_REFLOW_CALC_MAX_WIDTH) {
DR_state.PrettyUC(aMetrics.mMaximumWidth, width);
printf("m=%s ", width);
}
if (NS_FRAME_COMPLETE != aStatus) {
printf("status=%d", aStatus);
}
printf("\n");
}
DR_state.DeleteTreeNode(*treeNode);
}
#endif
// End Display Reflow
#endif

Просмотреть файл

@ -433,6 +433,14 @@ public:
virtual void DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent, PRBool aIncludeStyleData);
nsresult MakeFrameName(const char* aKind, nsString& aResult) const;
// Display Reflow Debugging
static void* DisplayReflowEnter(nsIFrame* aFrame,
const nsHTMLReflowState& aReflowState);
static void DisplayReflowExit(nsIFrame* aFrame,
nsHTMLReflowMetrics& aMetrics,
PRUint32 aStatus,
void* aFrameTreeNode);
#endif
protected:
@ -487,4 +495,31 @@ protected:
NS_IMETHOD_(nsrefcnt) Release(void);
};
// Start Display Reflow Debuggin
#ifdef DEBUG
struct DR_cookie {
DR_cookie(nsIFrame* aFrame,
const nsHTMLReflowState& mReflowState,
nsHTMLReflowMetrics& aMetrics,
nsReflowStatus& aStatus);
~DR_cookie();
nsIFrame* mFrame;
const nsHTMLReflowState& mReflowState;
nsHTMLReflowMetrics& mMetrics;
nsReflowStatus& mStatus;
void* mValue;
};
#define DISPLAY_REFLOW(dr_frame, dr_rf_state, dr_rf_metrics, dr_rf_status) \
DR_cookie dr_cookie(dr_frame, dr_rf_state, dr_rf_metrics, dr_rf_status);
#else
#define DISPLAY_REFLOW(dr_frame, dr_rf_state, dr_rf_metrics, dr_rf_status)
#endif
// End Display Reflow Debugging
#endif /* nsFrame_h___ */

Просмотреть файл

@ -475,6 +475,7 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsHTMLFrameOuterFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
//printf("OuterFrame::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsHTMLFrameOuterFrame::Reflow: maxSize=%d,%d reason=%d",

Просмотреть файл

@ -1050,6 +1050,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsHTMLFramesetFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));

Просмотреть файл

@ -732,12 +732,13 @@ nsGfxScrollFrame::GetMaxSize(nsBoxLayoutState& aState, nsSize& aSize)
}
NS_IMETHODIMP
nsGfxScrollFrame::Reflow(nsIPresContext* aPresContext,
nsGfxScrollFrame::Reflow(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsGfxScrollFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
// if there is a max element request then set it to -1 so we can see if it gets set
if (aDesiredSize.maxElementSize)

Просмотреть файл

@ -772,6 +772,7 @@ nsImageFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsImageFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aMetrics, aStatus);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsImageFrame::Reflow: availSize=%d,%d",
aReflowState.availableWidth, aReflowState.availableHeight));

Просмотреть файл

@ -328,6 +328,7 @@ nsInlineFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsInlineFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aMetrics, aStatus);
if (nsnull == aReflowState.mLineLayout) {
return NS_ERROR_INVALID_ARG;
}

Просмотреть файл

@ -884,6 +884,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsObjectFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aMetrics, aStatus);
nsresult rv = NS_OK;
// Get our desired size

Просмотреть файл

@ -148,6 +148,7 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsPageFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
aStatus = NS_FRAME_COMPLETE; // initialize out parameter
if (eReflowReason_Incremental == aReflowState.reason) {

Просмотреть файл

@ -65,6 +65,7 @@ nsPlaceholderFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsPlaceholderFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
aDesiredSize.width = 0;
aDesiredSize.height = 0;
aDesiredSize.ascent = 0;

Просмотреть файл

@ -294,6 +294,7 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsSimplePageSequenceFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
NS_FRAME_TRACE_REFLOW_IN("nsSimplePageSequenceFrame::Reflow");
aStatus = NS_FRAME_COMPLETE; // we're always complete

Просмотреть файл

@ -98,6 +98,7 @@ SpacerFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("SpacerFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aMetrics, aStatus);
aStatus = NS_FRAME_COMPLETE;
// By default, we have no area

Просмотреть файл

@ -4958,12 +4958,13 @@ nsTextFrame::MeasureText(nsIPresContext* aPresContext,
}
NS_IMETHODIMP
nsTextFrame::Reflow(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aMetrics,
nsTextFrame::Reflow(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aMetrics,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTextFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aMetrics, aStatus);
#ifdef NOISY_REFLOW
ListTag(stdout);
printf(": BeginReflow: availableSize=%d,%d\n",

Просмотреть файл

@ -503,6 +503,7 @@ ViewportFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("ViewportFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
NS_FRAME_TRACE_REFLOW_IN("ViewportFrame::Reflow");
NS_PRECONDITION(nsnull == aDesiredSize.maxElementSize, "unexpected request");

Просмотреть файл

@ -126,6 +126,7 @@ BRFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("BRFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aMetrics, aStatus);
if (aMetrics.maxElementSize) {
aMetrics.maxElementSize->width = 0;
aMetrics.maxElementSize->height = 0;

Просмотреть файл

@ -598,7 +598,7 @@ nsBlockFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsBlockFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aMetrics, aStatus);
#ifdef DEBUG
if (gNoisyReflow) {
IndentBy(stdout, gNoiseIndent);

Просмотреть файл

@ -1329,6 +1329,7 @@ nsBulletFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsBulletFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aMetrics, aStatus);
if (eReflowReason_Incremental == aReflowState.reason) {
nsIReflowCommand::ReflowType type;
aReflowState.reflowCommand->GetType(type);

Просмотреть файл

@ -218,6 +218,7 @@ nsFirstLetterFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aReflowStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsFirstLetterFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aMetrics, aReflowStatus);
nsresult rv = NS_OK;
// Grab overflow list

Просмотреть файл

@ -107,9 +107,9 @@ void ForceDrawFrame(nsIPresContext* aPresContext, nsFrame * aFrame);
static void RefreshContentFrames(nsIPresContext* aPresContext, nsIContent * aStartContent, nsIContent * aEndContent);
#endif
#include "prenv.h"
//----------------------------------------------------------------------
// start nsIFrameDebug
#ifdef NS_DEBUG
static PRBool gShowFrameBorders = PR_FALSE;
@ -219,9 +219,8 @@ nsIFrameDebug::RootFrameList(nsIPresContext* aPresContext, FILE* out, PRInt32 aI
}
}
}
#endif
//----------------------------------------------------------------------
// end nsIFrameDebug
nsresult
NS_NewEmptyFrame(nsIPresShell* aPresShell, nsIFrame** aNewFrame)
@ -4185,4 +4184,583 @@ nsFrame::VerifyDirtyBitSet(nsIFrame* aFrameList)
}
// Start Display Reflow
#ifdef DEBUG
DR_cookie::DR_cookie(nsIFrame* aFrame,
const nsHTMLReflowState& aReflowState,
nsHTMLReflowMetrics& aMetrics,
nsReflowStatus& aStatus)
:mFrame(aFrame), mReflowState(aReflowState), mMetrics(aMetrics), mStatus(aStatus)
{
mValue = nsFrame::DisplayReflowEnter(mFrame, mReflowState);
}
DR_cookie::~DR_cookie()
{
nsFrame::DisplayReflowExit(mFrame, mMetrics, mStatus, mValue);
}
void DR_DestroyArrayContents(nsVoidArray& aArray)
{
PRInt32 numElements = aArray.Count();
for (PRInt32 i = numElements - 1; i >= 0; i--) {
delete aArray.ElementAt(i);
}
}
struct DR_FrameTypeInfo;
struct DR_FrameTreeNode;
struct DR_Rule;
struct DR_State
{
DR_State();
~DR_State();
void Init();
void AddFrameTypeInfo(nsIAtom* aFrameType,
char* aFrameNameAbbrev,
char* aFrameName);
DR_FrameTypeInfo* GetFrameTypeInfo(nsIAtom* aFrameType);
DR_FrameTypeInfo* GetFrameTypeInfo(char* aFrameName);
void InitFrameTypeTable();
DR_FrameTreeNode* CreateTreeNode(nsIFrame* aFrame,
const nsHTMLReflowState& aReflowState);
void FindMatchingRule(DR_FrameTreeNode& aNode);
PRBool RuleMatches(DR_Rule& aRule,
DR_FrameTreeNode& aNode);
PRBool GetToken(FILE* aFile,
char* aBuf);
DR_Rule* ParseRule(FILE* aFile);
void ParseRulesFile();
void AddRule(nsVoidArray& aRules,
DR_Rule& aRule);
PRBool IsWhiteSpace(int c);
PRBool GetNumber(char* aBuf,
PRInt32& aNumber);
void PrettyUC(nscoord aSize,
char* aBuf);
void DisplayFrameTypeInfo(nsIFrame* aFrame,
PRInt32 aIndent);
void DeleteTreeNode(DR_FrameTreeNode& aNode);
PRBool mInited;
PRBool mActive;
PRInt32 mCount;
nsVoidArray mWildRules;
PRInt32 mAssert;
PRInt32 mIndentStart;
PRBool mIndentUndisplayedFrames;
nsVoidArray mFrameTypeTable;
// reflow specific state
nsVoidArray mFrameTreeLeaves;
};
static DR_State DR_state; // the one and only DR_State
struct DR_RulePart
{
DR_RulePart(nsIAtom* aFrameType) : mFrameType(aFrameType), mNext(0) {}
void Destroy();
nsIAtom* mFrameType;
DR_RulePart* mNext;
};
void DR_RulePart::Destroy()
{
if (mNext) {
mNext->Destroy();
}
delete this;
}
struct DR_Rule
{
DR_Rule() : mLength(0), mTarget(nsnull), mDisplay(PR_FALSE) {}
~DR_Rule() { if (mTarget) mTarget->Destroy(); }
void AddPart(nsIAtom* aFrameType);
PRUint32 mLength;
DR_RulePart* mTarget;
PRBool mDisplay;
};
void DR_Rule::AddPart(nsIAtom* aFrameType)
{
DR_RulePart* newPart = new DR_RulePart(aFrameType);
newPart->mNext = mTarget;
mTarget = newPart;
mLength++;
}
struct DR_FrameTypeInfo
{
DR_FrameTypeInfo(nsIAtom* aFrmeType, char* aFrameNameAbbrev, char* aFrameName);
~DR_FrameTypeInfo() { DR_DestroyArrayContents(mRules); }
nsIAtom* mType;
char mNameAbbrev[16];
char mName[32];
nsVoidArray mRules;
};
DR_FrameTypeInfo::DR_FrameTypeInfo(nsIAtom* aFrameType,
char* aFrameNameAbbrev,
char* aFrameName)
{
mType = aFrameType;
strcpy(mNameAbbrev, aFrameNameAbbrev);
strcpy(mName, aFrameName);
}
struct DR_FrameTreeNode
{
DR_FrameTreeNode(nsIFrame* aFrame, DR_FrameTreeNode* aParent) : mFrame(aFrame), mParent(aParent), mDisplay(0), mIndent(0) {}
nsIFrame* mFrame;
DR_FrameTreeNode* mParent;
PRBool mDisplay;
PRUint32 mIndent;
};
// DR_State implementation
DR_State::DR_State()
: mInited(PR_FALSE), mActive(PR_FALSE), mCount(0), mAssert(-1), mIndentStart(0), mIndentUndisplayedFrames(PR_FALSE)
{}
void DR_State::Init()
{
char* env = PR_GetEnv("GECKO_DISPLAY_REFLOW_ASSERT");
PRInt32 num;
if (env) {
if (GetNumber(env, num))
mAssert = num;
else
printf("GECKO_DISPLAY_REFLOW_ASSERT - invalid value = %s", env);
}
env = PR_GetEnv("GECKO_DISPLAY_REFLOW_INDENT_START");
if (env) {
if (GetNumber(env, num))
mIndentStart = num;
else
printf("GECKO_DISPLAY_REFLOW_INDENT_START - invalid value = %s", env);
}
env = PR_GetEnv("GECKO_DISPLAY_REFLOW_INDENT_UNDISPLAYED_FRAMES");
if (env) {
if (GetNumber(env, num))
mIndentUndisplayedFrames = num;
else
printf("GECKO_DISPLAY_REFLOW_INDENT_UNDISPLAYED_FRAMES - invalid value = %s", env);
}
InitFrameTypeTable();
ParseRulesFile();
mInited = PR_TRUE;
}
DR_State::~DR_State()
{
DR_DestroyArrayContents(mWildRules);
DR_DestroyArrayContents(mFrameTreeLeaves);
DR_DestroyArrayContents(mFrameTypeTable);
}
PRBool DR_State::GetNumber(char* aBuf,
PRInt32& aNumber)
{
if (sscanf(aBuf, "%d", &aNumber) > 0)
return PR_TRUE;
else
return PR_FALSE;
}
PRBool DR_State::IsWhiteSpace(int c) {
return (c == ' ') || (c == '\t') || (c == '\n') || (c == '\r');
}
PRBool DR_State::GetToken(FILE* aFile,
char* aBuf)
{
PRBool haveToken = PR_FALSE;
aBuf[0] = 0;
// get the 1st non whitespace char
int c = -1;
for (c = getc(aFile); (c > 0) && IsWhiteSpace(c); c = getc(aFile)) {
}
if (c > 0) {
haveToken = PR_TRUE;
aBuf[0] = c;
// get everything up to the next whitespace char
PRInt32 cX;
for (cX = 1, c = getc(aFile); ; cX++, c = getc(aFile)) {
if (c < 0) { // EOF
ungetc(' ', aFile);
break;
}
else {
if (IsWhiteSpace(c)) {
break;
}
else {
aBuf[cX] = c;
}
}
}
aBuf[cX] = 0;
}
return haveToken;
}
DR_Rule* DR_State::ParseRule(FILE* aFile)
{
char buf[128];
PRInt32 doDisplay;
DR_Rule* rule = nsnull;
while (GetToken(aFile, buf)) {
if (GetNumber(buf, doDisplay)) {
if (rule) {
rule->mDisplay = (PRBool)doDisplay;
break;
}
else {
printf("unexpected token - %s \n", buf);
}
}
else {
if (!rule) {
rule = new DR_Rule;
}
if (strcmp(buf, "*") == 0) {
rule->AddPart(nsnull);
}
else {
DR_FrameTypeInfo* info = GetFrameTypeInfo(buf);
if (info) {
rule->AddPart(info->mType);
}
else {
printf("invalid frame type - %s \n", buf);
}
}
}
}
return rule;
}
void DR_State::AddRule(nsVoidArray& aRules,
DR_Rule& aRule)
{
PRInt32 numRules = aRules.Count();
for (PRInt32 ruleX = 0; ruleX < numRules; ruleX++) {
DR_Rule* rule = (DR_Rule*)aRules.ElementAt(ruleX);
NS_ASSERTION(rule, "program error");
if (aRule.mLength > rule->mLength) {
aRules.InsertElementAt(&aRule, ruleX);
return;
}
}
aRules.AppendElement(&aRule);
}
void DR_State::ParseRulesFile()
{
char* path = PR_GetEnv("GECKO_DISPLAY_REFLOW_RULES_FILE");
if (path) {
FILE* inFile = fopen(path, "r");
if (inFile) {
for (DR_Rule* rule = ParseRule(inFile); rule; rule = ParseRule(inFile)) {
if (rule->mTarget) {
nsIAtom* fType = rule->mTarget->mFrameType;
if (fType) {
DR_FrameTypeInfo* info = GetFrameTypeInfo(fType);
if (info) {
AddRule(info->mRules, *rule);
}
}
else {
AddRule(mWildRules, *rule);
}
mActive = PR_TRUE;
}
}
}
}
}
void DR_State::AddFrameTypeInfo(nsIAtom* aFrameType,
char* aFrameNameAbbrev,
char* aFrameName)
{
mFrameTypeTable.AppendElement(new DR_FrameTypeInfo(aFrameType, aFrameNameAbbrev, aFrameName));
}
DR_FrameTypeInfo* DR_State::GetFrameTypeInfo(nsIAtom* aFrameType)
{
PRInt32 numEntries = mFrameTypeTable.Count();
for (PRInt32 i = 0; i < numEntries; i++) {
DR_FrameTypeInfo* info = (DR_FrameTypeInfo*)mFrameTypeTable.ElementAt(i);
if (info && (info->mType == aFrameType)) {
return info;
}
}
return nsnull;
}
DR_FrameTypeInfo* DR_State::GetFrameTypeInfo(char* aFrameName)
{
PRInt32 numEntries = mFrameTypeTable.Count();
for (PRInt32 i = 0; i < numEntries; i++) {
DR_FrameTypeInfo* info = (DR_FrameTypeInfo*)mFrameTypeTable.ElementAt(i);
if (info && ((strcmp(aFrameName, info->mName) == 0) || (strcmp(aFrameName, info->mNameAbbrev) == 0))) {
return info;
}
}
return nsnull;
}
void DR_State::InitFrameTypeTable()
{
AddFrameTypeInfo(nsLayoutAtoms::areaFrame, "area", "area");
AddFrameTypeInfo(nsLayoutAtoms::blockFrame, "block", "block");
AddFrameTypeInfo(nsLayoutAtoms::brFrame, "br", "br");
AddFrameTypeInfo(nsLayoutAtoms::bulletFrame, "bullet", "bullet");
AddFrameTypeInfo(nsLayoutAtoms::gfxButtonControlFrame, "button", "gfxButtonControl");
AddFrameTypeInfo(nsLayoutAtoms::htmlFrameInnerFrame, "frameI", "htmlFrameInner");
AddFrameTypeInfo(nsLayoutAtoms::htmlFrameOuterFrame, "frameO", "htmlFrameOuter");
AddFrameTypeInfo(nsLayoutAtoms::imageFrame, "img", "image");
AddFrameTypeInfo(nsLayoutAtoms::inlineFrame, "inline", "inline");
AddFrameTypeInfo(nsLayoutAtoms::letterFrame, "letter", "letter");
AddFrameTypeInfo(nsLayoutAtoms::lineFrame, "line", "line");
AddFrameTypeInfo(nsLayoutAtoms::listControlFrame, "select", "select");
AddFrameTypeInfo(nsLayoutAtoms::objectFrame, "obj", "object");
AddFrameTypeInfo(nsLayoutAtoms::pageFrame, "page", "page");
AddFrameTypeInfo(nsLayoutAtoms::placeholderFrame, "place", "placeholder");
AddFrameTypeInfo(nsLayoutAtoms::positionedInlineFrame, "posInline", "positionedInline");
AddFrameTypeInfo(nsLayoutAtoms::canvasFrame, "canvas", "canvas");
AddFrameTypeInfo(nsLayoutAtoms::rootFrame, "root", "root");
AddFrameTypeInfo(nsLayoutAtoms::scrollFrame, "scroll", "scroll");
AddFrameTypeInfo(nsLayoutAtoms::tableCaptionFrame, "caption", "tableCaption");
AddFrameTypeInfo(nsLayoutAtoms::tableCellFrame, "cell", "tableCell");
AddFrameTypeInfo(nsLayoutAtoms::tableColFrame, "col", "tableCol");
AddFrameTypeInfo(nsLayoutAtoms::tableColGroupFrame, "colG", "tableColGroup");
AddFrameTypeInfo(nsLayoutAtoms::tableFrame, "tbl", "table");
AddFrameTypeInfo(nsLayoutAtoms::tableOuterFrame, "tblO", "tableOuter");
AddFrameTypeInfo(nsLayoutAtoms::tableRowGroupFrame, "rowG", "tableRowGroup");
AddFrameTypeInfo(nsLayoutAtoms::tableRowFrame, "row", "tableRow");
AddFrameTypeInfo(nsLayoutAtoms::textInputFrame, "textCtl", "textInput");
AddFrameTypeInfo(nsLayoutAtoms::textFrame, "text", "text");
AddFrameTypeInfo(nsLayoutAtoms::viewportFrame, "VP", "viewport");
AddFrameTypeInfo(nsnull, "unknown", "unknown");
}
void DR_State::DisplayFrameTypeInfo(nsIFrame* aFrame,
PRInt32 aIndent)
{
nsCOMPtr<nsIAtom> fType;
aFrame->GetFrameType(getter_AddRefs(fType));
DR_FrameTypeInfo* frameTypeInfo = GetFrameTypeInfo(fType);
if (frameTypeInfo) {
for (PRInt32 i = 0; i < aIndent; i++) {
printf(" ");
}
printf("%s %p ", frameTypeInfo->mNameAbbrev, aFrame);
}
}
PRBool DR_State::RuleMatches(DR_Rule& aRule,
DR_FrameTreeNode& aNode)
{
NS_ASSERTION(aRule.mTarget, "program error");
DR_RulePart* rulePart;
DR_FrameTreeNode* parentNode;
for (rulePart = aRule.mTarget->mNext, parentNode = aNode.mParent;
rulePart && parentNode;
rulePart = rulePart->mNext, parentNode = parentNode->mParent) {
if (rulePart->mFrameType) {
if (parentNode->mFrame) {
nsCOMPtr<nsIAtom> fNodeType;
parentNode->mFrame->GetFrameType(getter_AddRefs(fNodeType));
if (rulePart->mFrameType != fNodeType) {
return PR_FALSE;
}
}
else NS_ASSERTION(PR_FALSE, "program error");
}
// else wild card match
}
return PR_TRUE;
}
void DR_State::FindMatchingRule(DR_FrameTreeNode& aNode)
{
if (!aNode.mFrame) {
NS_ASSERTION(PR_FALSE, "invalid DR_FrameTreeNode \n");
return;
}
PRBool matchingRule = PR_FALSE;
nsCOMPtr<nsIAtom> fType;
aNode.mFrame->GetFrameType(getter_AddRefs(fType));
DR_FrameTypeInfo* info = GetFrameTypeInfo(fType.get());
NS_ASSERTION(info, "program error");
PRInt32 numRules = info->mRules.Count();
for (PRInt32 ruleX = 0; ruleX < numRules; ruleX++) {
DR_Rule* rule = (DR_Rule*)info->mRules.ElementAt(ruleX);
if (rule && RuleMatches(*rule, aNode)) {
aNode.mDisplay = rule->mDisplay;
matchingRule = PR_TRUE;
break;
}
}
if (!matchingRule) {
PRInt32 numWildRules = mWildRules.Count();
for (PRInt32 ruleX = 0; ruleX < numWildRules; ruleX++) {
DR_Rule* rule = (DR_Rule*)mWildRules.ElementAt(ruleX);
if (rule && RuleMatches(*rule, aNode)) {
aNode.mDisplay = rule->mDisplay;
break;
}
}
}
if (aNode.mParent) {
aNode.mIndent = aNode.mParent->mIndent;
if (aNode.mDisplay || mIndentUndisplayedFrames) {
aNode.mIndent++;
}
}
}
DR_FrameTreeNode* DR_State::CreateTreeNode(nsIFrame* aFrame,
const nsHTMLReflowState& aReflowState)
{
// find the frame of the parent reflow state (usually just the parent of aFrame)
const nsHTMLReflowState* parentRS = aReflowState.parentReflowState;
nsIFrame* parentFrame = (parentRS) ? parentRS->frame : nsnull;
// find the parent tree node leaf
DR_FrameTreeNode* parentNode = nsnull;
DR_FrameTreeNode* lastLeaf = (DR_FrameTreeNode*)mFrameTreeLeaves.ElementAt(mFrameTreeLeaves.Count() - 1);
if (lastLeaf) {
for (parentNode = lastLeaf; parentNode && (parentNode->mFrame != parentFrame); parentNode = parentNode->mParent) {
}
}
DR_FrameTreeNode* newNode = new DR_FrameTreeNode(aFrame, parentNode);
FindMatchingRule(*newNode);
if (lastLeaf == parentNode) {
mFrameTreeLeaves.RemoveElementAt(mFrameTreeLeaves.Count() - 1);
}
mFrameTreeLeaves.AppendElement(newNode);
mCount++;
return newNode;
}
void DR_State::PrettyUC(nscoord aSize,
char* aBuf)
{
if (NS_UNCONSTRAINEDSIZE == aSize) {
strcpy(aBuf, "UC");
}
else {
sprintf(aBuf, "%d", aSize);
}
}
void DR_State::DeleteTreeNode(DR_FrameTreeNode& aNode)
{
mFrameTreeLeaves.RemoveElement(&aNode);
PRInt32 numLeaves = mFrameTreeLeaves.Count();
if ((0 == numLeaves) || (aNode.mParent != (DR_FrameTreeNode*)mFrameTreeLeaves.ElementAt(numLeaves - 1))) {
mFrameTreeLeaves.AppendElement(aNode.mParent);
}
// delete the tree node
delete &aNode;
}
void* nsFrame::DisplayReflowEnter(nsIFrame* aFrame,
const nsHTMLReflowState& aReflowState)
{
if (!DR_state.mInited) DR_state.Init();
if (!DR_state.mActive) return nsnull;
NS_ASSERTION(aFrame, "invalid call");
DR_FrameTreeNode* treeNode = DR_state.CreateTreeNode(aFrame, aReflowState);
if (treeNode->mDisplay) {
DR_state.DisplayFrameTypeInfo(aFrame, treeNode->mIndent);
char width[16];
char height[16];
DR_state.PrettyUC(aReflowState.availableWidth, width);
DR_state.PrettyUC(aReflowState.availableHeight, height);
printf("r=%d a=%s,%s ", aReflowState.reason, width, height);
DR_state.PrettyUC(aReflowState.mComputedWidth, width);
DR_state.PrettyUC(aReflowState.mComputedHeight, height);
printf("c=%s,%s ", width, height);
nsIFrame* inFlow;
aFrame->GetPrevInFlow(&inFlow);
if (inFlow) {
printf("pif=%p ", inFlow);
}
aFrame->GetNextInFlow(&inFlow);
if (inFlow) {
printf("nif=%p ", inFlow);
}
printf("cnt=%d \n", DR_state.mCount);
}
return treeNode;
}
void nsFrame::DisplayReflowExit(nsIFrame* aFrame,
nsHTMLReflowMetrics& aMetrics,
nsReflowStatus aStatus,
void* aFrameTreeNode)
{
if (!DR_state.mActive) return;
NS_ASSERTION(aFrame, "DisplayReflowExit - invalid call");
if (!aFrameTreeNode) return;
DR_FrameTreeNode* treeNode = (DR_FrameTreeNode*)aFrameTreeNode;
if (treeNode->mDisplay) {
DR_state.DisplayFrameTypeInfo(aFrame, treeNode->mIndent);
char width[16];
char height[16];
DR_state.PrettyUC(aMetrics.width, width);
DR_state.PrettyUC(aMetrics.height, height);
printf("d=%s,%s ", width, height);
if (aMetrics.maxElementSize) {
DR_state.PrettyUC(aMetrics.maxElementSize->width, width);
printf("me=%s ", width);
}
if (aMetrics.mFlags & NS_REFLOW_CALC_MAX_WIDTH) {
DR_state.PrettyUC(aMetrics.mMaximumWidth, width);
printf("m=%s ", width);
}
if (NS_FRAME_COMPLETE != aStatus) {
printf("status=%d", aStatus);
}
printf("\n");
}
DR_state.DeleteTreeNode(*treeNode);
}
#endif
// End Display Reflow
#endif

Просмотреть файл

@ -433,6 +433,14 @@ public:
virtual void DumpBaseRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent, PRBool aIncludeStyleData);
nsresult MakeFrameName(const char* aKind, nsString& aResult) const;
// Display Reflow Debugging
static void* DisplayReflowEnter(nsIFrame* aFrame,
const nsHTMLReflowState& aReflowState);
static void DisplayReflowExit(nsIFrame* aFrame,
nsHTMLReflowMetrics& aMetrics,
PRUint32 aStatus,
void* aFrameTreeNode);
#endif
protected:
@ -487,4 +495,31 @@ protected:
NS_IMETHOD_(nsrefcnt) Release(void);
};
// Start Display Reflow Debuggin
#ifdef DEBUG
struct DR_cookie {
DR_cookie(nsIFrame* aFrame,
const nsHTMLReflowState& mReflowState,
nsHTMLReflowMetrics& aMetrics,
nsReflowStatus& aStatus);
~DR_cookie();
nsIFrame* mFrame;
const nsHTMLReflowState& mReflowState;
nsHTMLReflowMetrics& mMetrics;
nsReflowStatus& mStatus;
void* mValue;
};
#define DISPLAY_REFLOW(dr_frame, dr_rf_state, dr_rf_metrics, dr_rf_status) \
DR_cookie dr_cookie(dr_frame, dr_rf_state, dr_rf_metrics, dr_rf_status);
#else
#define DISPLAY_REFLOW(dr_frame, dr_rf_state, dr_rf_metrics, dr_rf_status)
#endif
// End Display Reflow Debugging
#endif /* nsFrame_h___ */

Просмотреть файл

@ -732,12 +732,13 @@ nsGfxScrollFrame::GetMaxSize(nsBoxLayoutState& aState, nsSize& aSize)
}
NS_IMETHODIMP
nsGfxScrollFrame::Reflow(nsIPresContext* aPresContext,
nsGfxScrollFrame::Reflow(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsGfxScrollFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
// if there is a max element request then set it to -1 so we can see if it gets set
if (aDesiredSize.maxElementSize)

Просмотреть файл

@ -192,6 +192,7 @@ HRuleFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("HRuleFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
NS_PRECONDITION(mState & NS_FRAME_IN_REFLOW, "frame is not in reflow");
// bug 18754: In compat mode, we treat HR's as inline elements

Просмотреть файл

@ -772,6 +772,7 @@ nsImageFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsImageFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aMetrics, aStatus);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsImageFrame::Reflow: availSize=%d,%d",
aReflowState.availableWidth, aReflowState.availableHeight));

Просмотреть файл

@ -328,6 +328,7 @@ nsInlineFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsInlineFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aMetrics, aStatus);
if (nsnull == aReflowState.mLineLayout) {
return NS_ERROR_INVALID_ARG;
}

Просмотреть файл

@ -884,6 +884,7 @@ nsObjectFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsObjectFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aMetrics, aStatus);
nsresult rv = NS_OK;
// Get our desired size

Просмотреть файл

@ -148,6 +148,7 @@ NS_METHOD nsPageFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsPageFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
aStatus = NS_FRAME_COMPLETE; // initialize out parameter
if (eReflowReason_Incremental == aReflowState.reason) {

Просмотреть файл

@ -65,6 +65,7 @@ nsPlaceholderFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsPlaceholderFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
aDesiredSize.width = 0;
aDesiredSize.height = 0;
aDesiredSize.ascent = 0;

Просмотреть файл

@ -646,6 +646,7 @@ nsScrollFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsScrollFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
NS_FRAME_TRACE_MSG(NS_FRAME_TRACE_CALLS,
("enter nsScrollFrame::Reflow: maxSize=%d,%d",
aReflowState.availableWidth,

Просмотреть файл

@ -294,6 +294,7 @@ nsSimplePageSequenceFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsSimplePageSequenceFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
NS_FRAME_TRACE_REFLOW_IN("nsSimplePageSequenceFrame::Reflow");
aStatus = NS_FRAME_COMPLETE; // we're always complete

Просмотреть файл

@ -98,6 +98,7 @@ SpacerFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("SpacerFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aMetrics, aStatus);
aStatus = NS_FRAME_COMPLETE;
// By default, we have no area

Просмотреть файл

@ -4958,12 +4958,13 @@ nsTextFrame::MeasureText(nsIPresContext* aPresContext,
}
NS_IMETHODIMP
nsTextFrame::Reflow(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aMetrics,
nsTextFrame::Reflow(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aMetrics,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTextFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aMetrics, aStatus);
#ifdef NOISY_REFLOW
ListTag(stdout);
printf(": BeginReflow: availableSize=%d,%d\n",

Просмотреть файл

@ -503,6 +503,7 @@ ViewportFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("ViewportFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
NS_FRAME_TRACE_REFLOW_IN("ViewportFrame::Reflow");
NS_PRECONDITION(nsnull == aDesiredSize.maxElementSize, "unexpected request");

Просмотреть файл

@ -475,6 +475,7 @@ nsHTMLFrameOuterFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsHTMLFrameOuterFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
//printf("OuterFrame::Reflow %X (%d,%d) \n", this, aReflowState.availableWidth, aReflowState.availableHeight);
NS_FRAME_TRACE(NS_FRAME_TRACE_CALLS,
("enter nsHTMLFrameOuterFrame::Reflow: maxSize=%d,%d reason=%d",

Просмотреть файл

@ -1050,6 +1050,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsHTMLFramesetFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
nsCOMPtr<nsIPresShell> shell;
aPresContext->GetShell(getter_AddRefs(shell));

Просмотреть файл

@ -1225,6 +1225,7 @@ nsComboboxControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsComboboxControlFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
aStatus = NS_FRAME_COMPLETE;

Просмотреть файл

@ -281,6 +281,7 @@ nsFieldSetFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsFieldSetFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
// Initialize OUT parameter
aStatus = NS_FRAME_COMPLETE;

Просмотреть файл

@ -371,6 +371,7 @@ NS_IMETHODIMP nsFileControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsFileControlFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
aStatus = NS_FRAME_COMPLETE;

Просмотреть файл

@ -516,6 +516,7 @@ nsFormControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsFormControlFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
if (!mDidInit) {
mPresContext = aPresContext;

Просмотреть файл

@ -601,6 +601,7 @@ nsGfxButtonControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsGfxButtonControlFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
// The mFormFrame is set in the initial reflow within nsHTMLButtonControlFrame
nsresult rv = NS_OK;

Просмотреть файл

@ -698,6 +698,7 @@ nsGfxCheckboxControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsGfxCheckboxControlFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
nsresult rv = nsFormControlFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);
COMPARE_QUIRK_SIZE("nsGfxCheckboxControlFrame", 13, 13)

Просмотреть файл

@ -466,6 +466,7 @@ nsGfxRadioControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsGfxRadioControlFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
nsresult rv = nsNativeFormControlFrame::Reflow(aPresContext, aDesiredSize, aReflowState, aStatus);

Просмотреть файл

@ -2273,6 +2273,7 @@ nsGfxTextControlFrame2::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsGfxTextControlFrame2", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
SetInitialValue();

Просмотреть файл

@ -559,6 +559,7 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsHTMLButtonControlFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);

Просмотреть файл

@ -299,6 +299,7 @@ nsImageControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsImageControlFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
if (!mFormFrame && (eReflowReason_Initial == aReflowState.reason)) {
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);
// add ourself as an nsIFormControlFrame

Просмотреть файл

@ -332,6 +332,7 @@ NS_IMETHODIMP nsIsIndexFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsIsIndexFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
// The Areaframe takes care of all our reflow
// (except for when style is used to change its size?)

Просмотреть файл

@ -113,6 +113,7 @@ nsLabelFrame::Reflow(nsIPresContext* aPresContext,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
{
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
if (eReflowReason_Initial == aReflowState.reason)
nsFormControlFrame::RegUnRegAccessKey(aPresContext,
NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);

Просмотреть файл

@ -111,6 +111,7 @@ nsLegendFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsLegendFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
if (eReflowReason_Initial == aReflowState.reason) {
mPresContext = aPresContext;
nsFormControlFrame::RegUnRegAccessKey(aPresContext, NS_STATIC_CAST(nsIFrame*, this), PR_TRUE);

Просмотреть файл

@ -616,6 +616,7 @@ nsListControlFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsListControlFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
REFLOW_COUNTER_REQUEST();
aStatus = NS_FRAME_COMPLETE;

Просмотреть файл

@ -679,7 +679,8 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTableCellFrame", aReflowState.reason);
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState);
#endif
@ -788,7 +789,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
firstKid->GetOrigin(kidOrigin);
}
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(firstKid, (nsHTMLReflowState&)kidReflowState);
#endif
ReflowChild(firstKid, aPresContext, kidSize, kidReflowState,
@ -796,7 +797,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
if (isStyleChanged) {
Invalidate(aPresContext, mRect);
}
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(firstKid, (nsHTMLReflowState&)kidReflowState, &kidSize, aStatus);
#endif
@ -932,7 +933,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
// remember my desired size for this reflow
SetDesiredSize(aDesiredSize);
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState, &aDesiredSize, aStatus);
#endif

Просмотреть файл

@ -166,12 +166,13 @@ nsTableColFrame::GetFrameForPoint(nsIPresContext* aPresContext,
return NS_ERROR_FAILURE;
}
NS_METHOD nsTableColFrame::Reflow(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
NS_METHOD nsTableColFrame::Reflow(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTableColFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
aDesiredSize.width=0;
aDesiredSize.height=0;
if (nsnull!=aDesiredSize.maxElementSize)

Просмотреть файл

@ -487,6 +487,7 @@ NS_METHOD nsTableColGroupFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTableColGroupFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
NS_ASSERTION(nsnull!=mContent, "bad state -- null content for frame");
nsresult rv=NS_OK;
// for every content child that (is a column thingy and does not already have a frame)

Просмотреть файл

@ -1821,7 +1821,8 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTableFrame", aReflowState.reason);
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState);
#endif
@ -1981,7 +1982,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
}
}
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState, &aDesiredSize, aStatus);
#endif
return rv;

Просмотреть файл

@ -1487,7 +1487,8 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTableOuterFrame", aOuterRS.reason);
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
DISPLAY_REFLOW(this, aOuterRS, aDesiredSize, aStatus);
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aOuterRS);
#endif
@ -1628,7 +1629,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
mPriorAvailWidth = aOuterRS.availableWidth;
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aOuterRS, &aDesiredSize, aStatus);
#endif
return rv;

Просмотреть файл

@ -1298,7 +1298,8 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTableRowFrame", aReflowState.reason);
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState);
#endif
nsresult rv = NS_OK;
@ -1342,7 +1343,7 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext,
// just set our width to what was available. The table will calculate the width and not use our value.
aDesiredSize.width = aReflowState.availableWidth;
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState, &aDesiredSize, aStatus);
#endif
return rv;

Просмотреть файл

@ -1042,7 +1042,8 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTableRowGroupFrame", aReflowState.reason);
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState);
#endif
@ -1103,7 +1104,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext,
aDesiredSize.height = GetHeightOfRows(aPresContext);
}
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState, &aDesiredSize, aStatus);
#endif
return rv;

Просмотреть файл

@ -679,7 +679,8 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTableCellFrame", aReflowState.reason);
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState);
#endif
@ -788,7 +789,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
firstKid->GetOrigin(kidOrigin);
}
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(firstKid, (nsHTMLReflowState&)kidReflowState);
#endif
ReflowChild(firstKid, aPresContext, kidSize, kidReflowState,
@ -796,7 +797,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
if (isStyleChanged) {
Invalidate(aPresContext, mRect);
}
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(firstKid, (nsHTMLReflowState&)kidReflowState, &kidSize, aStatus);
#endif
@ -932,7 +933,7 @@ NS_METHOD nsTableCellFrame::Reflow(nsIPresContext* aPresContext,
// remember my desired size for this reflow
SetDesiredSize(aDesiredSize);
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState, &aDesiredSize, aStatus);
#endif

Просмотреть файл

@ -166,12 +166,13 @@ nsTableColFrame::GetFrameForPoint(nsIPresContext* aPresContext,
return NS_ERROR_FAILURE;
}
NS_METHOD nsTableColFrame::Reflow(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
NS_METHOD nsTableColFrame::Reflow(nsIPresContext* aPresContext,
nsHTMLReflowMetrics& aDesiredSize,
const nsHTMLReflowState& aReflowState,
nsReflowStatus& aStatus)
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTableColFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
aDesiredSize.width=0;
aDesiredSize.height=0;
if (nsnull!=aDesiredSize.maxElementSize)

Просмотреть файл

@ -487,6 +487,7 @@ NS_METHOD nsTableColGroupFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTableColGroupFrame", aReflowState.reason);
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
NS_ASSERTION(nsnull!=mContent, "bad state -- null content for frame");
nsresult rv=NS_OK;
// for every content child that (is a column thingy and does not already have a frame)

Просмотреть файл

@ -1821,7 +1821,8 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTableFrame", aReflowState.reason);
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState);
#endif
@ -1981,7 +1982,7 @@ NS_METHOD nsTableFrame::Reflow(nsIPresContext* aPresContext,
}
}
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState, &aDesiredSize, aStatus);
#endif
return rv;

Просмотреть файл

@ -1487,7 +1487,8 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTableOuterFrame", aOuterRS.reason);
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
DISPLAY_REFLOW(this, aOuterRS, aDesiredSize, aStatus);
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aOuterRS);
#endif
@ -1628,7 +1629,7 @@ NS_METHOD nsTableOuterFrame::Reflow(nsIPresContext* aPresContext,
mPriorAvailWidth = aOuterRS.availableWidth;
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aOuterRS, &aDesiredSize, aStatus);
#endif
return rv;

Просмотреть файл

@ -1298,7 +1298,8 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTableRowFrame", aReflowState.reason);
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState);
#endif
nsresult rv = NS_OK;
@ -1342,7 +1343,7 @@ nsTableRowFrame::Reflow(nsIPresContext* aPresContext,
// just set our width to what was available. The table will calculate the width and not use our value.
aDesiredSize.width = aReflowState.availableWidth;
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState, &aDesiredSize, aStatus);
#endif
return rv;

Просмотреть файл

@ -1042,7 +1042,8 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext,
nsReflowStatus& aStatus)
{
DO_GLOBAL_REFLOW_COUNT("nsTableRowGroupFrame", aReflowState.reason);
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus);
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState);
#endif
@ -1103,7 +1104,7 @@ nsTableRowGroupFrame::Reflow(nsIPresContext* aPresContext,
aDesiredSize.height = GetHeightOfRows(aPresContext);
}
#if defined DEBUG_TABLE_REFLOW | DEBUG_TABLE_REFLOW_TIMING
#if defined DEBUG_TABLE_REFLOW_TIMING
nsTableFrame::DebugReflow(this, (nsHTMLReflowState&)aReflowState, &aDesiredSize, aStatus);
#endif
return rv;