NS_ASSERTION(xMost < NS_UNCONSTRAINEDSIZE, "Some frame's size is bad."); if (xMost >= NS_UNCONSTRAINEDSIZE) { xMost = 0; }
DocumentViewerImpl::FindXMostFrameInList(nsIPresContext* aPresContext,                                          nsIRenderingContext* aRC,                                         nsIAtom*        aList,                                         nsIFrame*       aFrame,                                          nscoord         aX,                                         nscoord         aY,                                         PRInt32&        aMaxWidth){  nsIFrame * child;  aFrame->FirstChild(aPresContext, aList, &child);  while (child) {    PRBool isVisible = PR_TRUE;    // If the aRC is nsnull, then we skip the more expensive check and     // just check visibility    if (aRC) {      child->IsVisibleForPainting(aPresContext, *aRC, PR_TRUE, &isVisible);    } else {      nsCOMPtr<nsIStyleContext> sc;      child->GetStyleContext(getter_AddRefs(sc));      if (sc) {        const nsStyleVisibility* vis = (const nsStyleVisibility*)sc->GetStyleData(eStyleStruct_Visibility);        isVisible = vis->IsVisible();      }    }    if (isVisible) {      nsRect rect;      child->GetRect(rect);      rect.x += aX;      rect.y += aY;      nscoord xMost = rect.XMost();#ifdef DEBUG_PRINTING // keep this here but leave it turned off      nsAutoString tmp;      nsIFrameDebug*  frameDebug;      if (NS_SUCCEEDED(CallQueryInterface(child, &frameDebug))) {        frameDebug->GetFrameName(tmp);      }      printf("%p - %d,%d,%d,%d %s (%d > %d)\n", child, rect.x, rect.y, rect.width, rect.height, NS_LossyConvertUCS2toASCII(tmp).get(), xMost, aMaxWidth);#endif      if (xMost > aMaxWidth) {        aMaxWidth = xMost;#ifdef DEBUG_PRINTING // keep this here but leave it turned off        printf("%p - %d %s ", child, aMaxWidth, NS_LossyConvertUCS2toASCII(tmp).get());        if (aList == nsLayoutAtoms::overflowList) printf(" nsLayoutAtoms::overflowList\n");        if (aList == nsLayoutAtoms::floaterList) printf(" nsLayoutAtoms::floaterList\n");        if (aList == nsLayoutAtoms::fixedList) printf(" nsLayoutAtoms::fixedList\n");        if (aList == nsLayoutAtoms::absoluteList) printf(" nsLayoutAtoms::absoluteList\n");        if (aList == nsnull) printf(" nsnull\n");#endif      }      FindXMostFrameSize(aPresContext, aRC, child, rect.x, rect.y, aMaxWidth);    }    child->GetNextSibling(&child);  }}