Bug 826817. Part 2: Remove will-send-did-paint and did-send-will-paint flags from nsIWidgetListener::PaintWindow. r=tnikkel

This commit is contained in:
Robert O'Callahan 2013-01-28 13:34:06 -06:00
parent 1664912887
commit ff003c47b7
9 changed files with 21 additions and 29 deletions

View File

@ -638,7 +638,7 @@ void nsViewManager::WillPaintWindow(nsIWidget* aWidget, bool aWillSendDidPaint)
bool nsViewManager::PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion,
uint32_t aFlags)
{
{
if (!aWidget || !mContext)
return false;
@ -649,7 +649,7 @@ bool nsViewManager::PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion,
// destroyed it during CallWillPaintOnObservers (bug 378273).
nsView* view = nsView::GetViewFor(aWidget);
if (view && !aRegion.IsEmpty()) {
Refresh(view, aRegion, (aFlags & nsIWidgetListener::WILL_SEND_DID_PAINT));
Refresh(view, aRegion, true);
}
return true;

View File

@ -1026,8 +1026,7 @@ nsWindow::DrawTo(gfxASurface *targetSurface, const nsIntRect &invalidRect)
AutoLayerManagerSetup
setupLayerManager(this, ctx, mozilla::layers::BUFFER_NONE);
painted = mWidgetListener->PaintWindow(this, region,
nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT);
painted = mWidgetListener->PaintWindow(this, region, 0);
}
// XXX uhh.. we can't just ignore this because we no longer have
@ -1047,8 +1046,7 @@ nsWindow::DrawTo(gfxASurface *targetSurface, const nsIntRect &invalidRect)
static_cast<mozilla::layers::LayerManagerOGL*>(GetLayerManager(nullptr))->
SetClippingRegion(nsIntRegion(boundsRect));
painted = mWidgetListener->PaintWindow(this, region,
nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT);
painted = mWidgetListener->PaintWindow(this, region, 0);
break;
}

View File

@ -1507,8 +1507,7 @@ bool nsChildView::PaintWindow(nsIntRegion aRegion, bool aIsAlternate)
bool returnValue = false;
bool oldDispatchPaint = mIsDispatchPaint;
mIsDispatchPaint = true;
uint32_t flags =
nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT;
uint32_t flags = 0;
if (aIsAlternate) {
flags |= nsIWidgetListener::PAINT_IS_ALTERNATE;
}

View File

@ -235,8 +235,7 @@ nsWindow::DoDraw(void)
listener = gWindowToRedraw->GetWidgetListener();
if (listener) {
listener->PaintWindow(gWindowToRedraw, region,
nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT);
listener->PaintWindow(gWindowToRedraw, region, 0);
}
} else if (mozilla::layers::LAYERS_BASIC == lm->GetBackendType()) {
MOZ_ASSERT(sFramebufferOpen || sUsingOMTC);
@ -259,8 +258,7 @@ nsWindow::DoDraw(void)
listener = gWindowToRedraw->GetWidgetListener();
if (listener) {
listener->PaintWindow(gWindowToRedraw, region,
nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT);
listener->PaintWindow(gWindowToRedraw, region, 0);
}
}

View File

@ -2127,7 +2127,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
nsBaseWidget::AutoLayerManagerSetup
setupLayerManager(this, ctx, mozilla::layers::BUFFER_NONE);
listener->PaintWindow(this, region, nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT);
listener->PaintWindow(this, region, 0);
listener->DidPaintWindow();
g_free(rects);
@ -2137,7 +2137,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
LayerManagerOGL *manager = static_cast<LayerManagerOGL*>(GetLayerManager());
manager->SetClippingRegion(region);
listener->PaintWindow(this, region, nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT);
listener->PaintWindow(this, region, 0);
listener->DidPaintWindow();
g_free(rects);
@ -2200,7 +2200,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
bool painted = false;
{
AutoLayerManagerSetup setupLayerManager(this, ctx, layerBuffering);
painted = listener->PaintWindow(this, region, nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT);
painted = listener->PaintWindow(this, region, 0);
}
#ifdef MOZ_X11

View File

