зеркало из https://github.com/mozilla/gecko-dev.git
bug #8627: simulates NS_MOUSE_LEFT_BUTTON_UP after TrackControl/LClick calls which eat the native mouseUp event. This enables correct DOM event filtering.
This commit is contained in:
Родитель
1aa9b24b4f
Коммит
8c56ffebfe
|
@ -332,22 +332,31 @@ nsresult nsComboBox::Deselect()
|
|||
//-------------------------------------------------------------------------
|
||||
PRBool nsComboBox::DispatchMouseEvent(nsMouseEvent &aEvent)
|
||||
{
|
||||
PRBool eventHandled = PR_FALSE;
|
||||
switch (aEvent.message)
|
||||
{
|
||||
case NS_MOUSE_LEFT_DOUBLECLICK:
|
||||
case NS_MOUSE_LEFT_BUTTON_DOWN:
|
||||
eventHandled = Inherited::DispatchMouseEvent(aEvent);
|
||||
if (!eventHandled) {
|
||||
StartDraw();
|
||||
{
|
||||
Point thePoint;
|
||||
thePoint.h = aEvent.point.x;
|
||||
thePoint.v = aEvent.point.y;
|
||||
::TrackControl(mControl, thePoint, nil);
|
||||
ControlChanged(::GetControlValue(mControl));
|
||||
//¥TODO: the mouseUp event is eaten by TrackControl.
|
||||
//¥ We should create it and dispatch it after the mouseDown;
|
||||
}
|
||||
EndDraw();
|
||||
|
||||
// since the mouseUp event will be consumed by TrackControl,
|
||||
// simulate the mouse up event immediately.
|
||||
nsMouseEvent mouseUpEvent = aEvent;
|
||||
mouseUpEvent.message = NS_MOUSE_LEFT_BUTTON_UP;
|
||||
Inherited::DispatchMouseEvent(mouseUpEvent);
|
||||
}
|
||||
break;
|
||||
default:
|
||||
eventHandled = Inherited::DispatchMouseEvent(aEvent);
|
||||
break;
|
||||
}
|
||||
return (Inherited::DispatchMouseEvent(aEvent));
|
||||
return eventHandled;
|
||||
}
|
||||
|
|
|
@ -512,12 +512,14 @@ nsresult nsListBox::Deselect()
|
|||
//-------------------------------------------------------------------------
|
||||
PRBool nsListBox::DispatchMouseEvent(nsMouseEvent &aEvent)
|
||||
{
|
||||
PRBool eventHandled = PR_FALSE;
|
||||
switch (aEvent.message)
|
||||
{
|
||||
case NS_MOUSE_LEFT_DOUBLECLICK:
|
||||
case NS_MOUSE_LEFT_BUTTON_DOWN:
|
||||
eventHandled = Inherited::DispatchMouseEvent(aEvent);
|
||||
if (!eventHandled) {
|
||||
StartDraw();
|
||||
{
|
||||
Point thePoint;
|
||||
thePoint.h = aEvent.point.x;
|
||||
thePoint.v = aEvent.point.y;
|
||||
|
@ -529,10 +531,14 @@ PRBool nsListBox::DispatchMouseEvent(nsMouseEvent &aEvent)
|
|||
::LClick(thePoint, modifiers, mListHandle);
|
||||
ControlChanged(GetSelectedIndex());
|
||||
}
|
||||
//¥TODO: the mouseUp event is eaten by TrackControl.
|
||||
//¥ We should create it and dispatch it after the mouseDown;
|
||||
}
|
||||
EndDraw();
|
||||
|
||||
// since the mouseUp event will be consumed by TrackControl,
|
||||
// simulate the mouse up event immediately.
|
||||
nsMouseEvent mouseUpEvent = aEvent;
|
||||
mouseUpEvent.message = NS_MOUSE_LEFT_BUTTON_UP;
|
||||
Inherited::DispatchMouseEvent(mouseUpEvent);
|
||||
}
|
||||
break;
|
||||
}
|
||||
return (Inherited::DispatchMouseEvent(aEvent));
|
||||
|
|
Загрузка…
Ссылка в новой задаче