Backed out changeset 054698c2cb8f

--HG--
extra : rebase_source : 82b51116ca334c0853ace7f73b6f019831624d89
This commit is contained in:
Robert O'Callahan 2010-05-13 14:21:53 +12:00
parent 9afb4be369
commit 9fd70ebbb2
4 changed files with 14 additions and 59 deletions

View File

@ -346,9 +346,8 @@ nsDisplayList::ComputeVisibility(nsDisplayListBuilder* aBuilder,
// Record bounds of moving visible items in movingContentAccumulatedBounds.
// We do not need to add items that are uniform across the entire visible
// area, since they have no visible movement.
nscolor color;
if (isMoving &&
!(item->IsUniform(aBuilder, &color) &&
!(item->IsUniform(aBuilder) &&
bounds.Contains(aVisibleRegion->GetBounds()) &&
bounds.Contains(aVisibleRegionBeforeMove->GetBounds()))) {
if (movingContentAccumulatedBounds.IsEmpty()) {
@ -571,28 +570,6 @@ CreateEmptyThebesLayer(nsDisplayListBuilder* aBuilder,
return itemGroup;
}
static PRBool
IsAllUniform(nsDisplayListBuilder* aBuilder, nsDisplayList::ItemGroup* aGroup,
nscolor* aColor)
{
nsRect visibleRect = aGroup->mStartItem->GetVisibleRect();
nscolor finalColor = NS_RGBA(0,0,0,0);
for (nsDisplayList::ItemGroup* group = aGroup; group;
group = group->mNextItemsForLayer) {
for (nsDisplayItem* item = group->mStartItem; item != group->mEndItem;
item = item->GetAbove()) {
nscolor color;
if (visibleRect != item->GetVisibleRect())
return PR_FALSE;
if (!item->IsUniform(aBuilder, &color))
return PR_FALSE;
finalColor = NS_ComposeColors(finalColor, color);
}
}
*aColor = finalColor;
return PR_TRUE;
}
/**
* This is the heart of layout's integration with layers. We
* use a ClippedItemIterator to iterate through descendant display
@ -704,15 +681,6 @@ void nsDisplayList::BuildLayers(nsDisplayListBuilder* aBuilder,
for (PRUint32 i = 0; i < aLayers->Length(); ++i) {
LayerItems* layerItems = &aLayers->ElementAt(i);
nscolor color;
if (layerItems->mThebesLayer &&
IsAllUniform(aBuilder, layerItems->mItems, &color)) {
layerItems->mThebesLayer = nsnull;
nsRefPtr<ColorLayer> layer = aManager->CreateColorLayer();
layer->SetColor(gfxRGBA(color));
layerItems->mLayer = layer.forget();
}
gfxMatrix transform;
nsIntRect visibleRect = layerItems->mVisibleRect;
if (layerItems->mLayer->GetTransform().Is2D(&transform)) {
@ -1131,7 +1099,7 @@ nsDisplayBackground::IsOpaque(nsDisplayListBuilder* aBuilder) {
}
PRBool
nsDisplayBackground::IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor) {
nsDisplayBackground::IsUniform(nsDisplayListBuilder* aBuilder) {
// theme background overrides any other background
if (mIsThemed)
return PR_FALSE;
@ -1139,18 +1107,14 @@ nsDisplayBackground::IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor)
nsStyleContext *bgSC;
PRBool hasBG =
nsCSSRendering::FindBackground(mFrame->PresContext(), mFrame, &bgSC);
if (!hasBG) {
aColor = NS_RGBA(0,0,0,0);
if (!hasBG)
return PR_TRUE;
}
const nsStyleBackground* bg = bgSC->GetStyleBackground();
if (bg->BottomLayer().mImage.IsEmpty() &&
bg->mImageCount == 1 &&
!nsLayoutUtils::HasNonZeroCorner(mFrame->GetStyleBorder()->mBorderRadius) &&
bg->BottomLayer().mClip == NS_STYLE_BG_CLIP_BORDER) {
*aColor = bg->mBackgroundColor;
bg->BottomLayer().mClip == NS_STYLE_BG_CLIP_BORDER)
return PR_TRUE;
}
return PR_FALSE;
}
@ -1462,7 +1426,7 @@ nsDisplayWrapList::IsOpaque(nsDisplayListBuilder* aBuilder) {
return PR_FALSE;
}
PRBool nsDisplayWrapList::IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor) {
PRBool nsDisplayWrapList::IsUniform(nsDisplayListBuilder* aBuilder) {
// We could try to do something but let's conservatively just return PR_FALSE.
return PR_FALSE;
}
@ -2032,12 +1996,12 @@ PRBool nsDisplayTransform::IsOpaque(nsDisplayListBuilder *aBuilder)
* wrapped list is uniform. See IsOpaque for discussion of why this
* works.
*/
PRBool nsDisplayTransform::IsUniform(nsDisplayListBuilder *aBuilder, nscolor* aColor)
PRBool nsDisplayTransform::IsUniform(nsDisplayListBuilder *aBuilder)
{
const nsStyleDisplay* disp = mFrame->GetStyleDisplay();
return disp->mTransform.GetMainMatrixEntry(1) == 0.0f &&
disp->mTransform.GetMainMatrixEntry(2) == 0.0f &&
mStoredList.IsUniform(aBuilder, aColor);
mStoredList.IsUniform(aBuilder);
}
/* If UNIFIED_CONTINUATIONS is defined, we can merge two display lists that

View File

@ -544,11 +544,10 @@ public:
*/
virtual PRBool IsOpaque(nsDisplayListBuilder* aBuilder) { return PR_FALSE; }
/**
* If this returns true, then aColor is set to the uniform color
* @return PR_TRUE if the item is guaranteed to paint every pixel in its
* bounds with the same (possibly translucent) color
*/
virtual PRBool IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor) { return PR_FALSE; }
virtual PRBool IsUniform(nsDisplayListBuilder* aBuilder) { return PR_FALSE; }
/**
* @return PR_FALSE if the painting performed by the item is invariant
* when frame aFrame is moved relative to aBuilder->GetRootMovingFrame().
@ -629,8 +628,6 @@ public:
* list.
*/
virtual nsDisplayList* GetList() { return nsnull; }
const nsRect& GetVisibleRect() { return mVisibleRect; }
#ifdef NS_DEBUG
/**
@ -1306,11 +1303,7 @@ public:
return (NS_GET_A(mColor) == 255);
}
virtual PRBool IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor)
{
*aColor = mColor;
return PR_TRUE;
}
virtual PRBool IsUniform(nsDisplayListBuilder* aBuilder) { return PR_TRUE; }
virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
@ -1342,7 +1335,7 @@ public:
}
virtual PRBool IsOpaque(nsDisplayListBuilder* aBuilder);
virtual PRBool IsVaryingRelativeToMovingFrame(nsDisplayListBuilder* aBuilder);
virtual PRBool IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor);
virtual PRBool IsUniform(nsDisplayListBuilder* aBuilder);
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
NS_DISPLAY_DECL_NAME("Background")
@ -1475,7 +1468,7 @@ public:
HitTestState* aState, nsTArray<nsIFrame*> *aOutFrames);
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder);
virtual PRBool IsOpaque(nsDisplayListBuilder* aBuilder);
virtual PRBool IsUniform(nsDisplayListBuilder* aBuilder, nscolor* aColor);
virtual PRBool IsUniform(nsDisplayListBuilder* aBuilder);
virtual PRBool IsVaryingRelativeToMovingFrame(nsDisplayListBuilder* aBuilder);
virtual void Paint(nsDisplayListBuilder* aBuilder, nsIRenderingContext* aCtx);
virtual PRBool ComputeVisibility(nsDisplayListBuilder* aBuilder,
@ -1679,7 +1672,7 @@ public:
HitTestState *aState, nsTArray<nsIFrame*> *aOutFrames);
virtual nsRect GetBounds(nsDisplayListBuilder *aBuilder);
virtual PRBool IsOpaque(nsDisplayListBuilder *aBuilder);
virtual PRBool IsUniform(nsDisplayListBuilder *aBuilder, nscolor* aColor);
virtual PRBool IsUniform(nsDisplayListBuilder *aBuilder);
virtual void Paint(nsDisplayListBuilder *aBuilder,
nsIRenderingContext *aCtx);
virtual PRBool ComputeVisibility(nsDisplayListBuilder *aBuilder,

View File

@ -172,12 +172,11 @@ PrintDisplayListTo(nsDisplayListBuilder* aBuilder, const nsDisplayList& aList,
default:
break;
}
nscolor color;
fprintf(aOutput, "%s %p(%s) (%d,%d,%d,%d)%s%s%s%s\n", i->Name(),
(void*)f, NS_ConvertUTF16toUTF8(fName).get(),
rect.x, rect.y, rect.width, rect.height,
i->IsOpaque(aBuilder) ? " opaque" : "",
i->IsUniform(aBuilder, &color) ? " uniform" : "",
i->IsUniform(aBuilder) ? " uniform" : "",
f && aBuilder->IsMovingFrame(f) ? " moving" : "",
f && aBuilder->IsMovingFrame(f) && !i->GetList() &&
i->IsVaryingRelativeToMovingFrame(aBuilder) ? " varying" : "");

View File

@ -1388,8 +1388,7 @@ AddItemsToRegion(nsDisplayListBuilder* aBuilder, nsDisplayList* aList,
}
} else {
// not moving.
nscolor color;
if (item->IsUniform(aBuilder, &color)) {
if (item->IsUniform(aBuilder)) {
// If it's uniform, we don't need to invalidate where one part
// of the item was copied to another part.
exclude.IntersectRect(r, r + aDelta);