Bug 1057256 - Part 3 - Make touch caret handle events before selection carets. r=roc

This commit is contained in:
Ting-Yu Lin 2014-08-25 02:50:00 +02:00
parent 3277fc6dc5
commit 93c2d2c4b4

View File

@ -6832,24 +6832,29 @@ PresShell::HandleEvent(nsIFrame* aFrame,
retargetEventDoc->GetShell() :
nullptr;
nsRefPtr<SelectionCarets> selectionCaret = presShell ?
presShell->GetSelectionCarets() :
nullptr;
if (selectionCaret) {
*aEventStatus = selectionCaret->HandleEvent(aEvent);
// Bug 1057256: Touch caret should handle the event before selection carets.
// Otherwise, a long tap on touch caret will be incorrectly handled by
// selection carets which makes moving touch caret failed.
nsRefPtr<TouchCaret> touchCaret = presShell ?
presShell->GetTouchCaret() :
nullptr;
if (touchCaret) {
*aEventStatus = touchCaret->HandleEvent(aEvent);
if (*aEventStatus == nsEventStatus_eConsumeNoDefault) {
// If the event is consumed by the touch caret, Cancel APZC panning by
// If the event is consumed by the touch caret, cancel APZC panning by
// setting mMultipleActionsPrevented.
aEvent->mFlags.mMultipleActionsPrevented = true;
return NS_OK;
}
}
nsRefPtr<TouchCaret> touchCaret = presShell ? presShell->GetTouchCaret() : nullptr;
if (touchCaret) {
*aEventStatus = touchCaret->HandleEvent(aEvent);
nsRefPtr<SelectionCarets> selectionCaret = presShell ?
presShell->GetSelectionCarets() :
nullptr;
if (selectionCaret) {
*aEventStatus = selectionCaret->HandleEvent(aEvent);
if (*aEventStatus == nsEventStatus_eConsumeNoDefault) {
// If the event is consumed by the touch caret, cancel APZC panning by
// If the event is consumed by the selection carets, cancel APZC panning by
// setting mMultipleActionsPrevented.
aEvent->mFlags.mMultipleActionsPrevented = true;
return NS_OK;