Bug 1177018 - When finding a painted layer for a display item, include event regions in a layer's visible region. r=tn

--HG--
extra : rebase_source : 797a7d5274cee6280a6eced86784e40454f44924
extra : source : 0d93e3adfeeaa3360b236157d0747e1570135c64
This commit is contained in:
Botond Ballo 2015-06-26 17:26:06 -04:00
Родитель bbbb23bc55
Коммит 0885317d46
1 изменённых файлов: 19 добавлений и 7 удалений

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

@ -446,13 +446,8 @@ public:
*/
already_AddRefed<ImageContainer> GetContainerForImageLayer(nsDisplayListBuilder* aBuilder);
bool VisibleAboveRegionIntersects(const nsIntRect& aRect) const
{ return mVisibleAboveRegion.Intersects(aRect); }
bool VisibleAboveRegionIntersects(const nsIntRegion& aRegion) const
{ return !mVisibleAboveRegion.Intersect(aRegion).IsEmpty(); }
bool VisibleRegionIntersects(const nsIntRect& aRect) const
{ return mVisibleRegion.Intersects(aRect); }
bool VisibleRegionIntersects(const nsIntRegion& aRegion) const
{ return !mVisibleRegion.Intersect(aRegion).IsEmpty(); }
@ -1088,6 +1083,13 @@ public:
nsIFrame* GetContainerFrame() const { return mContainerFrame; }
nsDisplayListBuilder* Builder() const { return mBuilder; }
/**
* Check if we are currently inside an inactive layer.
*/
bool IsInInactiveLayer() const {
return mLayerBuilder->GetContainingPaintedLayerData();
}
/**
* Sets aOuterVisibleRegion as aLayer's visible region. aOuterVisibleRegion
* is in the coordinate space of the container reference frame.
@ -2584,12 +2586,22 @@ PaintedLayerDataNode::FindPaintedLayerFor(const nsIntRect& aVisibleRect,
} else {
PaintedLayerData* lowestUsableLayer = nullptr;
for (auto& data : Reversed(mPaintedLayerDataStack)) {
if (data.VisibleAboveRegionIntersects(aVisibleRect)) {
if (data.mVisibleAboveRegion.Intersects(aVisibleRect)) {
break;
}
MOZ_ASSERT(!data.mExclusiveToOneItem);
lowestUsableLayer = &data;
if (data.VisibleRegionIntersects(aVisibleRect)) {
nsIntRegion visibleRegion = data.mVisibleRegion;
// When checking whether the visible region intersects the given
// visible rect, also include the event-regions in the visible region,
// unless we're in an inactive layer, in which case the event-regions
// will be hoisted out into their own layer.
ContainerState& contState = mTree.ContState();
if (!contState.IsInInactiveLayer()) {
visibleRegion.OrWith(contState.ScaleRegionToOutsidePixels(data.mHitRegion));
visibleRegion.OrWith(contState.ScaleRegionToOutsidePixels(data.mMaybeHitRegion));
}
if (visibleRegion.Intersects(aVisibleRect)) {
break;
}
}