Bug 847453 - nsDOMWindowUtils::SendMouseEventCommon needs to set 'buttons' on the event. r=smaug.

This commit is contained in:
Jonathan Watt 2013-03-04 20:15:39 +00:00
Родитель 946ae9ce3a
Коммит e999c6ce87
1 изменённых файлов: 21 добавлений и 0 удалений

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

@ -595,6 +595,26 @@ ToWidgetPoint(float aX, float aY, const nsPoint& aOffset,
NSToIntRound((aY*appPerCSS + aOffset.y)/appPerDev));
}
static inline int16_t
GetButtonsFlagForButton(int32_t aButton)
{
switch (aButton) {
case nsMouseEvent::eLeftButton:
return nsMouseEvent::eLeftButtonFlag;
case nsMouseEvent::eMiddleButton:
return nsMouseEvent::eMiddleButtonFlag;
case nsMouseEvent::eRightButton:
return nsMouseEvent::eRightButtonFlag;
case 4:
return nsMouseEvent::e4thButtonFlag;
case 5:
return nsMouseEvent::e5thButtonFlag;
default:
NS_ERROR("Button not known.");
return 0;
}
}
NS_IMETHODIMP
nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType,
float aX,
@ -647,6 +667,7 @@ nsDOMWindowUtils::SendMouseEventCommon(const nsAString& aType,
nsMouseEvent::eContextMenuKey : nsMouseEvent::eNormal);
event.modifiers = GetWidgetModifiers(aModifiers);
event.button = aButton;
event.buttons = GetButtonsFlagForButton(aButton);
event.widget = widget;
event.pressure = aPressure;
event.inputSource = aInputSourceArg;