mChildInfosBefore[mChildInfosBeforeCount].child   = childBox;
mChildInfosBefore[mChildInfosBeforeCount].childElem = content;
nsSplitterFrameInner::MouseDown(nsIDOMEvent* aMouseEvent){    nsCOMPtr<nsIDOMMouseEvent> mouseEvent(do_QueryInterface(aMouseEvent));  PRUint16 button = 0;  mouseEvent->GetButton(&button);  // only if left button  if (button != 0)     return NS_OK;  nsAutoString disabled;  mOuter->GetContent()->GetAttr(kNameSpaceID_None,                                nsHTMLAtoms::disabled, disabled);  if (disabled.EqualsLiteral("true"))    return NS_OK;  nsBoxLayoutState state(mOuter->mPresContext);  mCurrentPos = 0;  mPressed = PR_TRUE;  mDidDrag = PR_FALSE;  mOuter->GetParentBox(&mParentBox);    // get our index  nscoord childIndex = nsFrameNavigator::IndexOf(mOuter->mPresContext, mParentBox, mOuter);  PRInt32 childCount = nsFrameNavigator::CountFrames(mOuter->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;  }  EnsureOrient();  PRBool isHorizontal = !mOuter->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;  nsIBox* childBox = nsnull;  mParentBox->GetChildBox(&childBox);   while (nsnull != childBox)   {     nsIContent* content = childBox->GetContent();    nsCOMPtr<nsIAtom> atom;    nsresult rv;    nsCOMPtr<nsIXBLService> xblService =              do_GetService("@mozilla.org/xbl;1", &rv);    if (NS_SUCCEEDED(rv) && xblService) {      PRInt32 dummy;      xblService->ResolveTag(content, &dummy, getter_AddRefs(atom));    } else      atom = content->Tag();    // skip over any splitters    if (atom != nsXULAtoms::splitter) {         nsSize prefSize(0,0);        nsSize minSize(0,0);        nsSize maxSize(0,0);        nscoord flex = 0;        childBox->GetPrefSize(state, prefSize);        childBox->GetMinSize(state, minSize);        childBox->GetMaxSize(state, maxSize);        nsBox::BoundsCheck(minSize, prefSize, maxSize);        mOuter->AddMargin(childBox, minSize);        mOuter->AddMargin(childBox, prefSize);        mOuter->AddMargin(childBox, maxSize);        childBox->GetFlex(state, flex);        nsMargin margin(0,0,0,0);        childBox->GetMargin(margin);        nsRect r(childBox->GetRect());        r.Inflate(margin);        nsAutoString fixed, hidden;        content->GetAttr(kNameSpaceID_None, nsXULAtoms::fixed, fixed);        // We need to check for hidden attribute too, since treecols with        // the hidden="true" attribute are not really hidden, just collapsed        content->GetAttr(kNameSpaceID_None, nsHTMLAtoms::hidden, hidden);        NS_NAMED_LITERAL_STRING(attrTrue, "true");        if (!attrTrue.Equals(fixed) && !attrTrue.Equals(hidden)) {            if (count < childIndex) {                mChildInfosBefore[mChildInfosBeforeCount].child   = childBox;                mChildInfosBefore[mChildInfosBeforeCount].min     = isHorizontal ? minSize.width : minSize.height;                mChildInfosBefore[mChildInfosBeforeCount].max     = isHorizontal ? maxSize.width : maxSize.height;                mChildInfosBefore[mChildInfosBeforeCount].current = isHorizontal ? r.width : r.height;                mChildInfosBefore[mChildInfosBeforeCount].flex    = flex;                mChildInfosBefore[mChildInfosBeforeCount].index   = count;                mChildInfosBefore[mChildInfosBeforeCount].changed = mChildInfosBefore[mChildInfosBeforeCount].current;                mChildInfosBeforeCount++;            } else if (count > childIndex) {                mChildInfosAfter[mChildInfosAfterCount].child   = childBox;                mChildInfosAfter[mChildInfosAfterCount].min     = isHorizontal ? minSize.width : minSize.height;                mChildInfosAfter[mChildInfosAfterCount].max     = isHorizontal ? maxSize.width : maxSize.height;                mChildInfosAfter[mChildInfosAfterCount].current = isHorizontal ? r.width : r.height;                mChildInfosAfter[mChildInfosAfterCount].flex    = flex;                mChildInfosAfter[mChildInfosAfterCount].index   = count;                mChildInfosAfter[mChildInfosAfterCount].changed = mChildInfosAfter[mChildInfosAfterCount].current;                mChildInfosAfterCount++;            }        }     }        rv = childBox->GetNextBox(&childBox);    NS_ASSERTION(rv == NS_OK,"failed to get next child");    count++;  }  PRBool isNormalDirection = PR_TRUE;  mParentBox->GetDirection(isNormalDirection);  if (!isNormalDirection) {    // The before array is really the after array, and the order needs to be reversed.    // First reverse both arrays.    Reverse(mChildInfosBefore, mChildInfosBeforeCount);    Reverse(mChildInfosAfter, mChildInfosAfterCount);    // Now swap the two arrays.    nscoord newAfterCount = mChildInfosBeforeCount;    mChildInfosBeforeCount = mChildInfosAfterCount;    mChildInfosAfterCount = newAfterCount;    nsSplitterInfo* temp = mChildInfosAfter;    mChildInfosAfter = mChildInfosBefore;    mChildInfosBefore = temp;  }  // 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;  nsRect vr = mOuter->GetView()->GetBounds();  PRInt32 c;  nsPoint pt = nsLayoutUtils::GetDOMEventCoordinatesRelativeTo(mouseEvent,                                                               mParentBox);  if (isHorizontal) {     c = pt.x;     mSplitterPos = mOuter->mRect.x;     mSplitterViewPos = vr.x;  } else {     c = pt.y;     mSplitterPos = mOuter->mRect.y;     mSplitterViewPos = vr.y;  }  mDragStart = c;      //printf("Pressed mDragStart=%d\n",mDragStart);  mOuter->CaptureMouse(mOuter->mPresContext, PR_TRUE);  return NS_OK;}