diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 55dad0e45e2..8697f83fe7c 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -1176,21 +1176,19 @@ ContainerState::FindThebesLayerFor(nsDisplayItem* aItem, return layer.forget(); } -static already_AddRefed -BuildTempManagerForInactiveLayer(nsDisplayListBuilder* aBuilder, - nsDisplayItem* aItem) +static void +PaintInactiveLayer(nsDisplayListBuilder* aBuilder, + nsDisplayItem* aItem, + gfxContext* aContext) { - // This item has an inactive layer. We will render it to a ThebesLayer - // using a temporary BasicLayerManager. Set up the layer - // manager now so that if we need to modify the retained layer - // tree during this process, those modifications will happen - // during the construction phase for the retained layer tree. + // This item has an inactive layer. Render it to a ThebesLayer + // using a temporary BasicLayerManager. nsRefPtr tempManager = new BasicLayerManager(); - tempManager->BeginTransaction(); + tempManager->BeginTransactionWithTarget(aContext); nsRefPtr layer = aItem->BuildLayer(aBuilder, tempManager); if (!layer) { tempManager->EndTransaction(nsnull, nsnull); - return nsnull; + return; } PRInt32 appUnitsPerDevPixel = AppUnitsPerDevPixel(aItem); nsIntRect itemVisibleRect = @@ -1198,9 +1196,7 @@ BuildTempManagerForInactiveLayer(nsDisplayListBuilder* aBuilder, SetVisibleRectForLayer(layer, itemVisibleRect); tempManager->SetRoot(layer); - // No painting should occur yet, since there is no target context. - tempManager->EndTransaction(nsnull, nsnull); - return tempManager.forget(); + tempManager->EndTransaction(FrameLayerBuilder::DrawThebesLayer, aBuilder); } /* @@ -1301,13 +1297,6 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList, mNewChildLayers.AppendElement(ownLayer); mBuilder->LayerBuilder()->AddLayerDisplayItem(ownLayer, item); } else { - nsRefPtr tempLayerManager; - if (layerState != LAYER_NONE) { - tempLayerManager = BuildTempManagerForInactiveLayer(mBuilder, item); - if (!tempLayerManager) - continue; - } - nsIFrame* f = item->GetUnderlyingFrame(); nsIFrame* activeScrolledRoot = nsLayoutUtils::GetActiveScrolledRootFor(f, mBuilder->ReferenceFrame()); @@ -1331,7 +1320,7 @@ ContainerState::ProcessDisplayItems(const nsDisplayList& aList, mBuilder->LayerBuilder()-> AddThebesDisplayItem(thebesLayer, item, aClip, mContainerFrame, - layerState, tempLayerManager); + layerState); } } } @@ -1392,8 +1381,7 @@ FrameLayerBuilder::AddThebesDisplayItem(ThebesLayer* aLayer, nsDisplayItem* aItem, const Clip& aClip, nsIFrame* aContainerLayerFrame, - LayerState aLayerState, - LayerManager* aTempManager) + LayerState aLayerState) { AddLayerDisplayItem(aLayer, aItem); @@ -1403,7 +1391,7 @@ FrameLayerBuilder::AddThebesDisplayItem(ThebesLayer* aLayer, NS_ASSERTION(aItem->GetUnderlyingFrame(), "Must have frame"); ClippedDisplayItem* cdi = entry->mItems.AppendElement(ClippedDisplayItem(aItem, aClip)); - cdi->mTempLayerManager = aTempManager; + cdi->mInactiveLayer = aLayerState != LAYER_NONE; } } @@ -1878,11 +1866,8 @@ FrameLayerBuilder::DrawThebesLayer(ThebesLayer* aLayer, } } - if (cdi->mTempLayerManager) { - // This item has an inactive layer. Render it to the ThebesLayer - // using the temporary BasicLayerManager. - cdi->mTempLayerManager->BeginTransactionWithTarget(aContext); - cdi->mTempLayerManager->EndTransaction(DrawThebesLayer, builder); + if (cdi->mInactiveLayer) { + PaintInactiveLayer(builder, cdi->mItem, aContext); } else { cdi->mItem->Paint(builder, rc); } diff --git a/layout/base/FrameLayerBuilder.h b/layout/base/FrameLayerBuilder.h index e051c85c4c3..44922044ca3 100644 --- a/layout/base/FrameLayerBuilder.h +++ b/layout/base/FrameLayerBuilder.h @@ -238,8 +238,7 @@ public: nsDisplayItem* aItem, const Clip& aClip, nsIFrame* aContainerLayerFrame, - LayerState aLayerState, - LayerManager* aTempManager); + LayerState aLayerState); /** * Given a frame and a display item key that uniquely identifies a @@ -430,8 +429,8 @@ protected: } nsDisplayItem* mItem; - nsRefPtr mTempLayerManager; Clip mClip; + PRPackedBool mInactiveLayer; }; /** diff --git a/layout/reftests/scrolling/fixed-text-2.html b/layout/reftests/scrolling/fixed-text-2.html new file mode 100644 index 00000000000..4c72e6970b1 --- /dev/null +++ b/layout/reftests/scrolling/fixed-text-2.html @@ -0,0 +1,19 @@ + + + + + + +
+
+ +
+ + + diff --git a/layout/reftests/scrolling/reftest.list b/layout/reftests/scrolling/reftest.list index ecb6f702110..3c649ec9292 100644 --- a/layout/reftests/scrolling/reftest.list +++ b/layout/reftests/scrolling/reftest.list @@ -1,6 +1,7 @@ HTTP == fixed-1.html fixed-1.html?ref HTTP == fixed-opacity-1.html fixed-opacity-1.html?ref HTTP == fixed-text-1.html fixed-text-1.html?ref +HTTP == fixed-text-2.html fixed-text-2.html?ref HTTP == opacity-mixed-scrolling-1.html opacity-mixed-scrolling-1.html?ref random-if(cocoaWidget) HTTP == opacity-mixed-scrolling-2.html opacity-mixed-scrolling-2.html?ref # see bug 625357 HTTP == simple-1.html simple-1.html?ref