From 007abc1c480a9712bb7ae8d93f01f8bb0b00bee6 Mon Sep 17 00:00:00 2001 From: "troy@netscape.com" Date: Thu, 11 Feb 1999 03:56:00 +0000 Subject: [PATCH] Fix for bug #3089 --- layout/generic/nsHTMLReflowState.cpp | 32 +++++++++++++++------- layout/html/base/src/nsHTMLReflowState.cpp | 32 +++++++++++++++------- 2 files changed, 44 insertions(+), 20 deletions(-) diff --git a/layout/generic/nsHTMLReflowState.cpp b/layout/generic/nsHTMLReflowState.cpp index 520459754cf2..10348f0e4499 100644 --- a/layout/generic/nsHTMLReflowState.cpp +++ b/layout/generic/nsHTMLReflowState.cpp @@ -945,11 +945,17 @@ nsHTMLReflowState::ComputeMarginFor(nsIFrame* aFrame, if (nsnull != rs) { nsStyleCoord left, right; nscoord containingBlockWidth = rs->computedWidth; - ComputeHorizontalValue(containingBlockWidth, spacing->mMargin.GetLeftUnit(), - spacing->mMargin.GetLeft(left), aResult.left); - ComputeHorizontalValue(containingBlockWidth, spacing->mMargin.GetRightUnit(), - spacing->mMargin.GetRight(right), - aResult.right); + if (NS_UNCONSTRAINEDSIZE == containingBlockWidth) { + aResult.left = 0; + aResult.right = 0; + + } else { + ComputeHorizontalValue(containingBlockWidth, spacing->mMargin.GetLeftUnit(), + spacing->mMargin.GetLeft(left), aResult.left); + ComputeHorizontalValue(containingBlockWidth, spacing->mMargin.GetRightUnit(), + spacing->mMargin.GetRight(right), + aResult.right); + } } else { aResult.left = 0; @@ -973,11 +979,17 @@ nsHTMLReflowState::ComputeMarginFor(nsIFrame* aFrame, // calculated with respect to the *width* of the containing // block, even for margin-top and margin-bottom. nscoord containingBlockWidth = rs->computedWidth; - ComputeHorizontalValue(containingBlockWidth, spacing->mMargin.GetTopUnit(), - spacing->mMargin.GetTop(top), aResult.top); - ComputeHorizontalValue(containingBlockWidth, spacing->mMargin.GetBottomUnit(), - spacing->mMargin.GetBottom(bottom), - aResult.bottom); + if (NS_UNCONSTRAINEDSIZE == containingBlockWidth) { + aResult.top = 0; + aResult.bottom = 0; + + } else { + ComputeHorizontalValue(containingBlockWidth, spacing->mMargin.GetTopUnit(), + spacing->mMargin.GetTop(top), aResult.top); + ComputeHorizontalValue(containingBlockWidth, spacing->mMargin.GetBottomUnit(), + spacing->mMargin.GetBottom(bottom), + aResult.bottom); + } } else { aResult.top = 0; diff --git a/layout/html/base/src/nsHTMLReflowState.cpp b/layout/html/base/src/nsHTMLReflowState.cpp index 520459754cf2..10348f0e4499 100644 --- a/layout/html/base/src/nsHTMLReflowState.cpp +++ b/layout/html/base/src/nsHTMLReflowState.cpp @@ -945,11 +945,17 @@ nsHTMLReflowState::ComputeMarginFor(nsIFrame* aFrame, if (nsnull != rs) { nsStyleCoord left, right; nscoord containingBlockWidth = rs->computedWidth; - ComputeHorizontalValue(containingBlockWidth, spacing->mMargin.GetLeftUnit(), - spacing->mMargin.GetLeft(left), aResult.left); - ComputeHorizontalValue(containingBlockWidth, spacing->mMargin.GetRightUnit(), - spacing->mMargin.GetRight(right), - aResult.right); + if (NS_UNCONSTRAINEDSIZE == containingBlockWidth) { + aResult.left = 0; + aResult.right = 0; + + } else { + ComputeHorizontalValue(containingBlockWidth, spacing->mMargin.GetLeftUnit(), + spacing->mMargin.GetLeft(left), aResult.left); + ComputeHorizontalValue(containingBlockWidth, spacing->mMargin.GetRightUnit(), + spacing->mMargin.GetRight(right), + aResult.right); + } } else { aResult.left = 0; @@ -973,11 +979,17 @@ nsHTMLReflowState::ComputeMarginFor(nsIFrame* aFrame, // calculated with respect to the *width* of the containing // block, even for margin-top and margin-bottom. nscoord containingBlockWidth = rs->computedWidth; - ComputeHorizontalValue(containingBlockWidth, spacing->mMargin.GetTopUnit(), - spacing->mMargin.GetTop(top), aResult.top); - ComputeHorizontalValue(containingBlockWidth, spacing->mMargin.GetBottomUnit(), - spacing->mMargin.GetBottom(bottom), - aResult.bottom); + if (NS_UNCONSTRAINEDSIZE == containingBlockWidth) { + aResult.top = 0; + aResult.bottom = 0; + + } else { + ComputeHorizontalValue(containingBlockWidth, spacing->mMargin.GetTopUnit(), + spacing->mMargin.GetTop(top), aResult.top); + ComputeHorizontalValue(containingBlockWidth, spacing->mMargin.GetBottomUnit(), + spacing->mMargin.GetBottom(bottom), + aResult.bottom); + } } else { aResult.top = 0;