Bug 710774 - Qt needs to dispatch DID_PAINT events. r=roc

--HG--
extra : rebase_source : 5355334cc90b93d4812281893c59b123f96f425d
This commit is contained in:
Oleg Romashin 2012-03-19 21:16:57 +01:00
Родитель 3dddf2a029
Коммит 190a7e0c41
1 изменённых файлов: 25 добавлений и 1 удалений

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

@ -1028,6 +1028,14 @@ GetSurfaceForQWidget(QWidget* aDrawable)
}
#endif
static void
DispatchDidPaint(nsIWidget* aWidget)
{
nsEventStatus status;
nsPaintEvent didPaintEvent(true, NS_DID_PAINT, aWidget);
aWidget->DispatchEvent(&didPaintEvent, status);
}
nsEventStatus
nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, QWidget* aWidget)
{
@ -1037,6 +1045,15 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, Q
return nsEventStatus_eIgnore;
}
// Dispatch WILL_PAINT to allow scripts etc. to run before we
// dispatch PAINT
{
nsEventStatus status;
nsPaintEvent willPaintEvent(true, NS_WILL_PAINT, this);
willPaintEvent.willSendDidPaint = true;
DispatchEvent(&willPaintEvent, status);
}
if (!mWidget)
return nsEventStatus_eIgnore;
@ -1061,7 +1078,9 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, Q
}
if (GetLayerManager(nsnull)->GetBackendType() == LayerManager::LAYERS_OPENGL) {
aPainter->beginNativePainting();
nsPaintEvent event(true, NS_PAINT, this);
event.willSendDidPaint = true;
event.refPoint.x = r.x();
event.refPoint.y = r.y();
event.region = nsIntRegion(rect);
@ -1078,7 +1097,10 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, Q
SetWorldTransform(matr);
#endif //MOZ_ENABLE_QTMOBILITY
return DispatchEvent(&event);
status = DispatchEvent(&event);
aPainter->endNativePainting();
DispatchDidPaint(this);
return status;
}
gfxQtPlatform::RenderMode renderMode = gfxQtPlatform::GetPlatform()->GetRenderMode();
@ -1128,6 +1150,7 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, Q
}
nsPaintEvent event(true, NS_PAINT, this);
event.willSendDidPaint = true;
event.refPoint.x = rect.x;
event.refPoint.y = rect.y;
event.region = nsIntRegion(rect);
@ -1206,6 +1229,7 @@ nsWindow::DoPaint(QPainter* aPainter, const QStyleOptionGraphicsItem* aOption, Q
ctx = nsnull;
targetSurface = nsnull;
DispatchDidPaint(this);
// check the return value!
return status;