Backed out changeset e95971991caa (bug 1022612)

This commit is contained in:
Carsten "Tomcat" Book 2014-07-15 10:30:32 +02:00
parent 39688f8ca9
commit 029b32a486
4 changed files with 37 additions and 6 deletions

View File

@ -2078,10 +2078,15 @@ ContainerState::PopThebesLayerData()
static bool
SuppressComponentAlpha(nsDisplayListBuilder* aBuilder,
nsDisplayItem* aItem)
nsDisplayItem* aItem,
const nsRect& aComponentAlphaBounds)
{
// Suppress component alpha for items in the toplevel window chrome that
// aren't transformed.
const nsRegion* windowTransparentRegion = aBuilder->GetFinalTransparentRegion();
if (!windowTransparentRegion || windowTransparentRegion->IsEmpty())
return false;
// Suppress component alpha for items in the toplevel window that are over
// the window translucent area
nsIFrame* f = aItem->Frame();
nsIFrame* ref = aBuilder->RootReferenceFrame();
if (f->PresContext() != ref->PresContext())
@ -2091,7 +2096,15 @@ SuppressComponentAlpha(nsDisplayListBuilder* aBuilder,
if (t->IsTransformed())
return false;
}
return true;
return windowTransparentRegion->Intersects(aComponentAlphaBounds);
}
static bool
WindowHasTransparency(nsDisplayListBuilder* aBuilder)
{
const nsRegion* windowTransparentRegion = aBuilder->GetFinalTransparentRegion();
return windowTransparentRegion && !windowTransparentRegion->IsEmpty();
}
void
@ -2191,7 +2204,9 @@ ThebesLayerData::Accumulate(ContainerState* aState,
// Opaque display items in chrome documents whose window is partially
// transparent are always added to the opaque region. This helps ensure
// that we get as much subpixel-AA as possible in the chrome.
if (tmp.GetNumRects() <= 4 || aItem->Frame()->PresContext()->IsChrome()) {
if (tmp.GetNumRects() <= 4 ||
(WindowHasTransparency(aState->mBuilder) &&
aItem->Frame()->PresContext()->IsChrome())) {
mOpaqueRegion = tmp;
}
}
@ -2203,7 +2218,7 @@ ThebesLayerData::Accumulate(ContainerState* aState,
nsIntRect componentAlphaRect =
aState->ScaleToOutsidePixels(componentAlpha, false).Intersect(aVisibleRect);
if (!mOpaqueRegion.Contains(componentAlphaRect)) {
if (SuppressComponentAlpha(aState->mBuilder, aItem)) {
if (SuppressComponentAlpha(aState->mBuilder, aItem, componentAlpha)) {
aItem->DisableComponentAlpha();
} else {
mNeedComponentAlpha = true;

View File

@ -494,6 +494,7 @@ nsDisplayListBuilder::nsDisplayListBuilder(nsIFrame* aReferenceFrame,
mIgnoreScrollFrame(nullptr),
mLayerEventRegions(nullptr),
mCurrentTableItem(nullptr),
mFinalTransparentRegion(nullptr),
mCurrentFrame(aReferenceFrame),
mCurrentReferenceFrame(aReferenceFrame),
mDirtyRect(-1,-1,-1,-1),

View File

@ -460,6 +460,19 @@ public:
*/
void MarkPreserve3DFramesForDisplayList(nsIFrame* aDirtyFrame, const nsRect& aDirtyRect);
/**
* Get the area of the final transparent region.
*/
const nsRegion* GetFinalTransparentRegion() { return mFinalTransparentRegion; }
/**
* Record the area of the final transparent region after all visibility
* calculations were performed.
*/
void SetFinalTransparentRegion(const nsRegion& aFinalTransparentRegion)
{
mFinalTransparentRegion = &aFinalTransparentRegion;
}
const nsTArray<ThemeGeometry>& GetThemeGeometries() { return mThemeGeometries; }
/**
@ -759,6 +772,7 @@ private:
nsAutoTArray<ThemeGeometry,2> mThemeGeometries;
nsDisplayTableItem* mCurrentTableItem;
DisplayListClipState mClipState;
const nsRegion* mFinalTransparentRegion;
// mCurrentFrame is the frame that we're currently calling (or about to call)
// BuildDisplayList on.
const nsIFrame* mCurrentFrame;

View File

@ -2957,6 +2957,7 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
} else if (!(aFlags & PAINT_DOCUMENT_RELATIVE)) {
nsIWidget *widget = aFrame->GetNearestWidget();
if (widget) {
builder.SetFinalTransparentRegion(visibleRegion);
// If we're finished building display list items for painting of the outermost
// pres shell, notify the widget about any toolbars we've encountered.
widget->UpdateThemeGeometries(builder.GetThemeGeometries());