Capture delayed events and cancel as necessary.
parent
17685eb92f
commit
4a31c96f87
|
@ -9335,7 +9335,7 @@ nsGlobalWindow::EnterModalState()
|
||||||
|
|
||||||
topWin->mSuspendedDoc = topDoc;
|
topWin->mSuspendedDoc = topDoc;
|
||||||
if (topDoc) {
|
if (topDoc) {
|
||||||
topDoc->SuppressEventHandling(nsIDocument::eAnimationsOnly);
|
topDoc->SuppressEventHandling(nsIDocument::eEvents);
|
||||||
}
|
}
|
||||||
|
|
||||||
nsGlobalWindow* inner = topWin->GetCurrentInnerWindowInternal();
|
nsGlobalWindow* inner = topWin->GetCurrentInnerWindowInternal();
|
||||||
|
@ -9372,7 +9372,7 @@ nsGlobalWindow::LeaveModalState()
|
||||||
|
|
||||||
if (topWin->mSuspendedDoc) {
|
if (topWin->mSuspendedDoc) {
|
||||||
nsCOMPtr<nsIDocument> currentDoc = topWin->GetExtantDoc();
|
nsCOMPtr<nsIDocument> currentDoc = topWin->GetExtantDoc();
|
||||||
topWin->mSuspendedDoc->UnsuppressEventHandlingAndFireEvents(nsIDocument::eAnimationsOnly,
|
topWin->mSuspendedDoc->UnsuppressEventHandlingAndFireEvents(nsIDocument::eEvents,
|
||||||
currentDoc == topWin->mSuspendedDoc);
|
currentDoc == topWin->mSuspendedDoc);
|
||||||
topWin->mSuspendedDoc = nullptr;
|
topWin->mSuspendedDoc = nullptr;
|
||||||
}
|
}
|
||||||
|
|
|
@ -8192,6 +8192,9 @@ PresShell::HandleEventInternal(WidgetEvent* aEvent,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
if (aEvent->mMessage == eKeyDown) {
|
||||||
|
mIsLastKeyDownCanceled = aEvent->mFlags.mDefaultPrevented;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case eMouseUp:
|
case eMouseUp:
|
||||||
|
@ -8981,6 +8984,9 @@ PresShell::FireOrClearDelayedEvents(bool aFireEvents)
|
||||||
!doc->EventHandlingSuppressed()) {
|
!doc->EventHandlingSuppressed()) {
|
||||||
nsAutoPtr<DelayedEvent> ev(mDelayedEvents[0].forget());
|
nsAutoPtr<DelayedEvent> ev(mDelayedEvents[0].forget());
|
||||||
mDelayedEvents.RemoveElementAt(0);
|
mDelayedEvents.RemoveElementAt(0);
|
||||||
|
if (ev->IsKeyPressEvent() && mIsLastKeyDownCanceled) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
ev->Dispatch();
|
ev->Dispatch();
|
||||||
}
|
}
|
||||||
if (!doc->EventHandlingSuppressed()) {
|
if (!doc->EventHandlingSuppressed()) {
|
||||||
|
@ -9775,6 +9781,12 @@ PresShell::DelayedKeyEvent::DelayedKeyEvent(WidgetKeyboardEvent* aEvent) :
|
||||||
mEvent = keyEvent;
|
mEvent = keyEvent;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
PresShell::DelayedKeyEvent::IsKeyPressEvent()
|
||||||
|
{
|
||||||
|
return mEvent->mMessage == eKeyPress;
|
||||||
|
}
|
||||||
|
|
||||||
// Start of DEBUG only code
|
// Start of DEBUG only code
|
||||||
|
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
|
|
|
@ -617,6 +617,7 @@ protected:
|
||||||
public:
|
public:
|
||||||
virtual ~DelayedEvent() { }
|
virtual ~DelayedEvent() { }
|
||||||
virtual void Dispatch() { }
|
virtual void Dispatch() { }
|
||||||
|
virtual bool IsKeyPressEvent() { return false; }
|
||||||
};
|
};
|
||||||
|
|
||||||
class DelayedInputEvent : public DelayedEvent
|
class DelayedInputEvent : public DelayedEvent
|
||||||
|
@ -641,6 +642,7 @@ protected:
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
explicit DelayedKeyEvent(mozilla::WidgetKeyboardEvent* aEvent);
|
explicit DelayedKeyEvent(mozilla::WidgetKeyboardEvent* aEvent);
|
||||||
|
virtual bool IsKeyPressEvent() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
// Check if aEvent is a mouse event and record the mouse location for later
|
// Check if aEvent is a mouse event and record the mouse location for later
|
||||||
|
@ -951,6 +953,8 @@ protected:
|
||||||
// Whether the widget has received a paint message yet.
|
// Whether the widget has received a paint message yet.
|
||||||
bool mHasReceivedPaintMessage : 1;
|
bool mHasReceivedPaintMessage : 1;
|
||||||
|
|
||||||
|
bool mIsLastKeyDownCanceled : 1;
|
||||||
|
|
||||||
static bool sDisableNonTestMouseEvents;
|
static bool sDisableNonTestMouseEvents;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -2,11 +2,6 @@
|
||||||
This form triggers a MP and gets filled in.<br>
|
This form triggers a MP and gets filled in.<br>
|
||||||
<form>
|
<form>
|
||||||
Username: <input type="text" id="userfield" name="u"><br>
|
Username: <input type="text" id="userfield" name="u"><br>
|
||||||
Password: <input type="password" id="passfield" name="p"><br>
|
Password: <input type="password" id="passfield" name="p"
|
||||||
<script>
|
oninput="parent.postMessage('filled', '*');"><br>
|
||||||
// Only notify when we fill in the password field.
|
|
||||||
document.getElementById("passfield").addEventListener("input", function() {
|
|
||||||
parent.postMessage("filled", "*");
|
|
||||||
});
|
|
||||||
</script>
|
|
||||||
</form>
|
</form>
|
||||||
|
|
Loading…
Reference in New Issue