Bug 371536: Stop creating views for positioned elements. r+sr=roc.

This commit is contained in:
sharparrow1%yahoo.com 2007-02-26 14:00:21 +00:00
Родитель 07b930f839
Коммит e85eefee1d
4 изменённых файлов: 31 добавлений и 30 удалений

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

@ -9609,12 +9609,17 @@ DoApplyRenderingChangeToTree(nsIFrame* aFrame,
UpdateViewsForTree(aFrame, aViewManager, aFrameManager, invalidRect,
aChange);
// if frame has view, will already be invalidated
if (!aFrame->HasView()
&& (aChange & nsChangeHint_RepaintFrame)) {
// if frame has view, will already be invalidated
invalidRect -= aFrame->GetPosition();
aFrame->Invalidate(invalidRect, PR_FALSE);
if (aFrame->GetParent()) {
// Tell the parent to invalidate instead of the frame itself in case
// the child is clipping invalidates
aFrame->GetParent()->Invalidate(invalidRect);
} else {
invalidRect -= aFrame->GetPosition();
aFrame->Invalidate(invalidRect, PR_FALSE);
}
}
}
}

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

@ -703,7 +703,9 @@ nsFrameManager::RemoveFrame(nsIFrame* aParentFrame,
// a gap where the old frame was, we invalidate it here. (This is
// reasonably likely to happen when removing a last child in a way
// that doesn't change the size of the parent.)
aOldFrame->Invalidate(nsRect(nsPoint(0, 0), aOldFrame->GetSize()));
// This has to sure to invalidate the entire overflow rect; this
// is important in the presence of absolute positioning
aOldFrame->Invalidate(aOldFrame->GetOverflowRect());
return aParentFrame->RemoveFrame(aListName, aOldFrame);
}

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

@ -339,6 +339,12 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
AutoNoisyIndenter indent(nsBlockFrame::gNoisy);
#endif // DEBUG
// Store position and overflow rect so taht we can invalidate the correct
// area if the position changes
nsRect oldOverflowRect(aKidFrame->GetOverflowRect() +
aKidFrame->GetPosition());
nsRect oldRect = aKidFrame->GetRect();
nsresult rv;
// Get the border values
const nsMargin& border = aReflowState.mStyleBorder->GetBorder();
@ -373,12 +379,6 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
kidReflowState.mComputedOffsets.top +
kidReflowState.mComputedMargin.top));
// Position its view, but don't bother it doing it now if we haven't
// yet determined the left offset
if (NS_AUTOOFFSET != kidReflowState.mComputedOffsets.left) {
nsContainerFrame::PositionFrameView(aKidFrame);
}
// Do the reflow
rv = aKidFrame->Reflow(aPresContext, kidDesiredSize, kidReflowState, aStatus);
@ -416,7 +416,6 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
nsRect rect(border.left + kidReflowState.mComputedOffsets.left + kidReflowState.mComputedMargin.left,
border.top + kidReflowState.mComputedOffsets.top + kidReflowState.mComputedMargin.top,
kidDesiredSize.width, kidDesiredSize.height);
nsRect oldRect = aKidFrame->GetRect();
aKidFrame->SetRect(rect);
// Size and position the view and set its opacity, visibility, content
@ -424,15 +423,18 @@ nsAbsoluteContainingBlock::ReflowAbsoluteFrame(nsIFrame* aDelegat
nsContainerFrame::SyncFrameViewAfterReflow(aPresContext, aKidFrame,
aKidFrame->GetView(),
&kidDesiredSize.mOverflowArea);
// if the frame moved, then the view would have invalidated everything so
// we don't need to do any invalidation here.
if (oldRect.TopLeft() == rect.TopLeft() &&
!(aDelegatingFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW) &&
oldRect.Size() != rect.Size()) {
// Invalidate the area where the frame changed size. We can't
// rely on the view to do this ... the view size might not change even
// though the frame size changed (and besides, views will go away).
// Invalidate the vertical strip
if (oldRect.TopLeft() != rect.TopLeft() ||
(aDelegatingFrame->GetStateBits() & NS_FRAME_FIRST_REFLOW)) {
// The frame moved; we have to invalidate the whole frame
// because the children may have moved after they were reflowed
// XXX This could be optimized in some cases, like repositioning and
// clipping
aKidFrame->GetParent()->Invalidate(oldOverflowRect);
aKidFrame->GetParent()->Invalidate(kidDesiredSize.mOverflowArea +
rect.TopLeft());
} else if (oldRect.Size() != rect.Size()) {
// Invalidate the area where the frame changed size.
nscoord innerWidth = PR_MIN(oldRect.width, rect.width);
nscoord innerHeight = PR_MIN(oldRect.height, rect.height);
nscoord outerWidth = PR_MAX(oldRect.width, rect.width);

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

@ -630,15 +630,7 @@ nsContainerFrame::SyncFrameViewProperties(nsPresContext* aPresContext,
PRBool
nsContainerFrame::FrameNeedsView(nsIFrame* aFrame)
{
if (aFrame->NeedsView()) {
return PR_TRUE;
}
if (aFrame->GetStyleContext()->GetStyleDisplay()->IsPositioned()) {
return PR_TRUE;
}
return PR_FALSE;
return aFrame->NeedsView();
}
static nscoord GetCoord(const nsStyleCoord& aCoord, nscoord aIfNotCoord)