viewManager->EndUpdateViewBatch();
nsCOMPtr<nsIPresShell> presShell; nsresult rv = aPresContext->GetShell(getter_AddRefs(presShell)); if (NS_SUCCEEDED(rv)) { PRBool isReflowLocked = PR_FALSE; presShell->IsReflowLocked(&isReflowLocked); if (isReflowLocked) { viewManager->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC); } else { viewManager->EndUpdateViewBatch(NS_VMREFRESH_IMMEDIATE); } } else { viewManager->EndUpdateViewBatch(NS_VMREFRESH_NO_SYNC); }
ApplyRenderingChangeToTree(nsIPresContext* aPresContext,                           nsIFrame* aFrame,                           nsIViewManager* aViewManager){  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 nsStyleSpacing* spacing;      aFrame->GetStyleData(eStyleStruct_Spacing, (const nsStyleStruct*&)spacing);      nscoord width;      spacing->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();//    viewManager->Composite();    NS_RELEASE(viewManager);  }}