NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }
nsSliderFrame::HandleEvent(nsIPresContext* aPresContext, nsGUIEvent* aEvent, nsEventStatus* aEventStatus) { nsIBox* scrollbarBox = GetScrollbar(); nsCOMPtr<nsIContent> scrollbar; GetContentOf(scrollbarBox, getter_AddRefs(scrollbar)); PRBool isHorizontal = IsHorizontal();  if (isDraggingThumb(aPresContext)) {   mRedrawImmediate = PR_TRUE;  switch (aEvent->message) { case NS_MOUSE_MOVE: {  nscoord pos = isHorizontal ? aEvent->point.x : aEvent->point.y;      nscoord startpx = mDragStartPx;  float p2t; aPresContext->GetScaledPixelsToTwips(&p2t); nscoord onePixel = NSIntPixelsToTwips(1, p2t); nscoord start = startpx*onePixel;  nsIFrame* thumbFrame = mFrames.FirstChild();  #ifdef OLD_SLIDER_FRAME_OFFSET_CALCULATION   nsIFrame* parent = this; while(parent != nsnull) {   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;  if (view) { nsCOMPtr<nsIWidget> widget; view->GetWidget(*getter_AddRefs(widget)); if (widget) { nsWindowType windowType; widget->GetWindowType(windowType); if (windowType == eWindowType_popup) break; } }  parent->GetParent(&parent); }  #else        nsIView *view = nsnull;  this->GetView(aPresContext, &view);  if (!view) {    nsIFrame *parent = nsnull; GetParentWithView(aPresContext, &parent);  if (parent) parent->GetView(aPresContext, &view); }  nsCOMPtr<nsIWidget> rootWidget;  if (view) { nsCOMPtr<nsIViewManager> vm; view->GetViewManager(*getter_AddRefs(vm)); if (vm) vm->GetWidget(getter_AddRefs(rootWidget)); }  if (view && rootWidget) {        while (view) { nsCOMPtr<nsIWidget> widget; view->GetWidget(*getter_AddRefs(widget));  if (widget) { nsWindowType windowType; widget->GetWindowType(windowType);  if (widget == rootWidget || windowType == eWindowType_popup) break; }  nscoord vx=0, vy=0; view->GetPosition(&vx, &vy); isHorizontal ? start -= vx : start -= vy;  view->GetParent(view); } }  #endif    start -= mThumbStart;   pos -= start; PRBool isMouseOutsideThumb = PR_FALSE; if (mSnapMultiplier) { nsSize thumbSize; thumbFrame->GetSize(thumbSize); if (isHorizontal) {  if (aEvent->point.y < (-mSnapMultiplier * thumbSize.height) || aEvent->point.y > thumbSize.height + (mSnapMultiplier * thumbSize.height)) isMouseOutsideThumb = PR_TRUE; } else {  if (aEvent->point.x < (-mSnapMultiplier * thumbSize.width) || aEvent->point.x > thumbSize.width + (mSnapMultiplier * thumbSize.width)) isMouseOutsideThumb = PR_TRUE; } } if (isMouseOutsideThumb) {  SetCurrentPosition(scrollbar, thumbFrame, (int) (mThumbStart / onePixel / mRatio)); return NS_OK; }    nscoord pospx = pos/onePixel;   pospx = nscoord(pospx/mRatio);   SetCurrentPosition(scrollbar, thumbFrame, pospx);  } break;  case NS_MOUSE_MIDDLE_BUTTON_UP: if(!mMiddlePref) break;  case NS_MOUSE_LEFT_BUTTON_UP:   AddListener(); DragThumb(aPresContext, PR_FALSE); mRedrawImmediate = PR_FALSE; return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus); }    mRedrawImmediate = PR_FALSE;   return NS_OK; } else if (mMiddlePref && aEvent->message == NS_MOUSE_MIDDLE_BUTTON_DOWN) {  nscoord pos = isHorizontal ? aEvent->point.x : aEvent->point.y; float p2t; aPresContext->GetScaledPixelsToTwips(&p2t); nscoord onePixel = NSIntPixelsToTwips(1, p2t); nscoord pospx = pos/onePixel;   nsIFrame* thumbFrame = mFrames.FirstChild(); nsSize thumbSize; thumbFrame->GetSize(thumbSize); nscoord thumbLength = isHorizontal ? thumbSize.width : thumbSize.height; thumbLength /= onePixel; pospx -= (thumbLength/2);    pospx = nscoord(pospx/mRatio);   SetCurrentPosition(scrollbar, thumbFrame, pospx);    nsIFrame* parent = this; while(parent != nsnull) {   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 ? pos += xoff : pos += yoff; } }  nsRect r; parent->GetRect(r); isHorizontal ? pos += r.x : pos += r.y; parent->GetParent(&parent); }  RemoveListener(); DragThumb(mPresContext, PR_TRUE); nsRect thumbRect; thumbFrame->GetRect(thumbRect);  if (isHorizontal) mThumbStart = thumbRect.x; else mThumbStart = thumbRect.y;  mDragStartPx =pos/onePixel; }      if (aEvent->message == NS_MOUSE_EXIT_SYNTH || aEvent->message == NS_MOUSE_LEFT_BUTTON_UP) HandleRelease(aPresContext, aEvent, aEventStatus);  return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus); }
  NS_IMETHOD HandleEvent(nsIDOMEvent* aEvent) { return NS_OK; }