Bug 628949 - Update visible region / glass regions after we paint. r=roc a=2.0.

This commit is contained in:
Jim Mathies 2011-02-17 15:42:39 -06:00
parent 03c6bcb459
commit d03eff2194

View File

@ -1526,8 +1526,6 @@ nsLayoutUtils::PaintFrame(nsIRenderingContext* aRenderingContext, nsIFrame* aFra
PRUint32 flags = nsDisplayList::PAINT_DEFAULT;
if (aFlags & PAINT_WIDGET_LAYERS) {
flags |= nsDisplayList::PAINT_USE_WIDGET_LAYERS;
nsIWidget *widget = aFrame->GetNearestWidget();
if (willFlushRetainedLayers) {
// The caller wanted to paint from retained layers, but set up
// the paint in such a way that we can't use them. We're going
@ -1537,17 +1535,15 @@ nsLayoutUtils::PaintFrame(nsIRenderingContext* aRenderingContext, nsIFrame* aFra
// not do this.
NS_WARNING("Flushing retained layers!");
flags |= nsDisplayList::PAINT_FLUSH_LAYERS;
} else if (widget && !(aFlags & PAINT_DOCUMENT_RELATIVE)) {
nsIWidget_MOZILLA_2_0_BRANCH* widget2 =
static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(widget);
PRInt32 pixelRatio = presContext->AppUnitsPerDevPixel();
nsIntRegion visibleWindowRegion(visibleRegion.ToOutsidePixels(pixelRatio));
builder.SetFinalTransparentRegion(visibleRegion);
widget2->UpdateTransparentRegion(visibleWindowRegion);
// If we're finished building display list items for painting of the outermost
// pres shell, notify the widget about any toolbars we've encountered.
widget2->UpdateThemeGeometries(builder.GetThemeGeometries());
} else if (!(aFlags & PAINT_DOCUMENT_RELATIVE)) {
nsIWidget_MOZILLA_2_0_BRANCH *widget2 =
static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(aFrame->GetNearestWidget());
if (widget2) {
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.
widget2->UpdateThemeGeometries(builder.GetThemeGeometries());
}
}
}
if (aFlags & PAINT_EXISTING_TRANSACTION) {
@ -1556,6 +1552,20 @@ nsLayoutUtils::PaintFrame(nsIRenderingContext* aRenderingContext, nsIFrame* aFra
list.PaintRoot(&builder, aRenderingContext, flags);
// Update the widget's transparent region information. This sets
// glass boundaries on Windows.
if ((aFlags & PAINT_WIDGET_LAYERS) &&
!willFlushRetainedLayers &&
!(aFlags & PAINT_DOCUMENT_RELATIVE)) {
nsIWidget_MOZILLA_2_0_BRANCH *widget2 =
static_cast<nsIWidget_MOZILLA_2_0_BRANCH*>(aFrame->GetNearestWidget());
if (widget2) {
PRInt32 pixelRatio = presContext->AppUnitsPerDevPixel();
nsIntRegion visibleWindowRegion(visibleRegion.ToOutsidePixels(presContext->AppUnitsPerDevPixel()));
widget2->UpdateTransparentRegion(visibleWindowRegion);
}
}
#ifdef DEBUG
if (gDumpPaintList) {
fprintf(stderr, "Painting --- after optimization:\n");