Change the way regression tests get the framestate to make it possible to mask

out irrelevant state bits as needed.  Apply this to NS_BLOCK_HAS_LINE_CURSOR.
Bug 237955, r+sr=roc, a=dbaron


git-svn-id: svn://10.0.0.236/trunk@154500 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2004-04-04 01:48:16 +00:00
parent 97802842f8
commit 0d643a702e
12 changed files with 68 additions and 28 deletions

View File

@@ -38,8 +38,8 @@
#define nsIFrameDebug_h___
#include "nsISupports.h"
#include "nsIFrame.h"
class nsIFrame;
class nsIPresContext;
struct PRLogModuleInfo;
@@ -66,6 +66,10 @@ public:
* XXX This should be eliminated and we use GetType() instead...
*/
NS_IMETHOD GetFrameName(nsAString& aResult) const = 0;
/**
* Return the state bits that are relevant to regression tests (that is, those bits which indicate a real difference when they differ
*/
NS_IMETHOD_(nsFrameState) GetDebugStateBits() const = 0;
/**
* Called to dump out regression data that describes the layout
* of the frame and it's children, and so on. The format of the

View File

@@ -580,18 +580,7 @@ nsFrameUtil::CompareTrees(Node* tree1, Node* tree2)
if (0 == PL_strncmp(tree1->type, kScrollbarFrame, sizeof(kScrollbarFrame) - 1))
continue;
// We'll ignore these flags for the purposes of comparing frame state:
//
// NS_FRAME_EXTERNAL_REFERENCE
// because this is set by the event state manager or the
// caret code when a frame is focused. Depending on whether
// or not the regression tests are run as the focused window
// will make this value vary randomly.
#define IRRELEVANT_FRAME_STATE_FLAGS NS_FRAME_EXTERNAL_REFERENCE
#define FRAME_STATE_MASK (~(IRRELEVANT_FRAME_STATE_FLAGS))
if ((tree1->state & FRAME_STATE_MASK) != (tree2->state & FRAME_STATE_MASK)) {
if (tree1->state != tree2->state) {
printf("frame state mismatch: 0x%x vs. 0x%x\n",
tree1->state, tree2->state);
printf("Node 1:\n");

View File

@@ -438,6 +438,14 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con
return NS_OK;
}
NS_IMETHODIMP_(nsFrameState)
nsBlockFrame::GetDebugStateBits() const
{
// We don't want to include our cursor flag in the bits the
// regression tester looks at
return nsBlockFrameSuper::GetDebugStateBits() & ~NS_BLOCK_HAS_LINE_CURSOR;
}
NS_IMETHODIMP
nsBlockFrame::GetFrameName(nsAString& aResult) const
{

View File

@@ -133,6 +133,7 @@ public:
virtual nsIAtom* GetType() const;
#ifdef DEBUG
NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const;
NS_IMETHOD_(nsFrameState) GetDebugStateBits() const;
NS_IMETHOD GetFrameName(nsAString& aResult) const;
NS_IMETHOD VerifyTree() const;
#endif

View File

@@ -2691,6 +2691,23 @@ nsFrame::GetFrameName(nsAString& aResult) const
return MakeFrameName(NS_LITERAL_STRING("Frame"), aResult);
}
NS_IMETHODIMP_(nsFrameState)
nsFrame::GetDebugStateBits() const
{
// We'll ignore these flags for the purposes of comparing frame state:
//
// NS_FRAME_EXTERNAL_REFERENCE
// because this is set by the event state manager or the
// caret code when a frame is focused. Depending on whether
// or not the regression tests are run as the focused window
// will make this value vary randomly.
#define IRRELEVANT_FRAME_STATE_FLAGS NS_FRAME_EXTERNAL_REFERENCE
#define FRAME_STATE_MASK (~(IRRELEVANT_FRAME_STATE_FLAGS))
return GetStateBits() & FRAME_STATE_MASK;
}
nsresult
nsFrame::MakeFrameName(const nsAString& aType, nsAString& aResult) const
{
@@ -2878,7 +2895,7 @@ nsFrame::DumpRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIn
XMLQuote(name);
fputs(NS_LossyConvertUCS2toASCII(name).get(), out);
fprintf(out, "\" state=\"%d\" parent=\"%ld\">\n",
mState, PRUptrdiff(mParent));
GetDebugStateBits(), PRUptrdiff(mParent));
aIndent++;
DumpBaseRegressionData(aPresContext, out, aIndent, aIncludeStyleData);

View File

@@ -243,6 +243,7 @@ public:
#ifdef NS_DEBUG
NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const;
NS_IMETHOD GetFrameName(nsAString& aResult) const;
NS_IMETHOD_(nsFrameState) GetDebugStateBits() const;
NS_IMETHOD DumpRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent, PRBool aIncludeStyleData);
NS_IMETHOD VerifyTree() const;
#endif

View File

@@ -580,18 +580,7 @@ nsFrameUtil::CompareTrees(Node* tree1, Node* tree2)
if (0 == PL_strncmp(tree1->type, kScrollbarFrame, sizeof(kScrollbarFrame) - 1))
continue;
// We'll ignore these flags for the purposes of comparing frame state:
//
// NS_FRAME_EXTERNAL_REFERENCE
// because this is set by the event state manager or the
// caret code when a frame is focused. Depending on whether
// or not the regression tests are run as the focused window
// will make this value vary randomly.
#define IRRELEVANT_FRAME_STATE_FLAGS NS_FRAME_EXTERNAL_REFERENCE
#define FRAME_STATE_MASK (~(IRRELEVANT_FRAME_STATE_FLAGS))
if ((tree1->state & FRAME_STATE_MASK) != (tree2->state & FRAME_STATE_MASK)) {
if (tree1->state != tree2->state) {
printf("frame state mismatch: 0x%x vs. 0x%x\n",
tree1->state, tree2->state);
printf("Node 1:\n");

View File

@@ -38,8 +38,8 @@
#define nsIFrameDebug_h___
#include "nsISupports.h"
#include "nsIFrame.h"
class nsIFrame;
class nsIPresContext;
struct PRLogModuleInfo;
@@ -66,6 +66,10 @@ public:
* XXX This should be eliminated and we use GetType() instead...
*/
NS_IMETHOD GetFrameName(nsAString& aResult) const = 0;
/**
* Return the state bits that are relevant to regression tests (that is, those bits which indicate a real difference when they differ
*/
NS_IMETHOD_(nsFrameState) GetDebugStateBits() const = 0;
/**
* Called to dump out regression data that describes the layout
* of the frame and it's children, and so on. The format of the

View File

@@ -438,6 +438,14 @@ nsBlockFrame::List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) con
return NS_OK;
}
NS_IMETHODIMP_(nsFrameState)
nsBlockFrame::GetDebugStateBits() const
{
// We don't want to include our cursor flag in the bits the
// regression tester looks at
return nsBlockFrameSuper::GetDebugStateBits() & ~NS_BLOCK_HAS_LINE_CURSOR;
}
NS_IMETHODIMP
nsBlockFrame::GetFrameName(nsAString& aResult) const
{

View File

@@ -133,6 +133,7 @@ public:
virtual nsIAtom* GetType() const;
#ifdef DEBUG
NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const;
NS_IMETHOD_(nsFrameState) GetDebugStateBits() const;
NS_IMETHOD GetFrameName(nsAString& aResult) const;
NS_IMETHOD VerifyTree() const;
#endif

View File

@@ -2691,6 +2691,23 @@ nsFrame::GetFrameName(nsAString& aResult) const
return MakeFrameName(NS_LITERAL_STRING("Frame"), aResult);
}
NS_IMETHODIMP_(nsFrameState)
nsFrame::GetDebugStateBits() const
{
// We'll ignore these flags for the purposes of comparing frame state:
//
// NS_FRAME_EXTERNAL_REFERENCE
// because this is set by the event state manager or the
// caret code when a frame is focused. Depending on whether
// or not the regression tests are run as the focused window
// will make this value vary randomly.
#define IRRELEVANT_FRAME_STATE_FLAGS NS_FRAME_EXTERNAL_REFERENCE
#define FRAME_STATE_MASK (~(IRRELEVANT_FRAME_STATE_FLAGS))
return GetStateBits() & FRAME_STATE_MASK;
}
nsresult
nsFrame::MakeFrameName(const nsAString& aType, nsAString& aResult) const
{
@@ -2878,7 +2895,7 @@ nsFrame::DumpRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIn
XMLQuote(name);
fputs(NS_LossyConvertUCS2toASCII(name).get(), out);
fprintf(out, "\" state=\"%d\" parent=\"%ld\">\n",
mState, PRUptrdiff(mParent));
GetDebugStateBits(), PRUptrdiff(mParent));
aIndent++;
DumpBaseRegressionData(aPresContext, out, aIndent, aIncludeStyleData);

View File

@@ -243,6 +243,7 @@ public:
#ifdef NS_DEBUG
NS_IMETHOD List(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent) const;
NS_IMETHOD GetFrameName(nsAString& aResult) const;
NS_IMETHOD_(nsFrameState) GetDebugStateBits() const;
NS_IMETHOD DumpRegressionData(nsIPresContext* aPresContext, FILE* out, PRInt32 aIndent, PRBool aIncludeStyleData);
NS_IMETHOD VerifyTree() const;
#endif