nscoord childIndex = nsFrameNavigator::IndexOf(mSplitter->mPresContext, mParentBox, mSplitter); PRInt32 childCount = nsFrameNavigator::CountFrames(mSplitter->mPresContext, mParentBox);
nscoord childIndex = nsFrameNavigator::IndexOf(mOuter->mPresContext, mParentBox, mOuter); PRInt32 childCount = nsFrameNavigator::CountFrames(mOuter->mPresContext, mParentBox);
nsSplitterFrameImpl::MouseDown(nsIDOMEvent* aMouseEvent){    mCurrentPos = 0;  mPressed = PR_TRUE;  mDidDrag = PR_FALSE;  nsIFrame* parent = nsnull;  mSplitter->GetParent(&parent);  mParentBox = (nsBoxFrame*)parent;  // get our index  nscoord childIndex = nsFrameNavigator::IndexOf(mSplitter->mPresContext, mParentBox, mSplitter);  PRInt32 childCount = nsFrameNavigator::CountFrames(mSplitter->mPresContext, mParentBox);  // if its 0 or the last index then stop right here.  if (childIndex == 0 || childIndex == childCount-1) {    mPressed = PR_FALSE;    return NS_OK;  }  PRBool isHorizontal = mParentBox->IsHorizontal();  ResizeType resizeBefore = GetResizeBefore();  ResizeType resizeAfter  = GetResizeAfter();  delete mChildInfosBefore;  delete mChildInfosAfter;  mChildInfosBefore = new nsSplitterInfo[childCount];  mChildInfosAfter  = new nsSplitterInfo[childCount];  // create info 2 lists. One of the children before us and one after.  PRInt32 count = 0;  mChildInfosBeforeCount = 0;  mChildInfosAfterCount = 0;  nsIFrame* childFrame = nsnull;  mParentBox->FirstChild(mSplitter->mPresContext, nsnull, &childFrame);   while (nsnull != childFrame)   {     nsCOMPtr<nsIContent> content;    childFrame->GetContent(getter_AddRefs(content));    nsIAtom* atom;    content->GetTag(atom);    // skip over any splitters    if (atom != nsXULAtoms::splitter) {         nsBoxInfo info;        mParentBox->GetChildBoxInfo(count, info);        const nsStyleSpacing* spacing;        nsresult rv = childFrame->GetStyleData(eStyleStruct_Spacing,        (const nsStyleStruct*&) spacing);        NS_ASSERTION(rv == NS_OK,"failed to get spacing info");        nsMargin margin(0,0,0,0);        spacing->GetMargin(margin);        nsRect r(0,0,0,0);        childFrame->GetRect(r);        r.Inflate(margin);        if (count < childIndex) {            mChildInfosBefore[mChildInfosBeforeCount].child   = childFrame;            mChildInfosBefore[mChildInfosBeforeCount].min     = isHorizontal ? info.minSize.width : info.minSize.height;            mChildInfosBefore[mChildInfosBeforeCount].max     = isHorizontal ? info.maxSize.width : info.maxSize.height;            mChildInfosBefore[mChildInfosBeforeCount].current = isHorizontal ? r.width : r.height;            mChildInfosBefore[mChildInfosBeforeCount].flex    = info.flex;            mChildInfosBefore[mChildInfosBeforeCount].index   = count;            mChildInfosBeforeCount++;        } else if (count > childIndex) {            mChildInfosAfter[mChildInfosAfterCount].child   = childFrame;            mChildInfosAfter[mChildInfosAfterCount].min     = isHorizontal ? info.minSize.width : info.minSize.height;            mChildInfosAfter[mChildInfosAfterCount].max     = isHorizontal ? info.maxSize.width : info.maxSize.height;            mChildInfosAfter[mChildInfosAfterCount].current = isHorizontal ? r.width : r.height;            mChildInfosAfter[mChildInfosAfterCount].flex    = info.flex;            mChildInfosAfter[mChildInfosAfterCount].index   = count;            mChildInfosAfterCount++;        }     }        nsresult rv = childFrame->GetNextSibling(&childFrame);    NS_ASSERTION(rv == NS_OK,"failed to get next child");    count++;  }  // if the resizebefore is closest we must reverse the list because the first child in the list  // is the Farthest we want the first child to be the closest.  if (resizeBefore == Closest)     Reverse(mChildInfosBefore, mChildInfosBeforeCount);  // if the resizeafter is the Farthest we must reverse the list because the first child in the list  // is the closest we want the first child to be the Farthest.  if (resizeAfter == Farthest)     Reverse(mChildInfosAfter, mChildInfosAfterCount);  // grow only applys to the children after. If grow is set then no space should be taken out of any children after  // us. To do this we just set the size of that list to be 0.  if (resizeAfter == Grow)     mChildInfosAfterCount = 0;  nsCOMPtr<nsIDOMMouseEvent> mouseEvent(do_QueryInterface(aMouseEvent));  nsRect vr(0,0,0,0);  nsIView *v;  mSplitter->GetView(mSplitter->mPresContext, &v);  v->GetBounds(vr);  PRInt32 c = 0;  if (isHorizontal) {     mouseEvent->GetClientX(&c);     mSplitterPos = mSplitter->mRect.x;     mSplitterViewPos = vr.x;  } else {     mouseEvent->GetClientY(&c);     mSplitterPos = mSplitter->mRect.y;     mSplitterViewPos = vr.y;  }  mDragStartPx = c;      //printf("Pressed mDragStartPx=%d\n",mDragStartPx);  return NS_OK;}