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
SuppressComponentAlpha(nsDisplayListBuilder* aBuilder,
nsDisplayItem* aItem,
const nsRect& aComponentAlphaBounds)
nsDisplayItem* aItem)
{
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
// Suppress component alpha for items in the toplevel window chrome that
// aren't transformed.
nsIFrame* f = aItem->Frame();
nsIFrame* ref = aBuilder->RootReferenceFrame();
if (f->PresContext() != ref->PresContext())
@ -2096,15 +2091,7 @@ SuppressComponentAlpha(nsDisplayListBuilder* aBuilder,
if (t->IsTransformed())
return false;
}
return windowTransparentRegion->Intersects(aComponentAlphaBounds);
}
static bool
WindowHasTransparency(nsDisplayListBuilder* aBuilder)
{
const nsRegion* windowTransparentRegion = aBuilder->GetFinalTransparentRegion();
return windowTransparentRegion && !windowTransparentRegion->IsEmpty();
return true;
}
void
@ -2204,9 +2191,7 @@ 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 ||
(WindowHasTransparency(aState->mBuilder) &&
aItem->Frame()->PresContext()->IsChrome())) {
if (tmp.GetNumRects() <= 4 || aItem->Frame()->PresContext()->IsChrome()) {
mOpaqueRegion = tmp;
}
}
@ -2218,7 +2203,7 @@ ThebesLayerData::Accumulate(ContainerState* aState,
nsIntRect componentAlphaRect =
aState->ScaleToOutsidePixels(componentAlpha, false).Intersect(aVisibleRect);
if (!mOpaqueRegion.Contains(componentAlphaRect)) {
if (SuppressComponentAlpha(aState->mBuilder, aItem, componentAlpha)) {
if (SuppressComponentAlpha(aState->mBuilder, aItem)) {
aItem->DisableComponentAlpha();
} else {
mNeedComponentAlpha = true;

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

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

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

@ -460,19 +460,6 @@ 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; }
/**
@ -772,7 +759,6 @@ 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;

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

@ -2955,7 +2955,6 @@ 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());