Bug 142459 Shift+click on scroll bar should jump to that location r=varga sr=bryner a=asa

This commit is contained in:
neil%parkwaycc.co.uk 2003-11-24 23:52:49 +00:00
Родитель eecc819944
Коммит 3d98242423
1 изменённых файлов: 14 добавлений и 6 удалений

Просмотреть файл

@ -628,7 +628,8 @@ nsSliderFrame::HandleEvent(nsIPresContext* aPresContext,
//return nsFrame::HandleEvent(aPresContext, aEvent, aEventStatus);
return NS_OK;
}
else if (mMiddlePref && aEvent->message == NS_MOUSE_MIDDLE_BUTTON_DOWN) {
else if ((aEvent->message == NS_MOUSE_LEFT_BUTTON_DOWN && ((nsMouseEvent *)aEvent)->isShift)
|| (mMiddlePref && aEvent->message == NS_MOUSE_MIDDLE_BUTTON_DOWN)) {
// convert coord from twips to pixels
nscoord pos = isHorizontal ? aEvent->point.x : aEvent->point.y;
float p2t;
@ -924,14 +925,18 @@ nsSliderFrame::MouseDown(nsIDOMEvent* aMouseEvent)
nsCOMPtr<nsIDOMMouseEvent> mouseEvent(do_QueryInterface(aMouseEvent));
PRUint16 button = 0;
PRBool scrollToClick = PR_FALSE;
mouseEvent->GetShiftKey(&scrollToClick);
mouseEvent->GetButton(&button);
if((mMiddlePref && button != 0 && button != 1) ||
(!mMiddlePref && button != 0))
if (button != 0) {
if (button != 1 || !mMiddlePref)
return NS_OK;
scrollToClick = PR_TRUE;
}
// If middle button, first place the middle of the slider thumb
// under the click
if (button == 1) {
// If shift click or middle button, first
// place the middle of the slider thumb under the click
if (scrollToClick) {
nscoord pos;
nscoord pospx;
@ -1092,6 +1097,9 @@ nsSliderFrame::HandlePress(nsIPresContext* aPresContext,
nsGUIEvent* aEvent,
nsEventStatus* aEventStatus)
{
if (((nsMouseEvent *)aEvent)->isShift)
return NS_OK;
nsIFrame* thumbFrame = mFrames.FirstChild();
if (!thumbFrame) // display:none?
return NS_OK;