support for constrained width, height

This commit is contained in:
karnaze%netscape.com 1998-10-19 23:02:41 +00:00
Родитель 321ba08ad1
Коммит 4730045a40
6 изменённых файлов: 44 добавлений и 0 удалений

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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;

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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) {

Просмотреть файл

@ -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;

Просмотреть файл

@ -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) {