Bug 1260704 - Instead of handling mouse up event, we handle mouse click event to trigger links. r=smaug

This commit is contained in:
Stone Shih
2016-05-16 15:45:43 +08:00
parent 58a1a26905
commit 9d8370d252
7 changed files with 150 additions and 9 deletions

View File

@@ -445,17 +445,15 @@ HTMLImageElement::AfterSetAttr(int32_t aNameSpaceID, nsIAtom* aName,
aValue, aNotify);
}
nsresult
HTMLImageElement::PreHandleEvent(EventChainPreVisitor& aVisitor)
{
// If we are a map and get a mouse click, don't let it be handled by
// the Generic Element as this could cause a click event to fire
// twice, once by the image frame for the map and once by the Anchor
// element. (bug 39723)
// We handle image element with attribute ismap in its corresponding frame
// element. Set mMultipleActionsPrevented here to prevent the click event
// trigger the behaviors in Element::PostHandleEventForLinks
WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent();
if (mouseEvent && mouseEvent->IsLeftClickEvent() && IsMap()) {
aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault;
mouseEvent->mFlags.mMultipleActionsPrevented = true;
}
return nsGenericHTMLElement::PreHandleEvent(aVisitor);
}