Bug 1232939 - Ensure the opaque region of a fixed background layer is correctly clipped. r=mstange

This commit is contained in:
Botond Ballo
2016-01-06 13:48:37 -05:00
parent 4aa4863fce
commit dabc6624f0
4 changed files with 55 additions and 0 deletions

View File

@@ -3196,6 +3196,18 @@ void ContainerState::FinishPaintedLayerData(PaintedLayerData& aData, FindOpaqueB
FLB_LOG_PAINTED_LAYER_DECISION(data, " Selected painted layer=%p\n", layer.get());
}
// If the layer is a fixed background layer, the clip on the fixed background
// display item was not applied to the opaque region in
// ContainerState::ComputeOpaqueRect(), but was saved in data->mItemClip.
// Apply it to the opaque region now. Note that it's important to do this
// before the opaque region is propagated to the NewLayerEntry below.
if (data->mSingleItemFixedToViewport && data->mItemClip.HasClip()) {
nsRect clipRect = data->mItemClip.GetClipRect();
nsRect insideRoundedCorners = data->mItemClip.ApproximateIntersectInward(clipRect);
nsIntRect insideRoundedCornersScaled = ScaleToInsidePixels(insideRoundedCorners);
data->mOpaqueRegion.AndWith(insideRoundedCornersScaled);
}
if (mLayerBuilder->IsBuildingRetainedLayers()) {
newLayerEntry->mVisibleRegion = data->mVisibleRegion;
newLayerEntry->mOpaqueRegion = data->mOpaqueRegion;