Bug 656749. Only optimize away zero-opacity elements when we're painting, not for any other kind of display list construction such as plugin geometry. r=tnikkel

This commit is contained in:
Robert O'Callahan 2011-05-23 12:28:47 +12:00
parent ab1023ee7a
commit b31c5d7b30
4 changed files with 14 additions and 8 deletions

View File

@ -99,6 +99,7 @@ _MOCHITEST_FILES = \
307-xo-redirect.sjs \
test_redirect_handling.html \
test_clear_site_data.html \
test_zero_opacity.html \
$(NULL)
# test_plugin_scroll_painting.html \ bug 596491

View File

@ -17,6 +17,12 @@
var p = document.getElementById('theplugin');
function startTest() {
if (!p.hasWidget()) {
todo(false, "This test is only relevant for windowed plugins");
SimpleTest.finish();
return;
}
// Wait for the plugin to have painted once.
var interval = setInterval(function() {
if (!p.getPaintCount())
@ -29,10 +35,6 @@
}
function doTest() {
if (!p.hasWidget()) {
todo(false, "This test is only relevant for windowed plugins");
return;
}
is(p.getClipRegionRectCount(), 1, "getClipRegionRectCount should be a single rect");
is(p.getClipRegionRectEdge(0,2) - p.getClipRegionRectEdge(0,0), 100, "width of clip region rect");
is(p.getClipRegionRectEdge(0,3) - p.getClipRegionRectEdge(0,1), 50, "height of clip region rect");

View File

@ -432,9 +432,12 @@ TreatAsOpaque(nsDisplayItem* aItem, nsDisplayListBuilder* aBuilder,
{
nsRegion opaque = aItem->GetOpaqueRegion(aBuilder, aTransparentBackground);
if (aBuilder->IsForPluginGeometry()) {
// Treat all chrome items as opaque
// Treat all chrome items as opaque, unless their frames are opacity:0.
// Since opacity:0 frames generate an nsDisplayOpacity, that item will
// not be treated as opaque here, so opacity:0 chrome content will be
// effectively ignored, as it should be.
nsIFrame* f = aItem->GetUnderlyingFrame();
if (f && f->PresContext()->IsChrome()) {
if (f && f->PresContext()->IsChrome() && f->GetStyleDisplay()->mOpacity != 0.0) {
opaque = aItem->GetBounds(aBuilder);
}
}

View File

@ -1466,8 +1466,8 @@ nsIFrame::BuildDisplayListForStackingContext(nsDisplayListBuilder* aBuilder,
nsRect absPosClip;
const nsStyleDisplay* disp = GetStyleDisplay();
// We can stop right away if this is a zero-opacity stacking context and
// we're not checking for event handling.
if (disp->mOpacity == 0.0 && !aBuilder->IsForEventDelivery())
// we're painting.
if (disp->mOpacity == 0.0 && aBuilder->IsForPainting())
return NS_OK;
PRBool applyAbsPosClipping =