diff --git a/dom/plugins/test/mochitest/Makefile.in b/dom/plugins/test/mochitest/Makefile.in index a84d5fe787d..1c655869e7f 100644 --- a/dom/plugins/test/mochitest/Makefile.in +++ b/dom/plugins/test/mochitest/Makefile.in @@ -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 diff --git a/dom/plugins/test/mochitest/test_zero_opacity.html b/dom/plugins/test/mochitest/test_zero_opacity.html index fad5c9db45b..4e9aa7865fe 100644 --- a/dom/plugins/test/mochitest/test_zero_opacity.html +++ b/dom/plugins/test/mochitest/test_zero_opacity.html @@ -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"); diff --git a/layout/base/nsDisplayList.cpp b/layout/base/nsDisplayList.cpp index 010b30f2dc0..8e33c81caa8 100644 --- a/layout/base/nsDisplayList.cpp +++ b/layout/base/nsDisplayList.cpp @@ -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); } } diff --git a/layout/generic/nsFrame.cpp b/layout/generic/nsFrame.cpp index 34f1bce5c12..67cfd9beedb 100644 --- a/layout/generic/nsFrame.cpp +++ b/layout/generic/nsFrame.cpp @@ -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 =