Bug 1062307 - Ensure the contextmenu event triggered by a long-press action targets things outside the root scroll frame. r=capella,smaug

This commit is contained in:
Kartikaya Gupta 2014-09-06 09:30:46 -04:00
parent 4009829935
commit 24c1971914
2 changed files with 6 additions and 2 deletions

View File

@ -6915,7 +6915,8 @@ PresShell::HandleEvent(nsIFrame* aFrame,
// document that is being captured.
retargetEventDoc = capturingContent->GetCrossShadowCurrentDoc();
#ifdef ANDROID
} else if (aEvent->mClass == eTouchEventClass) {
} else if (aEvent->mClass == eTouchEventClass ||
(aEvent->AsMouseEvent() && aEvent->AsMouseEvent()->inputSource == nsIDOMMouseEvent::MOZ_SOURCE_TOUCH)) {
retargetEventDoc = GetTouchEventTargetDocument();
#endif
}

View File

@ -1042,7 +1042,10 @@ nsWindow::OnContextmenuEvent(AndroidGeckoEvent *ae)
WidgetMouseEvent contextMenuEvent(true, NS_CONTEXTMENU, this,
WidgetMouseEvent::eReal, WidgetMouseEvent::eNormal);
contextMenuEvent.refPoint =
LayoutDeviceIntPoint(RoundedToInt(pt * GetDefaultScale()));
LayoutDeviceIntPoint(RoundedToInt(pt * GetDefaultScale())) -
LayoutDeviceIntPoint::FromUntyped(WidgetToScreenOffset());
contextMenuEvent.ignoreRootScrollFrame = true;
contextMenuEvent.inputSource = nsIDOMMouseEvent::MOZ_SOURCE_TOUCH;
nsEventStatus contextMenuStatus;
DispatchEvent(&contextMenuEvent, contextMenuStatus);