From ff003c47b7ae05920bc359a9e18415f359fd7c70 Mon Sep 17 00:00:00 2001 From: Robert O'Callahan Date: Mon, 28 Jan 2013 13:34:06 -0600 Subject: [PATCH] Bug 826817. Part 2: Remove will-send-did-paint and did-send-will-paint flags from nsIWidgetListener::PaintWindow. r=tnikkel --- view/src/nsViewManager.cpp | 4 ++-- widget/android/nsWindow.cpp | 6 ++---- widget/cocoa/nsChildView.mm | 3 +-- widget/gonk/nsWindow.cpp | 6 ++---- widget/gtk2/nsWindow.cpp | 6 +++--- widget/nsIWidgetListener.h | 7 +++---- widget/qt/nsWindow.cpp | 4 ++-- widget/windows/nsWindowGfx.cpp | 8 ++++---- widget/xpwidgets/PuppetWidget.cpp | 6 ++---- 9 files changed, 21 insertions(+), 29 deletions(-) diff --git a/view/src/nsViewManager.cpp b/view/src/nsViewManager.cpp index 1ebbf1d5357..932201ddb37 100644 --- a/view/src/nsViewManager.cpp +++ b/view/src/nsViewManager.cpp @@ -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; diff --git a/widget/android/nsWindow.cpp b/widget/android/nsWindow.cpp index 8453b496d4c..b8cc38923b2 100644 --- a/widget/android/nsWindow.cpp +++ b/widget/android/nsWindow.cpp @@ -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(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; } diff --git a/widget/cocoa/nsChildView.mm b/widget/cocoa/nsChildView.mm index aad74dacb91..4ab7e87bed0 100644 --- a/widget/cocoa/nsChildView.mm +++ b/widget/cocoa/nsChildView.mm @@ -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; } diff --git a/widget/gonk/nsWindow.cpp b/widget/gonk/nsWindow.cpp index 7c656729528..017b7e8728a 100644 --- a/widget/gonk/nsWindow.cpp +++ b/widget/gonk/nsWindow.cpp @@ -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); } } diff --git a/widget/gtk2/nsWindow.cpp b/widget/gtk2/nsWindow.cpp index aece5462334..ba04ee2896f 100644 --- a/widget/gtk2/nsWindow.cpp +++ b/widget/gtk2/nsWindow.cpp @@ -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(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 diff --git a/widget/nsIWidgetListener.h b/widget/nsIWidgetListener.h index 0bd47900621..75b663f18a3 100644 --- a/widget/nsIWidgetListener.h +++ b/widget/nsIWidgetListener.h @@ -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() { } diff --git a/widget/qt/nsWindow.cpp b/widget/qt/nsWindow.cpp index a25d4c94969..3e5c27f0655 100644 --- a/widget/qt/nsWindow.cpp +++ b/widget/qt/nsWindow.cpp @@ -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); } } diff --git a/widget/windows/nsWindowGfx.cpp b/widget/windows/nsWindowGfx.cpp index 354d1361928..47d3c43b447 100644 --- a/widget/windows/nsWindowGfx.cpp +++ b/widget/windows/nsWindowGfx.cpp @@ -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(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 = static_cast(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; diff --git a/widget/xpwidgets/PuppetWidget.cpp b/widget/xpwidgets/PuppetWidget.cpp index 6cd8e3327c6..e8c1b3ca9d8 100644 --- a/widget/xpwidgets/PuppetWidget.cpp +++ b/widget/xpwidgets/PuppetWidget.cpp @@ -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 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(); } }