nsIPresContext *presContext = GetPresContext();
FrameManager::GetCanvasFrame(nsIFrame** aCanvasFrame) const{  NS_ENSURE_TRUE(mPresShell, NS_ERROR_NOT_AVAILABLE);  NS_PRECONDITION(aCanvasFrame, "aCanvasFrame argument cannot be null");  nsIPresContext *presContext = GetPresContext();  *aCanvasFrame = nsnull;  if (mRootFrame) {    // walk the children of the root frame looking for a frame with type==canvas    // start at the root    nsIFrame* childFrame = mRootFrame;    while (childFrame) {      // get each sibling of the child and check them, startig at the child      nsIFrame *siblingFrame = childFrame;      while (siblingFrame) {        if (siblingFrame->GetType() == nsLayoutAtoms::canvasFrame) {          // this is it: set the out-arg and stop looking          *aCanvasFrame = siblingFrame;          break;        } else {          siblingFrame = siblingFrame->GetNextSibling();        }      }      // move on to the child's child      childFrame->FirstChild(presContext, nsnull, &childFrame);    }  }  return NS_OK;}