From 7815d371787963cf91c6578336afa122d50620e8 Mon Sep 17 00:00:00 2001 From: "bzbarsky%mit.edu" Date: Thu, 24 Jan 2002 21:19:21 +0000 Subject: [PATCH] Make computed border-style and float be "none" by default. Bugs 120982 and 120965, patch by Christopher Aillon , r=bzbarsky, sr=jst --- content/html/style/src/nsComputedDOMStyle.cpp | 34 +++++++++++-------- layout/style/nsComputedDOMStyle.cpp | 34 +++++++++++-------- 2 files changed, 38 insertions(+), 30 deletions(-) diff --git a/content/html/style/src/nsComputedDOMStyle.cpp b/content/html/style/src/nsComputedDOMStyle.cpp index 457b5b84829..8a95f8bf777 100644 --- a/content/html/style/src/nsComputedDOMStyle.cpp +++ b/content/html/style/src/nsComputedDOMStyle.cpp @@ -711,18 +711,17 @@ nsComputedDOMStyle::GetCssFloat(nsIFrame *aFrame, const nsStyleDisplay* display=nsnull; GetStyleData(eStyleStruct_Display,(const nsStyleStruct*&)display,aFrame); - if(display) { + if(display && display->mFloats != NS_STYLE_FLOAT_NONE) { const nsAFlatCString& cssFloat = nsCSSProps::SearchKeywordTable(display->mFloats, - nsCSSProps::kFloatKTable); + nsCSSProps::kFloatKTable); val->SetString(cssFloat); } else { - val->SetString(NS_LITERAL_STRING("")); + val->SetString(NS_LITERAL_STRING("none")); } - return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue), - (void **)&aValue); + return CallQueryInterface(val, &aValue); } #if 0 @@ -2841,11 +2840,11 @@ nsComputedDOMStyle::GetBorderWidthFor(PRUint8 aSide, if(border) { nsStyleCoord coord; - PRUint8 borderStyle = border->GetBorderStyle(aSide); - if (borderStyle == NS_STYLE_BORDER_STYLE_NONE) { - coord.SetCoordValue(0); - } - else { + PRUint8 borderStyle = border->GetBorderStyle(aSide); + if (borderStyle == NS_STYLE_BORDER_STYLE_NONE) { + coord.SetCoordValue(0); + } + else { switch(aSide) { case NS_SIDE_TOP: border->mBorder.GetTop(coord); break; @@ -2976,18 +2975,23 @@ nsComputedDOMStyle::GetBorderStyleFor(PRUint8 aSide, const nsStyleBorder* border = nsnull; GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)border, aFrame); - if(border) { + PRUint8 borderStyle = NS_STYLE_BORDER_STYLE_NONE; + + if (border) { + borderStyle = border->GetBorderStyle(aSide); + } + + if (borderStyle != NS_STYLE_BORDER_STYLE_NONE) { const nsAFlatCString& style= - nsCSSProps::SearchKeywordTable(border->GetBorderStyle(aSide), + nsCSSProps::SearchKeywordTable(borderStyle, nsCSSProps::kBorderStyleKTable); val->SetString(style); } else { - val->SetString(NS_LITERAL_STRING("")); + val->SetString(NS_LITERAL_STRING("none")); } - return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue), - (void **)&aValue); + return CallQueryInterface(val, &aValue); } nsresult diff --git a/layout/style/nsComputedDOMStyle.cpp b/layout/style/nsComputedDOMStyle.cpp index 457b5b84829..8a95f8bf777 100644 --- a/layout/style/nsComputedDOMStyle.cpp +++ b/layout/style/nsComputedDOMStyle.cpp @@ -711,18 +711,17 @@ nsComputedDOMStyle::GetCssFloat(nsIFrame *aFrame, const nsStyleDisplay* display=nsnull; GetStyleData(eStyleStruct_Display,(const nsStyleStruct*&)display,aFrame); - if(display) { + if(display && display->mFloats != NS_STYLE_FLOAT_NONE) { const nsAFlatCString& cssFloat = nsCSSProps::SearchKeywordTable(display->mFloats, - nsCSSProps::kFloatKTable); + nsCSSProps::kFloatKTable); val->SetString(cssFloat); } else { - val->SetString(NS_LITERAL_STRING("")); + val->SetString(NS_LITERAL_STRING("none")); } - return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue), - (void **)&aValue); + return CallQueryInterface(val, &aValue); } #if 0 @@ -2841,11 +2840,11 @@ nsComputedDOMStyle::GetBorderWidthFor(PRUint8 aSide, if(border) { nsStyleCoord coord; - PRUint8 borderStyle = border->GetBorderStyle(aSide); - if (borderStyle == NS_STYLE_BORDER_STYLE_NONE) { - coord.SetCoordValue(0); - } - else { + PRUint8 borderStyle = border->GetBorderStyle(aSide); + if (borderStyle == NS_STYLE_BORDER_STYLE_NONE) { + coord.SetCoordValue(0); + } + else { switch(aSide) { case NS_SIDE_TOP: border->mBorder.GetTop(coord); break; @@ -2976,18 +2975,23 @@ nsComputedDOMStyle::GetBorderStyleFor(PRUint8 aSide, const nsStyleBorder* border = nsnull; GetStyleData(eStyleStruct_Border, (const nsStyleStruct*&)border, aFrame); - if(border) { + PRUint8 borderStyle = NS_STYLE_BORDER_STYLE_NONE; + + if (border) { + borderStyle = border->GetBorderStyle(aSide); + } + + if (borderStyle != NS_STYLE_BORDER_STYLE_NONE) { const nsAFlatCString& style= - nsCSSProps::SearchKeywordTable(border->GetBorderStyle(aSide), + nsCSSProps::SearchKeywordTable(borderStyle, nsCSSProps::kBorderStyleKTable); val->SetString(style); } else { - val->SetString(NS_LITERAL_STRING("")); + val->SetString(NS_LITERAL_STRING("none")); } - return val->QueryInterface(NS_GET_IID(nsIDOMCSSPrimitiveValue), - (void **)&aValue); + return CallQueryInterface(val, &aValue); } nsresult