Make oncontextmenu default-prevention work in embedding. Bug 230281, patch by

jst, r=adamlock, sr=bzbarsky


git-svn-id: svn://10.0.0.236/trunk@170395 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
bzbarsky%mit.edu
2005-03-08 21:55:10 +00:00
parent b14f04137c
commit 2cc3f9400e

View File

@@ -70,6 +70,7 @@
#include "nsIDOMElement.h"
#include "nsIDOMEvent.h"
#include "nsIDOMMouseEvent.h"
#include "nsIDOMNSUIEvent.h"
#include "nsIDOMEventReceiver.h"
#include "nsIDOMNamedNodeMap.h"
#include "nsIDOMHTMLInputElement.h"
@@ -1612,6 +1613,17 @@ ChromeContextMenuListener::RemoveChromeListeners()
NS_IMETHODIMP
ChromeContextMenuListener::ContextMenu(nsIDOMEvent* aMouseEvent)
{
nsCOMPtr<nsIDOMNSUIEvent> uievent(do_QueryInterface(aMouseEvent));
if (uievent) {
PRBool isDefaultPrevented = PR_FALSE;
uievent->GetPreventDefault(&isDefaultPrevented);
if (isDefaultPrevented) {
return NS_OK;
}
}
nsCOMPtr<nsIDOMEventTarget> targetNode;
nsresult res = aMouseEvent->GetTarget(getter_AddRefs(targetNode));
if (NS_FAILED(res))