printf("----- "); nsFrame::ListTag(stdout, mOuter); printf(" Tag='%s', id='%s' class='%s'---------------\n", tagValue, idValue, kClassValue);
printf("child #%d: ", count); nsFrame::ListTag(stdout, childFrame); printf("Tag='%s', id='%s' class='%s'\n", tagValue, idValue, kClassValue);
nsBoxDebugInner::DisplayDebugInfoFor(nsIPresContext* aPresContext,                                     nsPoint&        aPoint,                                     PRInt32&        aCursor){    nscoord x = aPoint.x;    nscoord y = aPoint.y;    // get the area inside our border.    nsRect insideBorder(0,0,mOuter->mRect.width, mOuter->mRect.height);    const nsStyleSpacing* spacing;    nsresult rv = mOuter->GetStyleData(eStyleStruct_Spacing,               (const nsStyleStruct*&) spacing);    NS_ASSERTION(rv == NS_OK,"failed to get spacing");    if (NS_FAILED(rv))     return rv;    nsMargin border;    spacing->GetBorderPadding(border);    insideBorder.Deflate(border);    PRBool isHorizontal = mOuter->mInner->mHorizontal;    if (!insideBorder.Contains(nsPoint(x,y)))        return NS_OK;        //printf("%%%%%% inside box %%%%%%%\n");        int count = 0;        nsCalculatedBoxInfo* info = mOuter->GetInfoList()->GetFirst();        nsMargin m;        mOuter->mInner->GetDebugInset(m);        if ((isHorizontal && y < insideBorder.y + m.top) ||            (!isHorizontal && x < insideBorder.x + m.left)) {            //printf("**** inside debug border *******\n");            while (info)             {                    nsIFrame* childFrame = info->frame;                nsRect r;                childFrame->GetRect(r);                // if we are not in the child. But in the spring above the child.                if ((isHorizontal && x >= r.x && x < r.x + r.width) ||                    (!isHorizontal && y >= r.y && y < r.y + r.height)) {                    aCursor = NS_STYLE_CURSOR_POINTER;                       // found it but we already showed it.                        if (mDebugChild == childFrame)                            return PR_TRUE;                        nsCOMPtr<nsIContent> content;                        mOuter->mInner->GetContentOf(childFrame, getter_AddRefs(content));                        nsString id;                        mOuter->mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, id);                        char idValue[100];                        id.ToCString(idValue,100);                                               nsString kClass;                        mOuter->mContent->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::kClass, kClass);                        char kClassValue[100];                        kClass.ToCString(kClassValue,100);                        nsCOMPtr<nsIAtom> tag;                        mOuter->mContent->GetTag(*getter_AddRefs(tag));                        nsString tagString;                        tag->ToString(tagString);                        char tagValue[100];                        tagString.ToCString(tagValue,100);               #ifdef NS_DEBUG                        printf("----- ");                        nsFrame::ListTag(stdout, mOuter);                        printf(" Tag='%s', id='%s' class='%s'---------------\n", tagValue, idValue, kClassValue);#endif                        content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::id, id);                        id.ToCString(idValue,100);                                               content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::kClass, kClass);                        kClass.ToCString(kClassValue,100);                        content->GetTag(*getter_AddRefs(tag));                        tag->ToString(tagString);                        tagString.ToCString(tagValue,100);#ifdef NS_DEBUG                        printf("child #%d: ", count);                        nsFrame::ListTag(stdout, childFrame);                        printf("Tag='%s', id='%s' class='%s'\n", tagValue, idValue, kClassValue);#endif                        mDebugChild = childFrame;                        nsCalculatedBoxInfoImpl aSize(childFrame);                        aSize.prefSize.width = NS_INTRINSICSIZE;                        aSize.prefSize.height = NS_INTRINSICSIZE;                        aSize.minSize.width = NS_INTRINSICSIZE;                        aSize.minSize.height = NS_INTRINSICSIZE;                        aSize.maxSize.width = NS_INTRINSICSIZE;                        aSize.maxSize.height = NS_INTRINSICSIZE;                        aSize.calculatedSize.width = NS_INTRINSICSIZE;                        aSize.calculatedSize.height = NS_INTRINSICSIZE;                        aSize.flex = -1;                      // add in the css min, max, pref                        const nsStylePosition* position;                        nsresult rv = childFrame->GetStyleData(eStyleStruct_Position,                                      (const nsStyleStruct*&) position);                        NS_ASSERTION(NS_SUCCEEDED(rv), "failed to get position");                        if (NS_FAILED(rv))                            return PR_TRUE;                        // see if the width or height was specifically set                        if (position->mWidth.GetUnit() == eStyleUnit_Coord)  {                            aSize.prefSize.width = position->mWidth.GetCoordValue();                        }                        if (position->mHeight.GetUnit() == eStyleUnit_Coord) {                            aSize.prefSize.height = position->mHeight.GetCoordValue();                             }                            // same for min size. Unfortunately min size is always set to 0. So for now                        // we will assume 0 means not set.                        if (position->mMinWidth.GetUnit() == eStyleUnit_Coord) {                            nscoord min = position->mMinWidth.GetCoordValue();                            if (min != 0)                               aSize.minSize.width = min;                        }                        if (position->mMinHeight.GetUnit() == eStyleUnit_Coord) {                            nscoord min = position->mMinHeight.GetCoordValue();                            if (min != 0)                               aSize.minSize.height = min;                        }                        // and max                        if (position->mMaxWidth.GetUnit() == eStyleUnit_Coord) {                            nscoord max = position->mMaxWidth.GetCoordValue();                            aSize.maxSize.width = max;                        }                        if (position->mMaxHeight.GetUnit() == eStyleUnit_Coord) {                            nscoord max = position->mMaxHeight.GetCoordValue();                            aSize.maxSize.height = max;                        }                        PRInt32 error;                        nsAutoString value;                        if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsXULAtoms::flex, value))                        {                            value.Trim("%");                            aSize.flex = value.ToInteger(&error);                        }                        if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::width, value))                        {                            float p2t;                            aPresContext->GetScaledPixelsToTwips(&p2t);                            value.Trim("%");                            aSize.prefSize.width = NSIntPixelsToTwips(value.ToInteger(&error), p2t);                        }                        if (NS_CONTENT_ATTR_HAS_VALUE == content->GetAttribute(kNameSpaceID_None, nsHTMLAtoms::height, value))                        {                            float p2t;                            aPresContext->GetScaledPixelsToTwips(&p2t);                            value.Trim("%");                            aSize.prefSize.height = NSIntPixelsToTwips(value.ToInteger(&error), p2t);                        }                                   char min[100];                        char pref[100];                        char max[100];                        char calc[100];                        char flex[100];                        /*                        nsSize c(info->calculatedSize);                        if (c.width != NS_INTRINSICSIZE)                            c.width -= inset.left + inset.right;                       if (c.height != NS_INTRINSICSIZE)                            c.height -= inset.left + inset.right;                                         */                        GetValue(info->minSize,  aSize.minSize, min);                        GetValue(info->prefSize, aSize.prefSize, pref);                        GetValue(info->maxSize, aSize.maxSize, max);                        GetValue(info->calculatedSize,  aSize.calculatedSize, calc);                        GetValue(info->flex,  aSize.flex, flex);                        printf("min%s, pref%s, max%s, actual%s, flex=%s\n\n",                             min,                            pref,                            max,                            calc,                            flex                        );                        return PR_TRUE;                   }              info = info->next;              count++;            }        } else {                mDebugChild = nsnull;        }        return PR_FALSE;}