diff --git a/mozilla/layout/base/public/nsIFrameDebug.h b/mozilla/layout/base/public/nsIFrameDebug.h index 3ff296729dc..475b236adfe 100644 --- a/mozilla/layout/base/public/nsIFrameDebug.h +++ b/mozilla/layout/base/public/nsIFrameDebug.h @@ -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 diff --git a/mozilla/layout/base/src/nsFrameUtil.cpp b/mozilla/layout/base/src/nsFrameUtil.cpp index 8c622ae0a9e..d01bc0a90a9 100644 --- a/mozilla/layout/base/src/nsFrameUtil.cpp +++ b/mozilla/layout/base/src/nsFrameUtil.cpp @@ -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"); diff --git a/mozilla/layout/generic/nsBlockFrame.cpp b/mozilla/layout/generic/nsBlockFrame.cpp index 0ee0b121eda..9c0d26ebf66 100644 --- a/mozilla/layout/generic/nsBlockFrame.cpp +++ b/mozilla/layout/generic/nsBlockFrame.cpp @@ -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 { diff --git a/mozilla/layout/generic/nsBlockFrame.h b/mozilla/layout/generic/nsBlockFrame.h index 9ad45faaae0..8016a72c5aa 100644 --- a/mozilla/layout/generic/nsBlockFrame.h +++ b/mozilla/layout/generic/nsBlockFrame.h @@ -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 diff --git a/mozilla/layout/generic/nsFrame.cpp b/mozilla/layout/generic/nsFrame.cpp index be268264352..db7c2eeb405 100644 --- a/mozilla/layout/generic/nsFrame.cpp +++ b/mozilla/layout/generic/nsFrame.cpp @@ -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); diff --git a/mozilla/layout/generic/nsFrame.h b/mozilla/layout/generic/nsFrame.h index 1f35a9f36ba..54ccda3e501 100644 --- a/mozilla/layout/generic/nsFrame.h +++ b/mozilla/layout/generic/nsFrame.h @@ -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 diff --git a/mozilla/layout/generic/nsFrameUtil.cpp b/mozilla/layout/generic/nsFrameUtil.cpp index 8c622ae0a9e..d01bc0a90a9 100644 --- a/mozilla/layout/generic/nsFrameUtil.cpp +++ b/mozilla/layout/generic/nsFrameUtil.cpp @@ -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"); diff --git a/mozilla/layout/generic/nsIFrameDebug.h b/mozilla/layout/generic/nsIFrameDebug.h index 3ff296729dc..475b236adfe 100644 --- a/mozilla/layout/generic/nsIFrameDebug.h +++ b/mozilla/layout/generic/nsIFrameDebug.h @@ -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 diff --git a/mozilla/layout/html/base/src/nsBlockFrame.cpp b/mozilla/layout/html/base/src/nsBlockFrame.cpp index 0ee0b121eda..9c0d26ebf66 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.cpp +++ b/mozilla/layout/html/base/src/nsBlockFrame.cpp @@ -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 { diff --git a/mozilla/layout/html/base/src/nsBlockFrame.h b/mozilla/layout/html/base/src/nsBlockFrame.h index 9ad45faaae0..8016a72c5aa 100644 --- a/mozilla/layout/html/base/src/nsBlockFrame.h +++ b/mozilla/layout/html/base/src/nsBlockFrame.h @@ -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 diff --git a/mozilla/layout/html/base/src/nsFrame.cpp b/mozilla/layout/html/base/src/nsFrame.cpp index be268264352..db7c2eeb405 100644 --- a/mozilla/layout/html/base/src/nsFrame.cpp +++ b/mozilla/layout/html/base/src/nsFrame.cpp @@ -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); diff --git a/mozilla/layout/html/base/src/nsFrame.h b/mozilla/layout/html/base/src/nsFrame.h index 1f35a9f36ba..54ccda3e501 100644 --- a/mozilla/layout/html/base/src/nsFrame.h +++ b/mozilla/layout/html/base/src/nsFrame.h @@ -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