diff --git a/mozilla/layout/generic/nsHTMLReflowState.cpp b/mozilla/layout/generic/nsHTMLReflowState.cpp index 381212fd26a..713d7a1e3ab 100644 --- a/mozilla/layout/generic/nsHTMLReflowState.cpp +++ b/mozilla/layout/generic/nsHTMLReflowState.cpp @@ -739,8 +739,11 @@ nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext) NS_ASSERTION((computedMargin.right > -200000) && (computedMargin.right < 200000), "oy"); #endif - ComputeBorderFor(frame, mComputedBorderPadding); ComputePadding(containingBlockWidth); + if (!mStyleSpacing->GetBorder(mComputedBorderPadding)) { + // CSS2 has no percentage borders + mComputedBorderPadding.SizeTo(0, 0, 0, 0); + } mComputedBorderPadding += mComputedPadding; nsStyleUnit widthUnit = mStylePosition->mWidth.GetUnit(); @@ -1305,79 +1308,6 @@ nsHTMLReflowState::ComputePadding(nscoord aContainingBlockWidth) } } -void -nsHTMLReflowState::ComputePaddingFor(nsIFrame* aFrame, - const nsReflowState* aParentRS, - nsMargin& aResult) -{ - const nsStyleSpacing* spacing; - nsresult rv; - rv = aFrame->GetStyleData(eStyleStruct_Spacing, - (const nsStyleStruct*&) spacing); - if (NS_SUCCEEDED(rv) && (nsnull != spacing)) { - // If style can provide us the padding directly, then use it. - spacing->CalcPaddingFor(aFrame, aResult); -#if 0 - if (!spacing->GetPadding(aResult) && (nsnull != aParentRS)) -#else - spacing->CalcPaddingFor(aFrame, aResult); - if ((eStyleUnit_Percent == spacing->mPadding.GetTopUnit()) || - (eStyleUnit_Percent == spacing->mPadding.GetRightUnit()) || - (eStyleUnit_Percent == spacing->mPadding.GetBottomUnit()) || - (eStyleUnit_Percent == spacing->mPadding.GetLeftUnit())) -#endif - { - // We have to compute the value (because it's uncomputable by - // the style code). - const nsHTMLReflowState* rs = GetContainingBlockReflowState(aParentRS); - if (nsnull != rs) { - nsStyleCoord left, right, top, bottom; - nscoord containingBlockWidth = rs->computedWidth; - ComputeHorizontalValue(containingBlockWidth, spacing->mPadding.GetLeftUnit(), - spacing->mPadding.GetLeft(left), aResult.left); - ComputeHorizontalValue(containingBlockWidth, spacing->mPadding.GetRightUnit(), - spacing->mPadding.GetRight(right), - aResult.right); - - // According to the CSS2 spec, padding percentages are - // calculated with respect to the *width* of the containing - // block, even for padding-top and padding-bottom. - ComputeHorizontalValue(containingBlockWidth, spacing->mPadding.GetTopUnit(), - spacing->mPadding.GetTop(top), aResult.top); - ComputeHorizontalValue(containingBlockWidth, spacing->mPadding.GetBottomUnit(), - spacing->mPadding.GetBottom(bottom), - aResult.bottom); - } - else { - aResult.SizeTo(0, 0, 0, 0); - } - } - } - else { - aResult.SizeTo(0, 0, 0, 0); - } -} - -void -nsHTMLReflowState::ComputeBorderFor(nsIFrame* aFrame, - nsMargin& aResult) -{ - const nsStyleSpacing* spacing; - nsresult rv; - rv = aFrame->GetStyleData(eStyleStruct_Spacing, - (const nsStyleStruct*&) spacing); - if (NS_SUCCEEDED(rv) && (nsnull != spacing)) { - // If style can provide us the border directly, then use it. - if (!spacing->GetBorder(aResult)) { - // CSS2 has no percentage borders - aResult.SizeTo(0, 0, 0, 0); - } - } - else { - aResult.SizeTo(0, 0, 0, 0); - } -} - void nsHTMLReflowState::ComputeBorderPaddingFor(nsIFrame* aFrame, const nsReflowState* aParentRS, diff --git a/mozilla/layout/html/base/src/nsHTMLReflowState.cpp b/mozilla/layout/html/base/src/nsHTMLReflowState.cpp index 381212fd26a..713d7a1e3ab 100644 --- a/mozilla/layout/html/base/src/nsHTMLReflowState.cpp +++ b/mozilla/layout/html/base/src/nsHTMLReflowState.cpp @@ -739,8 +739,11 @@ nsHTMLReflowState::InitConstraints(nsIPresContext& aPresContext) NS_ASSERTION((computedMargin.right > -200000) && (computedMargin.right < 200000), "oy"); #endif - ComputeBorderFor(frame, mComputedBorderPadding); ComputePadding(containingBlockWidth); + if (!mStyleSpacing->GetBorder(mComputedBorderPadding)) { + // CSS2 has no percentage borders + mComputedBorderPadding.SizeTo(0, 0, 0, 0); + } mComputedBorderPadding += mComputedPadding; nsStyleUnit widthUnit = mStylePosition->mWidth.GetUnit(); @@ -1305,79 +1308,6 @@ nsHTMLReflowState::ComputePadding(nscoord aContainingBlockWidth) } } -void -nsHTMLReflowState::ComputePaddingFor(nsIFrame* aFrame, - const nsReflowState* aParentRS, - nsMargin& aResult) -{ - const nsStyleSpacing* spacing; - nsresult rv; - rv = aFrame->GetStyleData(eStyleStruct_Spacing, - (const nsStyleStruct*&) spacing); - if (NS_SUCCEEDED(rv) && (nsnull != spacing)) { - // If style can provide us the padding directly, then use it. - spacing->CalcPaddingFor(aFrame, aResult); -#if 0 - if (!spacing->GetPadding(aResult) && (nsnull != aParentRS)) -#else - spacing->CalcPaddingFor(aFrame, aResult); - if ((eStyleUnit_Percent == spacing->mPadding.GetTopUnit()) || - (eStyleUnit_Percent == spacing->mPadding.GetRightUnit()) || - (eStyleUnit_Percent == spacing->mPadding.GetBottomUnit()) || - (eStyleUnit_Percent == spacing->mPadding.GetLeftUnit())) -#endif - { - // We have to compute the value (because it's uncomputable by - // the style code). - const nsHTMLReflowState* rs = GetContainingBlockReflowState(aParentRS); - if (nsnull != rs) { - nsStyleCoord left, right, top, bottom; - nscoord containingBlockWidth = rs->computedWidth; - ComputeHorizontalValue(containingBlockWidth, spacing->mPadding.GetLeftUnit(), - spacing->mPadding.GetLeft(left), aResult.left); - ComputeHorizontalValue(containingBlockWidth, spacing->mPadding.GetRightUnit(), - spacing->mPadding.GetRight(right), - aResult.right); - - // According to the CSS2 spec, padding percentages are - // calculated with respect to the *width* of the containing - // block, even for padding-top and padding-bottom. - ComputeHorizontalValue(containingBlockWidth, spacing->mPadding.GetTopUnit(), - spacing->mPadding.GetTop(top), aResult.top); - ComputeHorizontalValue(containingBlockWidth, spacing->mPadding.GetBottomUnit(), - spacing->mPadding.GetBottom(bottom), - aResult.bottom); - } - else { - aResult.SizeTo(0, 0, 0, 0); - } - } - } - else { - aResult.SizeTo(0, 0, 0, 0); - } -} - -void -nsHTMLReflowState::ComputeBorderFor(nsIFrame* aFrame, - nsMargin& aResult) -{ - const nsStyleSpacing* spacing; - nsresult rv; - rv = aFrame->GetStyleData(eStyleStruct_Spacing, - (const nsStyleStruct*&) spacing); - if (NS_SUCCEEDED(rv) && (nsnull != spacing)) { - // If style can provide us the border directly, then use it. - if (!spacing->GetBorder(aResult)) { - // CSS2 has no percentage borders - aResult.SizeTo(0, 0, 0, 0); - } - } - else { - aResult.SizeTo(0, 0, 0, 0); - } -} - void nsHTMLReflowState::ComputeBorderPaddingFor(nsIFrame* aFrame, const nsReflowState* aParentRS, diff --git a/mozilla/layout/html/base/src/nsIHTMLReflow.h b/mozilla/layout/html/base/src/nsIHTMLReflow.h index e1c8d98bf46..9b497be1a0f 100644 --- a/mozilla/layout/html/base/src/nsIHTMLReflow.h +++ b/mozilla/layout/html/base/src/nsIHTMLReflow.h @@ -267,24 +267,6 @@ struct nsHTMLReflowState : nsReflowState { const nsReflowState* aParentReflowState, nsMargin& aResult); - /** - * Compute the padding for aFrame. If a percentage needs to - * be computed it will be computed by finding the containing block, - * use GetContainingBlockReflowState. aParentReflowState is aFrame's - * parent's reflow state. The resulting computed padding is returned - * in aResult. - */ - static void ComputePaddingFor(nsIFrame* aFrame, - const nsReflowState* aParentReflowState, - nsMargin& aResult); - - /** - * Compute the border for aFrame.The resulting computed - * padding is returned in aResult. - */ - static void ComputeBorderFor(nsIFrame* aFrame, - nsMargin& aResult); - /** * Compute the border plus padding for aFrame. If a * percentage needs to be computed it will be computed by finding