nsRect r; parent->GetRect(r);
nsRect r = parent->GetRect();
nsSplitterFrameInner::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent){        if (mDragging) {          //printf("Dragging\n");          PRBool isHorizontal = !mOuter->IsHorizontal();           // convert coord to pixels          nscoord pos = isHorizontal ? aEvent->point.x : aEvent->point.y;           // mDragStartPx is in pixels and is in our client areas coordinate system.            // so we need to first convert it so twips and then get it into our coordinate system.           // convert start to twips           nscoord startpx = mDragStartPx;                         float p2t;           aPresContext->GetScaledPixelsToTwips(&p2t);           nscoord onePixel = NSIntPixelsToTwips(1, p2t);           nscoord start = startpx*onePixel;           // get it into our coordintate system by subtracting our parents offsets.           nsIFrame* parent = mOuter;           while(parent != nsnull)           {              // if we hit a scrollable view make sure we take into account              // how much we are scrolled.              nsIView* view = parent->GetView(aPresContext);              if (view) {                nsIScrollableView* scrollingView;                nsresult result = CallQueryInterface(view, &scrollingView);                if (NS_SUCCEEDED(result)) {                    nscoord xoff = 0;                    nscoord yoff = 0;                    scrollingView->GetScrollPosition(xoff, yoff);                    isHorizontal ? start += xoff : start += yoff;                         }              }                    nsRect r;             parent->GetRect(r);             isHorizontal ? start -= r.x : start -= r.y;             parent->GetParent(&parent);           }           // take our current position and substract the start location           pos -= start;           //printf("Diff=%d\n", pos);                      ResizeType resizeAfter  = GetResizeAfter();           PRBool bounded;           if (resizeAfter == nsSplitterFrameInner::Grow)               bounded = PR_FALSE;           else                bounded = PR_TRUE;		   int i;           for (i=0; i < mChildInfosBeforeCount; i++)                mChildInfosBefore[i].changed = mChildInfosBefore[i].current;                      for (i=0; i < mChildInfosAfterCount; i++)                mChildInfosAfter[i].changed = mChildInfosAfter[i].current;            nscoord oldPos = pos;            ResizeChildTo(aPresContext, pos, mChildInfosBefore, mChildInfosAfter, mChildInfosBeforeCount, mChildInfosAfterCount, bounded);            State currentState = GetState();            CollapseDirection dir = GetCollapseDirection();            // if we are in a collapsed position            if (realTimeDrag && ((oldPos > 0 && oldPos > pos && dir == After) || (oldPos < 0 && oldPos < pos && dir == Before)))            {                // and we are not collapsed then collapse                if (currentState == Dragging) {                    if (oldPos > 0 && oldPos > pos)                    {                        //printf("Collapse right\n");                        if (GetCollapseDirection() == After)                         {                             mOuter->mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::state, NS_LITERAL_STRING("collapsed"), PR_TRUE);                                                   }                    } else if (oldPos < 0 && oldPos < pos)                    {                        //printf("Collapse left\n");                        if (GetCollapseDirection() == Before)                         {                          mOuter->mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::state, NS_LITERAL_STRING("collapsed"), PR_TRUE);                                                 }                    }                                }            } else {                // if we are not in a collapsed position and we are not dragging make sure                // we are dragging.                if (currentState != Dragging)                  mOuter->mContent->SetAttr(kNameSpaceID_None, nsXULAtoms::state, NS_LITERAL_STRING("dragging"), PR_TRUE);                if (realTimeDrag)                  AdjustChildren(aPresContext);                else                  MoveSplitterBy(aPresContext, pos);            }                       // printf("----- resize ----- ");            /*            for (i=0; i < mChildInfosBeforeCount; i++)                printf("before, index=%d, current=%d, changed=%d\n", mChildInfosBefore[i].index, mChildInfosBefore[i].current, mChildInfosBefore[i].changed);            for (i=0; i < mChildInfosAfterCount; i++)                printf("after, index=%d, current=%d, changed=%d\n", mChildInfosAfter[i].index, mChildInfosAfter[i].current, mChildInfosAfter[i].changed);            */            /*            nsCOMPtr<nsIPresShell> shell;            aPresContext->GetShell(getter_AddRefs(shell));            nsCOMPtr<nsHTMLReflowCommand> reflowCmd;            nsresult rv = NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), mOuter->mParent,                                                  eReflowType_StyleChanged);            if (NS_SUCCEEDED(rv))               shell->AppendReflowCommand(reflowCmd);                      nsCOMPtr<nsIPresShell> shell;           aPresContext->GetShell(getter_AddRefs(shell));           mOuter->mState |= NS_FRAME_IS_DIRTY;           mOuter->mParent->ReflowDirtyChild(shell, mOuter);*/           mDidDrag = PR_TRUE;    }}