Bug 1022612. Part 35: nsDisplayPluginReadback doesn't need to hack visible regions anymore. r=mattwoodrow

One nice bit of fallout from this bug is that handling plugin background
readback is simplified. We no longer have to fiddle with display item
visibility calculations; only layer occlusion culling has to know about
readback.

--HG--
extra : rebase_source : c735f4cb964d659b6778f5b43fa2e2b4c8f83933
This commit is contained in:
Robert O'Callahan 2014-06-23 16:24:14 +12:00
parent 9de5b60bcb
commit a7a227d36d

View File

@ -839,6 +839,12 @@ nsObjectFrame::PaintPrintPlugin(nsIFrame* aFrame, nsRenderingContext* aCtx,
static_cast<nsObjectFrame*>(aFrame)->PrintPlugin(*aCtx, aDirtyRect);
}
/**
* nsDisplayPluginReadback creates an active ReadbackLayer. The ReadbackLayer
* obtains from the compositor the contents of the window underneath
* the ReadbackLayer, which we then use as an opaque buffer for plugins to
* asynchronously draw onto.
*/
class nsDisplayPluginReadback : public nsDisplayItem {
public:
nsDisplayPluginReadback(nsDisplayListBuilder* aBuilder, nsIFrame* aFrame)
@ -854,9 +860,6 @@ public:
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
bool* aSnap) MOZ_OVERRIDE;
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) MOZ_OVERRIDE;
NS_DISPLAY_DECL_NAME("PluginReadback", TYPE_PLUGIN_READBACK)
@ -889,25 +892,6 @@ nsDisplayPluginReadback::GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap)
return GetDisplayItemBounds(aBuilder, this, mFrame);
}
bool
nsDisplayPluginReadback::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion)
{
if (!nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion,
aAllowVisibleRegionExpansion))
return false;
nsRect expand;
bool snap;
expand.IntersectRect(aAllowVisibleRegionExpansion, GetBounds(aBuilder, &snap));
// *Add* our bounds to the visible region so that stuff underneath us is
// likely to be made visible, so we can use it for a background! This is
// a bit crazy since we normally only subtract from the visible region.
aVisibleRegion->Or(*aVisibleRegion, expand);
return true;
}
#ifdef MOZ_WIDGET_ANDROID
class nsDisplayPluginVideo : public nsDisplayItem {
@ -925,9 +909,6 @@ public:
virtual nsRect GetBounds(nsDisplayListBuilder* aBuilder,
bool* aSnap) MOZ_OVERRIDE;
virtual bool ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion) MOZ_OVERRIDE;
NS_DISPLAY_DECL_NAME("PluginVideo", TYPE_PLUGIN_VIDEO)
@ -958,15 +939,6 @@ nsDisplayPluginVideo::GetBounds(nsDisplayListBuilder* aBuilder, bool* aSnap)
return GetDisplayItemBounds(aBuilder, this, mFrame);
}
bool
nsDisplayPluginVideo::ComputeVisibility(nsDisplayListBuilder* aBuilder,
nsRegion* aVisibleRegion,
const nsRect& aAllowVisibleRegionExpansion)
{
return nsDisplayItem::ComputeVisibility(aBuilder, aVisibleRegion,
aAllowVisibleRegionExpansion);
}
#endif
nsRect