Bug 579258. Remove the 'before move' region parameter to ComputeVisibility. r=tnikkel,a=joe

This commit is contained in:
Robert O'Callahan 2010-08-13 21:55:54 +12:00
parent b004c93cb1
commit 0b542b46ed
10 changed files with 48 additions and 196 deletions

View File

@ -70,7 +70,6 @@ using namespace mozilla::layers;
nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame, nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
PRBool aIsForEvents, PRBool aBuildCaret) PRBool aIsForEvents, PRBool aBuildCaret)
: mReferenceFrame(aReferenceFrame), : mReferenceFrame(aReferenceFrame),
mMovingFrame(nsnull),
mIgnoreScrollFrame(nsnull), mIgnoreScrollFrame(nsnull),
mCurrentTableItem(nsnull), mCurrentTableItem(nsnull),
mBuildCaret(aBuildCaret), mBuildCaret(aBuildCaret),
@ -179,13 +178,6 @@ nsDisplayListBuilder::SubtractFromVisibleRegion(nsRegion* aVisibleRegion,
} }
} }
PRBool
nsDisplayListBuilder::IsMovingFrame(nsIFrame* aFrame)
{
return mMovingFrame &&
nsLayoutUtils::IsAncestorFrameCrossDoc(mMovingFrame, aFrame, mReferenceFrame);
}
nsCaret * nsCaret *
nsDisplayListBuilder::GetCaret() { nsDisplayListBuilder::GetCaret() {
nsRefPtr<nsCaret> caret = CurrentPresShellState()->mPresShell->GetCaret(); nsRefPtr<nsCaret> caret = CurrentPresShellState()->mPresShell->GetCaret();
@ -296,10 +288,7 @@ nsDisplayList::GetBounds(nsDisplayListBuilder* aBuilder) const {
PRBool PRBool
nsDisplayList::ComputeVisibility(nsDisplayListBuilder* aBuilder, nsDisplayList::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion) {
nsRegion* aVisibleRegionBeforeMove) {
NS_ASSERTION(!aVisibleRegionBeforeMove, "Not supported anymore");
mVisibleRect = aVisibleRegion->GetBounds(); mVisibleRect = aVisibleRegion->GetBounds();
PRBool anyVisible = PR_FALSE; PRBool anyVisible = PR_FALSE;
@ -322,7 +311,7 @@ nsDisplayList::ComputeVisibility(nsDisplayListBuilder* aBuilder,
itemVisible.And(*aVisibleRegion, bounds); itemVisible.And(*aVisibleRegion, bounds);
item->mVisibleRect = itemVisible.GetBounds(); item->mVisibleRect = itemVisible.GetBounds();
if (item->ComputeVisibility(aBuilder, aVisibleRegion, aVisibleRegionBeforeMove)) { if (item->ComputeVisibility(aBuilder, aVisibleRegion)) {
anyVisible = PR_TRUE; anyVisible = PR_TRUE;
nsIFrame* f = item->GetUnderlyingFrame(); nsIFrame* f = item->GetUnderlyingFrame();
if (item->IsOpaque(aBuilder) && f) { if (item->IsOpaque(aBuilder) && f) {
@ -592,7 +581,7 @@ PRBool nsDisplayItem::RecomputeVisibility(nsDisplayListBuilder* aBuilder,
itemVisible.And(*aVisibleRegion, bounds); itemVisible.And(*aVisibleRegion, bounds);
mVisibleRect = itemVisible.GetBounds(); mVisibleRect = itemVisible.GetBounds();
if (!ComputeVisibility(aBuilder, aVisibleRegion, nsnull)) if (!ComputeVisibility(aBuilder, aVisibleRegion))
return PR_FALSE; return PR_FALSE;
if (IsOpaque(aBuilder)) { if (IsOpaque(aBuilder)) {
@ -682,11 +671,9 @@ static PRBool RoundedRectContainsRect(const nsRect& aRoundedRect,
PRBool PRBool
nsDisplayBackground::ComputeVisibility(nsDisplayListBuilder* aBuilder, nsDisplayBackground::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion)
nsRegion* aVisibleRegionBeforeMove)
{ {
if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion, if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion))
aVisibleRegionBeforeMove))
return PR_FALSE; return PR_FALSE;
// Return false if the background was propagated away from this // Return false if the background was propagated away from this
@ -859,19 +846,13 @@ nsDisplayOutline::Paint(nsDisplayListBuilder* aBuilder,
PRBool PRBool
nsDisplayOutline::ComputeVisibility(nsDisplayListBuilder* aBuilder, nsDisplayOutline::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion) {
nsRegion* aVisibleRegionBeforeMove) { if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion))
NS_ASSERTION(!aVisibleRegionBeforeMove, "not supported anymore");
if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion,
aVisibleRegionBeforeMove))
return PR_FALSE; return PR_FALSE;
const nsStyleOutline* outline = mFrame->GetStyleOutline(); const nsStyleOutline* outline = mFrame->GetStyleOutline();
nsRect borderBox(aBuilder->ToReferenceFrame(mFrame), mFrame->GetSize()); nsRect borderBox(aBuilder->ToReferenceFrame(mFrame), mFrame->GetSize());
if (borderBox.Contains(aVisibleRegion->GetBounds()) && if (borderBox.Contains(aVisibleRegion->GetBounds()) &&
(!aVisibleRegionBeforeMove ||
borderBox.Contains(aVisibleRegionBeforeMove->GetBounds())) &&
!nsLayoutUtils::HasNonZeroCorner(outline->mOutlineRadius)) { !nsLayoutUtils::HasNonZeroCorner(outline->mOutlineRadius)) {
if (outline->mOutlineOffset >= 0) { if (outline->mOutlineOffset >= 0) {
// the visible region is entirely inside the border-rect, and the outline // the visible region is entirely inside the border-rect, and the outline
@ -893,20 +874,14 @@ nsDisplayCaret::Paint(nsDisplayListBuilder* aBuilder,
PRBool PRBool
nsDisplayBorder::ComputeVisibility(nsDisplayListBuilder* aBuilder, nsDisplayBorder::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion) {
nsRegion* aVisibleRegionBeforeMove) { if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion))
NS_ASSERTION(!aVisibleRegionBeforeMove, "not supported anymore");
if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion,
aVisibleRegionBeforeMove))
return PR_FALSE; return PR_FALSE;
nsRect paddingRect = mFrame->GetPaddingRect() - mFrame->GetPosition() + nsRect paddingRect = mFrame->GetPaddingRect() - mFrame->GetPosition() +
aBuilder->ToReferenceFrame(mFrame); aBuilder->ToReferenceFrame(mFrame);
const nsStyleBorder *styleBorder; const nsStyleBorder *styleBorder;
if (paddingRect.Contains(aVisibleRegion->GetBounds()) && if (paddingRect.Contains(aVisibleRegion->GetBounds()) &&
(!aVisibleRegionBeforeMove ||
paddingRect.Contains(aVisibleRegionBeforeMove->GetBounds())) &&
!(styleBorder = mFrame->GetStyleBorder())->IsBorderImageLoaded() && !(styleBorder = mFrame->GetStyleBorder())->IsBorderImageLoaded() &&
!nsLayoutUtils::HasNonZeroCorner(styleBorder->mBorderRadius)) { !nsLayoutUtils::HasNonZeroCorner(styleBorder->mBorderRadius)) {
// the visible region is entirely inside the content rect, and no part // the visible region is entirely inside the content rect, and no part
@ -988,12 +963,8 @@ nsDisplayBoxShadowOuter::GetBounds(nsDisplayListBuilder* aBuilder) {
PRBool PRBool
nsDisplayBoxShadowOuter::ComputeVisibility(nsDisplayListBuilder* aBuilder, nsDisplayBoxShadowOuter::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion) {
nsRegion* aVisibleRegionBeforeMove) { if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion))
NS_ASSERTION(!aVisibleRegionBeforeMove, "not supported anymore");
if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion,
aVisibleRegionBeforeMove))
return PR_FALSE; return PR_FALSE;
// Store the actual visible region // Store the actual visible region
@ -1001,9 +972,6 @@ nsDisplayBoxShadowOuter::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsPoint origin = aBuilder->ToReferenceFrame(mFrame); nsPoint origin = aBuilder->ToReferenceFrame(mFrame);
nsRect visibleBounds = aVisibleRegion->GetBounds(); nsRect visibleBounds = aVisibleRegion->GetBounds();
if (aVisibleRegionBeforeMove) {
visibleBounds.UnionRect(visibleBounds, aVisibleRegionBeforeMove->GetBounds());
}
nsRect frameRect(origin, mFrame->GetSize()); nsRect frameRect(origin, mFrame->GetSize());
if (!frameRect.Contains(visibleBounds)) if (!frameRect.Contains(visibleBounds))
return PR_TRUE; return PR_TRUE;
@ -1041,12 +1009,8 @@ nsDisplayBoxShadowInner::Paint(nsDisplayListBuilder* aBuilder,
PRBool PRBool
nsDisplayBoxShadowInner::ComputeVisibility(nsDisplayListBuilder* aBuilder, nsDisplayBoxShadowInner::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion) {
nsRegion* aVisibleRegionBeforeMove) { if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion))
NS_ASSERTION(!aVisibleRegionBeforeMove, "not supported anymore");
if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion,
aVisibleRegionBeforeMove))
return PR_FALSE; return PR_FALSE;
// Store the actual visible region // Store the actual visible region
@ -1081,9 +1045,8 @@ nsDisplayWrapList::GetBounds(nsDisplayListBuilder* aBuilder) {
PRBool PRBool
nsDisplayWrapList::ComputeVisibility(nsDisplayListBuilder* aBuilder, nsDisplayWrapList::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion) {
nsRegion* aVisibleRegionBeforeMove) { return mList.ComputeVisibility(aBuilder, aVisibleRegion);
return mList.ComputeVisibility(aBuilder, aVisibleRegion, aVisibleRegionBeforeMove);
} }
PRBool PRBool
@ -1138,7 +1101,7 @@ PRBool nsDisplayWrapList::ChildrenCanBeInactive(nsDisplayListBuilder* aBuilder,
static nsresult static nsresult
WrapDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame, WrapDisplayList(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame,
nsDisplayList* aList, nsDisplayWrapper* aWrapper) { nsDisplayList* aList, nsDisplayWrapper* aWrapper) {
if (!aList->GetTop() && !aBuilder->HasMovingFrames()) if (!aList->GetTop())
return NS_OK; return NS_OK;
nsDisplayItem* item = aWrapper->WrapList(aBuilder, aFrame, aList); nsDisplayItem* item = aWrapper->WrapList(aBuilder, aFrame, aList);
if (!item) if (!item)
@ -1248,10 +1211,7 @@ nsDisplayOpacity::GetLayerState(nsDisplayListBuilder* aBuilder,
} }
PRBool nsDisplayOpacity::ComputeVisibility(nsDisplayListBuilder* aBuilder, PRBool nsDisplayOpacity::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion) {
nsRegion* aVisibleRegionBeforeMove) {
NS_ASSERTION(!aVisibleRegionBeforeMove, "not supported anymore");
// Our children are translucent so we should not allow them to subtract // Our children are translucent so we should not allow them to subtract
// area from aVisibleRegion. We do need to find out what is visible under // area from aVisibleRegion. We do need to find out what is visible under
// our children in the temporary compositing buffer, because if our children // our children in the temporary compositing buffer, because if our children
@ -1260,13 +1220,8 @@ PRBool nsDisplayOpacity::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRect bounds = GetBounds(aBuilder); nsRect bounds = GetBounds(aBuilder);
nsRegion visibleUnderChildren; nsRegion visibleUnderChildren;
visibleUnderChildren.And(*aVisibleRegion, bounds); visibleUnderChildren.And(*aVisibleRegion, bounds);
nsRegion visibleUnderChildrenBeforeMove;
if (aVisibleRegionBeforeMove) {
visibleUnderChildrenBeforeMove.And(*aVisibleRegionBeforeMove, bounds);
}
return return
nsDisplayWrapList::ComputeVisibility(aBuilder, &visibleUnderChildren, nsDisplayWrapList::ComputeVisibility(aBuilder, &visibleUnderChildren);
aVisibleRegionBeforeMove ? &visibleUnderChildrenBeforeMove : nsnull);
} }
PRBool nsDisplayOpacity::TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) { PRBool nsDisplayOpacity::TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) {
@ -1333,19 +1288,13 @@ void nsDisplayClip::Paint(nsDisplayListBuilder* aBuilder,
} }
PRBool nsDisplayClip::ComputeVisibility(nsDisplayListBuilder* aBuilder, PRBool nsDisplayClip::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion) {
nsRegion* aVisibleRegionBeforeMove) {
NS_ASSERTION(!aVisibleRegionBeforeMove, "not supported anymore");
nsRegion clipped; nsRegion clipped;
clipped.And(*aVisibleRegion, mClip); clipped.And(*aVisibleRegion, mClip);
nsRegion clippedBeforeMove;
nsRegion finalClipped(clipped); nsRegion finalClipped(clipped);
nsRegion finalClippedBeforeMove(clippedBeforeMove);
PRBool anyVisible = PRBool anyVisible =
nsDisplayWrapList::ComputeVisibility(aBuilder, &finalClipped, nsDisplayWrapList::ComputeVisibility(aBuilder, &finalClipped);
aVisibleRegionBeforeMove ? &finalClippedBeforeMove : nsnull);
nsRegion removed; nsRegion removed;
removed.Sub(clipped, finalClipped); removed.Sub(clipped, finalClipped);
@ -1413,23 +1362,15 @@ void nsDisplayZoom::Paint(nsDisplayListBuilder* aBuilder,
} }
PRBool nsDisplayZoom::ComputeVisibility(nsDisplayListBuilder *aBuilder, PRBool nsDisplayZoom::ComputeVisibility(nsDisplayListBuilder *aBuilder,
nsRegion *aVisibleRegion, nsRegion *aVisibleRegion)
nsRegion *aVisibleRegionBeforeMove)
{ {
NS_ASSERTION((aVisibleRegionBeforeMove != nsnull) ==
aBuilder->HasMovingFrames(),
"Should have aVisibleRegionBeforeMove when there are moving "
"frames");
NS_ASSERTION(aVisibleRegionBeforeMove == nsnull,
"we don't support scroll analysis with zoom");
// Convert the passed in visible region to our appunits. // Convert the passed in visible region to our appunits.
nsRegion visibleRegion = nsRegion visibleRegion =
aVisibleRegion->ConvertAppUnitsRoundOut(mParentAPD, mAPD); aVisibleRegion->ConvertAppUnitsRoundOut(mParentAPD, mAPD);
nsRegion originalVisibleRegion = visibleRegion; nsRegion originalVisibleRegion = visibleRegion;
PRBool retval = PRBool retval =
nsDisplayWrapList::ComputeVisibility(aBuilder, &visibleRegion, nsnull); nsDisplayWrapList::ComputeVisibility(aBuilder, &visibleRegion);
nsRegion removed; nsRegion removed;
// removed = originalVisibleRegion - visibleRegion // removed = originalVisibleRegion - visibleRegion
@ -1621,27 +1562,15 @@ nsDisplayTransform::GetLayerState(nsDisplayListBuilder* aBuilder,
} }
PRBool nsDisplayTransform::ComputeVisibility(nsDisplayListBuilder *aBuilder, PRBool nsDisplayTransform::ComputeVisibility(nsDisplayListBuilder *aBuilder,
nsRegion *aVisibleRegion, nsRegion *aVisibleRegion)
nsRegion *aVisibleRegionBeforeMove)
{ {
NS_ASSERTION(!aVisibleRegionBeforeMove, "not supported anymore");
/* As we do this, we need to be sure to /* As we do this, we need to be sure to
* untransform the visible rect, since we want everything that's painting to * untransform the visible rect, since we want everything that's painting to
* think that it's painting in its original rectangular coordinate space. */ * think that it's painting in its original rectangular coordinate space. */
nsRegion untransformedVisible = nsRegion untransformedVisible =
UntransformRect(mVisibleRect, mFrame, aBuilder->ToReferenceFrame(mFrame)); UntransformRect(mVisibleRect, mFrame, aBuilder->ToReferenceFrame(mFrame));
nsRegion untransformedVisibleBeforeMove; mStoredList.ComputeVisibility(aBuilder, &untransformedVisible);
if (aVisibleRegionBeforeMove) {
// mVisibleRect contains areas visible before and after the move, so it's
// OK (although conservative) to just use the same regions here.
untransformedVisibleBeforeMove = untransformedVisible;
}
mStoredList.ComputeVisibility(aBuilder, &untransformedVisible,
aVisibleRegionBeforeMove
? &untransformedVisibleBeforeMove
: nsnull);
return PR_TRUE; return PR_TRUE;
} }
@ -1888,10 +1817,7 @@ void nsDisplaySVGEffects::Paint(nsDisplayListBuilder* aBuilder,
} }
PRBool nsDisplaySVGEffects::ComputeVisibility(nsDisplayListBuilder* aBuilder, PRBool nsDisplaySVGEffects::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion) {
nsRegion* aVisibleRegionBeforeMove) {
NS_ASSERTION(!aVisibleRegionBeforeMove, "not supported anymore");
nsPoint offset = aBuilder->ToReferenceFrame(mEffectsFrame); nsPoint offset = aBuilder->ToReferenceFrame(mEffectsFrame);
nsRect dirtyRect = nsRect dirtyRect =
nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(mEffectsFrame, nsSVGIntegrationUtils::GetRequiredSourceForInvalidArea(mEffectsFrame,
@ -1901,11 +1827,7 @@ PRBool nsDisplaySVGEffects::ComputeVisibility(nsDisplayListBuilder* aBuilder,
// Our children may be made translucent or arbitrarily deformed so we should // Our children may be made translucent or arbitrarily deformed so we should
// not allow them to subtract area from aVisibleRegion. // not allow them to subtract area from aVisibleRegion.
nsRegion childrenVisible(dirtyRect); nsRegion childrenVisible(dirtyRect);
// mVisibleRect contains areas visible before and after the move, so it's nsDisplayWrapList::ComputeVisibility(aBuilder, &childrenVisible);
// OK (although conservative) to just use the same regions here.
nsRegion childrenVisibleBeforeMove(dirtyRect);
nsDisplayWrapList::ComputeVisibility(aBuilder, &childrenVisible,
aVisibleRegionBeforeMove ? &childrenVisibleBeforeMove : nsnull);
return PR_TRUE; return PR_TRUE;
} }

View File

@ -163,35 +163,6 @@ public:
*/ */
PRBool IsAtRootOfPseudoStackingContext() { return mIsAtRootOfPseudoStackingContext; } PRBool IsAtRootOfPseudoStackingContext() { return mIsAtRootOfPseudoStackingContext; }
/**
* Indicate that we'll use this display list to analyze the effects
* of aMovingFrame moving by aMoveDelta. The move has already been
* applied to the frame tree. Moving frames are not allowed to clip or
* cover (during ComputeVisibility) non-moving frames. E.g. when we're
* constructing a display list to see what should be repainted during a
* scroll operation, we specify the scrolled frame as the moving frame.
* @param aSaveVisibleRegionOfMovingContent if non-null,
* this receives a bounding region for the visible moving content
* (considering the moving content both before and after the move)
*/
void SetMovingFrame(nsIFrame* aMovingFrame) {
mMovingFrame = aMovingFrame;
}
/**
* @return PR_TRUE if we are doing analysis of moving frames
*/
PRBool HasMovingFrames() { return mMovingFrame != nsnull; }
/**
* @return the frame that was moved
*/
nsIFrame* GetRootMovingFrame() { return mMovingFrame; }
/**
* @return PR_TRUE if aFrame is, or is a descendant of, the hypothetical
* moving frame
*/
PRBool IsMovingFrame(nsIFrame* aFrame);
/** /**
* @return the selection that painting should be restricted to (or nsnull * @return the selection that painting should be restricted to (or nsnull
* in the normal unrestricted case) * in the normal unrestricted case)
@ -406,7 +377,6 @@ private:
FrameLayerBuilder mLayerBuilder; FrameLayerBuilder mLayerBuilder;
nsIFrame* mReferenceFrame; nsIFrame* mReferenceFrame;
nsIFrame* mMovingFrame;
nsIFrame* mIgnoreScrollFrame; nsIFrame* mIgnoreScrollFrame;
PLArenaPool mPool; PLArenaPool mPool;
nsCOMPtr<nsISelection> mBoundingSelection; nsCOMPtr<nsISelection> mBoundingSelection;
@ -605,10 +575,6 @@ public:
* On entry, aVisibleRegion contains the region (relative to ReferenceFrame()) * On entry, aVisibleRegion contains the region (relative to ReferenceFrame())
* which may be visible. If the display item opaquely covers an area, it * which may be visible. If the display item opaquely covers an area, it
* can remove that area from aVisibleRegion before returning. * can remove that area from aVisibleRegion before returning.
* If we're doing scroll analysis with moving frames, then
* aVisibleRegionBeforeMove will be non-null and contains the region that
* would have been visible before the move. aVisibleRegion contains the
* region that is visible after the move.
* nsDisplayList::ComputeVisibility automatically subtracts the bounds * nsDisplayList::ComputeVisibility automatically subtracts the bounds
* of items that return true from IsOpaque(), and automatically * of items that return true from IsOpaque(), and automatically
* removes items whose bounds do not intersect the visible area, * removes items whose bounds do not intersect the visible area,
@ -622,8 +588,7 @@ public:
* is visible * is visible
*/ */
virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion)
nsRegion* aVisibleRegionBeforeMove)
{ return !mVisibleRect.IsEmpty(); } { return !mVisibleRect.IsEmpty(); }
/** /**
@ -873,8 +838,7 @@ public:
* @return true if any item in the list is visible * @return true if any item in the list is visible
*/ */
PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion);
nsRegion* aVisibleRegionBeforeMove);
/** /**
* Returns true if the visible region output from ComputeVisiblity was * Returns true if the visible region output from ComputeVisiblity was
* empty, i.e. everything visible in this list is opaque. * empty, i.e. everything visible in this list is opaque.
@ -1239,8 +1203,7 @@ public:
virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx); virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion);
nsRegion* aVisibleRegionBeforeMove);
NS_DISPLAY_DECL_NAME("Border", TYPE_BORDER) NS_DISPLAY_DECL_NAME("Border", TYPE_BORDER)
}; };
@ -1306,8 +1269,7 @@ public:
aOutFrames->AppendElement(mFrame); aOutFrames->AppendElement(mFrame);
} }
virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion);
nsRegion* aVisibleRegionBeforeMove);
virtual PRBool IsOpaque(nsDisplayListBuilder* aBuilder); virtual PRBool IsOpaque(nsDisplayListBuilder* aBuilder);
virtual PRBool IsVaryingRelativeToMovingFrame(nsDisplayListBuilder* aBuilder, virtual PRBool IsVaryingRelativeToMovingFrame(nsDisplayListBuilder* aBuilder,
nsIFrame* aFrame); nsIFrame* aFrame);
@ -1339,8 +1301,7 @@ public:
virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx); virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder); virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion);
nsRegion* aVisibleRegionBeforeMove);
NS_DISPLAY_DECL_NAME("BoxShadowOuter", TYPE_BOX_SHADOW_OUTER) NS_DISPLAY_DECL_NAME("BoxShadowOuter", TYPE_BOX_SHADOW_OUTER)
private: private:
@ -1363,8 +1324,7 @@ public:
virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx); virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion);
nsRegion* aVisibleRegionBeforeMove);
NS_DISPLAY_DECL_NAME("BoxShadowInner", TYPE_BOX_SHADOW_INNER) NS_DISPLAY_DECL_NAME("BoxShadowInner", TYPE_BOX_SHADOW_INNER)
private: private:
@ -1388,8 +1348,7 @@ public:
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder); virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx); virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion);
nsRegion* aVisibleRegionBeforeMove);
NS_DISPLAY_DECL_NAME("Outline", TYPE_OUTLINE) NS_DISPLAY_DECL_NAME("Outline", TYPE_OUTLINE)
}; };
@ -1449,8 +1408,7 @@ public:
nsIFrame* aFrame); nsIFrame* aFrame);
virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx); virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion);
nsRegion* aVisibleRegionBeforeMove);
virtual PRBool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) { virtual PRBool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem) {
NS_WARNING("This list should already have been flattened!!!"); NS_WARNING("This list should already have been flattened!!!");
return PR_FALSE; return PR_FALSE;
@ -1530,8 +1488,7 @@ public:
virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder, virtual LayerState GetLayerState(nsDisplayListBuilder* aBuilder,
LayerManager* aManager); LayerManager* aManager);
virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion);
nsRegion* aVisibleRegionBeforeMove);
virtual PRBool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem); virtual PRBool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem);
NS_DISPLAY_DECL_NAME("Opacity", TYPE_OPACITY) NS_DISPLAY_DECL_NAME("Opacity", TYPE_OPACITY)
}; };
@ -1585,8 +1542,7 @@ public:
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder); virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx); virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion);
nsRegion* aVisibleRegionBeforeMove);
virtual PRBool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem); virtual PRBool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem);
NS_DISPLAY_DECL_NAME("Clip", TYPE_CLIP) NS_DISPLAY_DECL_NAME("Clip", TYPE_CLIP)
virtual PRUint32 GetPerFrameKey() { return 0; } virtual PRUint32 GetPerFrameKey() { return 0; }
@ -1631,8 +1587,7 @@ public:
virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect, virtual void HitTest(nsDisplayListBuilder* aBuilder, const nsRect& aRect,
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames); HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames);
virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion);
nsRegion* aVisibleRegionBeforeMove);
NS_DISPLAY_DECL_NAME("Zoom", TYPE_ZOOM) NS_DISPLAY_DECL_NAME("Zoom", TYPE_ZOOM)
// Get the app units per dev pixel ratio of the child document. // Get the app units per dev pixel ratio of the child document.
@ -1664,8 +1619,7 @@ public:
} }
virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx); virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion);
nsRegion* aVisibleRegionBeforeMove);
virtual PRBool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem); virtual PRBool TryMerge(nsDisplayListBuilder* aBuilder, nsDisplayItem* aItem);
NS_DISPLAY_DECL_NAME("SVGEffects", TYPE_SVG_EFFECTS) NS_DISPLAY_DECL_NAME("SVGEffects", TYPE_SVG_EFFECTS)
@ -1719,8 +1673,7 @@ public:
virtual already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder, virtual already_AddRefed<Layer> BuildLayer(nsDisplayListBuilder* aBuilder,
LayerManager* aManager); LayerManager* aManager);
virtual PRBool ComputeVisibility(nsDisplayListBuilder *aBuilder, virtual PRBool ComputeVisibility(nsDisplayListBuilder *aBuilder,
nsRegion *aVisibleRegion, nsRegion *aVisibleRegion);
nsRegion *aVisibleRegionBeforeMove);
virtual PRBool TryMerge(nsDisplayListBuilder *aBuilder, nsDisplayItem *aItem); virtual PRBool TryMerge(nsDisplayListBuilder *aBuilder, nsDisplayItem *aItem);
/** /**

View File

@ -1355,7 +1355,7 @@ nsLayoutUtils::PaintFrame(nsIRenderingContext* aRenderingContext, nsIFrame* aFra
} }
#endif #endif
list.ComputeVisibility(&builder, &visibleRegion, nsnull); list.ComputeVisibility(&builder, &visibleRegion);
#ifdef DEBUG #ifdef DEBUG
if (gDumpPaintList) { if (gDumpPaintList) {

View File

@ -2538,7 +2538,7 @@ nsRootPresContext::GetPluginGeometryUpdates(nsIFrame* aChangedSubtree,
#endif #endif
nsRegion visibleRegion(bounds); nsRegion visibleRegion(bounds);
list.ComputeVisibility(&builder, &visibleRegion, nsnull); list.ComputeVisibility(&builder, &visibleRegion);
#ifdef DEBUG #ifdef DEBUG
if (gDumpPluginList) { if (gDumpPluginList) {

View File

@ -5635,7 +5635,7 @@ PresShell::PaintRangePaintInfo(nsTArray<nsAutoPtr<RangePaintInfo> >* aItems,
aArea.MoveBy(-rangeInfo->mRootOffset.x, -rangeInfo->mRootOffset.y); aArea.MoveBy(-rangeInfo->mRootOffset.x, -rangeInfo->mRootOffset.y);
nsRegion visible(aArea); nsRegion visible(aArea);
rangeInfo->mList.ComputeVisibility(&rangeInfo->mBuilder, &visible, nsnull); rangeInfo->mList.ComputeVisibility(&rangeInfo->mBuilder, &visible);
rangeInfo->mList.PaintRoot(&rangeInfo->mBuilder, rc, nsDisplayList::PAINT_DEFAULT); rangeInfo->mList.PaintRoot(&rangeInfo->mBuilder, rc, nsDisplayList::PAINT_DEFAULT);
aArea.MoveBy(rangeInfo->mRootOffset.x, rangeInfo->mRootOffset.y); aArea.MoveBy(rangeInfo->mRootOffset.x, rangeInfo->mRootOffset.y);
} }

View File

@ -172,12 +172,10 @@ public:
} }
virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion)
nsRegion* aVisibleRegionBeforeMove)
{ {
return NS_GET_A(mExtraBackgroundColor) > 0 || return NS_GET_A(mExtraBackgroundColor) > 0 ||
nsDisplayBackground::ComputeVisibility(aBuilder, aVisibleRegion, nsDisplayBackground::ComputeVisibility(aBuilder, aVisibleRegion);
aVisibleRegionBeforeMove);
} }
virtual PRBool IsOpaque(nsDisplayListBuilder* aBuilder) virtual PRBool IsOpaque(nsDisplayListBuilder* aBuilder)
{ {

View File

@ -1058,23 +1058,7 @@ static PRBool ApplyAbsPosClipping(nsDisplayListBuilder* aBuilder,
if (!aFrame->GetAbsPosClipRect(aDisp, aRect, aFrame->GetSize())) if (!aFrame->GetAbsPosClipRect(aDisp, aRect, aFrame->GetSize()))
return PR_FALSE; return PR_FALSE;
// A moving frame should not be allowed to clip a non-moving frame.
// Abs-pos clipping always clips frames below it in the frame tree, except
// for when an abs-pos frame clips a fixed-pos frame. So when fixed-pos
// elements are present we do not allow a moving abs-pos frame with
// an out-of-flow descendant (which could be a fixed frame) child to clip
// anything. It's OK to not clip anything, even the moving children ...
// all that could happen is that we get unnecessarily conservative results
// for nsLayoutUtils::ComputeRepaintRegionForCopy ... but this is a rare
// situation.
if (aBuilder->HasMovingFrames() &&
aFrame->PresContext()->FrameManager()->GetRootFrame()->
GetFirstChild(nsGkAtoms::fixedList) &&
aBuilder->IsMovingFrame(aFrame))
return PR_FALSE;
*aRect += aBuilder->ToReferenceFrame(aFrame); *aRect += aBuilder->ToReferenceFrame(aFrame);
return PR_TRUE; return PR_TRUE;
} }

View File

@ -1568,7 +1568,7 @@ InvalidateFixedBackgroundFrames(nsIFrame* aRootFrame,
return; return;
nsRegion visibleRegion(aUpdateRect); nsRegion visibleRegion(aUpdateRect);
list.ComputeVisibility(&builder, &visibleRegion, nsnull); list.ComputeVisibility(&builder, &visibleRegion);
InvalidateFixedBackgroundFramesFromList(&builder, aMovingFrame, list); InvalidateFixedBackgroundFramesFromList(&builder, aMovingFrame, list);
list.DeleteAll(); list.DeleteAll();

View File

@ -1189,14 +1189,10 @@ nsDisplayPlugin::Paint(nsDisplayListBuilder* aBuilder,
PRBool PRBool
nsDisplayPlugin::ComputeVisibility(nsDisplayListBuilder* aBuilder, nsDisplayPlugin::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion)
nsRegion* aVisibleRegionBeforeMove)
{ {
NS_ASSERTION(!aVisibleRegionBeforeMove, "not supported anymore");
mVisibleRegion.And(*aVisibleRegion, GetBounds(aBuilder)); mVisibleRegion.And(*aVisibleRegion, GetBounds(aBuilder));
return nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion, return nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion);
aVisibleRegionBeforeMove);
} }
PRBool PRBool

View File

@ -280,8 +280,7 @@ public:
virtual void Paint(nsDisplayListBuilder* aBuilder, virtual void Paint(nsDisplayListBuilder* aBuilder,
nsIRenderingContext* aCtx); nsIRenderingContext* aCtx);
virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder, virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion, nsRegion* aVisibleRegion);
nsRegion* aVisibleRegionBeforeMove);
NS_DISPLAY_DECL_NAME("Plugin", TYPE_PLUGIN) NS_DISPLAY_DECL_NAME("Plugin", TYPE_PLUGIN)