From 9fd70ebbb2d81ef980d13b3979f11c0bfb111077 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Thu, 13 May 2010 14:21:53 +1200 Subject: [PATCH] Backed out changeset 054698c2cb8f --HG-- extra : rebase_source : 82b51116ca334c0853ace7f73b6f019831624d89 --- layout/base/nsDisplayList.cpp | 50 +++++--------------------------- layout/base/nsDisplayList.h | 17 ++++------- layout/base/nsLayoutDebugger.cpp | 3 +- layout/base/nsLayoutUtils.cpp | 3 +- 4 files changed, 14 insertions(+), 59 deletions(-) diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 35e7368193e..e1d53a3dc24 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -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 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 diff --git a/layout/base/nsDisplayList.h b/layout/base/nsDisplayList.h index 3fe69bba7aa..2314b627913 100644 --- a/layout/base/nsDisplayList.h +++ b/layout/base/nsDisplayList.h @@ -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 *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 *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, diff --git a/layout/base/nsLayoutDebugger.cpp b/layout/base/nsLayoutDebugger.cpp index fa35a13e13f..5f0dc6aeb1f 100644 --- a/layout/base/nsLayoutDebugger.cpp +++ b/layout/base/nsLayoutDebugger.cpp @@ -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" : ""); diff --git a/layout/base/nsLayoutUtils.cpp b/layout/base/nsLayoutUtils.cpp index 58729f2f134..4c1b90bef2f 100644 --- a/layout/base/nsLayoutUtils.cpp +++ b/layout/base/nsLayoutUtils.cpp @@ -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);