if (mPrt->mPrintFrameType == nsIPrintOptions::kSelectedFrame) {
if (mPrt->mPrintFrameType == nsIPrintSettings::kSelectedFrame) {
DocumentViewerImpl::SetClipRect(PrintObject*  aPO,                                 const nsRect& aClipRect,                                nscoord       aOffsetX,                                nscoord       aOffsetY,                                PRBool        aDoingSetClip){  NS_ASSERTION(aPO, "Pointer is null!");  nsRect clipRect = aClipRect;  if (aDoingSetClip) {    nscoord width  = (aPO->mRect.x+aPO->mRect.width) > aClipRect.width?aClipRect.width-aPO->mRect.x:aPO->mRect.width;    nscoord height = (aPO->mRect.y+aPO->mRect.height) > aClipRect.height?aClipRect.height-aPO->mRect.y:aPO->mRect.height;    aPO->mClipRect.SetRect(aPO->mRect.x, aPO->mRect.y, width, height);  }     PRBool doClip = aDoingSetClip;  if (aPO->mFrameType == eFrame) {    if (aDoingSetClip) {      aPO->mClipRect.SetRect(aOffsetX, aOffsetY, aPO->mClipRect.width, aPO->mClipRect.height);      clipRect = aPO->mClipRect;    } else if (mPrt->mPrintFrameType == nsIPrintOptions::kFramesAsIs) {      aPO->mClipRect.SetRect(aOffsetX, aOffsetY, aPO->mRect.width, aPO->mRect.height);      clipRect = aPO->mClipRect;      doClip = PR_TRUE;    }  } else if (aPO->mFrameType == eIFrame) {    if (aDoingSetClip) {      aPO->mClipRect.SetRect(aOffsetX, aOffsetY, aPO->mClipRect.width, aPO->mClipRect.height);      clipRect = aPO->mClipRect;    } else {      if (mPrt->mPrintFrameType == nsIPrintOptions::kSelectedFrame) {        if (aPO->mParent && aPO->mParent == mPrt->mSelectedPO) {          aPO->mClipRect.SetRect(aOffsetX, aOffsetY, aPO->mRect.width, aPO->mRect.height);          clipRect = aPO->mClipRect;          doClip = PR_TRUE;        }      } else {        aPO->mClipRect.SetRect(aOffsetX, aOffsetY, aPO->mRect.width, aPO->mRect.height);        clipRect = aPO->mClipRect;        doClip = PR_TRUE;      }    }  }  PRINT_DEBUG_MSG3("In DV::SetClipRect PO: %p (%9s) ", aPO, gFrameTypesStr[aPO->mFrameType]);  PRINT_DEBUG_MSG5("%5d,%5d,%5d,%5d\n", aPO->mClipRect.x, aPO->mClipRect.y,aPO->mClipRect.width, aPO->mClipRect.height);  PRInt32 cnt = aPO->mKids.Count();  for (PRInt32 i=0;i<cnt;i++) {    SetClipRect((PrintObject *)aPO->mKids[i], clipRect,                 aOffsetX+aPO->mRect.x, aOffsetY+aPO->mRect.y, doClip);  }}