From 800f53879d8a8d191d8fe5447bf75d478b2b2f42 Mon Sep 17 00:00:00 2001 From: "dbaron%dbaron.org" Date: Sun, 8 Jun 2003 00:36:08 +0000 Subject: [PATCH] Fix bustage on compilers with broken for loop scoping. b=125246 git-svn-id: svn://10.0.0.236/trunk@143424 18797224-902f-48f8-a5cc-f745e15eee43 --- mozilla/content/base/src/nsRuleNode.cpp | 148 +++++++++++++----------- mozilla/layout/style/nsRuleNode.cpp | 148 +++++++++++++----------- 2 files changed, 158 insertions(+), 138 deletions(-) diff --git a/mozilla/content/base/src/nsRuleNode.cpp b/mozilla/content/base/src/nsRuleNode.cpp index 2dfa12d44ef..1bb258619e1 100644 --- a/mozilla/content/base/src/nsRuleNode.cpp +++ b/mozilla/content/base/src/nsRuleNode.cpp @@ -3239,31 +3239,35 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct, // border-size: length, enum, inherit nsStyleCoord coord; nsStyleCoord parentCoord; - FOR_CSS_SIDES(side) { - const nsCSSValue &value = marginData.mBorderWidth.*(nsCSSRect::sides[side]); - if (SetCoord(value, coord, parentCoord, SETCOORD_LE, aContext, - mPresContext, inherited)) - border->mBorder.Set(side, coord); - else if (eCSSUnit_Inherit == value.GetUnit()) { - inherited = PR_TRUE; - border->mBorder.Set(side, parentBorder->mBorder.Get(side, coord)); + { // scope for compilers with broken |for| loop scoping + FOR_CSS_SIDES(side) { + const nsCSSValue &value = marginData.mBorderWidth.*(nsCSSRect::sides[side]); + if (SetCoord(value, coord, parentCoord, SETCOORD_LE, aContext, + mPresContext, inherited)) + border->mBorder.Set(side, coord); + else if (eCSSUnit_Inherit == value.GetUnit()) { + inherited = PR_TRUE; + border->mBorder.Set(side, parentBorder->mBorder.Get(side, coord)); + } } } // border-style: enum, none, inhert const nsCSSRect& ourStyle = marginData.mBorderStyle; - FOR_CSS_SIDES(side) { - const nsCSSValue &value = ourStyle.*(nsCSSRect::sides[side]); - nsCSSUnit unit = value.GetUnit(); - if (eCSSUnit_Enumerated == unit) { - border->SetBorderStyle(side, value.GetIntValue()); - } - else if (eCSSUnit_None == unit) { - border->SetBorderStyle(side, NS_STYLE_BORDER_STYLE_NONE); - } - else if (eCSSUnit_Inherit == unit) { - inherited = PR_TRUE; - border->SetBorderStyle(side, parentBorder->GetBorderStyle(side)); + { // scope for compilers with broken |for| loop scoping + FOR_CSS_SIDES(side) { + const nsCSSValue &value = ourStyle.*(nsCSSRect::sides[side]); + nsCSSUnit unit = value.GetUnit(); + if (eCSSUnit_Enumerated == unit) { + border->SetBorderStyle(side, value.GetIntValue()); + } + else if (eCSSUnit_None == unit) { + border->SetBorderStyle(side, NS_STYLE_BORDER_STYLE_NONE); + } + else if (eCSSUnit_Inherit == unit) { + inherited = PR_TRUE; + border->SetBorderStyle(side, parentBorder->GetBorderStyle(side)); + } } } @@ -3271,21 +3275,23 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct, nscolor borderColor; nscolor unused = NS_RGB(0,0,0); - FOR_CSS_SIDES(side) { - nsCSSValueList* list = - marginData.mBorderColors.*(nsCSSValueListRect::sides[side]); - if (list) { - // Some composite border color information has been specified for this - // border side. - border->EnsureBorderColors(); - border->ClearBorderColors(side); - while (list) { - if (SetColor(list->mValue, unused, mPresContext, borderColor, inherited)) - border->AppendBorderColor(side, borderColor, PR_FALSE); - else if (eCSSUnit_Enumerated == list->mValue.GetUnit() && - NS_STYLE_COLOR_TRANSPARENT == list->mValue.GetIntValue()) - border->AppendBorderColor(side, nsnull, PR_TRUE); - list = list->mNext; + { // scope for compilers with broken |for| loop scoping + FOR_CSS_SIDES(side) { + nsCSSValueList* list = + marginData.mBorderColors.*(nsCSSValueListRect::sides[side]); + if (list) { + // Some composite border color information has been specified for this + // border side. + border->EnsureBorderColors(); + border->ClearBorderColors(side); + while (list) { + if (SetColor(list->mValue, unused, mPresContext, borderColor, inherited)) + border->AppendBorderColor(side, borderColor, PR_FALSE); + else if (eCSSUnit_Enumerated == list->mValue.GetUnit() && + NS_STYLE_COLOR_TRANSPARENT == list->mValue.GetIntValue()) + border->AppendBorderColor(side, nsnull, PR_TRUE); + list = list->mNext; + } } } } @@ -3295,46 +3301,50 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct, PRBool transparent; PRBool foreground; - FOR_CSS_SIDES(side) { - const nsCSSValue &value = ourBorderColor.*(nsCSSRect::sides[side]); - if (eCSSUnit_Inherit == value.GetUnit()) { - inherited = PR_TRUE; - parentBorder->GetBorderColor(side, borderColor, - transparent, foreground); - if (transparent) - border->SetBorderTransparent(side); - else if (foreground) { - // We want to inherit the color from the parent, not use the - // color on the element where this chunk of style data will be - // used. We can ensure that the data for the parent are fully - // computed (unlike for the element where this will be used, for - // which the color could be specified on a more specific rule). - border->SetBorderColor(side, parentContext->GetStyleColor()->mColor); - } else - border->SetBorderColor(side, borderColor); - } - else if (SetColor(value, unused, mPresContext, borderColor, inherited)) { - border->SetBorderColor(side, borderColor); - } - else if (eCSSUnit_Enumerated == value.GetUnit()) { - switch (value.GetIntValue()) { - case NS_STYLE_COLOR_TRANSPARENT: + { // scope for compilers with broken |for| loop scoping + FOR_CSS_SIDES(side) { + const nsCSSValue &value = ourBorderColor.*(nsCSSRect::sides[side]); + if (eCSSUnit_Inherit == value.GetUnit()) { + inherited = PR_TRUE; + parentBorder->GetBorderColor(side, borderColor, + transparent, foreground); + if (transparent) border->SetBorderTransparent(side); - break; - case NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR: - border->SetBorderToForeground(side); - break; + else if (foreground) { + // We want to inherit the color from the parent, not use the + // color on the element where this chunk of style data will be + // used. We can ensure that the data for the parent are fully + // computed (unlike for the element where this will be used, for + // which the color could be specified on a more specific rule). + border->SetBorderColor(side, parentContext->GetStyleColor()->mColor); + } else + border->SetBorderColor(side, borderColor); + } + else if (SetColor(value, unused, mPresContext, borderColor, inherited)) { + border->SetBorderColor(side, borderColor); + } + else if (eCSSUnit_Enumerated == value.GetUnit()) { + switch (value.GetIntValue()) { + case NS_STYLE_COLOR_TRANSPARENT: + border->SetBorderTransparent(side); + break; + case NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR: + border->SetBorderToForeground(side); + break; + } } } } // -moz-border-radius: length, percent, inherit - FOR_CSS_SIDES(side) { - parentBorder->mBorderRadius.Get(side, parentCoord); - if (SetCoord(marginData.mBorderRadius.*(nsCSSRect::sides[side]), coord, - parentCoord, SETCOORD_LPH, aContext, mPresContext, - inherited)) - border->mBorderRadius.Set(side, coord); + { // scope for compilers with broken |for| loop scoping + FOR_CSS_SIDES(side) { + parentBorder->mBorderRadius.Get(side, parentCoord); + if (SetCoord(marginData.mBorderRadius.*(nsCSSRect::sides[side]), coord, + parentCoord, SETCOORD_LPH, aContext, mPresContext, + inherited)) + border->mBorderRadius.Set(side, coord); + } } // float-edge: enum, inherit diff --git a/mozilla/layout/style/nsRuleNode.cpp b/mozilla/layout/style/nsRuleNode.cpp index 2dfa12d44ef..1bb258619e1 100644 --- a/mozilla/layout/style/nsRuleNode.cpp +++ b/mozilla/layout/style/nsRuleNode.cpp @@ -3239,31 +3239,35 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct, // border-size: length, enum, inherit nsStyleCoord coord; nsStyleCoord parentCoord; - FOR_CSS_SIDES(side) { - const nsCSSValue &value = marginData.mBorderWidth.*(nsCSSRect::sides[side]); - if (SetCoord(value, coord, parentCoord, SETCOORD_LE, aContext, - mPresContext, inherited)) - border->mBorder.Set(side, coord); - else if (eCSSUnit_Inherit == value.GetUnit()) { - inherited = PR_TRUE; - border->mBorder.Set(side, parentBorder->mBorder.Get(side, coord)); + { // scope for compilers with broken |for| loop scoping + FOR_CSS_SIDES(side) { + const nsCSSValue &value = marginData.mBorderWidth.*(nsCSSRect::sides[side]); + if (SetCoord(value, coord, parentCoord, SETCOORD_LE, aContext, + mPresContext, inherited)) + border->mBorder.Set(side, coord); + else if (eCSSUnit_Inherit == value.GetUnit()) { + inherited = PR_TRUE; + border->mBorder.Set(side, parentBorder->mBorder.Get(side, coord)); + } } } // border-style: enum, none, inhert const nsCSSRect& ourStyle = marginData.mBorderStyle; - FOR_CSS_SIDES(side) { - const nsCSSValue &value = ourStyle.*(nsCSSRect::sides[side]); - nsCSSUnit unit = value.GetUnit(); - if (eCSSUnit_Enumerated == unit) { - border->SetBorderStyle(side, value.GetIntValue()); - } - else if (eCSSUnit_None == unit) { - border->SetBorderStyle(side, NS_STYLE_BORDER_STYLE_NONE); - } - else if (eCSSUnit_Inherit == unit) { - inherited = PR_TRUE; - border->SetBorderStyle(side, parentBorder->GetBorderStyle(side)); + { // scope for compilers with broken |for| loop scoping + FOR_CSS_SIDES(side) { + const nsCSSValue &value = ourStyle.*(nsCSSRect::sides[side]); + nsCSSUnit unit = value.GetUnit(); + if (eCSSUnit_Enumerated == unit) { + border->SetBorderStyle(side, value.GetIntValue()); + } + else if (eCSSUnit_None == unit) { + border->SetBorderStyle(side, NS_STYLE_BORDER_STYLE_NONE); + } + else if (eCSSUnit_Inherit == unit) { + inherited = PR_TRUE; + border->SetBorderStyle(side, parentBorder->GetBorderStyle(side)); + } } } @@ -3271,21 +3275,23 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct, nscolor borderColor; nscolor unused = NS_RGB(0,0,0); - FOR_CSS_SIDES(side) { - nsCSSValueList* list = - marginData.mBorderColors.*(nsCSSValueListRect::sides[side]); - if (list) { - // Some composite border color information has been specified for this - // border side. - border->EnsureBorderColors(); - border->ClearBorderColors(side); - while (list) { - if (SetColor(list->mValue, unused, mPresContext, borderColor, inherited)) - border->AppendBorderColor(side, borderColor, PR_FALSE); - else if (eCSSUnit_Enumerated == list->mValue.GetUnit() && - NS_STYLE_COLOR_TRANSPARENT == list->mValue.GetIntValue()) - border->AppendBorderColor(side, nsnull, PR_TRUE); - list = list->mNext; + { // scope for compilers with broken |for| loop scoping + FOR_CSS_SIDES(side) { + nsCSSValueList* list = + marginData.mBorderColors.*(nsCSSValueListRect::sides[side]); + if (list) { + // Some composite border color information has been specified for this + // border side. + border->EnsureBorderColors(); + border->ClearBorderColors(side); + while (list) { + if (SetColor(list->mValue, unused, mPresContext, borderColor, inherited)) + border->AppendBorderColor(side, borderColor, PR_FALSE); + else if (eCSSUnit_Enumerated == list->mValue.GetUnit() && + NS_STYLE_COLOR_TRANSPARENT == list->mValue.GetIntValue()) + border->AppendBorderColor(side, nsnull, PR_TRUE); + list = list->mNext; + } } } } @@ -3295,46 +3301,50 @@ nsRuleNode::ComputeBorderData(nsStyleStruct* aStartStruct, PRBool transparent; PRBool foreground; - FOR_CSS_SIDES(side) { - const nsCSSValue &value = ourBorderColor.*(nsCSSRect::sides[side]); - if (eCSSUnit_Inherit == value.GetUnit()) { - inherited = PR_TRUE; - parentBorder->GetBorderColor(side, borderColor, - transparent, foreground); - if (transparent) - border->SetBorderTransparent(side); - else if (foreground) { - // We want to inherit the color from the parent, not use the - // color on the element where this chunk of style data will be - // used. We can ensure that the data for the parent are fully - // computed (unlike for the element where this will be used, for - // which the color could be specified on a more specific rule). - border->SetBorderColor(side, parentContext->GetStyleColor()->mColor); - } else - border->SetBorderColor(side, borderColor); - } - else if (SetColor(value, unused, mPresContext, borderColor, inherited)) { - border->SetBorderColor(side, borderColor); - } - else if (eCSSUnit_Enumerated == value.GetUnit()) { - switch (value.GetIntValue()) { - case NS_STYLE_COLOR_TRANSPARENT: + { // scope for compilers with broken |for| loop scoping + FOR_CSS_SIDES(side) { + const nsCSSValue &value = ourBorderColor.*(nsCSSRect::sides[side]); + if (eCSSUnit_Inherit == value.GetUnit()) { + inherited = PR_TRUE; + parentBorder->GetBorderColor(side, borderColor, + transparent, foreground); + if (transparent) border->SetBorderTransparent(side); - break; - case NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR: - border->SetBorderToForeground(side); - break; + else if (foreground) { + // We want to inherit the color from the parent, not use the + // color on the element where this chunk of style data will be + // used. We can ensure that the data for the parent are fully + // computed (unlike for the element where this will be used, for + // which the color could be specified on a more specific rule). + border->SetBorderColor(side, parentContext->GetStyleColor()->mColor); + } else + border->SetBorderColor(side, borderColor); + } + else if (SetColor(value, unused, mPresContext, borderColor, inherited)) { + border->SetBorderColor(side, borderColor); + } + else if (eCSSUnit_Enumerated == value.GetUnit()) { + switch (value.GetIntValue()) { + case NS_STYLE_COLOR_TRANSPARENT: + border->SetBorderTransparent(side); + break; + case NS_STYLE_COLOR_MOZ_USE_TEXT_COLOR: + border->SetBorderToForeground(side); + break; + } } } } // -moz-border-radius: length, percent, inherit - FOR_CSS_SIDES(side) { - parentBorder->mBorderRadius.Get(side, parentCoord); - if (SetCoord(marginData.mBorderRadius.*(nsCSSRect::sides[side]), coord, - parentCoord, SETCOORD_LPH, aContext, mPresContext, - inherited)) - border->mBorderRadius.Set(side, coord); + { // scope for compilers with broken |for| loop scoping + FOR_CSS_SIDES(side) { + parentBorder->mBorderRadius.Get(side, parentCoord); + if (SetCoord(marginData.mBorderRadius.*(nsCSSRect::sides[side]), coord, + parentCoord, SETCOORD_LPH, aContext, mPresContext, + inherited)) + border->mBorderRadius.Set(side, coord); + } } // float-edge: enum, inherit