printf("Collapse right\n"); if (GetCollapseDirection() == After) { mSplitter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, "collapsed", PR_TRUE); AdjustChildren(aPresContext); AddListener(); CaptureMouse(PR_FALSE); mPressed = PR_FALSE; return;
if (currentState == Dragging) { if (oldPos > 0 && oldPos > pos) {  if (GetCollapseDirection() == After) { mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, "collapsed", PR_TRUE);  }  } else if (oldPos < 0 && oldPos < pos) {  if (GetCollapseDirection() == Before) { mOuter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, "collapsed", PR_TRUE);  } }
nsSplitterFrameImpl::MouseDrag(nsIPresContext* aPresContext, nsGUIEvent* aEvent){        if (IsMouseCaptured(aPresContext)) {          PRBool isHorizontal = !mSplitter->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 = mSplitter;           while(parent != nsnull)           {              // if we hit a scrollable view make sure we take into account              // how much we are scrolled.              nsIScrollableView* scrollingView;              nsIView*           view;              parent->GetView(aPresContext, &view);              if (view) {                nsresult result = view->QueryInterface(NS_GET_IID(nsIScrollableView), (void**)&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 == nsSplitterFrameImpl::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);            /*            if (oldPos > 0 && oldPos > pos)            {                printf("Collapse right\n");                if (GetCollapseDirection() == After) {                      mSplitter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, "collapsed", PR_TRUE);                      AdjustChildren(aPresContext);                      AddListener();                      CaptureMouse(PR_FALSE);                      mPressed = PR_FALSE;                                         return;                }            }            if (oldPos < 0 && oldPos < pos)            {                printf("Collapse left\n");                if (GetCollapseDirection() == Before) {                  mSplitter->mContent->SetAttribute(kNameSpaceID_None, nsXULAtoms::state, "collapsed", PR_TRUE);                  AdjustChildren(aPresContext);                  AddListener();                  CaptureMouse(PR_FALSE);                  mPressed = PR_FALSE;                                     return;                }            }            */           // 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<nsIReflowCommand> reflowCmd;            nsresult rv = NS_NewHTMLReflowCommand(getter_AddRefs(reflowCmd), mSplitter->mParent,                                                  nsIReflowCommand::StyleChanged);            if (NS_SUCCEEDED(rv))               shell->AppendReflowCommand(reflowCmd);           mDidDrag = PR_TRUE;    }}