Bug 481024. Text control frame screws up max-width and max-height. r+sr=dbaron

This commit is contained in:
Boris Zbarsky 2009-04-27 14:18:37 -07:00
parent deec57be71
commit 6940b0930e
10 changed files with 61 additions and 14 deletions

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<div style="display: block; border: none; width: 200px; height: 200px; padding: 50px; background: green;"></div>
</body>
</html>

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<textarea style="display: block; border: none; width: 200px; height: 200px; padding: 50px; background: green"></textarea>
</body>
</html>

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<textarea style="display: block; border: none; width: 200px; height: 200px; padding: 50px; background: green; max-width: 200px;"></textarea>
</body>
</html>

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<textarea style="display: block; border: none; width: 200px; height: 200px; padding: 50px; background: green; max-height: 200px;"></textarea>
</body>
</html>

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<div style="display: block; border: none; width: 200px; height: 200px; padding: 50px; background: green; max-width: 200px;"></div>
</body>
</html>

View File

@ -0,0 +1,6 @@
<!DOCTYPE html>
<html>
<body>
<div style="display: block; border: none; width: 200px; height: 200px; padding: 50px; background: green; max-height: 200px"></div>
</body>
</html>

View File

@ -1190,6 +1190,11 @@ fails == 472020-2.xul 472020-2-ref.xul
== 480880-2a.html about:blank
== 480880-2b.html about:blank
== 480880-2c.html about:blank
== 481024-1a.html 481024-1-ref.html
== 481024-1b.html 481024-1-ref.html
== 481024-1c.html 481024-1-ref.html
== 481024-1d.html 481024-1-ref.html
== 481024-1e.html 481024-1-ref.html
!= 481948-1.html 481948-1-ref.html
!= 481948-2.html 481948-2-ref.html
fails-if(MOZ_WIDGET_TOOLKIT=="gtk2") == 481948-3.html 481948-3-ref.html # different behavior on Linux, see bug 488364

View File

@ -722,6 +722,7 @@ nsBoxFrame::Reflow(nsPresContext* aPresContext,
prefSize = GetPrefSize(state);
nsSize minSize = GetMinSize(state);
nsSize maxSize = GetMaxSize(state);
// XXXbz isn't GetPrefSize supposed to bounds-check for us?
prefSize = BoundsCheck(minSize, prefSize, maxSize);
}
@ -730,24 +731,26 @@ nsBoxFrame::Reflow(nsPresContext* aPresContext,
if (aReflowState.ComputedHeight() == NS_INTRINSICSIZE) {
computedSize.height = prefSize.height;
// prefSize is border-box, so we need to figure out the right
// length to apply our min/max constraints to.
nscoord outsideBoxSizing = 0;
switch (GetStylePosition()->mBoxSizing) {
case NS_STYLE_BOX_SIZING_CONTENT:
outsideBoxSizing = aReflowState.mComputedBorderPadding.TopBottom();
// fall through
case NS_STYLE_BOX_SIZING_PADDING:
outsideBoxSizing -= aReflowState.mComputedPadding.TopBottom();
break;
}
computedSize.height -= outsideBoxSizing;
// Note: might be negative now, but that's OK because min-width is
// never negative.
aReflowState.ApplyMinMaxConstraints(nsnull, &computedSize.height);
computedSize.height += outsideBoxSizing;
} else {
computedSize.height += m.top + m.bottom;
}
// handle reflow state min and max sizes
if (computedSize.width > aReflowState.mComputedMaxWidth)
computedSize.width = aReflowState.mComputedMaxWidth;
if (computedSize.height > aReflowState.mComputedMaxHeight)
computedSize.height = aReflowState.mComputedMaxHeight;
if (computedSize.width < aReflowState.mComputedMinWidth)
computedSize.width = aReflowState.mComputedMinWidth;
if (computedSize.height < aReflowState.mComputedMinHeight)
computedSize.height = aReflowState.mComputedMinHeight;
nsRect r(mRect.x, mRect.y, computedSize.width, computedSize.height);
SetBounds(state, r);

View File

@ -5,11 +5,13 @@ html|*.textbox-input {
-moz-appearance: none !important;
text-align: inherit;
text-shadow: inherit;
-moz-box-sizing: border-box;
}
html|*.textbox-textarea {
-moz-appearance: none !important;
text-shadow: inherit;
-moz-box-sizing: border-box;
}
textbox[isempty="true"] html|*.textbox-input ,

View File

@ -14,6 +14,7 @@
-moz-user-focus: ignore;
-moz-user-select: -moz-none;
display: -moz-box;
-moz-box-sizing: border-box;
}
:root {