зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1195722 - On desktop, allow the context menu to pop up concurrently with text selection. r=tylin
On desktop, the context menu is shown when the user lifts their finger after a long press, but only if the eMouseLongTap event is not cancelled. So by not cancelling it, we allow both the text selection and the context menu. On Android, the context menu takes priority over text selection, so this has no effect (i.e. if the context menu is shown, then the AccessibleCaret code never even gets the eMouseLongTap event). Also on Android nothing else relies on the cancellation of the eMouseLongTap event, so this change is a no-op. MozReview-Commit-ID: peFzB2afha
This commit is contained in:
Родитель
6962e151a2
Коммит
ea0f7627b9
|
@ -322,13 +322,12 @@ public:
|
|||
virtual nsEventStatus OnLongTap(AccessibleCaretEventHub* aContext,
|
||||
const nsPoint& aPoint) override
|
||||
{
|
||||
nsEventStatus rv = nsEventStatus_eIgnore;
|
||||
|
||||
if (NS_SUCCEEDED(aContext->mManager->SelectWordOrShortcut(aPoint))) {
|
||||
rv = nsEventStatus_eConsumeNoDefault;
|
||||
}
|
||||
|
||||
return rv;
|
||||
// In general text selection is lower-priority than the context menu. If
|
||||
// we consume this long-press event, then it prevents the context menu from
|
||||
// showing up on desktop Firefox (because that happens on long-tap-up, if
|
||||
// the long-tap was not cancelled). So we return eIgnore instead.
|
||||
aContext->mManager->SelectWordOrShortcut(aPoint);
|
||||
return nsEventStatus_eIgnore;
|
||||
}
|
||||
|
||||
virtual nsEventStatus OnRelease(AccessibleCaretEventHub* aContext) override
|
||||
|
|
|
@ -550,7 +550,7 @@ AccessibleCaretEventHubTester::TestLongTapWithSelectWordSuccessful(
|
|||
|
||||
HandleEventAndCheckState(CreateLongTapEvent(0, 0),
|
||||
MockAccessibleCaretEventHub::LongTapState(),
|
||||
nsEventStatus_eConsumeNoDefault);
|
||||
nsEventStatus_eIgnore);
|
||||
|
||||
HandleEventAndCheckState(aReleaseEventCreator(0, 0),
|
||||
MockAccessibleCaretEventHub::NoActionState(),
|
||||
|
@ -567,7 +567,7 @@ AccessibleCaretEventHubTester::TestLongTapWithSelectWordSuccessful(
|
|||
|
||||
HandleEventAndCheckState(CreateLongTapEvent(1, 1),
|
||||
MockAccessibleCaretEventHub::LongTapState(),
|
||||
nsEventStatus_eConsumeNoDefault);
|
||||
nsEventStatus_eIgnore);
|
||||
|
||||
mHub->AsyncPanZoomStarted();
|
||||
EXPECT_EQ(mHub->GetState(), MockAccessibleCaretEventHub::ScrollState());
|
||||
|
|
Загрузка…
Ссылка в новой задаче