Bug 1310403, Remove special mouse handling for buttons which fixes extra focus events, r=smaug

This commit is contained in:
Neil Deakin
2016-11-11 10:30:36 -05:00
parent 801dab7b0f
commit 011287ef31
4 changed files with 41 additions and 76 deletions

View File

@@ -298,69 +298,6 @@ HTMLButtonElement::PostHandleEvent(EventChainPostVisitor& aVisitor)
}
break;
case eMouseDown:
{
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
if (mouseEvent->button == WidgetMouseEvent::eLeftButton) {
if (mouseEvent->IsTrusted()) {
EventStateManager* esm =
aVisitor.mPresContext->EventStateManager();
EventStateManager::SetActiveManager(
static_cast<EventStateManager*>(esm), this);
}
nsIFocusManager* fm = nsFocusManager::GetFocusManager();
if (fm) {
uint32_t flags = nsIFocusManager::FLAG_BYMOUSE |
nsIFocusManager::FLAG_NOSCROLL;
// If this was a touch-generated event, pass that information:
if (mouseEvent->inputSource == nsIDOMMouseEvent::MOZ_SOURCE_TOUCH) {
flags |= nsIFocusManager::FLAG_BYTOUCH;
}
fm->SetFocus(this, flags);
}
mouseEvent->mFlags.mMultipleActionsPrevented = true;
} else if (mouseEvent->button == WidgetMouseEvent::eMiddleButton ||
mouseEvent->button == WidgetMouseEvent::eRightButton) {
// cancel all of these events for buttons
//XXXsmaug What to do with these events? Why these should be cancelled?
if (aVisitor.mDOMEvent) {
aVisitor.mDOMEvent->StopPropagation();
}
}
}
break;
// cancel all of these events for buttons
//XXXsmaug What to do with these events? Why these should be cancelled?
case eMouseUp:
case eMouseDoubleClick:
{
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
if (aVisitor.mDOMEvent &&
(mouseEvent->button == WidgetMouseEvent::eMiddleButton ||
mouseEvent->button == WidgetMouseEvent::eRightButton)) {
aVisitor.mDOMEvent->StopPropagation();
}
}
break;
case eMouseOver:
{
aVisitor.mPresContext->EventStateManager()->
SetContentState(this, NS_EVENT_STATE_HOVER);
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
}
break;
// XXX this doesn't seem to do anything yet
case eMouseOut:
{
aVisitor.mPresContext->EventStateManager()->
SetContentState(nullptr, NS_EVENT_STATE_HOVER);
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
}
break;
default:
break;
}