mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 388280, command event needs to know user input state, otherwise a popup could be blocked, r=jst,sr=bz
This commit is contained in:
parent
8ae10bc4a7
commit
e28524ff33
@ -1131,6 +1131,10 @@ nsDOMEvent::GetEventPopupControlState(nsEvent *aEvent)
|
||||
}
|
||||
}
|
||||
break;
|
||||
case NS_XUL_COMMAND_EVENT :
|
||||
if (nsEventStateManager::IsHandlingUserInput()) {
|
||||
abuse = openControlled;
|
||||
}
|
||||
}
|
||||
|
||||
return abuse;
|
||||
|
@ -266,13 +266,15 @@ public:
|
||||
PRBool aShift,
|
||||
PRBool aControl,
|
||||
PRBool aAlt,
|
||||
PRBool aMeta)
|
||||
PRBool aMeta,
|
||||
PRBool aUserInput)
|
||||
: mMenu(aMenu),
|
||||
mIsTrusted(aIsTrusted),
|
||||
mShift(aShift),
|
||||
mControl(aControl),
|
||||
mAlt(aAlt),
|
||||
mMeta(aMeta)
|
||||
mMeta(aMeta),
|
||||
mUserInput(aUserInput)
|
||||
{
|
||||
NS_ASSERTION(aMenu, "null menu supplied to nsXULMenuCommandEvent constructor");
|
||||
}
|
||||
@ -286,6 +288,7 @@ private:
|
||||
PRBool mControl;
|
||||
PRBool mAlt;
|
||||
PRBool mMeta;
|
||||
PRBool mUserInput;
|
||||
};
|
||||
|
||||
class nsXULPopupManager : public nsIDOMKeyListener,
|
||||
|
@ -140,6 +140,7 @@ include $(topsrcdir)/config/rules.mk
|
||||
LOCAL_INCLUDES = \
|
||||
-I$(srcdir) \
|
||||
-I$(srcdir)/../../../base \
|
||||
-I$(srcdir)/../../../../content/events/src \
|
||||
-I$(srcdir)/../../../generic \
|
||||
-I$(srcdir)/../../../style \
|
||||
$(NULL)
|
||||
|
@ -47,6 +47,7 @@
|
||||
#include "nsIDOMNSUIEvent.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsCSSFrameConstructor.h"
|
||||
#include "nsLayoutUtils.h"
|
||||
#include "nsIViewManager.h"
|
||||
@ -681,8 +682,13 @@ nsXULPopupManager::ExecuteMenu(nsIContent* aMenu, nsEvent* aEvent)
|
||||
meta = static_cast<nsInputEvent *>(aEvent)->isMeta;
|
||||
}
|
||||
|
||||
// Because the command event is firing asynchronously, a flag is needed to
|
||||
// indicate whether user input is being handled. This ensures that a popup
|
||||
// window won't get blocked.
|
||||
PRBool userinput = nsEventStateManager::IsHandlingUserInput();
|
||||
|
||||
nsCOMPtr<nsIRunnable> event =
|
||||
new nsXULMenuCommandEvent(aMenu, isTrusted, shift, control, alt, meta);
|
||||
new nsXULMenuCommandEvent(aMenu, isTrusted, shift, control, alt, meta, userinput);
|
||||
NS_DispatchToCurrentThread(event);
|
||||
}
|
||||
|
||||
@ -1612,6 +1618,8 @@ nsXULMenuCommandEvent::Run()
|
||||
// Deselect ourselves.
|
||||
menuFrame->SelectMenu(PR_FALSE);
|
||||
|
||||
nsAutoHandlingUserInputStatePusher userInpStatePusher(mUserInput);
|
||||
|
||||
nsEventStatus status = nsEventStatus_eIgnore;
|
||||
nsXULCommandEvent commandEvent(mIsTrusted, NS_XUL_COMMAND, nsnull);
|
||||
commandEvent.isShift = mShift;
|
||||
|
Loading…
Reference in New Issue
Block a user