diff --git a/layout/forms/nsFieldSetFrame.cpp b/layout/forms/nsFieldSetFrame.cpp index dba2e8ba2d8..41a6e6b9328 100644 --- a/layout/forms/nsFieldSetFrame.cpp +++ b/layout/forms/nsFieldSetFrame.cpp @@ -342,6 +342,9 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, nscoord contentWidth = contentSize.width + borderPadding.left + borderPadding.right; aDesiredSize.width = (legendWidth > contentWidth) ? legendWidth : contentWidth; + if (aReflowState.HaveConstrainedWidth() && (aReflowState.minWidth > aDesiredSize.width)) { + aDesiredSize.width = aReflowState.minWidth; + } // Place the legend nsRect legendRect(0, 0, 0, 0); @@ -402,6 +405,9 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, aDesiredSize.height = contentTopOffset + contentSize.height + borderPadding.bottom; if (mInline) // XXX parents don't yet ...... aDesiredSize.height += margin.bottom; + if (aReflowState.HaveConstrainedHeight() && (aReflowState.minHeight > aDesiredSize.height)) { + aDesiredSize.height = aReflowState.minHeight; + } aDesiredSize.ascent = aDesiredSize.height; aDesiredSize.descent = 0; if (nsnull != aDesiredSize.maxElementSize) { diff --git a/layout/forms/nsHTMLButtonControlFrame.cpp b/layout/forms/nsHTMLButtonControlFrame.cpp index 9ffca74d8a3..a1e20471de6 100644 --- a/layout/forms/nsHTMLButtonControlFrame.cpp +++ b/layout/forms/nsHTMLButtonControlFrame.cpp @@ -605,6 +605,15 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext, aDesiredSize.maxElementSize->width += borderPadding.left + borderPadding.right; aDesiredSize.maxElementSize->height += borderPadding.top + borderPadding.bottom; } + + // if we are constrained and the child is smaller, use the constrained values + if (aReflowState.HaveConstrainedWidth() && (aDesiredSize.width < aReflowState.minWidth)) { + aDesiredSize.width = aReflowState.minWidth; + } + if (aReflowState.HaveConstrainedHeight() && (aDesiredSize.height < aReflowState.minHeight)) { + aDesiredSize.height = aReflowState.minHeight; + } + aDesiredSize.ascent = aDesiredSize.height; aDesiredSize.descent = 0; diff --git a/layout/forms/nsLegendFrame.cpp b/layout/forms/nsLegendFrame.cpp index bdc44428659..9606a51dcda 100644 --- a/layout/forms/nsLegendFrame.cpp +++ b/layout/forms/nsLegendFrame.cpp @@ -146,7 +146,14 @@ nsLegendFrame::Reflow(nsIPresContext& aPresContext, // add in our border and padding to the size of the child aDesiredSize.width += borderPadding.left + borderPadding.right; + if (aReflowState.HaveConstrainedWidth() && (aReflowState.minWidth > aDesiredSize.width)) { + aDesiredSize.width = aReflowState.minWidth; + } + aDesiredSize.height += borderPadding.top + borderPadding.bottom; + if (aReflowState.HaveConstrainedHeight() && (aReflowState.minHeight > aDesiredSize.height)) { + aDesiredSize.height = aReflowState.minHeight; + } // adjust our max element size, if necessary if (aDesiredSize.maxElementSize) { diff --git a/layout/html/forms/src/nsFieldSetFrame.cpp b/layout/html/forms/src/nsFieldSetFrame.cpp index dba2e8ba2d8..41a6e6b9328 100644 --- a/layout/html/forms/src/nsFieldSetFrame.cpp +++ b/layout/html/forms/src/nsFieldSetFrame.cpp @@ -342,6 +342,9 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, nscoord contentWidth = contentSize.width + borderPadding.left + borderPadding.right; aDesiredSize.width = (legendWidth > contentWidth) ? legendWidth : contentWidth; + if (aReflowState.HaveConstrainedWidth() && (aReflowState.minWidth > aDesiredSize.width)) { + aDesiredSize.width = aReflowState.minWidth; + } // Place the legend nsRect legendRect(0, 0, 0, 0); @@ -402,6 +405,9 @@ nsFieldSetFrame::Reflow(nsIPresContext& aPresContext, aDesiredSize.height = contentTopOffset + contentSize.height + borderPadding.bottom; if (mInline) // XXX parents don't yet ...... aDesiredSize.height += margin.bottom; + if (aReflowState.HaveConstrainedHeight() && (aReflowState.minHeight > aDesiredSize.height)) { + aDesiredSize.height = aReflowState.minHeight; + } aDesiredSize.ascent = aDesiredSize.height; aDesiredSize.descent = 0; if (nsnull != aDesiredSize.maxElementSize) { diff --git a/layout/html/forms/src/nsHTMLButtonControlFrame.cpp b/layout/html/forms/src/nsHTMLButtonControlFrame.cpp index 9ffca74d8a3..a1e20471de6 100644 --- a/layout/html/forms/src/nsHTMLButtonControlFrame.cpp +++ b/layout/html/forms/src/nsHTMLButtonControlFrame.cpp @@ -605,6 +605,15 @@ nsHTMLButtonControlFrame::Reflow(nsIPresContext& aPresContext, aDesiredSize.maxElementSize->width += borderPadding.left + borderPadding.right; aDesiredSize.maxElementSize->height += borderPadding.top + borderPadding.bottom; } + + // if we are constrained and the child is smaller, use the constrained values + if (aReflowState.HaveConstrainedWidth() && (aDesiredSize.width < aReflowState.minWidth)) { + aDesiredSize.width = aReflowState.minWidth; + } + if (aReflowState.HaveConstrainedHeight() && (aDesiredSize.height < aReflowState.minHeight)) { + aDesiredSize.height = aReflowState.minHeight; + } + aDesiredSize.ascent = aDesiredSize.height; aDesiredSize.descent = 0; diff --git a/layout/html/forms/src/nsLegendFrame.cpp b/layout/html/forms/src/nsLegendFrame.cpp index bdc44428659..9606a51dcda 100644 --- a/layout/html/forms/src/nsLegendFrame.cpp +++ b/layout/html/forms/src/nsLegendFrame.cpp @@ -146,7 +146,14 @@ nsLegendFrame::Reflow(nsIPresContext& aPresContext, // add in our border and padding to the size of the child aDesiredSize.width += borderPadding.left + borderPadding.right; + if (aReflowState.HaveConstrainedWidth() && (aReflowState.minWidth > aDesiredSize.width)) { + aDesiredSize.width = aReflowState.minWidth; + } + aDesiredSize.height += borderPadding.top + borderPadding.bottom; + if (aReflowState.HaveConstrainedHeight() && (aReflowState.minHeight > aDesiredSize.height)) { + aDesiredSize.height = aReflowState.minHeight; + } // adjust our max element size, if necessary if (aDesiredSize.maxElementSize) {