Bug 597268. Paint QuickDraw plugins differently to make them not flicker on scrolling. r=roc,josh a=b

This commit is contained in:
Jeff Muizelaar 2010-09-17 10:58:26 -07:00
Родитель 013530df13
Коммит 46fe63d710
2 изменённых файлов: 43 добавлений и 0 удалений

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

@ -404,6 +404,8 @@ public:
PRBool IsPluginView() { return (mWindowType == eWindowType_plugin); } PRBool IsPluginView() { return (mWindowType == eWindowType_plugin); }
void PaintQD();
protected: protected:
PRBool ReportDestroyEvent(); PRBool ReportDestroyEvent();

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

@ -1232,6 +1232,40 @@ NS_IMETHODIMP nsChildView::GetPluginClipRect(nsIntRect& outClipRect, nsIntPoint&
NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT; NS_OBJC_END_TRY_ABORT_BLOCK_NSRESULT;
} }
#ifndef NP_NO_CARBON
static void InitializeEventRecord(EventRecord* event, Point* aMousePosition)
{
memset(event, 0, sizeof(EventRecord));
if (aMousePosition) {
event->where = *aMousePosition;
} else {
::GetGlobalMouse(&event->where);
}
event->when = ::TickCount();
event->modifiers = ::GetCurrentKeyModifiers();
}
#endif
void nsChildView::PaintQD()
{
#ifndef NP_NO_CARBON
void *pluginPort = this->GetNativeData(NS_NATIVE_PLUGIN_PORT_QD);
void *window = ::GetWindowFromPort(static_cast<NP_Port*>(pluginPort)->port);
NS_SUCCEEDED(StartDrawPlugin());
EventRecord updateEvent;
InitializeEventRecord(&updateEvent, nsnull);
updateEvent.what = updateEvt;
updateEvent.message = UInt32(window);
nsCOMPtr<nsIPluginInstance> instance;
mPluginInstanceOwner->GetInstance(*getter_AddRefs(instance));
instance->HandleEvent(&updateEvent, nsnull);
EndDrawPlugin();
#endif
}
NS_IMETHODIMP nsChildView::StartDrawPlugin() NS_IMETHODIMP nsChildView::StartDrawPlugin()
{ {
NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT; NS_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -2556,6 +2590,13 @@ NSEvent* gLastDragMouseDownEvent = nil;
!isVisible) !isVisible)
return; return;
#ifndef NP_NO_QUICKDRAW
if (mIsPluginView && mPluginDrawingModel == NPDrawingModelQuickDraw) {
mGeckoChild->PaintQD();
return;
}
#endif
#ifdef DEBUG_UPDATE #ifdef DEBUG_UPDATE
nsIntRect geckoBounds; nsIntRect geckoBounds;
mGeckoChild->GetBounds(geckoBounds); mGeckoChild->GetBounds(geckoBounds);