Bug 522390. Fix percentage-height kids of scrollframes in quirks mode to deal with the height of the scrollframe becoming auto. r=dbaron

This commit is contained in:
Boris Zbarsky 2009-10-29 21:47:43 -04:00
parent d69d1afc18
commit c2173a710f
4 changed files with 41 additions and 13 deletions

View File

@ -0,0 +1,7 @@
<!DOCTYPE html>
<body>
<div id="a" style="overflow:auto; width:200px">
<div style="background: green; height:100%">
</div>
</div>
</body>

View File

@ -0,0 +1,7 @@
<!DOCTYPE html>
<body onload="document.getElementById('a').style.removeProperty('height');">
<div id="a" style="overflow:auto; height:200px; width:200px">
<div style="background: green; height:100%">
</div>
</div>
</body>

View File

@ -21,3 +21,4 @@
== hScrollSimpleMinHeightQuirks-3D.html greenboxhbar.html
== hScrollAbsMinHeightD.html greenboxhbar.html
== hScrollAbsMinHeightQuirksD.html greenboxhbar.html
== dynamicHeight100.html dynamicHeight100-ref.html

View File

@ -1103,28 +1103,41 @@ nsChangeHint nsStylePosition::CalcDifference(const nsStylePosition& aOther) cons
return NS_STYLE_HINT_REFLOW;
}
if (mBoxSizing != aOther.mBoxSizing) {
return nsChangeHint_ReflowFrame;
}
nsChangeHint heightHint = NS_STYLE_HINT_NONE;
if (mHeight != aOther.mHeight ||
mMinHeight != aOther.mMinHeight ||
mMaxHeight != aOther.mMaxHeight) {
// Height changes can't affect intrinsic widths, but due to our
// not-so-great computation of mVResize in nsHTMLReflowState, do need to
// force reflow of the whole subtree.
heightHint =
NS_CombineHint(nsChangeHint_NeedReflow, nsChangeHint_NeedDirtyReflow);
}
if ((mWidth == aOther.mWidth) &&
(mMinWidth == aOther.mMinWidth) &&
(mMaxWidth == aOther.mMaxWidth) &&
(mHeight == aOther.mHeight) &&
(mMinHeight == aOther.mMinHeight) &&
(mMaxHeight == aOther.mMaxHeight) &&
(mBoxSizing == aOther.mBoxSizing)) {
(mMaxWidth == aOther.mMaxWidth)) {
if (mOffset == aOther.mOffset) {
return NS_STYLE_HINT_NONE;
return heightHint;
} else {
// Offset changes only affect positioned content, and can't affect any
// intrinsic widths. They also don't need to force reflow of
// descendants.
return nsChangeHint_NeedReflow;
return NS_CombineHint(heightHint, nsChangeHint_NeedReflow);
}
}
// None of our differences can affect descendant intrinsic sizes and none of
// them need to force children to reflow.
return NS_SubtractHint(nsChangeHint_ReflowFrame,
NS_CombineHint(nsChangeHint_ClearDescendantIntrinsics,
nsChangeHint_NeedDirtyReflow));
// None of our width differences can affect descendant intrinsic
// sizes and none of them need to force children to reflow.
return
NS_CombineHint(heightHint,
NS_SubtractHint(nsChangeHint_ReflowFrame,
NS_CombineHint(nsChangeHint_ClearDescendantIntrinsics,
nsChangeHint_NeedDirtyReflow)));
}
#ifdef DEBUG