Fix PostprocessRetainedLayers to not test occlusion with asynchronous clips. (bug 1148582 part 5, r=tn)

This commit is contained in:
David Anderson 2015-06-02 16:34:28 -07:00
Родитель c5555b3c2d
Коммит 422d7967dc
3 изменённых файлов: 38 добавлений и 2 удалений

Просмотреть файл

@ -929,6 +929,27 @@ Layer::GetVisibleRegionRelativeToRootLayer(nsIntRegion& aResult,
return true;
}
Maybe<ParentLayerIntRect>
Layer::GetCombinedClipRect() const
{
Maybe<ParentLayerIntRect> clip = GetClipRect();
for (size_t i = 0; i < mFrameMetrics.Length(); i++) {
if (!mFrameMetrics[i].HasClipRect()) {
continue;
}
const ParentLayerIntRect& other = mFrameMetrics[i].ClipRect();
if (clip) {
clip = Some(clip.value().Intersect(other));
} else {
clip = Some(other);
}
}
return clip;
}
ContainerLayer::ContainerLayer(LayerManager* aManager, void* aImplData)
: Layer(aManager, aImplData),
mFirstChild(nullptr),

Просмотреть файл

@ -1255,6 +1255,12 @@ public:
bool IsScrollbarContainer() { return mIsScrollbarContainer; }
Layer* GetMaskLayer() const { return mMaskLayer; }
/*
* Get the combined clip rect of the Layer clip and all clips on FrameMetrics.
* This is intended for use in Layout. The compositor needs to apply async
* transforms to find the combined clip.
*/
Maybe<ParentLayerIntRect> GetCombinedClipRect() const;
/**
* Retrieve the root level visible region for |this| taking into account

Просмотреть файл

@ -4408,6 +4408,15 @@ InvalidateVisibleBoundsChangesForScrolledLayer(PaintedLayer* aLayer)
}
}
static inline const Maybe<ParentLayerIntRect>&
GetStationaryClipInContainer(Layer* aLayer)
{
if (size_t metricsCount = aLayer->GetFrameMetricsCount()) {
return aLayer->GetFrameMetrics(metricsCount - 1).GetClipRect();
}
return aLayer->GetClipRect();
}
void
ContainerState::PostprocessRetainedLayers(nsIntRegion* aOpaqueRegionForContainer)
{
@ -4434,7 +4443,7 @@ ContainerState::PostprocessRetainedLayers(nsIntRegion* aOpaqueRegionForContainer
if (hideAll) {
e->mVisibleRegion.SetEmpty();
} else if (!e->mLayer->IsScrollbarContainer()) {
const Maybe<ParentLayerIntRect>& clipRect = e->mLayer->GetClipRect();
const Maybe<ParentLayerIntRect>& clipRect = GetStationaryClipInContainer(e->mLayer);
if (clipRect && opaqueRegionForContainer >= 0 &&
opaqueRegions[opaqueRegionForContainer].mOpaqueRegion.Contains(ParentLayerIntRect::ToUntyped(*clipRect))) {
e->mVisibleRegion.SetEmpty();
@ -4474,7 +4483,7 @@ ContainerState::PostprocessRetainedLayers(nsIntRegion* aOpaqueRegionForContainer
}
nsIntRegion clippedOpaque = e->mOpaqueRegion;
const Maybe<ParentLayerIntRect>& clipRect = e->mLayer->GetClipRect();
Maybe<ParentLayerIntRect> clipRect = e->mLayer->GetCombinedClipRect();
if (clipRect) {
clippedOpaque.AndWith(ParentLayerIntRect::ToUntyped(*clipRect));
}