nsPluginEvent pluginEvent = { &updateEvent, nsPluginPlatformWindowRef(pluginPort->port) }; PRBool eventHandled = PR_FALSE; mInstance->HandleEvent(&pluginEvent, &eventHandled);
GrafPtr oldPort; ::GetPort(&oldPort); ::SetPort((GrafPtr)pluginPort->port);  nsPluginEvent pluginEvent = { &updateEvent, nsPluginPlatformWindowRef(GetWindowFromPort(pluginPort->port)) }; PRBool eventHandled = PR_FALSE; mInstance->HandleEvent(&pluginEvent, &eventHandled);  ::SetPort(oldPort); }
void nsPluginInstanceOwner::Paint(const nsRect& aDirtyRect, PRUint32 ndc){  if(!mInstance)    return; #ifdef XP_MAC  nsPluginPort* pluginPort = GetPluginPort();#ifdef DO_DIRTY_INTERSECT   // aDirtyRect isn't always correct, see bug 56128  nsPoint rel(aDirtyRect.x, aDirtyRect.y);  nsPoint abs(0,0);  nsCOMPtr<nsIWidget> containerWidget;  // Convert dirty rect relative coordinates to absolute and also get the containerWidget  ConvertRelativeToWindowAbsolute(mOwner, mContext, rel, abs, *getter_AddRefs(containerWidget));  nsRect absDirtyRect = nsRect(abs.x, abs.y, aDirtyRect.width, aDirtyRect.height);  // Convert to absolute pixel values for the dirty rect  nsRect absDirtyRectInPixels;  ConvertTwipsToPixels(*mContext, absDirtyRect, absDirtyRectInPixels);#endif  FixUpPluginWindow();  EventRecord updateEvent;  InitializeEventRecord(&updateEvent);  updateEvent.what = updateEvt;  updateEvent.message = UInt32(pluginPort->port);  nsPluginEvent pluginEvent = { &updateEvent, nsPluginPlatformWindowRef(pluginPort->port) };  PRBool eventHandled = PR_FALSE;  mInstance->HandleEvent(&pluginEvent, &eventHandled);#endif#ifdef XP_WIN  nsPluginWindow * window;  GetWindow(window);  nsRect relDirtyRect = nsRect(aDirtyRect.x, aDirtyRect.y, aDirtyRect.width, aDirtyRect.height);  nsRect relDirtyRectInPixels;  ConvertTwipsToPixels(*mContext, relDirtyRect, relDirtyRectInPixels);  // we got dirty rectangle in relative window coordinates, but we  // need it in absolute units and in the (left, top, right, bottom) form  RECT drc;  drc.left   = relDirtyRectInPixels.x + window->x;  drc.top    = relDirtyRectInPixels.y + window->y;  drc.right  = drc.left + relDirtyRectInPixels.width;  drc.bottom = drc.top + relDirtyRectInPixels.height;  nsPluginEvent pluginEvent;  pluginEvent.event = 0x000F; //!!! This is bad, but is it better to include <windows.h> for WM_PAINT only?  pluginEvent.wParam = (uint32)ndc;  pluginEvent.lParam = (uint32)&drc;  PRBool eventHandled = PR_FALSE;  mInstance->HandleEvent(&pluginEvent, &eventHandled);#endif}