@ -115,7 +115,7 @@ public:
/*
* Indicate that a paint is about to occur on this window. This is called
* at a time when it's OK to change the geometry of this widget or of
* other widgets.
* other widgets. Must be called before every call to PaintWindow.
*/
virtual void WillPaintWindow(nsIWidget* aWidget, bool aWillSendDidPaint) { }
@ -126,9 +126,7 @@ public:
* this widget or of other widgets.
*/
enum {
SENT_WILL_PAINT = 1 << 0, /* WillPaintWindow has already been called */
WILL_SEND_DID_PAINT = 1 << 1, /* A call to DidPaintWindow will be made afterwards. */
PAINT_IS_ALTERNATE = 1 << 2 /* We are painting something other than the normal widget */
PAINT_IS_ALTERNATE = 1 << 0 /* We are painting something other than the normal widget */
};
virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion, uint32_t aFlags) { return false; }
@ -136,6 +134,7 @@ public:
* Indicates that a paint occurred.
* This is called at a time when it is OK to change the geometry of
* this widget or of other widgets.
* Must be called after every call to PaintWindow.
*/
virtual void DidPaintWindow() { }

View File

@ -1077,7 +1077,7 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, Q
#endif //MOZ_ENABLE_QTMOBILITY
if (mWidgetListener)
painted = mWidgetListener->PaintWindow(this, region, nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT);
painted = mWidgetListener->PaintWindow(this, region, 0);
aPainter->endNativePainting();
if (mWidgetListener)
mWidgetListener->DidPaintWindow();
@ -1135,7 +1135,7 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, Q
setupLayerManager(this, ctx, mozilla::layers::BUFFER_NONE);
if (mWidgetListener) {
nsIntRegion region(rect);
painted = mWidgetListener->PaintWindow(this, region, nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT);
painted = mWidgetListener->PaintWindow(this, region, 0);
}
}

View File

@ -397,7 +397,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
{
AutoLayerManagerSetup
setupLayerManager(this, thebesContext, doubleBuffering);
result = listener->PaintWindow(this, region, nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT);
result = listener->PaintWindow(this, region, 0);
}
#ifdef MOZ_XUL
@ -512,7 +512,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
case LAYERS_OPENGL:
static_cast<mozilla::layers::LayerManagerOGL*>(GetLayerManager())->
SetClippingRegion(region);
result = listener->PaintWindow(this, region, nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT);
result = listener->PaintWindow(this, region, 0);
break;
#ifdef MOZ_ENABLE_D3D9_LAYER
case LAYERS_D3D9:
@ -520,7 +520,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
nsRefPtr<LayerManagerD3D9> layerManagerD3D9 =
static_cast<mozilla::layers::LayerManagerD3D9*>(GetLayerManager());
layerManagerD3D9->SetClippingRegion(region);
result = listener->PaintWindow(this, region, nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT);
result = listener->PaintWindow(this, region, 0);
if (layerManagerD3D9->DeviceWasRemoved()) {
mLayerManager->Destroy();
mLayerManager = nullptr;
@ -540,7 +540,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
if (layerManagerD3D10->device() != gfxWindowsPlatform::GetPlatform()->GetD3D10Device()) {
Invalidate();
} else {
result = listener->PaintWindow(this, region, nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT);
result = listener->PaintWindow(this, region, 0);
}
}
break;

View File

@ -530,16 +530,14 @@ PuppetWidget::Paint()
#endif
if (mozilla::layers::LAYERS_D3D10 == mLayerManager->GetBackendType()) {
mAttachedWidgetListener->PaintWindow(this, region,
nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT);
mAttachedWidgetListener->PaintWindow(this, region, 0);
} else {
nsRefPtr<gfxContext> ctx = new gfxContext(mSurface);
ctx->Rectangle(gfxRect(0,0,0,0));
ctx->Clip();
AutoLayerManagerSetup setupLayerManager(this, ctx,
BUFFER_NONE);
mAttachedWidgetListener->PaintWindow(this, region,
nsIWidgetListener::SENT_WILL_PAINT | nsIWidgetListener::WILL_SEND_DID_PAINT);
mAttachedWidgetListener->PaintWindow(this, region, 0);
mTabChild->NotifyPainted();
}
}