Bug 170330. Factor out overflowArea calculations and take into account overflow:hidden. Also improve calculations of clipping for invalidation in the view manager. r+sr=dbaron

git-svn-id: svn://10.0.0.236/trunk@135555 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
roc+%cs.cmu.edu
2002-12-21 23:25:38 +00:00
parent 49642c7b2f
commit b997358c68
14 changed files with 207 additions and 157 deletions

View File

@@ -1258,16 +1258,11 @@ nsLineLayout::ReflowFrame(nsIFrame* aFrame,
nsIView* view;
aFrame->GetView(mPresContext, &view);
if (view) {
nsIViewManager *vm;
view->GetViewManager(vm);
nsCOMPtr<nsIViewManager> vm;
view->GetViewManager(*getter_AddRefs(vm));
#if 0 // XXX This is the correct code. We'll turn it on later to mitigate risk.
vm->ResizeView(view, pfd->mCombinedArea);
#else // imitate the old, wrong code
nsRect r(0, 0, metrics.width, metrics.height);
vm->ResizeView(view, r);
#endif
NS_RELEASE(vm);
nsContainerFrame::SyncFrameViewAfterSizeChange(mPresContext, pfd->mFrame, nsnull, view);
}
// Tell the frame that we're done reflowing it
@@ -3323,20 +3318,26 @@ nsLineLayout::RelativePositionFrames(PerSpanData* psd, nsRect& aCombinedArea)
}
// If we just computed a spans combined area, we need to update its
// NS_FRAME_OUTSIDE_CHILDREN bit..
// NS_FRAME_OUTSIDE_CHILDREN bit. We also may need to take into account
// an outline.
if (nsnull != psd->mFrame) {
pfd = psd->mFrame;
nsIFrame* frame = pfd->mFrame;
nsFrameState oldState;
frame->GetFrameState(&oldState);
nsFrameState newState = oldState & ~NS_FRAME_OUTSIDE_CHILDREN;
if ((minX < 0) || (minY < 0) ||
(maxX > pfd->mBounds.width) || (maxY > pfd->mBounds.height)) {
newState |= NS_FRAME_OUTSIDE_CHILDREN;
}
if (newState != oldState) {
frame->SetFrameState(newState);
}
// We're conservative here; the combined area for this span/frame
// is the union of the area that the frame computed during reflow
// and the area that we computed for it here in RelativePositionFrames.
// We do this because relatively positioned frames that are also spans
// have two contributors to the overflow area: overflowing inline children
// and overflowing absolute children.
// This could be larger than necessary if inline alignment caused an inline child
// to overflow less, because its old overflow would still be counted in
// pfd->mCombinedArea.
// But in practice it's OK to have an overflow area that's larger than necessary.
// (Although if it happens too often it could become a paint performance issue).
nsRect children;
children.UnionRect(pfd->mCombinedArea, aCombinedArea);
NS_STATIC_CAST(nsFrame*, frame)->ComputeOverflowArea(aCombinedArea, children);
}
}