Bug 1022612. Part 14: Don't compute a final transparent region anymore. r=mattwoodrow

Computing this via FrameLayerBuilder is some work and we don't really have to.

SuppressComponentAlpha will be true in more cases. This will be OK as long as
text in the chrome window is over opaque content in the same ThebesLayer. We
will miss some edge cases such as text in 'opacity' with no opaque background.
This should be OK.

--HG--
extra : rebase_source : 8ac6abb8f6b3ab078883935688ae1f5059b797c7
This commit is contained in:
Robert O'Callahan 2014-06-09 16:48:00 +12:00
Родитель 2d1cc777ee
Коммит 527a62cc6b
4 изменённых файлов: 6 добавлений и 37 удалений

Просмотреть файл

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

Просмотреть файл

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

Просмотреть файл

@ -460,19 +460,6 @@ public:
*/ */
void MarkPreserve3DFramesForDisplayList(nsIFrame* aDirtyFrame, const nsRect& aDirtyRect); 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; } const nsTArray<ThemeGeometry>& GetThemeGeometries() { return mThemeGeometries; }
/** /**
@ -772,7 +759,6 @@ private:
nsAutoTArray<ThemeGeometry,2> mThemeGeometries; nsAutoTArray<ThemeGeometry,2> mThemeGeometries;
nsDisplayTableItem* mCurrentTableItem; nsDisplayTableItem* mCurrentTableItem;
DisplayListClipState mClipState; DisplayListClipState mClipState;
const nsRegion* mFinalTransparentRegion;
// mCurrentFrame is the frame that we're currently calling (or about to call) // mCurrentFrame is the frame that we're currently calling (or about to call)
// BuildDisplayList on. // BuildDisplayList on.
const nsIFrame* mCurrentFrame; const nsIFrame* mCurrentFrame;

Просмотреть файл

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