nsRect r(0, 0, mRect.width, mRect.height);  viewMan->SetViewVisibility(view, nsViewVisibility_kShow);
view->SetVisibility(nsViewVisibility_kShow);
nsObjectFrame::CreateWidget(nsPresContext* aPresContext,                            nscoord aWidth,                            nscoord aHeight,                            PRBool aViewOnly){  // Create our view and widget  nsRect boundBox(0, 0, aWidth, aHeight);  nsIView *parView = GetAncestorWithView()->GetView();  nsIViewManager* viewMan = parView->GetViewManager();  //  nsWidgetInitData* initData = GetWidgetInitData(aPresContext); // needs to be deleted    // initialize the view as hidden since we don't know the (x,y) until Paint  nsIView *view = viewMan->CreateView(boundBox, parView, nsViewVisibility_kHide);  //  if (nsnull != initData) {  //    delete(initData);  //  }  if (!view) {    return NS_OK;       //XXX why OK? MMP  }#if 0  // set the content's widget, so it can get content modified by the widget  nsIWidget *widget = view->GetWidget();  if (widget) {    nsInput* content = (nsInput *)mContent; // change this cast to QueryInterface     content->SetWidget(widget);  } else {    NS_ASSERTION(0, "could not get widget");  }#endif  // Turn off double buffering on the Mac. This depends on bug 49743 and partially  // fixes 32327, 19931 amd 51787#if defined(XP_MAC) || defined(XP_MACOSX)  PRBool doubleBuffer =    nsContentUtils::GetBoolPref("plugin.enable_double_buffer");    viewMan->AllowDoubleBuffering(doubleBuffer);#endif    // XXX Put this last in document order  // XXX Should we be setting the z-index here?  viewMan->InsertChild(parView, view, nsnull, PR_TRUE);    if(aViewOnly != PR_TRUE) {    // Bug 179822: Create widget and allow non-unicode SubClass    nsWidgetInitData initData;    initData.mUnicode = PR_FALSE;    nsresult result = view->CreateWidget(kWidgetCID, &initData);    if (NS_FAILED(result)) {      return NS_OK;       //XXX why OK? MMP    }  }  {    // Here we set the background color for this widget because some plugins will use     // the child window background color when painting. If it's not set, it may default to gray    // Sometimes, a frame doesn't have a background color or is transparent. In this    // case, walk up the frame tree until we do find a frame with a background color    for (nsIFrame* frame = this; frame; frame = frame->GetParent()) {      const nsStyleBackground* background = frame->GetStyleBackground();      if (!background->IsTransparent()) {  // make sure we got an actual color        nsIWidget* win = view->GetWidget();        if (win)          win->SetBackgroundColor(background->mBackgroundColor);        break;      }    }        //this is ugly. it was ripped off from didreflow(). MMP    // Position and size view relative to its parent, not relative to our    // parent frame (our parent frame may not have a view).    nsIView* parentWithView;    nsPoint origin;    nsRect r(0, 0, mRect.width, mRect.height);    viewMan->SetViewVisibility(view, nsViewVisibility_kShow);    GetOffsetFromView(aPresContext, origin, &parentWithView);    viewMan->ResizeView(view, r);    viewMan->MoveViewTo(view, origin.x, origin.y);  }  SetView(view);  return NS_OK;}