if (! view) {   const nsStyleOutline* outline; aFrame->GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline); nscoord width; outline->GetOutlineWidth(width); if (width > 0) { invalidRect.Inflate(width, width); } nsPoint frameOrigin; aFrame->GetOrigin(frameOrigin); invalidRect -= frameOrigin; invalidRect += viewOffset; viewManager->UpdateView(parentView, invalidRect, NS_VMREFRESH_NO_SYNC); }  aFrame->GetNextInFlow(&aFrame); }  if (viewManager) { viewManager->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC); NS_RELEASE(viewManager); }
viewManager->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC);
ApplyRenderingChangeToTree(nsIPresContext* aPresContext,                           nsIFrame* aFrame,                           nsIViewManager* aViewManager){  nsCOMPtr<nsIPresShell> shell;  aPresContext->GetShell(getter_AddRefs(shell));  PRBool isPaintingSuppressed = PR_FALSE;  shell->IsPaintingSuppressed(&isPaintingSuppressed);  if (isPaintingSuppressed)    return; // Don't allow synchronous rendering changes when painting is turned off.  nsIViewManager* viewManager = aViewManager;  // Trigger rendering updates by damaging this frame and any  // continuations of this frame.  // XXX this needs to detect the need for a view due to an opacity change and deal with it...  if (viewManager) {    NS_ADDREF(viewManager); // add local ref    viewManager->BeginUpdateViewBatch();  }  while (nsnull != aFrame) {    // Get the frame's bounding rect    nsRect invalidRect;    nsPoint viewOffset;    // Get view if this frame has one and trigger an update. If the    // frame doesn't have a view, find the nearest containing view    // (adjusting r's coordinate system to reflect the nesting) and    // update there.    nsIView* view = nsnull;    aFrame->GetView(aPresContext, &view);    nsIView* parentView;    if (! view) { // XXX can view have children outside it?      aFrame->GetOffsetFromView(aPresContext, viewOffset, &parentView);      NS_ASSERTION(nsnull != parentView, "no view");      if (! viewManager) {        parentView->GetViewManager(viewManager);        viewManager->BeginUpdateViewBatch();      }    }    else {      if (! viewManager) {        view->GetViewManager(viewManager);        viewManager->BeginUpdateViewBatch();      }    }    UpdateViewsForTree(aPresContext, aFrame, viewManager, invalidRect);    if (! view) { // if frame has view, will already be invalidated      // XXX Instead of calling this we should really be calling      // Invalidate on on the nsFrame (which does this)      const nsStyleOutline* outline;      aFrame->GetStyleData(eStyleStruct_Outline, (const nsStyleStruct*&)outline);      nscoord width;      outline->GetOutlineWidth(width);      if (width > 0) {        invalidRect.Inflate(width, width);      }      nsPoint frameOrigin;      aFrame->GetOrigin(frameOrigin);      invalidRect -= frameOrigin;      invalidRect += viewOffset;      viewManager->UpdateView(parentView, invalidRect, NS_VMREFRESH_NO_SYNC);    }    aFrame->GetNextInFlow(&aFrame);  }  if (viewManager) {      viewManager->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC);    NS_RELEASE(viewManager);  }}