diff --git a/layout/base/FrameLayerBuilder.cpp b/layout/base/FrameLayerBuilder.cpp index 57c529d3584..7cf4e3d5f25 100644 --- a/layout/base/FrameLayerBuilder.cpp +++ b/layout/base/FrameLayerBuilder.cpp @@ -970,6 +970,12 @@ ContainerState::PopThebesLayerData() nsRefPtr imageLayer = CreateOrRecycleImageLayer(); imageLayer->SetContainer(imageContainer); data->mImage->ConfigureLayer(imageLayer); + if (mParameters.mInActiveTransformedSubtree) { + // The layer's current transform is applied first, then the result is scaled. + gfx3DMatrix transform = imageLayer->GetTransform()* + gfx3DMatrix::ScalingMatrix(mParameters.mXScale, mParameters.mYScale, 1.0f); + imageLayer->SetTransform(transform); + } NS_ASSERTION(data->mImageClip.mRoundedClipRects.IsEmpty(), "How did we get rounded clip rects here?"); if (data->mImageClip.mHaveClipRect) { @@ -1124,6 +1130,17 @@ ContainerState::ThebesLayerData::Accumulate(ContainerState* aState, { nscolor uniformColor; bool isUniform = aItem->IsUniform(aState->mBuilder, &uniformColor); + + /* Mark as available for conversion to image layer if this is a nsDisplayImage and + * we are the first visible item in the ThebesLayerData object. + */ + if (aItem->GetType() == nsDisplayItem::TYPE_IMAGE && mVisibleRegion.IsEmpty()) { + mImage = static_cast(aItem); + mImageClip = aClip; + } else { + mImage = nsnull; + } + // Some display items have to exist (so they can set forceTransparentSurface // below) but don't draw anything. They'll return true for isUniform but // a color with opacity 0. @@ -1152,16 +1169,6 @@ ContainerState::ThebesLayerData::Accumulate(ContainerState* aState, mDrawRegion.Or(mDrawRegion, aDrawRect); mDrawRegion.SimplifyOutward(4); } - - /* Mark as available for conversion to image layer if this is a nsDisplayImage and - * we are the first visible item in the ThebesLayerData object. - */ - if (aItem->GetType() == nsDisplayItem::TYPE_IMAGE && mVisibleRegion.IsEmpty()) { - mImage = static_cast(aItem); - mImageClip = aClip; - } else { - mImage = nsnull; - } bool forceTransparentSurface = false; nsRegion opaque = aItem->GetOpaqueRegion(aState->mBuilder, &forceTransparentSurface); diff --git a/layout/generic/nsImageFrame.cpp b/layout/generic/nsImageFrame.cpp index 451c41fe169..45275cffd24 100644 --- a/layout/generic/nsImageFrame.cpp +++ b/layout/generic/nsImageFrame.cpp @@ -544,6 +544,7 @@ nsImageFrame::OnStartContainer(imgIRequest *aRequest, imgIContainer *aImage) */ nsPresContext *presContext = PresContext(); aImage->SetAnimationMode(presContext->ImageAnimationMode()); + mImageContainer = nsnull; if (IsPendingLoad(aRequest)) { // We don't care @@ -621,6 +622,7 @@ nsImageFrame::OnStopDecode(imgIRequest *aRequest, nsPresContext *presContext = PresContext(); nsIPresShell *presShell = presContext->GetPresShell(); NS_ASSERTION(presShell, "No PresShell."); + mImageContainer = nsnull; // Check what request type we're dealing with nsCOMPtr imageLoader = do_QueryInterface(mContent); @@ -1237,7 +1239,10 @@ nsDisplayImage::ConfigureLayer(ImageLayer* aLayer) nsRefPtr nsImageFrame::GetContainer(LayerManager* aManager, imgIContainer* aImage) { - if (mImageContainer && mImageContainer->Manager() == aManager) { + if (mImageContainer && + (mImageContainer->Manager() == aManager || + (!mImageContainer->Manager() && + (mImageContainer->GetBackendType() == aManager->GetBackendType())))) { return mImageContainer; }