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) WidgetMouseEvent* mouseEvent = aVisitor.mEvent->AsMouseEvent(); if (mouseEvent && mouseEvent->IsLeftClickEvent()) { bool isMap = false; GetIsMap(&isMap); if (isMap) { aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault; } } return nsGenericHTMLElement::PreHandleEvent(aVisitor); }
nsresult HTMLImageElement::PreHandleEvent(nsEventChainPreVisitor& 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) if (aVisitor.mEvent->eventStructType == NS_MOUSE_EVENT && aVisitor.mEvent->message == NS_MOUSE_CLICK && static_cast<nsMouseEvent*>(aVisitor.mEvent)->button == nsMouseEvent::eLeftButton) { bool isMap = false; GetIsMap(&isMap); if (isMap) { aVisitor.mEventStatus = nsEventStatus_eConsumeNoDefault; } } return nsGenericHTMLElement::PreHandleEvent(aVisitor); }