Make iframes and objects obey CSS max-width/height and min-width/height if
their sizes are unconstrained. Bug 181875, r+sr=roc+moz git-svn-id: svn://10.0.0.236/trunk@141192 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
parent
02650524ba
commit
eefaa620cb
@ -457,13 +457,17 @@ nsHTMLFrameOuterFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
aDesiredSize.width = aReflowState.mComputedWidth;
|
||||
}
|
||||
else {
|
||||
aDesiredSize.width = NSIntPixelsToTwips(300, p2t);
|
||||
aDesiredSize.width = PR_MIN(PR_MAX(NSIntPixelsToTwips(300, p2t),
|
||||
aReflowState.mComputedMinWidth),
|
||||
aReflowState.mComputedMaxWidth);
|
||||
}
|
||||
if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedHeight) {
|
||||
aDesiredSize.height = aReflowState.mComputedHeight;
|
||||
}
|
||||
else {
|
||||
aDesiredSize.height = NSIntPixelsToTwips(150, p2t);
|
||||
aDesiredSize.height = PR_MIN(PR_MAX(NSIntPixelsToTwips(150, p2t),
|
||||
aReflowState.mComputedMinHeight),
|
||||
aReflowState.mComputedMaxHeight);
|
||||
}
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
|
||||
@ -921,10 +921,14 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
float p2t;
|
||||
aPresContext->GetScaledPixelsToTwips(&p2t);
|
||||
if (aMetrics.width == NS_UNCONSTRAINEDSIZE) {
|
||||
aMetrics.width = NSIntPixelsToTwips(EMBED_DEF_WIDTH, p2t);
|
||||
aMetrics.width = PR_MIN(PR_MAX(NSIntPixelsToTwips(EMBED_DEF_WIDTH, p2t),
|
||||
aReflowState.mComputedMinWidth),
|
||||
aReflowState.mComputedMaxWidth);
|
||||
}
|
||||
if (aMetrics.height == NS_UNCONSTRAINEDSIZE) {
|
||||
aMetrics.height = NSIntPixelsToTwips(EMBED_DEF_HEIGHT, p2t);
|
||||
aMetrics.height = PR_MIN(PR_MAX(NSIntPixelsToTwips(EMBED_DEF_HEIGHT, p2t),
|
||||
aReflowState.mComputedMinHeight),
|
||||
aReflowState.mComputedMaxHeight);
|
||||
}
|
||||
}
|
||||
|
||||
@ -932,7 +936,9 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
// nothing to go on (no width set, no information from the plugin, nothing).
|
||||
// Make up a number.
|
||||
if (aMetrics.width == NS_UNCONSTRAINEDSIZE) {
|
||||
aMetrics.width = 0;
|
||||
aMetrics.width =
|
||||
(aReflowState.mComputedMinWidth != NS_UNCONSTRAINEDSIZE) ?
|
||||
aReflowState.mComputedMinWidth : 0;
|
||||
}
|
||||
|
||||
// At this point, the height has an unconstrained value only in two cases:
|
||||
@ -940,7 +946,9 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
// b) We have no height information at all.
|
||||
// In either case, we have to make up a number.
|
||||
if (aMetrics.height == NS_UNCONSTRAINEDSIZE) {
|
||||
aMetrics.height = 0;
|
||||
aMetrics.height =
|
||||
(aReflowState.mComputedMinHeight != NS_UNCONSTRAINEDSIZE) ?
|
||||
aReflowState.mComputedMinHeight : 0;
|
||||
}
|
||||
|
||||
// XXXbz don't add in the border and padding, because we screw up our
|
||||
|
||||
@ -921,10 +921,14 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
float p2t;
|
||||
aPresContext->GetScaledPixelsToTwips(&p2t);
|
||||
if (aMetrics.width == NS_UNCONSTRAINEDSIZE) {
|
||||
aMetrics.width = NSIntPixelsToTwips(EMBED_DEF_WIDTH, p2t);
|
||||
aMetrics.width = PR_MIN(PR_MAX(NSIntPixelsToTwips(EMBED_DEF_WIDTH, p2t),
|
||||
aReflowState.mComputedMinWidth),
|
||||
aReflowState.mComputedMaxWidth);
|
||||
}
|
||||
if (aMetrics.height == NS_UNCONSTRAINEDSIZE) {
|
||||
aMetrics.height = NSIntPixelsToTwips(EMBED_DEF_HEIGHT, p2t);
|
||||
aMetrics.height = PR_MIN(PR_MAX(NSIntPixelsToTwips(EMBED_DEF_HEIGHT, p2t),
|
||||
aReflowState.mComputedMinHeight),
|
||||
aReflowState.mComputedMaxHeight);
|
||||
}
|
||||
}
|
||||
|
||||
@ -932,7 +936,9 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
// nothing to go on (no width set, no information from the plugin, nothing).
|
||||
// Make up a number.
|
||||
if (aMetrics.width == NS_UNCONSTRAINEDSIZE) {
|
||||
aMetrics.width = 0;
|
||||
aMetrics.width =
|
||||
(aReflowState.mComputedMinWidth != NS_UNCONSTRAINEDSIZE) ?
|
||||
aReflowState.mComputedMinWidth : 0;
|
||||
}
|
||||
|
||||
// At this point, the height has an unconstrained value only in two cases:
|
||||
@ -940,7 +946,9 @@ nsObjectFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
// b) We have no height information at all.
|
||||
// In either case, we have to make up a number.
|
||||
if (aMetrics.height == NS_UNCONSTRAINEDSIZE) {
|
||||
aMetrics.height = 0;
|
||||
aMetrics.height =
|
||||
(aReflowState.mComputedMinHeight != NS_UNCONSTRAINEDSIZE) ?
|
||||
aReflowState.mComputedMinHeight : 0;
|
||||
}
|
||||
|
||||
// XXXbz don't add in the border and padding, because we screw up our
|
||||
|
||||
@ -457,13 +457,17 @@ nsHTMLFrameOuterFrame::GetDesiredSize(nsIPresContext* aPresContext,
|
||||
aDesiredSize.width = aReflowState.mComputedWidth;
|
||||
}
|
||||
else {
|
||||
aDesiredSize.width = NSIntPixelsToTwips(300, p2t);
|
||||
aDesiredSize.width = PR_MIN(PR_MAX(NSIntPixelsToTwips(300, p2t),
|
||||
aReflowState.mComputedMinWidth),
|
||||
aReflowState.mComputedMaxWidth);
|
||||
}
|
||||
if (NS_UNCONSTRAINEDSIZE != aReflowState.mComputedHeight) {
|
||||
aDesiredSize.height = aReflowState.mComputedHeight;
|
||||
}
|
||||
else {
|
||||
aDesiredSize.height = NSIntPixelsToTwips(150, p2t);
|
||||
aDesiredSize.height = PR_MIN(PR_MAX(NSIntPixelsToTwips(150, p2t),
|
||||
aReflowState.mComputedMinHeight),
|
||||
aReflowState.mComputedMaxHeight);
|
||||
}
|
||||
aDesiredSize.ascent = aDesiredSize.height;
|
||||
aDesiredSize.descent = 0;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user