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
parent 8784fd1eba
commit 816a0cfc94
2 changed files with 43 additions and 0 deletions

View File

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

View File

@ -1232,6 +1232,40 @@ NS_IMETHODIMP nsChildView::GetPluginClipRect(nsIntRect& outClipRect, nsIntPoint&
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_OBJC_BEGIN_TRY_ABORT_BLOCK_NSRESULT;
@ -2556,6 +2590,13 @@ NSEvent* gLastDragMouseDownEvent = nil;
!isVisible)
return;
#ifndef NP_NO_QUICKDRAW
if (mIsPluginView && mPluginDrawingModel == NPDrawingModelQuickDraw) {
mGeckoChild->PaintQD();
return;
}
#endif
#ifdef DEBUG_UPDATE
nsIntRect geckoBounds;
mGeckoChild->GetBounds(geckoBounds);