Remove the VerifyReflow code that checked the space manager state. (Bug 191448) r+sr=roc

This commit is contained in:
L. David Baron 2009-01-04 14:52:38 -05:00
Родитель 4d4096952f
Коммит 9cefaf0382
6 изменённых файлов: 3 добавлений и 138 удалений

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

@ -1629,7 +1629,6 @@ GK_ATOM(overflowPlaceholdersProperty, "OverflowPlaceholdersProperty") // nsFram
GK_ATOM(preEffectsBBoxProperty, "PreEffectsBBoxProperty") // nsRect*
GK_ATOM(preTransformBBoxProperty, "PreTransformBBoxProperty") // nsRect*
GK_ATOM(rowUnpaginatedHeightProperty, "RowUnpaginatedHeightProperty") // nscoord*
GK_ATOM(spaceManagerProperty, "SpaceManagerProperty") // the space manager for a block
GK_ATOM(tabWidthProperty, "TabWidthProperty") // nsTArray<TabSetting>* array of tab widths
GK_ATOM(tableBCProperty, "TableBCProperty") // table border collapsing info (e.g. damage area, table border widths)
GK_ATOM(usedMarginProperty, "UsedMarginProperty") // nsMargin*

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

@ -123,8 +123,7 @@ typedef PRUint32 nsFrameState;
#define VERIFY_REFLOW_DUMP_COMMANDS 0x08
#define VERIFY_REFLOW_NOISY_RC 0x10
#define VERIFY_REFLOW_REALLY_NOISY_RC 0x20
#define VERIFY_REFLOW_INCLUDE_SPACE_MANAGER 0x40
#define VERIFY_REFLOW_DURING_RESIZE_REFLOW 0x80
#define VERIFY_REFLOW_DURING_RESIZE_REFLOW 0x40
/**
* Presentation shell interface. Presentation shells are the

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

@ -137,7 +137,6 @@
#include "nsIFrameDebug.h"
#endif
// for |#ifdef DEBUG| code
#include "nsSpaceManager.h"
#include "prenv.h"
#include "nsIAttribute.h"
#include "nsIGlobalHistory2.h"
@ -257,7 +256,6 @@ static const VerifyReflowFlags gFlags[] = {
{ "list-commands", VERIFY_REFLOW_DUMP_COMMANDS },
{ "noisy-commands", VERIFY_REFLOW_NOISY_RC },
{ "really-noisy-commands", VERIFY_REFLOW_REALLY_NOISY_RC },
{ "space-manager", VERIFY_REFLOW_INCLUDE_SPACE_MANAGER },
{ "resize", VERIFY_REFLOW_DURING_RESIZE_REFLOW },
};
@ -6792,102 +6790,7 @@ CompareTrees(nsPresContext* aFirstPresContext, nsIFrame* aFirstFrame,
break;
}
// verify that neither frame has a space manager,
// or they both do and the space managers are equivalent
nsSpaceManager *sm1 = static_cast<nsSpaceManager*>
(k1->GetProperty(nsGkAtoms::spaceManagerProperty));
// look at the test frame
nsSpaceManager *sm2 = static_cast<nsSpaceManager*>
(k2->GetProperty(nsGkAtoms::spaceManagerProperty));
// now compare the space managers
if (((nsnull == sm1) && (nsnull != sm2)) ||
((nsnull != sm1) && (nsnull == sm2))) { // one is null, and the other is not
ok = PR_FALSE;
LogVerifyMessage(k1, k2, "space managers are not matched\n");
}
else if (sm1 && sm2) { // both are not null, compare them
// first, compare yMost
nscoord yMost1, yMost2;
nsresult smresult = sm1->YMost(yMost1);
if (NS_ERROR_ABORT != smresult)
{
NS_ASSERTION(NS_SUCCEEDED(smresult), "bad result");
smresult = sm2->YMost(yMost2);
NS_ASSERTION(NS_SUCCEEDED(smresult), "bad result");
if (yMost1 != yMost2) {
LogVerifyMessage(k1, k2, "yMost of space managers differs\n");
}
// now compare bands by sampling
PRInt32 yIncrement = yMost1/100;
if (0==yIncrement) {
yIncrement = 1; // guarantee we make progress in the loop below
}
nscoord yOffset = 0;
for ( ; ok && yOffset < yMost1; yOffset += yIncrement)
{
nscoord small=5, large=100;
nsBandData band1, band2;
nsBandTrapezoid trap1[20], trap2[20];
band1.mSize = band2.mSize = 20;
band1.mTrapezoids = trap1;
band2.mTrapezoids = trap2;
sm1->GetBandData(yOffset, nsSize(small,small), band1);
sm2->GetBandData(yOffset, nsSize(small,small), band2);
if (band1.mCount != band2.mCount)
{ // count mismatch, stop comparing
LogVerifyMessage(k1, k2, "band.mCount of space managers differs\n");
printf("count1= %d, count2=%d, yOffset = %d, size=%d\n",
band1.mCount, band2.mCount, yOffset, small);
ok = PR_FALSE;
}
else // band counts match, compare individual traps
{
PRInt32 trapIndex=0;
for ( ;trapIndex<band1.mCount; trapIndex++)
{
PRBool match = (trap1[trapIndex].EqualGeometry(trap2[trapIndex])) &&
((trap1[trapIndex].mFrames!=nsnull) == (trap2[trapIndex].mFrames!=nsnull));
if (!match)
{
LogVerifyMessage(k1, k2, "band.mTrapezoids of space managers differs\n");
printf ("index %d\n", trapIndex);
}
}
}
// test the larger maxSize
sm1->GetBandData(yOffset, nsSize(large,large), band1);
sm2->GetBandData(yOffset, nsSize(large,large), band2);
if (band1.mCount != band2.mCount)
{ // count mismatch, stop comparing
LogVerifyMessage(k1, k2, "band.mCount of space managers differs\n");
printf("count1= %d, count2=%d, yOffset = %d, size=%d\n",
band1.mCount, band2.mCount, yOffset, small);
ok = PR_FALSE;
}
else // band counts match, compare individual traps
{
PRInt32 trapIndex=0;
for ( ; trapIndex<band1.mCount; trapIndex++)
{
PRBool match = (trap1[trapIndex].EqualGeometry(trap2[trapIndex])) &&
((trap1[trapIndex].mFrames!=nsnull) == (trap2[trapIndex].mFrames!=nsnull));
if (!match)
{
LogVerifyMessage(k1, k2, "band.mTrapezoids of space managers differs\n");
printf ("index %d\n", trapIndex);
}
}
}
}
}
}
// XXX Should perhaps compare their float managers.
// Compare the sub-trees too
if (!CompareTrees(aFirstPresContext, k1, aSecondPresContext, k2)) {

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

@ -1114,24 +1114,6 @@ nsBlockFrame::Reflow(nsPresContext* aPresContext,
aMetrics.mOverflowArea.UnionRect(aMetrics.mOverflowArea,
overflowContainerBounds);
// see if verifyReflow is enabled, and if so store off the space manager pointer
#ifdef DEBUG
PRInt32 verifyReflowFlags = nsIPresShell::GetVerifyReflowFlags();
if (VERIFY_REFLOW_INCLUDE_SPACE_MANAGER & verifyReflowFlags)
{
// this is a leak of the space manager, but it's only in debug if verify reflow is enabled, so not a big deal
nsIPresShell *shell = aPresContext->GetPresShell();
if (shell) {
nsHTMLReflowState& reflowState = (nsHTMLReflowState&)aReflowState;
rv = SetProperty(nsGkAtoms::spaceManagerProperty,
reflowState.mSpaceManager,
nsnull /* should be nsSpaceManagerDestroyer*/);
autoSpaceManager.DebugOrphanSpaceManager();
}
}
#endif
// Let the absolutely positioned container reflow any absolutely positioned
// child frames that need to be reflowed, e.g., elements with a percentage
// based width/height

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

@ -1451,10 +1451,7 @@ nsAutoSpaceManager::~nsAutoSpaceManager()
}
#endif
#ifdef DEBUG
if (mOwns)
#endif
delete mNew;
delete mNew;
}
}

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

@ -468,9 +468,6 @@ class nsAutoSpaceManager {
public:
nsAutoSpaceManager(nsHTMLReflowState& aReflowState)
: mReflowState(aReflowState),
#ifdef DEBUG
mOwns(PR_TRUE),
#endif
mNew(nsnull),
mOld(nsnull) {}
@ -484,20 +481,8 @@ public:
nsresult
CreateSpaceManager(nsPresContext *aPresContext);
#ifdef DEBUG
/**
* `Orphan' any space manager that the nsAutoSpaceManager created;
* i.e., make it so that we don't destroy the space manager when we
* go out of scope.
*/
void DebugOrphanSpaceManager() { mOwns = PR_FALSE; }
#endif
protected:
nsHTMLReflowState &mReflowState;
#ifdef DEBUG
PRBool mOwns;
#endif
nsSpaceManager *mNew;
nsSpaceManager *mOld;
};