const nsStyleFont* font = (const nsStyleFont*) mStyleContext->GetStyleData(eStyleStruct_Font);  aRenderingContext.SetFont(font->mFont); aRenderingContext.SetColor(NS_RGB(192, 192, 192)); aRenderingContext.FillRect(0, 0, mRect.width, mRect.height); aRenderingContext.SetColor(NS_RGB(0, 0, 0)); aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height); float p2t; aPresContext.GetPixelsToTwips(&p2t); nscoord px3 = NSIntPixelsToTwips(3, p2t); nsAutoString tmp; nsIAtom* atom; mContent->GetTag(atom); if (nsnull != atom) { atom->ToString(tmp); NS_RELEASE(atom); aRenderingContext.DrawString(tmp, px3, px3); } } #else  if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) { mInstanceOwner->Paint(aDirtyRect);
nsIPluginInstance * inst; if (NS_OK == GetPluginInstance(inst)) {  nsPluginWindow * window; mInstanceOwner->GetWindow(window);  if (window->type == nsPluginWindowType_Drawable) {  PRBool doupdatewindow = PR_FALSE;   PRUint32 hdc; aRenderingContext.RetrieveCurrentNativeGraphicData(&hdc); if(NS_REINTERPRET_CAST(PRUint32, window->window) != hdc) { window->window = NS_REINTERPRET_CAST(nsPluginPort*, hdc); doupdatewindow = PR_TRUE; }     nsTransform2D* rcTransform; aRenderingContext.GetCurrentTransform(rcTransform); nsPoint origin; rcTransform->GetTranslationCoord(&origin.x, &origin.y);  if((window->x != origin.x) || (window->y != origin.y)) { window->x = origin.x; window->y = origin.y; doupdatewindow = PR_TRUE; }   if(doupdatewindow) { #ifdef XP_WIN   nsIViewManager* vm = aPresContext->GetViewManager(); if (vm) { nsIView* view; vm->GetRootView(view); if (view) { nsIWidget* win = view->GetWidget(); if (win) { nsRect visibleRect; win->GetBounds(visibleRect);    origin = GetWindowOriginInPixels(window->type); nsRect winlessRect = nsRect(origin, nsSize(window->width, window->height)); winlessRect.IntersectRect(winlessRect, visibleRect);   if (mWindowlessRect != winlessRect) { mWindowlessRect = winlessRect;  WINDOWPOS winpos; memset(&winpos, 0, sizeof(winpos)); winpos.x = mWindowlessRect.x; winpos.y = mWindowlessRect.y; winpos.cx = mWindowlessRect.width; winpos.cy = mWindowlessRect.height;   nsPluginEvent pluginEvent; pluginEvent.event = 0x0047; pluginEvent.wParam = 0; pluginEvent.lParam = (uint32)&winpos; PRBool eventHandled = PR_FALSE;  inst->HandleEvent(&pluginEvent, &eventHandled); } } } } #endif  inst->SetWindow(window); }  mInstanceOwner->Paint(aDirtyRect, hdc); } NS_RELEASE(inst); }
nsObjectFrame::Paint(nsIPresContext& aPresContext,                     nsIRenderingContext& aRenderingContext,                     const nsRect& aDirtyRect,                     nsFramePaintLayer aWhichLayer){#if !defined(XP_MAC)  //~~~  nsIFrame * child = mFrames.FirstChild();  if(child != NULL) //This is an image  {    nsObjectFrameSuper::Paint(aPresContext, aRenderingContext, aDirtyRect, aWhichLayer);    return NS_OK;  }  if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {    const nsStyleFont* font = (const nsStyleFont*)      mStyleContext->GetStyleData(eStyleStruct_Font);    aRenderingContext.SetFont(font->mFont);    aRenderingContext.SetColor(NS_RGB(192, 192, 192));    aRenderingContext.FillRect(0, 0, mRect.width, mRect.height);    aRenderingContext.SetColor(NS_RGB(0, 0, 0));    aRenderingContext.DrawRect(0, 0, mRect.width, mRect.height);    float p2t;    aPresContext.GetPixelsToTwips(&p2t);    nscoord px3 = NSIntPixelsToTwips(3, p2t);    nsAutoString tmp;    nsIAtom* atom;    mContent->GetTag(atom);    if (nsnull != atom) {      atom->ToString(tmp);      NS_RELEASE(atom);      aRenderingContext.DrawString(tmp, px3, px3);    }  }#else  // delegate all painting to the plugin instance.  if (NS_FRAME_PAINT_LAYER_FOREGROUND == aWhichLayer) {    mInstanceOwner->Paint(aDirtyRect);  }#endif /* !XP_MAC */  return NS_OK;}