From 4c08064fc5632bb68496fe53101e210c6e43d7e2 Mon Sep 17 00:00:00 2001 From: "hwaara%chello.se" Date: Fri, 7 Dec 2001 19:40:07 +0000 Subject: [PATCH] #113663, clean up and improve support for frameborder and scrolling attributes on frame elements. r=bz, sr=attinasi git-svn-id: svn://10.0.0.236/trunk@110016 18797224-902f-48f8-a5cc-f745e15eee43 --- .../html/content/src/nsGenericHTMLElement.cpp | 53 ++++-------------- .../html/content/src/nsGenericHTMLElement.h | 12 ++--- .../html/content/src/nsHTMLFrameElement.cpp | 9 ++-- .../content/src/nsHTMLFrameSetElement.cpp | 6 +-- .../html/content/src/nsHTMLIFrameElement.cpp | 8 +-- mozilla/layout/generic/nsFrameFrame.cpp | 27 ++++------ mozilla/layout/generic/nsFrameSetFrame.cpp | 54 +++++++++---------- mozilla/layout/generic/nsFrameSetFrame.h | 4 +- .../layout/html/document/src/nsFrameFrame.cpp | 27 ++++------ .../html/document/src/nsFrameSetFrame.cpp | 54 +++++++++---------- .../html/document/src/nsFrameSetFrame.h | 4 +- 11 files changed, 98 insertions(+), 160 deletions(-) diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp index 43ea1aa4f6d..6a0c7e0846d 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.cpp +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.cpp @@ -2898,7 +2898,7 @@ static nsGenericHTMLElement::EnumTable kDivAlignTable[] = { { 0 } }; -static nsGenericHTMLElement::EnumTable kFrameborderQuirksTable[] = { +static nsGenericHTMLElement::EnumTable kFrameborderTable[] = { { "yes", NS_STYLE_FRAME_YES }, { "no", NS_STYLE_FRAME_NO }, { "1", NS_STYLE_FRAME_1 }, @@ -2906,13 +2906,7 @@ static nsGenericHTMLElement::EnumTable kFrameborderQuirksTable[] = { { 0 } }; -static nsGenericHTMLElement::EnumTable kFrameborderStandardTable[] = { - { "1", NS_STYLE_FRAME_1 }, - { "0", NS_STYLE_FRAME_0 }, - { 0 } -}; - -static nsGenericHTMLElement::EnumTable kScrollingQuirksTable[] = { +static nsGenericHTMLElement::EnumTable kScrollingTable[] = { { "yes", NS_STYLE_FRAME_YES }, { "no", NS_STYLE_FRAME_NO }, { "on", NS_STYLE_FRAME_ON }, @@ -2923,13 +2917,6 @@ static nsGenericHTMLElement::EnumTable kScrollingQuirksTable[] = { { 0 } }; -static nsGenericHTMLElement::EnumTable kScrollingStandardTable[] = { - { "yes", NS_STYLE_FRAME_YES }, - { "no", NS_STYLE_FRAME_NO }, - { "auto", NS_STYLE_FRAME_AUTO }, - { 0 } -}; - static nsGenericHTMLElement::EnumTable kTableVAlignTable[] = { { "top", NS_STYLE_VERTICAL_ALIGN_TOP }, { "middle", NS_STYLE_VERTICAL_ALIGN_MIDDLE }, @@ -3124,51 +3111,31 @@ nsGenericHTMLElement::ImageAttributeToString(nsIAtom* aAttribute, } PRBool -nsGenericHTMLElement::ParseFrameborderValue(PRBool aStandardMode, - const nsAReadableString& aString, +nsGenericHTMLElement::ParseFrameborderValue(const nsAReadableString& aString, nsHTMLValue& aResult) { - if (aStandardMode) { - return ParseEnumValue(aString, kFrameborderStandardTable, aResult); - } else { - return ParseEnumValue(aString, kFrameborderQuirksTable, aResult); - } + return ParseEnumValue(aString, kFrameborderTable, aResult); } PRBool -nsGenericHTMLElement::FrameborderValueToString(PRBool aStandardMode, - const nsHTMLValue& aValue, +nsGenericHTMLElement::FrameborderValueToString(const nsHTMLValue& aValue, nsAWritableString& aResult) { - if (aStandardMode) { - return EnumValueToString(aValue, kFrameborderStandardTable, aResult); - } else { - return EnumValueToString(aValue, kFrameborderQuirksTable, aResult); - } + return EnumValueToString(aValue, kFrameborderTable, aResult); } PRBool -nsGenericHTMLElement::ParseScrollingValue(PRBool aStandardMode, - const nsAReadableString& aString, +nsGenericHTMLElement::ParseScrollingValue(const nsAReadableString& aString, nsHTMLValue& aResult) { - if (aStandardMode) { - return ParseEnumValue(aString, kScrollingStandardTable, aResult); - } else { - return ParseEnumValue(aString, kScrollingQuirksTable, aResult); - } + return ParseEnumValue(aString, kScrollingTable, aResult); } PRBool -nsGenericHTMLElement::ScrollingValueToString(PRBool aStandardMode, - const nsHTMLValue& aValue, +nsGenericHTMLElement::ScrollingValueToString(const nsHTMLValue& aValue, nsAWritableString& aResult) { - if (aStandardMode) { - return EnumValueToString(aValue, kScrollingStandardTable, aResult); - } else { - return EnumValueToString(aValue, kScrollingQuirksTable, aResult); - } + return EnumValueToString(aValue, kScrollingTable, aResult); } nsresult diff --git a/mozilla/content/html/content/src/nsGenericHTMLElement.h b/mozilla/content/html/content/src/nsGenericHTMLElement.h index 4b5e2a0bc96..297f3aaae18 100644 --- a/mozilla/content/html/content/src/nsGenericHTMLElement.h +++ b/mozilla/content/html/content/src/nsGenericHTMLElement.h @@ -295,20 +295,16 @@ public: const nsHTMLValue& aValue, nsAWritableString& aResult); - static PRBool ParseFrameborderValue(PRBool aStandardMode, - const nsAReadableString& aString, + static PRBool ParseFrameborderValue(const nsAReadableString& aString, nsHTMLValue& aResult); - static PRBool FrameborderValueToString(PRBool aStandardMode, - const nsHTMLValue& aValue, + static PRBool FrameborderValueToString(const nsHTMLValue& aValue, nsAWritableString& aResult); - static PRBool ParseScrollingValue(PRBool aStandardMode, - const nsAReadableString& aString, + static PRBool ParseScrollingValue(const nsAReadableString& aString, nsHTMLValue& aResult); - static PRBool ScrollingValueToString(PRBool aStandardMode, - const nsHTMLValue& aValue, + static PRBool ScrollingValueToString(const nsHTMLValue& aValue, nsAWritableString& aResult); nsresult ReparseStyleAttribute(void); diff --git a/mozilla/content/html/content/src/nsHTMLFrameElement.cpp b/mozilla/content/html/content/src/nsHTMLFrameElement.cpp index 377f538ba1e..c3edcab0922 100644 --- a/mozilla/content/html/content/src/nsHTMLFrameElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFrameElement.cpp @@ -259,8 +259,7 @@ nsHTMLFrameElement::StringToAttribute(nsIAtom* aAttribute, } } else if (aAttribute == nsHTMLAtoms::frameborder) { - // XXX need to check for correct mode - if (ParseFrameborderValue(PR_FALSE, aValue, aResult)) { + if (ParseFrameborderValue(aValue, aResult)) { return NS_CONTENT_ATTR_HAS_VALUE; } } @@ -279,7 +278,7 @@ nsHTMLFrameElement::StringToAttribute(nsIAtom* aAttribute, return NS_CONTENT_ATTR_HAS_VALUE; } else if (aAttribute == nsHTMLAtoms::scrolling) { - if (ParseScrollingValue(PR_FALSE, aValue, aResult)) { + if (ParseScrollingValue(aValue, aResult)) { return NS_CONTENT_ATTR_HAS_VALUE; } } @@ -293,11 +292,11 @@ nsHTMLFrameElement::AttributeToString(nsIAtom* aAttribute, nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::frameborder) { - FrameborderValueToString(PR_FALSE, aValue, aResult); + FrameborderValueToString(aValue, aResult); return NS_CONTENT_ATTR_HAS_VALUE; } else if (aAttribute == nsHTMLAtoms::scrolling) { - ScrollingValueToString(PR_FALSE, aValue, aResult); + ScrollingValueToString(aValue, aResult); return NS_CONTENT_ATTR_HAS_VALUE; } diff --git a/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp b/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp index b73157c7ff1..eca7d95edab 100644 --- a/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLFrameSetElement.cpp @@ -172,8 +172,7 @@ nsHTMLFrameSetElement::StringToAttribute(nsIAtom* aAttribute, } } else if (aAttribute == nsHTMLAtoms::frameborder) { - // XXX need to check for correct mode - if (nsGenericHTMLElement::ParseFrameborderValue(PR_FALSE, aValue, aResult)) { + if (nsGenericHTMLElement::ParseFrameborderValue(aValue, aResult)) { return NS_CONTENT_ATTR_HAS_VALUE; } } @@ -191,8 +190,7 @@ nsHTMLFrameSetElement::AttributeToString(nsIAtom* aAttribute, nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::frameborder) { - // XXX need to check for correct mode - nsGenericHTMLElement::FrameborderValueToString(PR_FALSE, aValue, aResult); + nsGenericHTMLElement::FrameborderValueToString(aValue, aResult); return NS_CONTENT_ATTR_HAS_VALUE; } return nsGenericHTMLContainerElement::AttributeToString(aAttribute, aValue, diff --git a/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp b/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp index 099357f296a..704e5e4dcba 100644 --- a/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp +++ b/mozilla/content/html/content/src/nsHTMLIFrameElement.cpp @@ -280,12 +280,12 @@ nsHTMLIFrameElement::StringToAttribute(nsIAtom* aAttribute, } } else if (aAttribute == nsHTMLAtoms::frameborder) { - if (ParseFrameborderValue(!InNavQuirksMode(mDocument), aValue, aResult)) { + if (ParseFrameborderValue(aValue, aResult)) { return NS_CONTENT_ATTR_HAS_VALUE; } } else if (aAttribute == nsHTMLAtoms::scrolling) { - if (ParseScrollingValue(PR_TRUE, aValue, aResult)) { + if (ParseScrollingValue(aValue, aResult)) { return NS_CONTENT_ATTR_HAS_VALUE; } } @@ -304,11 +304,11 @@ nsHTMLIFrameElement::AttributeToString(nsIAtom* aAttribute, nsAWritableString& aResult) const { if (aAttribute == nsHTMLAtoms::frameborder) { - FrameborderValueToString(PR_TRUE, aValue, aResult); + FrameborderValueToString(aValue, aResult); return NS_CONTENT_ATTR_HAS_VALUE; } else if (aAttribute == nsHTMLAtoms::scrolling) { - ScrollingValueToString(PR_TRUE, aValue, aResult); + ScrollingValueToString(aValue, aResult); return NS_CONTENT_ATTR_HAS_VALUE; } else if (aAttribute == nsHTMLAtoms::align) { diff --git a/mozilla/layout/generic/nsFrameFrame.cpp b/mozilla/layout/generic/nsFrameFrame.cpp index e279839a7bf..1c93d200450 100644 --- a/mozilla/layout/generic/nsFrameFrame.cpp +++ b/mozilla/layout/generic/nsFrameFrame.cpp @@ -252,7 +252,7 @@ public: PRBool GetURL(nsIContent* aContent, nsString& aResult); PRBool GetName(nsIContent* aContent, nsString& aResult); PRInt32 GetScrolling(nsIContent* aContent); - nsFrameborder GetFrameBorder(PRBool aStandardMode); + nsFrameborder GetFrameBorder(); PRInt32 GetMarginWidth(nsIPresContext* aPresContext, nsIContent* aContent); PRInt32 GetMarginHeight(nsIPresContext* aPresContext, nsIContent* aContent); @@ -775,7 +775,7 @@ PRInt32 nsHTMLFrameInnerFrame::GetScrolling(nsIContent* aContent) return returnValue; } -nsFrameborder nsHTMLFrameInnerFrame::GetFrameBorder(PRBool aStandardMode) +nsFrameborder nsHTMLFrameInnerFrame::GetFrameBorder() { nsFrameborder rv = eFrameborder_Notset; nsresult res = NS_OK; @@ -784,22 +784,17 @@ nsFrameborder nsHTMLFrameInnerFrame::GetFrameBorder(PRBool aStandardMode) nsHTMLValue value; if (NS_CONTENT_ATTR_HAS_VALUE == (content->GetHTMLAttribute(nsHTMLAtoms::frameborder, value))) { if (eHTMLUnit_Enumerated == value.GetUnit()) { - PRInt32 intValue; - intValue = value.GetIntValue(); - if (!aStandardMode) { - if (NS_STYLE_FRAME_YES == intValue) { + switch (value.GetIntValue()) + { + case NS_STYLE_FRAME_1: + case NS_STYLE_FRAME_YES: rv = eFrameborder_Yes; - } - else if (NS_STYLE_FRAME_NO == intValue) { + break; + + case NS_STYLE_FRAME_0: + case NS_STYLE_FRAME_NO: rv = eFrameborder_No; - } - } else { - if (NS_STYLE_FRAME_0 == intValue) { - rv = eFrameborder_No; - } - else if (NS_STYLE_FRAME_1 == intValue) { - rv = eFrameborder_Yes; - } + break; } } } diff --git a/mozilla/layout/generic/nsFrameSetFrame.cpp b/mozilla/layout/generic/nsFrameSetFrame.cpp index d0ca0ce9664..c65d265414a 100644 --- a/mozilla/layout/generic/nsFrameSetFrame.cpp +++ b/mozilla/layout/generic/nsFrameSetFrame.cpp @@ -358,7 +358,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext, nsCOMPtr shell; aPresContext->GetShell(getter_AddRefs(shell)); - nsFrameborder frameborder = GetFrameBorder(PR_FALSE); + nsFrameborder frameborder = GetFrameBorder(); PRInt32 borderWidth = GetBorderWidth(aPresContext, PR_FALSE); nscolor borderColor = GetBorderColor(); @@ -404,7 +404,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext, aPresContext->ResolveStyleContextFor(child, mStyleContext, PR_FALSE, getter_AddRefs(kidSC)); - if (nsHTMLAtoms::frameset == tag.get()) { + if (nsHTMLAtoms::frameset == tag) { result = NS_NewHTMLFramesetFrame(shell, &frame); mChildTypes[mChildCount] = FRAMESET; @@ -421,7 +421,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext, mChildTypes[mChildCount] = FRAME; - mChildFrameborder[mChildCount] = GetFrameBorder(child, PR_FALSE); + mChildFrameborder[mChildCount] = GetFrameBorder(child); mChildBorderColors[mChildCount].Set(GetBorderColor(child)); } @@ -627,7 +627,7 @@ PRInt32 nsHTMLFramesetFrame::GetBorderWidth(nsIPresContext* aPresContext, PRBool forcing = mForceFrameResizability && aTakeForcingIntoAccount; if (!forcing) { - nsFrameborder frameborder = GetFrameBorder(PR_FALSE); + nsFrameborder frameborder = GetFrameBorder(); if (frameborder == eFrameborder_No) { return 0; } @@ -1017,28 +1017,23 @@ nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild, } static -nsFrameborder GetFrameBorderHelper(nsIHTMLContent* aContent, - PRBool aStandardMode) +nsFrameborder GetFrameBorderHelper(nsIHTMLContent* aContent) { if (nsnull != aContent) { nsHTMLValue value; if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetHTMLAttribute(nsHTMLAtoms::frameborder, value))) { - if (eHTMLUnit_Enumerated == value.GetUnit()) { - PRInt32 intValue; - intValue = value.GetIntValue(); - if (!aStandardMode) { - if (NS_STYLE_FRAME_YES == intValue) { - intValue = NS_STYLE_FRAME_1; - } - else if (NS_STYLE_FRAME_NO == intValue) { - intValue = NS_STYLE_FRAME_0; - } - } - if (NS_STYLE_FRAME_0 == intValue) { - return eFrameborder_No; - } - else if (NS_STYLE_FRAME_1 == intValue) { - return eFrameborder_Yes; + if (eHTMLUnit_Enumerated == value.GetUnit()) { + switch (value.GetIntValue()) + { + case NS_STYLE_FRAME_YES: + case NS_STYLE_FRAME_1: + return eFrameborder_Yes; + break; + + case NS_STYLE_FRAME_NO: + case NS_STYLE_FRAME_0: + return eFrameborder_No; + break; } } } @@ -1046,13 +1041,13 @@ nsFrameborder GetFrameBorderHelper(nsIHTMLContent* aContent, return eFrameborder_Notset; } -nsFrameborder nsHTMLFramesetFrame::GetFrameBorder(PRBool aStandardMode) +nsFrameborder nsHTMLFramesetFrame::GetFrameBorder() { nsFrameborder result = eFrameborder_Notset; nsIHTMLContent* content = nsnull; mContent->QueryInterface(kIHTMLContentIID, (void**) &content); - if (nsnull != content) { - result = GetFrameBorderHelper(content, aStandardMode); + if (content) { + result = GetFrameBorderHelper(content); NS_RELEASE(content); } if (eFrameborder_Notset == result) { @@ -1061,18 +1056,17 @@ nsFrameborder nsHTMLFramesetFrame::GetFrameBorder(PRBool aStandardMode) return result; } -nsFrameborder nsHTMLFramesetFrame::GetFrameBorder(nsIContent* aContent, - PRBool aStandardMode) +nsFrameborder nsHTMLFramesetFrame::GetFrameBorder(nsIContent* aContent) { nsFrameborder result = eFrameborder_Notset; nsIHTMLContent* content = nsnull; aContent->QueryInterface(kIHTMLContentIID, (void**) &content); if (nsnull != content) { - result = GetFrameBorderHelper(content, aStandardMode); + result = GetFrameBorderHelper(content); NS_RELEASE(content); } if (eFrameborder_Notset == result) { - return GetFrameBorder(aStandardMode); + return GetFrameBorder(); } return result; } @@ -1180,7 +1174,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext, PRBool* horBordersVis = nsnull; // horizontal borders visibility nscolor* horBorderColors = nsnull; nscolor borderColor = GetBorderColor(); - nsFrameborder frameborder = GetFrameBorder(PR_FALSE); + nsFrameborder frameborder = GetFrameBorder(); if (firstTime) { verBordersVis = new PRBool[mNumCols]; diff --git a/mozilla/layout/generic/nsFrameSetFrame.h b/mozilla/layout/generic/nsFrameSetFrame.h index b5a80d92cd1..fe786185fd8 100644 --- a/mozilla/layout/generic/nsFrameSetFrame.h +++ b/mozilla/layout/generic/nsFrameSetFrame.h @@ -219,9 +219,9 @@ protected: void SetParentBorderColor(nscolor aColor) { mParentBorderColor = aColor; } - nsFrameborder GetFrameBorder(PRBool aStandardMode); + nsFrameborder GetFrameBorder(); - nsFrameborder GetFrameBorder(nsIContent* aContent, PRBool aStandardMode); + nsFrameborder GetFrameBorder(nsIContent* aContent); nscolor GetBorderColor(); diff --git a/mozilla/layout/html/document/src/nsFrameFrame.cpp b/mozilla/layout/html/document/src/nsFrameFrame.cpp index e279839a7bf..1c93d200450 100644 --- a/mozilla/layout/html/document/src/nsFrameFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameFrame.cpp @@ -252,7 +252,7 @@ public: PRBool GetURL(nsIContent* aContent, nsString& aResult); PRBool GetName(nsIContent* aContent, nsString& aResult); PRInt32 GetScrolling(nsIContent* aContent); - nsFrameborder GetFrameBorder(PRBool aStandardMode); + nsFrameborder GetFrameBorder(); PRInt32 GetMarginWidth(nsIPresContext* aPresContext, nsIContent* aContent); PRInt32 GetMarginHeight(nsIPresContext* aPresContext, nsIContent* aContent); @@ -775,7 +775,7 @@ PRInt32 nsHTMLFrameInnerFrame::GetScrolling(nsIContent* aContent) return returnValue; } -nsFrameborder nsHTMLFrameInnerFrame::GetFrameBorder(PRBool aStandardMode) +nsFrameborder nsHTMLFrameInnerFrame::GetFrameBorder() { nsFrameborder rv = eFrameborder_Notset; nsresult res = NS_OK; @@ -784,22 +784,17 @@ nsFrameborder nsHTMLFrameInnerFrame::GetFrameBorder(PRBool aStandardMode) nsHTMLValue value; if (NS_CONTENT_ATTR_HAS_VALUE == (content->GetHTMLAttribute(nsHTMLAtoms::frameborder, value))) { if (eHTMLUnit_Enumerated == value.GetUnit()) { - PRInt32 intValue; - intValue = value.GetIntValue(); - if (!aStandardMode) { - if (NS_STYLE_FRAME_YES == intValue) { + switch (value.GetIntValue()) + { + case NS_STYLE_FRAME_1: + case NS_STYLE_FRAME_YES: rv = eFrameborder_Yes; - } - else if (NS_STYLE_FRAME_NO == intValue) { + break; + + case NS_STYLE_FRAME_0: + case NS_STYLE_FRAME_NO: rv = eFrameborder_No; - } - } else { - if (NS_STYLE_FRAME_0 == intValue) { - rv = eFrameborder_No; - } - else if (NS_STYLE_FRAME_1 == intValue) { - rv = eFrameborder_Yes; - } + break; } } } diff --git a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp index d0ca0ce9664..c65d265414a 100644 --- a/mozilla/layout/html/document/src/nsFrameSetFrame.cpp +++ b/mozilla/layout/html/document/src/nsFrameSetFrame.cpp @@ -358,7 +358,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext, nsCOMPtr shell; aPresContext->GetShell(getter_AddRefs(shell)); - nsFrameborder frameborder = GetFrameBorder(PR_FALSE); + nsFrameborder frameborder = GetFrameBorder(); PRInt32 borderWidth = GetBorderWidth(aPresContext, PR_FALSE); nscolor borderColor = GetBorderColor(); @@ -404,7 +404,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext, aPresContext->ResolveStyleContextFor(child, mStyleContext, PR_FALSE, getter_AddRefs(kidSC)); - if (nsHTMLAtoms::frameset == tag.get()) { + if (nsHTMLAtoms::frameset == tag) { result = NS_NewHTMLFramesetFrame(shell, &frame); mChildTypes[mChildCount] = FRAMESET; @@ -421,7 +421,7 @@ nsHTMLFramesetFrame::Init(nsIPresContext* aPresContext, mChildTypes[mChildCount] = FRAME; - mChildFrameborder[mChildCount] = GetFrameBorder(child, PR_FALSE); + mChildFrameborder[mChildCount] = GetFrameBorder(child); mChildBorderColors[mChildCount].Set(GetBorderColor(child)); } @@ -627,7 +627,7 @@ PRInt32 nsHTMLFramesetFrame::GetBorderWidth(nsIPresContext* aPresContext, PRBool forcing = mForceFrameResizability && aTakeForcingIntoAccount; if (!forcing) { - nsFrameborder frameborder = GetFrameBorder(PR_FALSE); + nsFrameborder frameborder = GetFrameBorder(); if (frameborder == eFrameborder_No) { return 0; } @@ -1017,28 +1017,23 @@ nsHTMLFramesetFrame::ReflowPlaceChild(nsIFrame* aChild, } static -nsFrameborder GetFrameBorderHelper(nsIHTMLContent* aContent, - PRBool aStandardMode) +nsFrameborder GetFrameBorderHelper(nsIHTMLContent* aContent) { if (nsnull != aContent) { nsHTMLValue value; if (NS_CONTENT_ATTR_HAS_VALUE == (aContent->GetHTMLAttribute(nsHTMLAtoms::frameborder, value))) { - if (eHTMLUnit_Enumerated == value.GetUnit()) { - PRInt32 intValue; - intValue = value.GetIntValue(); - if (!aStandardMode) { - if (NS_STYLE_FRAME_YES == intValue) { - intValue = NS_STYLE_FRAME_1; - } - else if (NS_STYLE_FRAME_NO == intValue) { - intValue = NS_STYLE_FRAME_0; - } - } - if (NS_STYLE_FRAME_0 == intValue) { - return eFrameborder_No; - } - else if (NS_STYLE_FRAME_1 == intValue) { - return eFrameborder_Yes; + if (eHTMLUnit_Enumerated == value.GetUnit()) { + switch (value.GetIntValue()) + { + case NS_STYLE_FRAME_YES: + case NS_STYLE_FRAME_1: + return eFrameborder_Yes; + break; + + case NS_STYLE_FRAME_NO: + case NS_STYLE_FRAME_0: + return eFrameborder_No; + break; } } } @@ -1046,13 +1041,13 @@ nsFrameborder GetFrameBorderHelper(nsIHTMLContent* aContent, return eFrameborder_Notset; } -nsFrameborder nsHTMLFramesetFrame::GetFrameBorder(PRBool aStandardMode) +nsFrameborder nsHTMLFramesetFrame::GetFrameBorder() { nsFrameborder result = eFrameborder_Notset; nsIHTMLContent* content = nsnull; mContent->QueryInterface(kIHTMLContentIID, (void**) &content); - if (nsnull != content) { - result = GetFrameBorderHelper(content, aStandardMode); + if (content) { + result = GetFrameBorderHelper(content); NS_RELEASE(content); } if (eFrameborder_Notset == result) { @@ -1061,18 +1056,17 @@ nsFrameborder nsHTMLFramesetFrame::GetFrameBorder(PRBool aStandardMode) return result; } -nsFrameborder nsHTMLFramesetFrame::GetFrameBorder(nsIContent* aContent, - PRBool aStandardMode) +nsFrameborder nsHTMLFramesetFrame::GetFrameBorder(nsIContent* aContent) { nsFrameborder result = eFrameborder_Notset; nsIHTMLContent* content = nsnull; aContent->QueryInterface(kIHTMLContentIID, (void**) &content); if (nsnull != content) { - result = GetFrameBorderHelper(content, aStandardMode); + result = GetFrameBorderHelper(content); NS_RELEASE(content); } if (eFrameborder_Notset == result) { - return GetFrameBorder(aStandardMode); + return GetFrameBorder(); } return result; } @@ -1180,7 +1174,7 @@ nsHTMLFramesetFrame::Reflow(nsIPresContext* aPresContext, PRBool* horBordersVis = nsnull; // horizontal borders visibility nscolor* horBorderColors = nsnull; nscolor borderColor = GetBorderColor(); - nsFrameborder frameborder = GetFrameBorder(PR_FALSE); + nsFrameborder frameborder = GetFrameBorder(); if (firstTime) { verBordersVis = new PRBool[mNumCols]; diff --git a/mozilla/layout/html/document/src/nsFrameSetFrame.h b/mozilla/layout/html/document/src/nsFrameSetFrame.h index b5a80d92cd1..fe786185fd8 100644 --- a/mozilla/layout/html/document/src/nsFrameSetFrame.h +++ b/mozilla/layout/html/document/src/nsFrameSetFrame.h @@ -219,9 +219,9 @@ protected: void SetParentBorderColor(nscolor aColor) { mParentBorderColor = aColor; } - nsFrameborder GetFrameBorder(PRBool aStandardMode); + nsFrameborder GetFrameBorder(); - nsFrameborder GetFrameBorder(nsIContent* aContent, PRBool aStandardMode); + nsFrameborder GetFrameBorder(nsIContent* aContent); nscolor GetBorderColor();