mirror of
https://gitlab.winehq.org/wine/wine-gecko.git
synced 2024-09-13 09:24:08 -07:00
Bug 839103 - part 2 - enable chrome dispatching of nsIDOMEvents in nsAsyncDOMEvent; r=bz
This commit is contained in:
parent
b2aae26008
commit
6d6b3771e3
@ -9,6 +9,7 @@
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsEventDispatcher.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#include "nsDOMEvent.h"
|
||||
|
||||
nsAsyncDOMEvent::nsAsyncDOMEvent(nsINode *aEventNode, nsEvent &aEvent)
|
||||
: mEventNode(aEventNode), mDispatchChromeOnly(false)
|
||||
@ -24,10 +25,26 @@ nsAsyncDOMEvent::nsAsyncDOMEvent(nsINode *aEventNode, nsEvent &aEvent)
|
||||
NS_IMETHODIMP nsAsyncDOMEvent::Run()
|
||||
{
|
||||
if (mEvent) {
|
||||
NS_ASSERTION(!mDispatchChromeOnly, "Can't do that");
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(mEventNode);
|
||||
bool defaultActionEnabled; // This is not used because the caller is async
|
||||
target->DispatchEvent(mEvent, &defaultActionEnabled);
|
||||
if (mDispatchChromeOnly) {
|
||||
MOZ_ASSERT(mEvent->InternalDOMEvent()->IsTrusted());
|
||||
|
||||
nsCOMPtr<nsIDocument> ownerDoc = mEventNode->OwnerDoc();
|
||||
nsPIDOMWindow* window = ownerDoc->GetWindow();
|
||||
if (!window) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> target = window->GetParentTarget();
|
||||
if (!target) {
|
||||
return NS_ERROR_INVALID_ARG;
|
||||
}
|
||||
nsEventDispatcher::DispatchDOMEvent(target, nullptr, mEvent,
|
||||
nullptr, nullptr);
|
||||
} else {
|
||||
nsCOMPtr<nsIDOMEventTarget> target = do_QueryInterface(mEventNode);
|
||||
bool defaultActionEnabled; // This is not used because the caller is async
|
||||
target->DispatchEvent(mEvent, &defaultActionEnabled);
|
||||
}
|
||||
} else {
|
||||
nsIDocument* doc = mEventNode->OwnerDoc();
|
||||
if (mDispatchChromeOnly) {
|
||||
|
Loading…
Reference in New Issue
Block a user