Bug 255584. Don't include areas above and to the left of the origin when we're trying to figure out the scrollable width and height --- we can't scroll to them! r+sr=dbaron

This commit is contained in:
roc+%cs.cmu.edu 2004-08-21 03:04:26 +00:00
Родитель a69f689eba
Коммит 1bd2f329e8
3 изменённых файлов: 17 добавлений и 7 удалений

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

@ -2132,11 +2132,14 @@ nsGfxScrollFrameInner::GetScrolledSize(nsPresContext* aPresContext,
mScrollAreaBox->GetChildBox(&child);
nsIFrame* frame;
child->GetFrame(&frame);
nsIView* view = frame->GetView();
NS_ASSERTION(view,"Scrolled frame must have a view!!!");
nsRect rect = view->GetBounds();
nsSize size(rect.width, rect.height);
// forget about the stuff above or to the left of the origin, since
// we can't currently scroll there anyway.
nsSize size(rect.XMost(), rect.YMost());
nsBox::AddMargin(child, size);
nsBox::AddBorderAndPadding(mScrollAreaBox, size);

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

@ -2132,11 +2132,14 @@ nsGfxScrollFrameInner::GetScrolledSize(nsPresContext* aPresContext,
mScrollAreaBox->GetChildBox(&child);
nsIFrame* frame;
child->GetFrame(&frame);
nsIView* view = frame->GetView();
NS_ASSERTION(view,"Scrolled frame must have a view!!!");
nsRect rect = view->GetBounds();
nsSize size(rect.width, rect.height);
// forget about the stuff above or to the left of the origin, since
// we can't currently scroll there anyway.
nsSize size(rect.XMost(), rect.YMost());
nsBox::AddMargin(child, size);
nsBox::AddBorderAndPadding(mScrollAreaBox, size);

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

@ -897,15 +897,19 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState,
// we will set the child's rect to include the overflow size.
if (mFrame->GetStateBits() & NS_FRAME_OUTSIDE_CHILDREN) {
// make sure we store the overflow size
mOverflow.width = aDesiredSize.mOverflowArea.width;
mOverflow.height = aDesiredSize.mOverflowArea.height;
// This kinda sucks. We should be able to handle the case
// where there's overflow above or to the left of the
// origin. But for now just chop that stuff off.
mOverflow.width = aDesiredSize.mOverflowArea.XMost();
mOverflow.height = aDesiredSize.mOverflowArea.YMost();
// include the overflow size in our child's rect?
if (mIncludeOverflow) {
//printf("OutsideChildren width=%d, height=%d\n", aDesiredSize.mOverflowArea.width, aDesiredSize.mOverflowArea.height);
aDesiredSize.width = aDesiredSize.mOverflowArea.width;
aDesiredSize.width = aDesiredSize.mOverflowArea.XMost();
if (aDesiredSize.width <= aWidth)
aDesiredSize.height = aDesiredSize.mOverflowArea.height;
aDesiredSize.height = aDesiredSize.mOverflowArea.YMost();
else {
if (aDesiredSize.width > aWidth)
{
@ -922,7 +926,7 @@ nsBoxToBlockAdaptor::Reflow(nsBoxLayoutState& aState,
mFrame->WillReflow(aPresContext);
mFrame->Reflow(aPresContext, aDesiredSize, reflowState, aStatus);
if (mFrame->GetStateBits() & NS_FRAME_OUTSIDE_CHILDREN)
aDesiredSize.height = aDesiredSize.mOverflowArea.height;
aDesiredSize.height = aDesiredSize.mOverflowArea.YMost();
}
}