Skip to content

Commit

Permalink
Bug 1057256 - Part 3 - Make touch caret handle events before selectio…
Browse files Browse the repository at this point in the history
…n carets. r=roc
  • Loading branch information
aethanyc committed Aug 25, 2014
1 parent 3277fc6 commit 93c2d2c
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions layout/base/nsPresShell.cpp
Expand Up @@ -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;
Expand Down

0 comments on commit 93c2d2c

Please sign in to comment.