Bug 676241 part 8: Remove alternate layer manager handling. r=mattwoodrow

This commit is contained in:
Markus Stange 2013-05-23 16:49:18 +02:00
Родитель 5a0070db14
Коммит 450dc8aa87
21 изменённых файлов: 32 добавлений и 71 удалений

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

@ -1687,7 +1687,7 @@ void nsWebBrowser::WindowLowered(nsIWidget* aWidget)
Deactivate();
}
bool nsWebBrowser::PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion, uint32_t aFlags)
bool nsWebBrowser::PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion)
{
LayerManager* layerManager = aWidget->GetLayerManager();
NS_ASSERTION(layerManager, "Must be in paint event");

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

@ -124,7 +124,7 @@ protected:
// nsIWidgetListener
virtual void WindowRaised(nsIWidget* aWidget);
virtual void WindowLowered(nsIWidget* aWidget);
virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion, uint32_t aFlags) MOZ_OVERRIDE;
virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion) MOZ_OVERRIDE;
protected:
nsDocShellTreeOwner* mDocShellTreeOwner;

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

@ -1144,7 +1144,7 @@ void nsDisplayList::PaintForFrame(nsDisplayListBuilder* aBuilder,
BuildContainerLayerFor(aBuilder, layerManager, aForFrame, nullptr, *this,
containerParameters, nullptr);
if (widgetTransaction && !(aFlags & PAINT_NO_CLEAR_INVALIDATIONS)) {
if (widgetTransaction) {
aForFrame->ClearInvalidationStateBits();
}

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

@ -1478,8 +1478,7 @@ public:
PAINT_USE_WIDGET_LAYERS = 0x01,
PAINT_FLUSH_LAYERS = 0x02,
PAINT_EXISTING_TRANSACTION = 0x04,
PAINT_NO_COMPOSITE = 0x08,
PAINT_NO_CLEAR_INVALIDATIONS = 0x10
PAINT_NO_COMPOSITE = 0x08
};
void PaintRoot(nsDisplayListBuilder* aBuilder, nsRenderingContext* aCtx,
uint32_t aFlags) const;

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

@ -2089,9 +2089,6 @@ nsLayoutUtils::PaintFrame(nsRenderingContext* aRenderingContext, nsIFrame* aFram
if (aFlags & PAINT_NO_COMPOSITE) {
flags |= nsDisplayList::PAINT_NO_COMPOSITE;
}
if (aFlags & PAINT_NO_CLEAR_INVALIDATIONS) {
flags |= nsDisplayList::PAINT_NO_CLEAR_INVALIDATIONS;
}
list.PaintRoot(&builder, aRenderingContext, flags);

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

@ -676,8 +676,7 @@ public:
PAINT_ALL_CONTINUATIONS = 0x40,
PAINT_TO_WINDOW = 0x80,
PAINT_EXISTING_TRANSACTION = 0x100,
PAINT_NO_COMPOSITE = 0x200,
PAINT_NO_CLEAR_INVALIDATIONS = 0x400
PAINT_NO_COMPOSITE = 0x200
};
/**

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

@ -5576,9 +5576,6 @@ PresShell::Paint(nsView* aViewToPaint,
if (!(aFlags & PAINT_COMPOSITE)) {
flags |= nsLayoutUtils::PAINT_NO_COMPOSITE;
}
if (aViewToPaint->InAlternatePaint()) {
flags |= nsLayoutUtils::PAINT_NO_CLEAR_INVALIDATIONS;
}
if (frame) {
// Defer invalidates that are triggered during painting, and discard

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

@ -290,18 +290,9 @@ public:
bool HasWidget() const { return mWindow != nullptr; }
void SetForcedRepaint(bool aForceRepaint) {
if (!mInAlternatePaint) {
mForcedRepaint = aForceRepaint;
}
mForcedRepaint = aForceRepaint;
}
/**
* Returns true if the view is currently painting
* into an alternate destination, such as the titlebar
* area on OSX.
*/
bool InAlternatePaint() { return mInAlternatePaint; }
/**
* Make aWidget direct its events to this view.
* The caller must call DetachWidgetEventHandler before this view
@ -381,7 +372,7 @@ public:
virtual bool WindowResized(nsIWidget* aWidget, int32_t aWidth, int32_t aHeight) MOZ_OVERRIDE;
virtual bool RequestWindowClose(nsIWidget* aWidget) MOZ_OVERRIDE;
virtual void WillPaintWindow(nsIWidget* aWidget) MOZ_OVERRIDE;
virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion, uint32_t aFlags) MOZ_OVERRIDE;
virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion) MOZ_OVERRIDE;
virtual void DidPaintWindow() MOZ_OVERRIDE;
virtual void RequestRepaint() MOZ_OVERRIDE;
virtual nsEventStatus HandleEvent(nsGUIEvent* aEvent, bool aUseAttachedEvents) MOZ_OVERRIDE;
@ -476,7 +467,6 @@ private:
uint32_t mVFlags;
bool mWidgetIsTopLevel;
bool mForcedRepaint;
bool mInAlternatePaint;
};
#endif

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

@ -380,8 +380,7 @@ private:
bool IsPaintingAllowed() { return RootViewManager()->mRefreshDisableCount == 0; }
void WillPaintWindow(nsIWidget* aWidget);
bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion,
uint32_t aFlags);
bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion);
void DidPaintWindow();
// Call this when you need to let the viewmanager know that it now has

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

@ -32,7 +32,6 @@ nsView::nsView(nsViewManager* aViewManager, nsViewVisibility aVisibility)
mViewManager = aViewManager;
mDirtyRegion = nullptr;
mWidgetIsTopLevel = false;
mInAlternatePaint = false;
}
void nsView::DropMouseGrabbing()
@ -998,19 +997,12 @@ nsView::WillPaintWindow(nsIWidget* aWidget)
}
bool
nsView::PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion, uint32_t aFlags)
nsView::PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion)
{
NS_ASSERTION(this == nsView::GetViewFor(aWidget), "wrong view for widget?");
mInAlternatePaint = aFlags & PAINT_IS_ALTERNATE;
nsRefPtr<nsViewManager> vm = mViewManager;
bool result = vm->PaintWindow(aWidget, aRegion, aFlags);
// PaintWindow can destroy this via WillPaintWindow notification, so we have
// to re-get the view from the widget.
nsView* view = nsView::GetViewFor(aWidget);
if (view) {
view->mInAlternatePaint = false;
}
bool result = vm->PaintWindow(aWidget, aRegion);
return result;
}

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

@ -397,7 +397,6 @@ void nsViewManager::ProcessPendingUpdatesForView(nsView* aView,
#endif
nsAutoScriptBlocker scriptBlocker;
NS_ASSERTION(aView->HasWidget(), "Must have a widget!");
aView->GetWidget()->WillPaint();
SetPainting(true);
mPresShell->Paint(aView, nsRegion(),
nsIPresShell::PAINT_LAYERS);
@ -639,8 +638,7 @@ void nsViewManager::WillPaintWindow(nsIWidget* aWidget)
}
}
bool nsViewManager::PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion,
uint32_t aFlags)
bool nsViewManager::PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion)
{
if (!aWidget || !mContext)
return false;

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

@ -981,13 +981,13 @@ nsWindow::DrawTo(gfxASurface *targetSurface, const nsIntRect &invalidRect)
AutoLayerManagerSetup
setupLayerManager(this, ctx, mozilla::layers::BUFFER_NONE);
mWidgetListener->PaintWindow(this, region, 0);
mWidgetListener->PaintWindow(this, region);
}
break;
}
case mozilla::layers::LAYERS_CLIENT: {
mWidgetListener->PaintWindow(this, region, 0);
mWidgetListener->PaintWindow(this, region);
break;
}
@ -996,7 +996,7 @@ nsWindow::DrawTo(gfxASurface *targetSurface, const nsIntRect &invalidRect)
static_cast<mozilla::layers::LayerManagerOGL*>(GetLayerManager(nullptr))->
SetClippingRegion(nsIntRegion(boundsRect));
mWidgetListener->PaintWindow(this, region, 0);
mWidgetListener->PaintWindow(this, region);
break;
}

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

@ -1539,7 +1539,7 @@ bool nsChildView::PaintWindow(nsIntRegion aRegion)
bool returnValue = false;
bool oldDispatchPaint = mIsDispatchPaint;
mIsDispatchPaint = true;
returnValue = listener->PaintWindow(widget, aRegion, 0);
returnValue = listener->PaintWindow(widget, aRegion);
listener = widget->GetWidgetListener();
if (listener) {

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

@ -227,7 +227,7 @@ nsWindow::DoDraw(void)
listener = gWindowToRedraw->GetWidgetListener();
if (listener) {
listener->PaintWindow(gWindowToRedraw, region, 0);
listener->PaintWindow(gWindowToRedraw, region);
}
} else if (mozilla::layers::LAYERS_CLIENT == lm->GetBackendType()) {
// No need to do anything, the compositor will handle drawing
@ -252,7 +252,7 @@ nsWindow::DoDraw(void)
listener = gWindowToRedraw->GetWidgetListener();
if (listener) {
listener->PaintWindow(gWindowToRedraw, region, 0);
listener->PaintWindow(gWindowToRedraw, region);
}
}

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

@ -2135,7 +2135,7 @@ nsWindow::OnExposeEvent(cairo_t *cr)
LayerManagerOGL *manager = static_cast<LayerManagerOGL*>(GetLayerManager());
manager->SetClippingRegion(region);
listener->PaintWindow(this, region, 0);
listener->PaintWindow(this, region);
listener->DidPaintWindow();
g_free(rects);
@ -2199,11 +2199,11 @@ nsWindow::OnExposeEvent(cairo_t *cr)
{
if (GetLayerManager()->GetBackendType() == LAYERS_BASIC) {
AutoLayerManagerSetup setupLayerManager(this, ctx, layerBuffering);
painted = listener->PaintWindow(this, region, 0);
painted = listener->PaintWindow(this, region);
} else if (GetLayerManager()->GetBackendType() == LAYERS_CLIENT) {
ClientLayerManager *manager = static_cast<ClientLayerManager*>(GetLayerManager());
manager->SetShadowTarget(ctx);
painted = listener->PaintWindow(this, region, 0);
painted = listener->PaintWindow(this, region);
}
}

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

@ -92,8 +92,8 @@ typedef nsEventStatus (* EVENT_CALLBACK)(nsGUIEvent *event);
#endif
#define NS_IWIDGET_IID \
{ 0x37b67cb4, 0x140c, 0x4d46, \
{ 0xa9, 0xf8, 0x28, 0xcc, 0x08, 0x3d, 0x1f, 0x54 } }
{ 0xa7d1e8d4, 0xe2c1, 0x45cb, \
{ 0xab, 0x72, 0xb3, 0xe9, 0xf9, 0xcc, 0xb2, 0xce } }
/*
* Window shadow styles
@ -1658,13 +1658,6 @@ class nsIWidget : public nsISupports {
return !bounds.IsEmpty();
}
/**
* This function is called by nsViewManager right before the retained layer
* tree for this widget is about to be updated, and any required
* ThebesLayer painting occurs.
*/
virtual void WillPaint() { }
/**
* Get the natural bounds of this widget. This method is only
* meaningful for widgets for which Gecko implements screen

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

@ -125,10 +125,7 @@ public:
* This is called at a time when it is not OK to change the geometry of
* this widget or of other widgets.
*/
enum {
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; }
virtual bool PaintWindow(nsIWidget* aWidget, nsIntRegion aRegion) { return false; }
/**
* Indicates that a paint occurred.

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

@ -1077,7 +1077,7 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, Q
#endif //MOZ_ENABLE_QTMOBILITY
if (mWidgetListener)
painted = mWidgetListener->PaintWindow(this, region, 0);
painted = mWidgetListener->PaintWindow(this, region);
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, 0);
painted = mWidgetListener->PaintWindow(this, region);
}
}

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

@ -397,7 +397,7 @@ bool nsWindow::OnPaint(HDC aDC, uint32_t aNestingLevel)
{
AutoLayerManagerSetup
setupLayerManager(this, thebesContext, doubleBuffering);
result = listener->PaintWindow(this, region, 0);
result = listener->PaintWindow(this, region);
}
#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, 0);
result = listener->PaintWindow(this, region);
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, 0);
result = listener->PaintWindow(this, region);
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, 0);
result = listener->PaintWindow(this, region);
}
}
break;

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

@ -935,7 +935,7 @@ void MetroWidget::Paint(const nsIntRegion& aInvalidRegion)
if (!listener)
return;
listener->PaintWindow(this, aInvalidRegion, 0);
listener->PaintWindow(this, aInvalidRegion);
listener = GetPaintListener();
if (!listener)

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

@ -570,7 +570,7 @@ PuppetWidget::Paint()
#endif
if (mozilla::layers::LAYERS_D3D10 == mLayerManager->GetBackendType()) {
mAttachedWidgetListener->PaintWindow(this, region, 0);
mAttachedWidgetListener->PaintWindow(this, region);
} else if (mozilla::layers::LAYERS_CLIENT == mLayerManager->GetBackendType()) {
// Do nothing, the compositor will handle drawing
if (mTabChild) {
@ -582,7 +582,7 @@ PuppetWidget::Paint()
ctx->Clip();
AutoLayerManagerSetup setupLayerManager(this, ctx,
BUFFER_NONE);
mAttachedWidgetListener->PaintWindow(this, region, 0);
mAttachedWidgetListener->PaintWindow(this, region);
if (mTabChild) {
mTabChild->NotifyPainted();
}