Bug 1118051. Report layer event regions items as having empty bounds so they don't expand the visible region of layers. r=roc

When choosing a painted layer for the event region item we must report the bounds of the hit regions as the bounds so that we don't fall through to the bottom most painted layer.
This commit is contained in:
Timothy Nikkel 2015-02-11 17:06:47 -06:00
parent 3b5238786f
commit f64a0401c8
3 changed files with 20 additions and 2 deletions

View File

@ -2915,6 +2915,11 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
ScaleToOutsidePixels(item->GetVisibleRect(), false);
bool snap;
nsRect itemContent = item->GetBounds(mBuilder, &snap);
if (itemType == nsDisplayItem::TYPE_LAYER_EVENT_REGIONS) {
nsDisplayLayerEventRegions* eventRegions =
static_cast<nsDisplayLayerEventRegions*>(item);
itemContent = eventRegions->GetHitRegionBounds(mBuilder, &snap);
}
nsIntRect itemDrawRect = ScaleToOutsidePixels(itemContent, snap);
bool prerenderedTransform = itemType == nsDisplayItem::TYPE_TRANSFORM &&
static_cast<nsDisplayTransform*>(item)->ShouldPrerender(mBuilder);
@ -2929,7 +2934,15 @@ ContainerState::ProcessDisplayItems(nsDisplayList* aList)
clipRect.MoveBy(mParameters.mOffset);
}
#ifdef DEBUG
((nsRect&)mAccumulatedChildBounds).UnionRect(mAccumulatedChildBounds, itemContent);
nsRect bounds = itemContent;
bool dummy;
if (itemType == nsDisplayItem::TYPE_LAYER_EVENT_REGIONS) {
bounds = item->GetBounds(mBuilder, &dummy);
if (itemClip.HasClip()) {
bounds.IntersectRect(bounds, itemClip.GetClipRect());
}
}
((nsRect&)mAccumulatedChildBounds).UnionRect(mAccumulatedChildBounds, bounds);
#endif
itemVisibleRect.IntersectRect(itemVisibleRect, itemDrawRect);

View File

@ -2626,6 +2626,11 @@ public:
}
#endif
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap) MOZ_OVERRIDE
{
*aSnap = false;
return nsRect();
}
nsRect GetHitRegionBounds(nsDisplayListBuilder* aBuilder, bool* aSnap)
{
*aSnap = false;
return mHitRegion.GetBounds().Union(mMaybeHitRegion.GetBounds());

View File

@ -1849,7 +1849,7 @@ test-pref(dom.webcomponents.enabled,true) == 1066554-1.html 1066554-1-ref.html
== 1069716-1.html 1069716-1-ref.html
== 1078262-1.html about:blank
test-pref(layout.testing.overlay-scrollbars.always-visible,false) == 1081072-1.html 1081072-1-ref.html
fuzzy-if(B2G,128,75) == 1081185-1.html 1081185-1-ref.html # fuzzy with event-regions, see bug 1107843
== 1081185-1.html 1081185-1-ref.html
== 1097437-1.html 1097437-1-ref.html
== 1103258-1.html 1103258-1-ref.html # assertion crash test with layers culling test
== 1105137-1.html 1105137-1-ref.html