diff options
author | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-04-26 14:13:32 +0200 |
---|---|---|
committer | wolfbeast <mcwerewolf@wolfbeast.com> | 2019-04-26 14:13:32 +0200 |
commit | 3424afccaebc71c4acd4fa9eadf519c408c5965b (patch) | |
tree | b9c79b7f13f0fac5ad645c07e77892596cfb122a /layout/base/nsPresShell.cpp | |
parent | ace7f20fa76c0a1594ab80d3a07fda92a7edea67 (diff) | |
download | uxp-3424afccaebc71c4acd4fa9eadf519c408c5965b.tar.gz |
Capture delayed events and cancel as necessary.
Tag #1052
Diffstat (limited to 'layout/base/nsPresShell.cpp')
-rw-r--r-- | layout/base/nsPresShell.cpp | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/layout/base/nsPresShell.cpp b/layout/base/nsPresShell.cpp index 5dfbb8dba6..d4fbebbf2f 100644 --- a/layout/base/nsPresShell.cpp +++ b/layout/base/nsPresShell.cpp @@ -8192,6 +8192,9 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent, } } } + if (aEvent->mMessage == eKeyDown) { + mIsLastKeyDownCanceled = aEvent->mFlags.mDefaultPrevented; + } break; } case eMouseUp: @@ -8981,6 +8984,9 @@ PresShell::FireOrClearDelayedEvents(bool aFireEvents) !doc->EventHandlingSuppressed()) { nsAutoPtr<DelayedEvent> ev(mDelayedEvents[0].forget()); mDelayedEvents.RemoveElementAt(0); + if (ev->IsKeyPressEvent() && mIsLastKeyDownCanceled) { + continue; + } ev->Dispatch(); } if (!doc->EventHandlingSuppressed()) { @@ -9775,6 +9781,12 @@ PresShell::DelayedKeyEvent::DelayedKeyEvent(WidgetKeyboardEvent* aEvent) : mEvent = keyEvent; } +bool +PresShell::DelayedKeyEvent::IsKeyPressEvent() +{ + return mEvent->mMessage == eKeyPress; +} + // Start of DEBUG only code #ifdef DEBUG |