diff --git a/mozilla/layout/forms/nsComboboxControlFrame.cpp b/mozilla/layout/forms/nsComboboxControlFrame.cpp index f7651128027..36d1b0b1fbd 100644 --- a/mozilla/layout/forms/nsComboboxControlFrame.cpp +++ b/mozilla/layout/forms/nsComboboxControlFrame.cpp @@ -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; diff --git a/mozilla/layout/forms/nsFieldSetFrame.cpp b/mozilla/layout/forms/nsFieldSetFrame.cpp index bffe57d0aa5..1fc83eb882d 100644 --- a/mozilla/layout/forms/nsFieldSetFrame.cpp +++ b/mozilla/layout/forms/nsFieldSetFrame.cpp @@ -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; diff --git a/mozilla/layout/forms/nsFileControlFrame.cpp b/mozilla/layout/forms/nsFileControlFrame.cpp index 12789bfcbf8..f037e6838fd 100644 --- a/mozilla/layout/forms/nsFileControlFrame.cpp +++ b/mozilla/layout/forms/nsFileControlFrame.cpp @@ -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; diff --git a/mozilla/layout/forms/nsFormControlFrame.cpp b/mozilla/layout/forms/nsFormControlFrame.cpp index b7859997a58..cd2a335fee4 100644 --- a/mozilla/layout/forms/nsFormControlFrame.cpp +++ b/mozilla/layout/forms/nsFormControlFrame.cpp @@ -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; diff --git a/mozilla/layout/forms/nsGfxButtonControlFrame.cpp b/mozilla/layout/forms/nsGfxButtonControlFrame.cpp index c95df32fcb2..4f72bc535ae 100644 --- a/mozilla/layout/forms/nsGfxButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsGfxButtonControlFrame.cpp @@ -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; diff --git a/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp b/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp index b0706b17383..a39ef7158ae 100644 --- a/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp +++ b/mozilla/layout/forms/nsGfxCheckboxControlFrame.cpp @@ -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) diff --git a/mozilla/layout/forms/nsGfxRadioControlFrame.cpp b/mozilla/layout/forms/nsGfxRadioControlFrame.cpp index b052d54a2f8..6ba09c753c5 100644 --- a/mozilla/layout/forms/nsGfxRadioControlFrame.cpp +++ b/mozilla/layout/forms/nsGfxRadioControlFrame.cpp @@ -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); diff --git a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp index 2f63a55fa1b..18eed4330e2 100644 --- a/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/forms/nsHTMLButtonControlFrame.cpp @@ -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); diff --git a/mozilla/layout/forms/nsImageControlFrame.cpp b/mozilla/layout/forms/nsImageControlFrame.cpp index 12068710798..bece11bc0c1 100644 --- a/mozilla/layout/forms/nsImageControlFrame.cpp +++ b/mozilla/layout/forms/nsImageControlFrame.cpp @@ -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 diff --git a/mozilla/layout/forms/nsIsIndexFrame.cpp b/mozilla/layout/forms/nsIsIndexFrame.cpp index 0142521eb83..d0a69f40ab3 100644 --- a/mozilla/layout/forms/nsIsIndexFrame.cpp +++ b/mozilla/layout/forms/nsIsIndexFrame.cpp @@ -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?) diff --git a/mozilla/layout/forms/nsLegendFrame.cpp b/mozilla/layout/forms/nsLegendFrame.cpp index 797109ee272..c0a95dfc06d 100644 --- a/mozilla/layout/forms/nsLegendFrame.cpp +++ b/mozilla/layout/forms/nsLegendFrame.cpp @@ -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); diff --git a/mozilla/layout/forms/nsListControlFrame.cpp b/mozilla/layout/forms/nsListControlFrame.cpp index 14c400aad08..df0a8e16549 100644 --- a/mozilla/layout/forms/nsListControlFrame.cpp +++ b/mozilla/layout/forms/nsListControlFrame.cpp @@ -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; diff --git a/mozilla/layout/generic/nsBRFrame.cpp b/mozilla/layout/generic/nsBRFrame.cpp index a44b08ab3c2..cab5fef82f4 100644 --- a/mozilla/layout/generic/nsBRFrame.cpp +++ b/mozilla/layout/generic/nsBRFrame.cpp @@ -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; diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index e7ef70cc1c3..75f159046f1 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -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); diff --git a/mozilla/layout/generic/nsBulletFrame.cpp b/mozilla/layout/generic/nsBulletFrame.cpp index 09919708605..561279c2df8 100644 --- a/mozilla/layout/generic/nsBulletFrame.cpp +++ b/mozilla/layout/generic/nsBulletFrame.cpp @@ -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); diff --git a/mozilla/layout/generic/nsFirstLetterFrame.cpp b/mozilla/layout/generic/nsFirstLetterFrame.cpp index 66a45f55901..2df87dd3785 100644 --- a/mozilla/layout/generic/nsFirstLetterFrame.cpp +++ b/mozilla/layout/generic/nsFirstLetterFrame.cpp @@ -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 diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index d91d401b537..7d728d2a4d2 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -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 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 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 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 diff --git a/mozilla/layout/generic/nsFrame.h b/mozilla/layout/generic/nsFrame.h index 03d44f20698..6d1a7cc7f7a 100644 --- a/mozilla/layout/generic/nsFrame.h +++ b/mozilla/layout/generic/nsFrame.h @@ -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___ */ diff --git a/mozilla/layout/generic/nsFrameFrame.cpp b/mozilla/layout/generic/nsFrameFrame.cpp index 86601079eb9..3055576aa46 100644 --- a/mozilla/layout/generic/nsFrameFrame.cpp +++ b/mozilla/layout/generic/nsFrameFrame.cpp @@ -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", diff --git a/mozilla/layout/generic/nsFrameSetFrame.cpp b/mozilla/layout/generic/nsFrameSetFrame.cpp index a59a3ca27d5..dedc972c7aa 100644 --- a/mozilla/layout/generic/nsFrameSetFrame.cpp +++ b/mozilla/layout/generic/nsFrameSetFrame.cpp @@ -1050,6 +1050,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext, nsReflowStatus& aStatus) { DO_GLOBAL_REFLOW_COUNT("nsHTMLFramesetFrame", aReflowState.reason); + DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus); nsCOMPtr shell; aPresContext->GetShell(getter_AddRefs(shell)); diff --git a/mozilla/layout/generic/nsGfxScrollFrame.cpp b/mozilla/layout/generic/nsGfxScrollFrame.cpp index 1ecf213e53f..e5190b97bd5 100644 --- a/mozilla/layout/generic/nsGfxScrollFrame.cpp +++ b/mozilla/layout/generic/nsGfxScrollFrame.cpp @@ -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) diff --git a/mozilla/layout/generic/nsImageFrame.cpp b/mozilla/layout/generic/nsImageFrame.cpp index b8a508d4815..0ee2f440639 100644 --- a/mozilla/layout/generic/nsImageFrame.cpp +++ b/mozilla/layout/generic/nsImageFrame.cpp @@ -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)); diff --git a/mozilla/layout/generic/nsInlineFrame.cpp b/mozilla/layout/generic/nsInlineFrame.cpp index 6157fda6f88..7a4ff853f0c 100644 --- a/mozilla/layout/generic/nsInlineFrame.cpp +++ b/mozilla/layout/generic/nsInlineFrame.cpp @@ -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; } diff --git a/mozilla/layout/generic/nsObjectFrame.cpp b/mozilla/layout/generic/nsObjectFrame.cpp index f5bc2a7f58d..c76b6b269c2 100644 --- a/mozilla/layout/generic/nsObjectFrame.cpp +++ b/mozilla/layout/generic/nsObjectFrame.cpp @@ -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 diff --git a/mozilla/layout/generic/nsPageFrame.cpp b/mozilla/layout/generic/nsPageFrame.cpp index 10ac9480789..9f667592db2 100644 --- a/mozilla/layout/generic/nsPageFrame.cpp +++ b/mozilla/layout/generic/nsPageFrame.cpp @@ -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) { diff --git a/mozilla/layout/generic/nsPlaceholderFrame.cpp b/mozilla/layout/generic/nsPlaceholderFrame.cpp index 754e6868a80..50e5c4a9524 100644 --- a/mozilla/layout/generic/nsPlaceholderFrame.cpp +++ b/mozilla/layout/generic/nsPlaceholderFrame.cpp @@ -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; diff --git a/mozilla/layout/generic/nsSimplePageSequence.cpp b/mozilla/layout/generic/nsSimplePageSequence.cpp index 00356e9fa00..fc4fdec017e 100644 --- a/mozilla/layout/generic/nsSimplePageSequence.cpp +++ b/mozilla/layout/generic/nsSimplePageSequence.cpp @@ -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 diff --git a/mozilla/layout/generic/nsSpacerFrame.cpp b/mozilla/layout/generic/nsSpacerFrame.cpp index 7ad8f168723..7eb6e3e2858 100644 --- a/mozilla/layout/generic/nsSpacerFrame.cpp +++ b/mozilla/layout/generic/nsSpacerFrame.cpp @@ -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 diff --git a/mozilla/layout/generic/nsTextFrame.cpp b/mozilla/layout/generic/nsTextFrame.cpp index 6fb7a46336e..76c60fa881f 100644 --- a/mozilla/layout/generic/nsTextFrame.cpp +++ b/mozilla/layout/generic/nsTextFrame.cpp @@ -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", diff --git a/mozilla/layout/generic/nsViewportFrame.cpp b/mozilla/layout/generic/nsViewportFrame.cpp index 25f1b3987f1..bc86caca24f 100644 --- a/mozilla/layout/generic/nsViewportFrame.cpp +++ b/mozilla/layout/generic/nsViewportFrame.cpp @@ -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"); diff --git a/mozilla/layout/html/base/src/nsBRFrame.cpp b/mozilla/layout/html/base/src/nsBRFrame.cpp index a44b08ab3c2..cab5fef82f4 100644 --- a/mozilla/layout/html/base/src/nsBRFrame.cpp +++ b/mozilla/layout/html/base/src/nsBRFrame.cpp @@ -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; diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index e7ef70cc1c3..75f159046f1 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -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); diff --git a/mozilla/layout/html/base/src/nsBulletFrame.cpp b/mozilla/layout/html/base/src/nsBulletFrame.cpp index 09919708605..561279c2df8 100644 --- a/mozilla/layout/html/base/src/nsBulletFrame.cpp +++ b/mozilla/layout/html/base/src/nsBulletFrame.cpp @@ -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); diff --git a/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp b/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp index 66a45f55901..2df87dd3785 100644 --- a/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp +++ b/mozilla/layout/html/base/src/nsFirstLetterFrame.cpp @@ -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 diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index d91d401b537..7d728d2a4d2 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -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 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 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 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 diff --git a/mozilla/layout/html/base/src/nsFrame.h b/mozilla/layout/html/base/src/nsFrame.h index 03d44f20698..6d1a7cc7f7a 100644 --- a/mozilla/layout/html/base/src/nsFrame.h +++ b/mozilla/layout/html/base/src/nsFrame.h @@ -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___ */ diff --git a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp index 1ecf213e53f..e5190b97bd5 100644 --- a/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsGfxScrollFrame.cpp @@ -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) diff --git a/mozilla/layout/html/base/src/nsHRFrame.cpp b/mozilla/layout/html/base/src/nsHRFrame.cpp index 4a1a3d73c47..86c71389c0c 100644 --- a/mozilla/layout/html/base/src/nsHRFrame.cpp +++ b/mozilla/layout/html/base/src/nsHRFrame.cpp @@ -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 diff --git a/mozilla/layout/html/base/src/nsImageFrame.cpp b/mozilla/layout/html/base/src/nsImageFrame.cpp index b8a508d4815..0ee2f440639 100644 --- a/mozilla/layout/html/base/src/nsImageFrame.cpp +++ b/mozilla/layout/html/base/src/nsImageFrame.cpp @@ -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)); diff --git a/mozilla/layout/html/base/src/nsInlineFrame.cpp b/mozilla/layout/html/base/src/nsInlineFrame.cpp index 6157fda6f88..7a4ff853f0c 100644 --- a/mozilla/layout/html/base/src/nsInlineFrame.cpp +++ b/mozilla/layout/html/base/src/nsInlineFrame.cpp @@ -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; } diff --git a/mozilla/layout/html/base/src/nsObjectFrame.cpp b/mozilla/layout/html/base/src/nsObjectFrame.cpp index f5bc2a7f58d..c76b6b269c2 100644 --- a/mozilla/layout/html/base/src/nsObjectFrame.cpp +++ b/mozilla/layout/html/base/src/nsObjectFrame.cpp @@ -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 diff --git a/mozilla/layout/html/base/src/nsPageFrame.cpp b/mozilla/layout/html/base/src/nsPageFrame.cpp index 10ac9480789..9f667592db2 100644 --- a/mozilla/layout/html/base/src/nsPageFrame.cpp +++ b/mozilla/layout/html/base/src/nsPageFrame.cpp @@ -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) { diff --git a/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp b/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp index 754e6868a80..50e5c4a9524 100644 --- a/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp +++ b/mozilla/layout/html/base/src/nsPlaceholderFrame.cpp @@ -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; diff --git a/mozilla/layout/html/base/src/nsScrollFrame.cpp b/mozilla/layout/html/base/src/nsScrollFrame.cpp index 26366bd5d6a..46ea3be0a82 100644 --- a/mozilla/layout/html/base/src/nsScrollFrame.cpp +++ b/mozilla/layout/html/base/src/nsScrollFrame.cpp @@ -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, diff --git a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp index 00356e9fa00..fc4fdec017e 100644 --- a/mozilla/layout/html/base/src/nsSimplePageSequence.cpp +++ b/mozilla/layout/html/base/src/nsSimplePageSequence.cpp @@ -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 diff --git a/mozilla/layout/html/base/src/nsSpacerFrame.cpp b/mozilla/layout/html/base/src/nsSpacerFrame.cpp index 7ad8f168723..7eb6e3e2858 100644 --- a/mozilla/layout/html/base/src/nsSpacerFrame.cpp +++ b/mozilla/layout/html/base/src/nsSpacerFrame.cpp @@ -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 diff --git a/mozilla/layout/html/base/src/nsTextFrame.cpp b/mozilla/layout/html/base/src/nsTextFrame.cpp index 6fb7a46336e..76c60fa881f 100644 --- a/mozilla/layout/html/base/src/nsTextFrame.cpp +++ b/mozilla/layout/html/base/src/nsTextFrame.cpp @@ -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", diff --git a/mozilla/layout/html/base/src/nsViewportFrame.cpp b/mozilla/layout/html/base/src/nsViewportFrame.cpp index 25f1b3987f1..bc86caca24f 100644 --- a/mozilla/layout/html/base/src/nsViewportFrame.cpp +++ b/mozilla/layout/html/base/src/nsViewportFrame.cpp @@ -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"); diff --git a/mozilla/layout/html/document/src/nsFrameFrame.cpp b/mozilla/layout/html/document/src/nsFrameFrame.cpp index 86601079eb9..3055576aa46 100644 --- a/mozilla/layout/html/document/src/nsFrameFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameFrame.cpp @@ -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", diff --git a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp index a59a3ca27d5..dedc972c7aa 100644 --- a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp @@ -1050,6 +1050,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext, nsReflowStatus& aStatus) { DO_GLOBAL_REFLOW_COUNT("nsHTMLFramesetFrame", aReflowState.reason); + DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus); nsCOMPtr shell; aPresContext->GetShell(getter_AddRefs(shell)); diff --git a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp index f7651128027..36d1b0b1fbd 100644 --- a/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsComboboxControlFrame.cpp @@ -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; diff --git a/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp b/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp index bffe57d0aa5..1fc83eb882d 100644 --- a/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFieldSetFrame.cpp @@ -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; diff --git a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp index 12789bfcbf8..f037e6838fd 100644 --- a/mozilla/layout/html/forms/src/nsFileControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFileControlFrame.cpp @@ -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; diff --git a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp index b7859997a58..cd2a335fee4 100644 --- a/mozilla/layout/html/forms/src/nsFormControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsFormControlFrame.cpp @@ -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; diff --git a/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp index c95df32fcb2..4f72bc535ae 100644 --- a/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxButtonControlFrame.cpp @@ -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; diff --git a/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp index b0706b17383..a39ef7158ae 100644 --- a/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxCheckboxControlFrame.cpp @@ -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) diff --git a/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp b/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp index b052d54a2f8..6ba09c753c5 100644 --- a/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsGfxRadioControlFrame.cpp @@ -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); diff --git a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp index 903cf71d4a4..628479242d4 100644 --- a/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp +++ b/mozilla/layout/html/forms/src/nsGfxTextControlFrame2.cpp @@ -2273,6 +2273,7 @@ nsGfxTextControlFrame2::Reflow(nsIPresContext* aPresContext, nsReflowStatus& aStatus) { DO_GLOBAL_REFLOW_COUNT("nsGfxTextControlFrame2", aReflowState.reason); + DISPLAY_REFLOW(this, aReflowState, aDesiredSize, aStatus); SetInitialValue(); diff --git a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index 2f63a55fa1b..18eed4330e2 100644 --- a/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -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); diff --git a/mozilla/layout/html/forms/src/nsImageControlFrame.cpp b/mozilla/layout/html/forms/src/nsImageControlFrame.cpp index 12068710798..bece11bc0c1 100644 --- a/mozilla/layout/html/forms/src/nsImageControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsImageControlFrame.cpp @@ -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 diff --git a/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp b/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp index 0142521eb83..d0a69f40ab3 100644 --- a/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp +++ b/mozilla/layout/html/forms/src/nsIsIndexFrame.cpp @@ -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?) diff --git a/mozilla/layout/html/forms/src/nsLabelFrame.cpp b/mozilla/layout/html/forms/src/nsLabelFrame.cpp index d01b53dd1a7..6d4c566c75c 100644 --- a/mozilla/layout/html/forms/src/nsLabelFrame.cpp +++ b/mozilla/layout/html/forms/src/nsLabelFrame.cpp @@ -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); diff --git a/mozilla/layout/html/forms/src/nsLegendFrame.cpp b/mozilla/layout/html/forms/src/nsLegendFrame.cpp index 797109ee272..c0a95dfc06d 100644 --- a/mozilla/layout/html/forms/src/nsLegendFrame.cpp +++ b/mozilla/layout/html/forms/src/nsLegendFrame.cpp @@ -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); diff --git a/mozilla/layout/html/forms/src/nsListControlFrame.cpp b/mozilla/layout/html/forms/src/nsListControlFrame.cpp index 14c400aad08..df0a8e16549 100644 --- a/mozilla/layout/html/forms/src/nsListControlFrame.cpp +++ b/mozilla/layout/html/forms/src/nsListControlFrame.cpp @@ -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; diff --git a/mozilla/layout/html/table/src/nsTableCellFrame.cpp b/mozilla/layout/html/table/src/nsTableCellFrame.cpp index 026171ba479..791132c0d65 100644 --- a/mozilla/layout/html/table/src/nsTableCellFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableCellFrame.cpp @@ -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 diff --git a/mozilla/layout/html/table/src/nsTableColFrame.cpp b/mozilla/layout/html/table/src/nsTableColFrame.cpp index 70d46373ee8..419eafe1c84 100644 --- a/mozilla/layout/html/table/src/nsTableColFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableColFrame.cpp @@ -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) diff --git a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp index 34cae11c3b0..1d2d1fff569 100644 --- a/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableColGroupFrame.cpp @@ -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) diff --git a/mozilla/layout/html/table/src/nsTableFrame.cpp b/mozilla/layout/html/table/src/nsTableFrame.cpp index 7f66b9b2575..785a22d985b 100644 --- a/mozilla/layout/html/table/src/nsTableFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableFrame.cpp @@ -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; diff --git a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp index c5dbdca0c6c..f714a7b5848 100644 --- a/mozilla/layout/html/table/src/nsTableOuterFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableOuterFrame.cpp @@ -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; diff --git a/mozilla/layout/html/table/src/nsTableRowFrame.cpp b/mozilla/layout/html/table/src/nsTableRowFrame.cpp index 6ba228ff8f6..0ddd271299a 100644 --- a/mozilla/layout/html/table/src/nsTableRowFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowFrame.cpp @@ -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; diff --git a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp index 9406a189907..19ed469dd5f 100644 --- a/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/html/table/src/nsTableRowGroupFrame.cpp @@ -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; diff --git a/mozilla/layout/tables/nsTableCellFrame.cpp b/mozilla/layout/tables/nsTableCellFrame.cpp index 026171ba479..791132c0d65 100644 --- a/mozilla/layout/tables/nsTableCellFrame.cpp +++ b/mozilla/layout/tables/nsTableCellFrame.cpp @@ -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 diff --git a/mozilla/layout/tables/nsTableColFrame.cpp b/mozilla/layout/tables/nsTableColFrame.cpp index 70d46373ee8..419eafe1c84 100644 --- a/mozilla/layout/tables/nsTableColFrame.cpp +++ b/mozilla/layout/tables/nsTableColFrame.cpp @@ -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) diff --git a/mozilla/layout/tables/nsTableColGroupFrame.cpp b/mozilla/layout/tables/nsTableColGroupFrame.cpp index 34cae11c3b0..1d2d1fff569 100644 --- a/mozilla/layout/tables/nsTableColGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableColGroupFrame.cpp @@ -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) diff --git a/mozilla/layout/tables/nsTableFrame.cpp b/mozilla/layout/tables/nsTableFrame.cpp index 7f66b9b2575..785a22d985b 100644 --- a/mozilla/layout/tables/nsTableFrame.cpp +++ b/mozilla/layout/tables/nsTableFrame.cpp @@ -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; diff --git a/mozilla/layout/tables/nsTableOuterFrame.cpp b/mozilla/layout/tables/nsTableOuterFrame.cpp index c5dbdca0c6c..f714a7b5848 100644 --- a/mozilla/layout/tables/nsTableOuterFrame.cpp +++ b/mozilla/layout/tables/nsTableOuterFrame.cpp @@ -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; diff --git a/mozilla/layout/tables/nsTableRowFrame.cpp b/mozilla/layout/tables/nsTableRowFrame.cpp index 6ba228ff8f6..0ddd271299a 100644 --- a/mozilla/layout/tables/nsTableRowFrame.cpp +++ b/mozilla/layout/tables/nsTableRowFrame.cpp @@ -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; diff --git a/mozilla/layout/tables/nsTableRowGroupFrame.cpp b/mozilla/layout/tables/nsTableRowGroupFrame.cpp index 9406a189907..19ed469dd5f 100644 --- a/mozilla/layout/tables/nsTableRowGroupFrame.cpp +++ b/mozilla/layout/tables/nsTableRowGroupFrame.cpp @@ -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;