Not all scrollable children of the viewport are the root scrollframe. Fix

semi-hangs when fixed-pos elements have non-visible overflow.  Bug 295292,
r+sr=roc, a=chofmann
This commit is contained in:
bzbarsky%mit.edu 2005-05-31 18:30:27 +00:00
parent 16b9f82412
commit a3843ab96f
2 changed files with 22 additions and 13 deletions

View File

@ -1553,7 +1553,7 @@ nsGfxScrollFrameInner::CreateAnonymousContent(nsISupportsArray& aAnonymousChildr
if (presContext->IsPaginated()) {
// allow scrollbars if this is the child of the viewport, because
// we must be the scrollbars for the print preview window
if (!parent || parent->GetType() != nsLayoutAtoms::viewportFrame) {
if (!OuterIsRootScrollframe()) {
mNeverHasVerticalScrollbar = mNeverHasHorizontalScrollbar = PR_TRUE;
return;
}
@ -2348,19 +2348,16 @@ nsGfxScrollFrameInner::LayoutScrollbars(nsBoxLayoutState& aState,
// (if the reflow is initial or resize, the fixed children will
// be re-laid out anyway)
if (aOldScrollArea.Size() != aScrollArea.Size()
&& nsBoxLayoutState::Dirty == aState.LayoutReason()) {
&& nsBoxLayoutState::Dirty == aState.LayoutReason() &&
OuterIsRootScrollframe()) {
// Usually there are no fixed children, so don't do anything unless there's
// at least one fixed child
nsIFrame* parentFrame = mOuter->GetParent();
if (parentFrame) {
if (parentFrame->GetType() == nsLayoutAtoms::viewportFrame) {
// Usually there are no fixed children, so don't do anything unless there's
// at least one fixed child
if (parentFrame->GetFirstChild(nsLayoutAtoms::fixedList)) {
// force a reflow of the fixed children
mOuter->GetPresContext()->PresShell()->
AppendReflowCommand(parentFrame, eReflowType_UserDefined,
nsLayoutAtoms::fixedList);
}
}
if (parentFrame->GetFirstChild(nsLayoutAtoms::fixedList)) {
// force a reflow of the fixed children
mOuter->GetPresContext()->PresShell()->
AppendReflowCommand(parentFrame, eReflowType_UserDefined,
nsLayoutAtoms::fixedList);
}
}
}
@ -2444,6 +2441,14 @@ nsGfxScrollFrameInner::SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisibl
}
}
PRBool
nsGfxScrollFrameInner::OuterIsRootScrollframe()
{
nsIFrame* parent = mOuter->GetParent();
return parent && parent->GetType() == nsLayoutAtoms::viewportFrame &&
parent->GetFirstChild(nsnull) == mOuter;
}
PRInt32
nsGfxScrollFrameInner::GetIntegerAttribute(nsIBox* aBox, nsIAtom* atom, PRInt32 defaultValue)
{

View File

@ -120,6 +120,10 @@ public:
static void SetScrollbarVisibility(nsIBox* aScrollbar, PRBool aVisible);
// Return true if mOuter is the root scrollframe (that is, the
// unique in-flow child of the viewport).
PRBool OuterIsRootScrollframe();
nsSize GetScrolledSize() const;
nsMargin GetActualScrollbarSizes() const;
nsMargin GetDesiredScrollbarSizes(nsBoxLayoutState* aState);