Bug 289431. Don't include overflow from children in frames that are overflow:-moz-hidden-unscrollable. r+sr=bzbarsky,a=brendan

This commit is contained in:
roc+%cs.cmu.edu 2005-04-11 22:03:23 +00:00
Родитель 98d2ea1e3c
Коммит 0a0d19cb3f
3 изменённых файлов: 26 добавлений и 6 удалений

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

@ -4353,14 +4353,24 @@ nsIFrame::FinishAndStoreOverflow(nsRect* aOverflowArea, nsSize aNewSize)
aOverflowArea->Contains(nsRect(nsPoint(0, 0), aNewSize)), aOverflowArea->Contains(nsRect(nsPoint(0, 0), aNewSize)),
"Computed overflow area must contain frame bounds"); "Computed overflow area must contain frame bounds");
PRBool geometricOverflow =
aOverflowArea->x < 0 || aOverflowArea->y < 0 ||
aOverflowArea->XMost() > aNewSize.width || aOverflowArea->YMost() > aNewSize.height;
// Clear geometric overflow area if we clip our children
NS_ASSERTION((GetStyleDisplay()->mOverflowY == NS_STYLE_OVERFLOW_CLIP) ==
(GetStyleDisplay()->mOverflowX == NS_STYLE_OVERFLOW_CLIP),
"If one overflow is clip, the other should be too");
if (geometricOverflow &&
GetStyleDisplay()->mOverflowX == NS_STYLE_OVERFLOW_CLIP) {
*aOverflowArea = nsRect(nsPoint(0, 0), aNewSize);
geometricOverflow = PR_FALSE;
}
PRBool hasOutline; PRBool hasOutline;
nsRect outlineRect(ComputeOutlineRect(this, &hasOutline, *aOverflowArea)); nsRect outlineRect(ComputeOutlineRect(this, &hasOutline, *aOverflowArea));
if (hasOutline || if (hasOutline || geometricOverflow) {
(aOverflowArea->x < 0) || // Throw out any overflow if we're -moz-hidden-unscrollable
(aOverflowArea->y < 0) ||
(aOverflowArea->XMost() > aNewSize.width) ||
(aOverflowArea->YMost() > aNewSize.height)) {
mState |= NS_FRAME_OUTSIDE_CHILDREN; mState |= NS_FRAME_OUTSIDE_CHILDREN;
nsRect* overflowArea = GetOverflowAreaProperty(PR_TRUE); nsRect* overflowArea = GetOverflowAreaProperty(PR_TRUE);
NS_ASSERTION(overflowArea, "should have created rect"); NS_ASSERTION(overflowArea, "should have created rect");

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

@ -804,6 +804,16 @@ nsIFrame::Layout(nsBoxLayoutState& aState)
return NS_OK; return NS_OK;
} }
PRBool
nsBox::DoesClipChildren()
{
const nsStyleDisplay* display = GetStyleDisplay();
NS_ASSERTION((display->mOverflowY == NS_STYLE_OVERFLOW_CLIP) ==
(display->mOverflowX == NS_STYLE_OVERFLOW_CLIP),
"If one overflow is clip, the other should be too");
return display->mOverflowX == NS_STYLE_OVERFLOW_CLIP;
}
nsresult nsresult
nsBox::SyncLayout(nsBoxLayoutState& aState) nsBox::SyncLayout(nsBoxLayoutState& aState)
{ {

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

@ -110,7 +110,7 @@ public:
* Returns PR_TRUE if this box clips its children, e.g., if this box is an sc * Returns PR_TRUE if this box clips its children, e.g., if this box is an sc
rollbox. rollbox.
*/ */
virtual PRBool DoesClipChildren() { return PR_FALSE; } virtual PRBool DoesClipChildren();
virtual PRBool ComputesOwnOverflowArea() = 0; virtual PRBool ComputesOwnOverflowArea() = 0;
NS_HIDDEN_(nsresult) SyncLayout(nsBoxLayoutState& aBoxLayoutState); NS_HIDDEN_(nsresult) SyncLayout(nsBoxLayoutState& aBoxLayoutState);