From d358511c254628bf7ffd462af396e9568ab75323 Mon Sep 17 00:00:00 2001 From: "pollmann%netscape.com" Date: Thu, 3 Aug 2000 22:26:56 +0000 Subject: [PATCH] Bug 40383: Treat frameset rows spec 0* as 1* in quirks mode; r=harishd git-svn-id: svn://10.0.0.236/trunk@75530 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/layout/generic/nsFrameSetFrame.cpp | 21 ++++++++++++++----- mozilla/layout/generic/nsFrameSetFrame.h | 5 +++-- .../html/document/src/nsFrameSetFrame.cpp | 21 ++++++++++++++----- .../html/document/src/nsFrameSetFrame.h | 5 +++-- 4 files changed, 38 insertions(+), 14 deletions(-) diff --git a/mozilla/layout/generic/nsFrameSetFrame.cpp b/mozilla/layout/generic/nsFrameSetFrame.cpp index 8e6e009c1a2..52104e4f073 100644 --- a/mozilla/layout/generic/nsFrameSetFrame.cpp +++ b/mozilla/layout/generic/nsFrameSetFrame.cpp @@ -651,7 +651,7 @@ nsHTMLFramesetFrame::Paint(nsIPresContext* aPresContext, aDirtyRect, aWhichLayer); } -void nsHTMLFramesetFrame::ParseRowCol(nsIAtom* aAttrType, PRInt32& aNumSpecs, nsFramesetSpec** aSpecs) +void nsHTMLFramesetFrame::ParseRowCol(nsIPresContext* aPresContext, nsIAtom* aAttrType, PRInt32& aNumSpecs, nsFramesetSpec** aSpecs) { nsHTMLValue value; nsAutoString rowsCols; @@ -662,7 +662,7 @@ void nsHTMLFramesetFrame::ParseRowCol(nsIAtom* aAttrType, PRInt32& aNumSpecs, ns if (eHTMLUnit_String == value.GetUnit()) { value.GetStringValue(rowsCols); nsFramesetSpec* specs = new nsFramesetSpec[gMaxNumRowColSpecs]; - aNumSpecs = ParseRowColSpec(rowsCols, gMaxNumRowColSpecs, specs); + aNumSpecs = ParseRowColSpec(aPresContext, rowsCols, gMaxNumRowColSpecs, specs); *aSpecs = new nsFramesetSpec[aNumSpecs]; for (int i = 0; i < aNumSpecs; i++) { (*aSpecs)[i] = specs[i]; @@ -684,7 +684,8 @@ void nsHTMLFramesetFrame::ParseRowCol(nsIAtom* aAttrType, PRInt32& aNumSpecs, ns * Translate a "rows" or "cols" spec into an array of nsFramesetSpecs */ PRInt32 -nsHTMLFramesetFrame::ParseRowColSpec(nsString& aSpec, +nsHTMLFramesetFrame::ParseRowColSpec(nsIPresContext* aPresContext, + nsString& aSpec, PRInt32 aMaxNumValues, nsFramesetSpec* aSpecs) { @@ -761,6 +762,16 @@ nsHTMLFramesetFrame::ParseRowColSpec(nsString& aSpec, } } + // Treat 0* as 1* in quirks mode (bug 40383) + nsCompatibility mode; + aPresContext->GetCompatibilityMode(&mode); + if (eCompatibility_NavQuirks == mode) { + if ((eFramesetUnit_Relative == aSpecs[i].mUnit) && + (0 == aSpecs[i].mValue)) { + aSpecs[i].mValue = 1; + } + } + // Catch zero and negative frame sizes for Nav compatability // Nav resized absolute and relative frames to "1" and // percent frames to an even percentage of the width @@ -933,8 +944,8 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext, if (firstTime) { // parse the rows= cols= data - ParseRowCol(nsHTMLAtoms::rows, mNumRows, &mRowSpecs); - ParseRowCol(nsHTMLAtoms::cols, mNumCols, &mColSpecs); + ParseRowCol(aPresContext, nsHTMLAtoms::rows, mNumRows, &mRowSpecs); + ParseRowCol(aPresContext, nsHTMLAtoms::cols, mNumCols, &mColSpecs); mRowSizes = new nscoord[mNumRows]; mColSizes = new nscoord[mNumCols]; } diff --git a/mozilla/layout/generic/nsFrameSetFrame.h b/mozilla/layout/generic/nsFrameSetFrame.h index 02a3bcdbbf4..e15e24612f2 100644 --- a/mozilla/layout/generic/nsFrameSetFrame.h +++ b/mozilla/layout/generic/nsFrameSetFrame.h @@ -208,9 +208,10 @@ protected: virtual PRIntn GetSkipSides() const; - void ParseRowCol(nsIAtom* aAttrType, PRInt32& aNumSpecs, nsFramesetSpec** aSpecs); + void ParseRowCol(nsIPresContext* aPresContext, nsIAtom* aAttrType, PRInt32& aNumSpecs, nsFramesetSpec** aSpecs); - PRInt32 ParseRowColSpec(nsString& aSpec, + PRInt32 ParseRowColSpec(nsIPresContext* aPresContext, + nsString& aSpec, PRInt32 aMaxNumValues, nsFramesetSpec* aSpecs); diff --git a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp index 8e6e009c1a2..52104e4f073 100644 --- a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp @@ -651,7 +651,7 @@ nsHTMLFramesetFrame::Paint(nsIPresContext* aPresContext, aDirtyRect, aWhichLayer); } -void nsHTMLFramesetFrame::ParseRowCol(nsIAtom* aAttrType, PRInt32& aNumSpecs, nsFramesetSpec** aSpecs) +void nsHTMLFramesetFrame::ParseRowCol(nsIPresContext* aPresContext, nsIAtom* aAttrType, PRInt32& aNumSpecs, nsFramesetSpec** aSpecs) { nsHTMLValue value; nsAutoString rowsCols; @@ -662,7 +662,7 @@ void nsHTMLFramesetFrame::ParseRowCol(nsIAtom* aAttrType, PRInt32& aNumSpecs, ns if (eHTMLUnit_String == value.GetUnit()) { value.GetStringValue(rowsCols); nsFramesetSpec* specs = new nsFramesetSpec[gMaxNumRowColSpecs]; - aNumSpecs = ParseRowColSpec(rowsCols, gMaxNumRowColSpecs, specs); + aNumSpecs = ParseRowColSpec(aPresContext, rowsCols, gMaxNumRowColSpecs, specs); *aSpecs = new nsFramesetSpec[aNumSpecs]; for (int i = 0; i < aNumSpecs; i++) { (*aSpecs)[i] = specs[i]; @@ -684,7 +684,8 @@ void nsHTMLFramesetFrame::ParseRowCol(nsIAtom* aAttrType, PRInt32& aNumSpecs, ns * Translate a "rows" or "cols" spec into an array of nsFramesetSpecs */ PRInt32 -nsHTMLFramesetFrame::ParseRowColSpec(nsString& aSpec, +nsHTMLFramesetFrame::ParseRowColSpec(nsIPresContext* aPresContext, + nsString& aSpec, PRInt32 aMaxNumValues, nsFramesetSpec* aSpecs) { @@ -761,6 +762,16 @@ nsHTMLFramesetFrame::ParseRowColSpec(nsString& aSpec, } } + // Treat 0* as 1* in quirks mode (bug 40383) + nsCompatibility mode; + aPresContext->GetCompatibilityMode(&mode); + if (eCompatibility_NavQuirks == mode) { + if ((eFramesetUnit_Relative == aSpecs[i].mUnit) && + (0 == aSpecs[i].mValue)) { + aSpecs[i].mValue = 1; + } + } + // Catch zero and negative frame sizes for Nav compatability // Nav resized absolute and relative frames to "1" and // percent frames to an even percentage of the width @@ -933,8 +944,8 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext, if (firstTime) { // parse the rows= cols= data - ParseRowCol(nsHTMLAtoms::rows, mNumRows, &mRowSpecs); - ParseRowCol(nsHTMLAtoms::cols, mNumCols, &mColSpecs); + ParseRowCol(aPresContext, nsHTMLAtoms::rows, mNumRows, &mRowSpecs); + ParseRowCol(aPresContext, nsHTMLAtoms::cols, mNumCols, &mColSpecs); mRowSizes = new nscoord[mNumRows]; mColSizes = new nscoord[mNumCols]; } diff --git a/mozilla/layout/html/document/src/nsFrameSetFrame.h b/mozilla/layout/html/document/src/nsFrameSetFrame.h index 02a3bcdbbf4..e15e24612f2 100644 --- a/mozilla/layout/html/document/src/nsFrameSetFrame.h +++ b/mozilla/layout/html/document/src/nsFrameSetFrame.h @@ -208,9 +208,10 @@ protected: virtual PRIntn GetSkipSides() const; - void ParseRowCol(nsIAtom* aAttrType, PRInt32& aNumSpecs, nsFramesetSpec** aSpecs); + void ParseRowCol(nsIPresContext* aPresContext, nsIAtom* aAttrType, PRInt32& aNumSpecs, nsFramesetSpec** aSpecs); - PRInt32 ParseRowColSpec(nsString& aSpec, + PRInt32 ParseRowColSpec(nsIPresContext* aPresContext, + nsString& aSpec, PRInt32 aMaxNumValues, nsFramesetSpec* aSpecs);