Bug 1309587 - PreventDefault() on suppressed/delayed key events that are sent back to parent. r=smaug

--HG--
extra : rebase_source : 0762ef1284c063c9716a963bf40ff5cc82b48326
This commit is contained in:
Jessica Jong 2016-11-21 06:55:00 -05:00
Родитель a2e45117d7
Коммит 3f2c55024c
3 изменённых файлов: 9 добавлений и 0 удалений

Просмотреть файл

@ -1804,6 +1804,10 @@ TabChild::RecvRealKeyEvent(const WidgetKeyboardEvent& event,
mIgnoreKeyPressEvent = status == nsEventStatus_eConsumeNoDefault;
}
if (localEvent.mFlags.mIsSuppressedOrDelayed) {
localEvent.PreventDefault();
}
// If a response is desired from the content process, resend the key event.
// If mAccessKeyForwardedToChild is set, then don't resend the key event yet
// as RecvHandleAccessKey will do this.

Просмотреть файл

@ -7513,6 +7513,7 @@ PresShell::HandleEvent(nsIFrame* aFrame,
delete event;
}
}
aEvent->mFlags.mIsSuppressedOrDelayed = true;
return NS_OK;
}

Просмотреть файл

@ -132,6 +132,10 @@ public:
// Similar to mComposed. Set it to true to allow events cross the boundary
// between native non-anonymous content and native anonymouse content
bool mComposedInNativeAnonymousContent : 1;
// True if the event is suppressed or delayed. This is used when parent side
// process the key event after content side, parent side may drop the key
// event if it was suppressed or delayed in content side.
bool mIsSuppressedOrDelayed : 1;
// If the event is being handled in target phase, returns true.
inline bool InTargetPhase() const