зеркало из https://github.com/mozilla/gecko-dev.git
Fixing bug 110798. Freezing the interfaces nsIDOMEvent, nsIDOMEventListener, nsIDOMEventTarget and nsIDOMDocumentEvent. r=harishd@netscape.com, sr=jband@netscape.com
This commit is contained in:
Родитель
a4cf6d5f30
Коммит
d9e3afb71d
|
@ -47,6 +47,7 @@
|
|||
#include "nsIFrame.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
@ -389,7 +390,11 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
|||
NS_IMETHODIMP nsRootAccessible::GetTargetNode(nsIDOMEvent *aEvent, nsCOMPtr<nsIDOMNode>& aTargetNode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> domEventTarget;
|
||||
aEvent->GetOriginalTarget(getter_AddRefs(domEventTarget));
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->GetOriginalTarget(getter_AddRefs(domEventTarget));
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
aTargetNode = do_QueryInterface(domEventTarget, &rv);
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "nsIFrame.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMElement.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsReadableUtils.h"
|
||||
|
@ -389,7 +390,12 @@ NS_IMETHODIMP nsRootAccessible::HandleEvent(nsIDOMEvent* aEvent)
|
|||
NS_IMETHODIMP nsRootAccessible::GetTargetNode(nsIDOMEvent *aEvent, nsCOMPtr<nsIDOMNode>& aTargetNode)
|
||||
{
|
||||
nsCOMPtr<nsIDOMEventTarget> domEventTarget;
|
||||
aEvent->GetOriginalTarget(getter_AddRefs(domEventTarget));
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->GetOriginalTarget(getter_AddRefs(domEventTarget));
|
||||
}
|
||||
|
||||
nsresult rv;
|
||||
aTargetNode = do_QueryInterface(domEventTarget, &rv);
|
||||
|
|
|
@ -285,6 +285,7 @@ NS_INTERFACE_MAP_BEGIN(nsDOMEvent)
|
|||
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMKeyEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNSUIEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMNSEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIPrivateDOMEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIPrivateTextEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIPrivateCompositionEvent)
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDOMNSUIEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsISupports.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsIPrivateCompositionEvent.h"
|
||||
|
@ -55,15 +56,16 @@
|
|||
class nsIContent;
|
||||
class nsIScrollableView;
|
||||
|
||||
class nsDOMEvent : public nsIDOMKeyEvent,
|
||||
class nsDOMEvent : public nsIDOMKeyEvent,
|
||||
public nsIDOMNSEvent,
|
||||
public nsIDOMMouseEvent,
|
||||
public nsIDOMNSUIEvent,
|
||||
public nsIPrivateDOMEvent,
|
||||
public nsIPrivateTextEvent,
|
||||
public nsIDOMNSUIEvent,
|
||||
public nsIPrivateDOMEvent,
|
||||
public nsIPrivateTextEvent,
|
||||
public nsIPrivateCompositionEvent
|
||||
{
|
||||
|
||||
public:
|
||||
|
||||
// Note: this enum must be kept in sync with mEventNames in nsDOMEvent.cpp
|
||||
enum nsDOMEvents {
|
||||
eDOMEvents_mousedown=0,
|
||||
|
@ -124,27 +126,13 @@ public:
|
|||
NS_DECL_ISUPPORTS
|
||||
|
||||
// nsIDOMEvent Interface
|
||||
NS_IMETHOD GetType(nsAWritableString& aType);
|
||||
NS_IMETHOD GetTarget(nsIDOMEventTarget** aTarget);
|
||||
NS_IMETHOD GetCurrentTarget(nsIDOMEventTarget** aCurrentTarget);
|
||||
NS_IMETHOD GetOriginalTarget(nsIDOMEventTarget** aOriginalTarget);
|
||||
NS_IMETHOD GetEventPhase(PRUint16* aEventPhase);
|
||||
NS_IMETHOD GetBubbles(PRBool* aBubbles);
|
||||
NS_IMETHOD GetCancelable(PRBool* aCancelable);
|
||||
NS_IMETHOD GetTimeStamp(PRUint64* aTimestamp);
|
||||
NS_IMETHOD StopPropagation();
|
||||
NS_IMETHOD PreventBubble();
|
||||
NS_IMETHOD PreventCapture();
|
||||
NS_IMETHOD PreventDefault();
|
||||
NS_IMETHOD InitEvent(const nsAReadableString& aEventTypeArg,
|
||||
PRBool aCanBubbleArg, PRBool aCancelableArg);
|
||||
NS_DECL_NSIDOMEVENT
|
||||
|
||||
// nsIDOMNSEvent Interface
|
||||
NS_DECL_NSIDOMNSEVENT
|
||||
|
||||
// nsIDOMUIEvent Interface
|
||||
NS_IMETHOD GetView(nsIDOMAbstractView** aView);
|
||||
NS_IMETHOD GetDetail(PRInt32* aDetail);
|
||||
NS_IMETHOD InitUIEvent(const nsAReadableString& aTypeArg,
|
||||
PRBool aCanBubbleArg, PRBool aCancelableArg,
|
||||
nsIDOMAbstractView* aViewArg, PRInt32 aDetailArg);
|
||||
NS_DECL_NSIDOMUIEVENT
|
||||
|
||||
// nsIDOMMouseEvent Interface and nsIDOMKeyEvent Interface
|
||||
NS_IMETHOD GetScreenX(PRInt32* aScreenX);
|
||||
|
|
|
@ -40,6 +40,7 @@
|
|||
#include "nsGUIEvent.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsEventListenerManager.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
#include "nsIDOMMouseMotionListener.h"
|
||||
|
@ -2379,7 +2380,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
EventArrayType arrayType;
|
||||
nsListenerStruct *ls;
|
||||
|
||||
if (aEventTypes & nsIDOMEvent::MOUSEDOWN) {
|
||||
if (aEventTypes & nsIDOMNSEvent::MOUSEDOWN) {
|
||||
arrayType = eEventArrayType_Mouse;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2388,7 +2389,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::MOUSEUP) {
|
||||
if (aEventTypes & nsIDOMNSEvent::MOUSEUP) {
|
||||
arrayType = eEventArrayType_Mouse;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2397,7 +2398,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::MOUSEOVER) {
|
||||
if (aEventTypes & nsIDOMNSEvent::MOUSEOVER) {
|
||||
arrayType = eEventArrayType_Mouse;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2406,7 +2407,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::MOUSEOUT) {
|
||||
if (aEventTypes & nsIDOMNSEvent::MOUSEOUT) {
|
||||
arrayType = eEventArrayType_Mouse;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2415,7 +2416,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::MOUSEMOVE) {
|
||||
if (aEventTypes & nsIDOMNSEvent::MOUSEMOVE) {
|
||||
arrayType = eEventArrayType_MouseMotion;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2424,7 +2425,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::CLICK) {
|
||||
if (aEventTypes & nsIDOMNSEvent::CLICK) {
|
||||
arrayType = eEventArrayType_Mouse;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2433,7 +2434,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::DBLCLICK) {
|
||||
if (aEventTypes & nsIDOMNSEvent::DBLCLICK) {
|
||||
arrayType = eEventArrayType_Mouse;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2442,7 +2443,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::KEYDOWN) {
|
||||
if (aEventTypes & nsIDOMNSEvent::KEYDOWN) {
|
||||
arrayType = eEventArrayType_Key;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2451,7 +2452,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::KEYUP) {
|
||||
if (aEventTypes & nsIDOMNSEvent::KEYUP) {
|
||||
arrayType = eEventArrayType_Key;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2460,7 +2461,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::KEYPRESS) {
|
||||
if (aEventTypes & nsIDOMNSEvent::KEYPRESS) {
|
||||
arrayType = eEventArrayType_Key;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2469,7 +2470,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::DRAGDROP) {
|
||||
if (aEventTypes & nsIDOMNSEvent::DRAGDROP) {
|
||||
arrayType = eEventArrayType_Drag;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2478,7 +2479,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
/*if (aEventTypes & nsIDOMEvent::MOUSEDRAG) {
|
||||
/*if (aEventTypes & nsIDOMNSEvent::MOUSEDRAG) {
|
||||
arrayType = kIDOMMouseListenerarrayType;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2487,7 +2488,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}*/
|
||||
if (aEventTypes & nsIDOMEvent::FOCUS) {
|
||||
if (aEventTypes & nsIDOMNSEvent::FOCUS) {
|
||||
arrayType = eEventArrayType_Focus;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2496,7 +2497,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::BLUR) {
|
||||
if (aEventTypes & nsIDOMNSEvent::BLUR) {
|
||||
arrayType = eEventArrayType_Focus;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2505,7 +2506,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::SELECT) {
|
||||
if (aEventTypes & nsIDOMNSEvent::SELECT) {
|
||||
arrayType = eEventArrayType_Form;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2514,7 +2515,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::CHANGE) {
|
||||
if (aEventTypes & nsIDOMNSEvent::CHANGE) {
|
||||
arrayType = eEventArrayType_Form;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2523,7 +2524,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::RESET) {
|
||||
if (aEventTypes & nsIDOMNSEvent::RESET) {
|
||||
arrayType = eEventArrayType_Form;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2532,7 +2533,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::SUBMIT) {
|
||||
if (aEventTypes & nsIDOMNSEvent::SUBMIT) {
|
||||
arrayType = eEventArrayType_Form;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2541,7 +2542,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::LOAD) {
|
||||
if (aEventTypes & nsIDOMNSEvent::LOAD) {
|
||||
arrayType = eEventArrayType_Load;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2550,7 +2551,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::UNLOAD) {
|
||||
if (aEventTypes & nsIDOMNSEvent::UNLOAD) {
|
||||
arrayType = eEventArrayType_Load;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2559,7 +2560,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::ABORT) {
|
||||
if (aEventTypes & nsIDOMNSEvent::ABORT) {
|
||||
arrayType = eEventArrayType_Load;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2568,7 +2569,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::ERROR) {
|
||||
if (aEventTypes & nsIDOMNSEvent::ERROR) {
|
||||
arrayType = eEventArrayType_Load;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2577,7 +2578,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::RESIZE) {
|
||||
if (aEventTypes & nsIDOMNSEvent::RESIZE) {
|
||||
arrayType = eEventArrayType_Paint;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
@ -2586,7 +2587,7 @@ nsresult nsEventListenerManager::FlipCaptureBit(PRInt32 aEventTypes, PRBool aIni
|
|||
ls->mFlags |= NS_EVENT_FLAG_CAPTURE;
|
||||
}
|
||||
}
|
||||
if (aEventTypes & nsIDOMEvent::SCROLL) {
|
||||
if (aEventTypes & nsIDOMNSEvent::SCROLL) {
|
||||
arrayType = eEventArrayType_Scroll;
|
||||
ls = FindJSEventListener(arrayType);
|
||||
if (ls) {
|
||||
|
|
|
@ -54,6 +54,7 @@
|
|||
#include "nsIFormControlFrame.h"
|
||||
#include "nsIEventStateManager.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsISizeOfHandler.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
@ -496,11 +497,20 @@ nsHTMLButtonElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
|||
case NS_MOUSE_RIGHT_DOUBLECLICK:
|
||||
case NS_MOUSE_RIGHT_BUTTON_DOWN:
|
||||
case NS_MOUSE_RIGHT_BUTTON_UP:
|
||||
if (aDOMEvent != nsnull && *aDOMEvent != nsnull) {
|
||||
(*aDOMEvent)->PreventBubble();
|
||||
} else {
|
||||
ret = NS_ERROR_FAILURE;
|
||||
{
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent;
|
||||
|
||||
if (aDOMEvent) {
|
||||
nsevent = do_QueryInterface(*aDOMEvent);
|
||||
}
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
} else {
|
||||
ret = NS_ERROR_FAILURE;
|
||||
}
|
||||
}
|
||||
|
||||
break;
|
||||
|
||||
case NS_MOUSE_ENTER_SYNTH:
|
||||
|
|
|
@ -75,6 +75,7 @@
|
|||
|
||||
#include "nsIPresState.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMNodeList.h"
|
||||
#include "nsIDOMHTMLCollection.h"
|
||||
#include "nsICheckboxControlFrame.h"
|
||||
|
@ -1074,7 +1075,13 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
|||
(*aDOMEvent)->GetTarget(getter_AddRefs(oldTarget));
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> originalTarget;
|
||||
(*aDOMEvent)->GetOriginalTarget(getter_AddRefs(originalTarget));
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(*aDOMEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->GetOriginalTarget(getter_AddRefs(originalTarget));
|
||||
}
|
||||
|
||||
if (!originalTarget) {
|
||||
privateEvent->SetOriginalTarget(oldTarget);
|
||||
}
|
||||
|
@ -1299,8 +1306,14 @@ nsHTMLInputElement::HandleDOMEvent(nsIPresContext* aPresContext,
|
|||
if (type == NS_FORM_INPUT_BUTTON ||
|
||||
type == NS_FORM_INPUT_RESET ||
|
||||
type == NS_FORM_INPUT_SUBMIT ) {
|
||||
if (aDOMEvent != nsnull && *aDOMEvent != nsnull) {
|
||||
(*aDOMEvent)->PreventBubble();
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent;
|
||||
|
||||
if (aDOMEvent) {
|
||||
nsevent = do_QueryInterface(*aDOMEvent);
|
||||
}
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
} else {
|
||||
rv = NS_ERROR_FAILURE;
|
||||
}
|
||||
|
|
|
@ -65,6 +65,7 @@
|
|||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsIDOMNSUIEvent.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
|
||||
#include "nsIBoxObject.h"
|
||||
#include "nsIPopupBoxObject.h"
|
||||
|
@ -269,6 +270,8 @@ XULPopupListenerImpl::PreLaunchPopup(nsIDOMEvent* aMouseEvent)
|
|||
// Store clicked-on node in xul document for context menus and menu popups.
|
||||
xulDocument->SetPopupNode( targetNode );
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aMouseEvent));
|
||||
|
||||
switch (popupType) {
|
||||
case eXULPopupType_popup:
|
||||
// Check for left mouse button down
|
||||
|
@ -276,7 +279,11 @@ XULPopupListenerImpl::PreLaunchPopup(nsIDOMEvent* aMouseEvent)
|
|||
if (button == 0) {
|
||||
// Time to launch a popup menu.
|
||||
LaunchPopup(aMouseEvent);
|
||||
aMouseEvent->PreventBubble();
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
|
||||
aMouseEvent->PreventDefault();
|
||||
}
|
||||
break;
|
||||
|
@ -289,7 +296,11 @@ XULPopupListenerImpl::PreLaunchPopup(nsIDOMEvent* aMouseEvent)
|
|||
FireFocusOnTargetContent(targetNode);
|
||||
#endif
|
||||
LaunchPopup(aMouseEvent);
|
||||
aMouseEvent->PreventBubble();
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
|
||||
aMouseEvent->PreventDefault();
|
||||
break;
|
||||
}
|
||||
|
|
|
@ -40,6 +40,16 @@
|
|||
|
||||
#include "domstubs.idl"
|
||||
|
||||
/**
|
||||
* The nsIDOMDocumentEvent interface is the interface to the event
|
||||
* factory method on a DOM document object.
|
||||
*
|
||||
* For more information on this interface please see
|
||||
* http://www.w3.org/TR/DOM-Level-2-Events/
|
||||
*
|
||||
* @status FROZEN
|
||||
*/
|
||||
|
||||
[scriptable, uuid(46b91d66-28e2-11d4-ab1e-0010830123b4)]
|
||||
interface nsIDOMDocumentEvent : nsISupports
|
||||
{
|
||||
|
|
|
@ -42,63 +42,33 @@
|
|||
|
||||
interface nsIDOMEventTarget;
|
||||
|
||||
/**
|
||||
* The nsIDOMEvent interface is the primary datatype for all events in
|
||||
* the Document Object Model.
|
||||
*
|
||||
* For more information on this interface please see
|
||||
* http://www.w3.org/TR/DOM-Level-2-Events/
|
||||
*
|
||||
* @status FROZEN
|
||||
*/
|
||||
|
||||
[scriptable, uuid(a66b7b80-ff46-bd97-0080-5f8ae38add32)]
|
||||
interface nsIDOMEvent : nsISupports
|
||||
{
|
||||
const unsigned short CAPTURING_PHASE = 1;
|
||||
const unsigned short AT_TARGET = 2;
|
||||
const unsigned short BUBBLING_PHASE = 3;
|
||||
|
||||
const long MOUSEDOWN = 0x00000001;
|
||||
const long MOUSEUP = 0x00000002;
|
||||
const long MOUSEOVER = 0x00000004;
|
||||
const long MOUSEOUT = 0x00000008;
|
||||
const long MOUSEMOVE = 0x00000010;
|
||||
const long MOUSEDRAG = 0x00000020;
|
||||
const long CLICK = 0x00000040;
|
||||
const long DBLCLICK = 0x00000080;
|
||||
const long KEYDOWN = 0x00000100;
|
||||
const long KEYUP = 0x00000200;
|
||||
const long KEYPRESS = 0x00000400;
|
||||
const long DRAGDROP = 0x00000800;
|
||||
const long FOCUS = 0x00001000;
|
||||
const long BLUR = 0x00002000;
|
||||
const long SELECT = 0x00004000;
|
||||
const long CHANGE = 0x00008000;
|
||||
const long RESET = 0x00010000;
|
||||
const long SUBMIT = 0x00020000;
|
||||
const long SCROLL = 0x00040000;
|
||||
const long LOAD = 0x00080000;
|
||||
const long UNLOAD = 0x00100000;
|
||||
const long XFER_DONE = 0x00200000;
|
||||
const long ABORT = 0x00400000;
|
||||
const long ERROR = 0x00800000;
|
||||
const long LOCATE = 0x01000000;
|
||||
const long MOVE = 0x02000000;
|
||||
const long RESIZE = 0x04000000;
|
||||
const long FORWARD = 0x08000000;
|
||||
const long HELP = 0x10000000;
|
||||
const long BACK = 0x20000000;
|
||||
const long TEXT = 0x40000000;
|
||||
|
||||
const long ALT_MASK = 0x00000001;
|
||||
const long CONTROL_MASK = 0x00000002;
|
||||
const long SHIFT_MASK = 0x00000004;
|
||||
const long META_MASK = 0x00000008;
|
||||
// PhaseType
|
||||
const unsigned short CAPTURING_PHASE = 1;
|
||||
const unsigned short AT_TARGET = 2;
|
||||
const unsigned short BUBBLING_PHASE = 3;
|
||||
|
||||
readonly attribute DOMString type;
|
||||
readonly attribute nsIDOMEventTarget target;
|
||||
readonly attribute nsIDOMEventTarget currentTarget;
|
||||
readonly attribute nsIDOMEventTarget originalTarget;
|
||||
readonly attribute unsigned short eventPhase;
|
||||
readonly attribute boolean bubbles;
|
||||
readonly attribute boolean cancelable;
|
||||
readonly attribute DOMTimeStamp timeStamp;
|
||||
|
||||
void stopPropagation();
|
||||
void preventBubble();
|
||||
void preventCapture();
|
||||
void preventDefault();
|
||||
void initEvent(in DOMString eventTypeArg,
|
||||
in boolean canBubbleArg,
|
||||
|
|
|
@ -40,6 +40,16 @@
|
|||
|
||||
#include "domstubs.idl"
|
||||
|
||||
/**
|
||||
* The nsIDOMEventListener interface is a callback interface for
|
||||
* listening to events in the Document Object Model.
|
||||
*
|
||||
* For more information on this interface please see
|
||||
* http://www.w3.org/TR/DOM-Level-2-Events/
|
||||
*
|
||||
* @status FROZEN
|
||||
*/
|
||||
|
||||
[scriptable, function, uuid(df31c120-ded6-11d1-bd85-00805f8ae3f4)]
|
||||
interface nsIDOMEventListener : nsISupports
|
||||
{
|
||||
|
|
|
@ -40,6 +40,16 @@
|
|||
|
||||
#include "domstubs.idl"
|
||||
|
||||
/**
|
||||
* The nsIDOMEventTarget interface is the interface implemented by all
|
||||
* event targets in the Document Object Model.
|
||||
*
|
||||
* For more information on this interface please see
|
||||
* http://www.w3.org/TR/DOM-Level-2-Events/
|
||||
*
|
||||
* @status FROZEN
|
||||
*/
|
||||
|
||||
[scriptable, uuid(1c773b30-d1cf-11d2-bd95-00805f8ae3f4)]
|
||||
interface nsIDOMEventTarget : nsISupports
|
||||
{
|
||||
|
|
|
@ -20,8 +20,7 @@
|
|||
* the Initial Developer. All Rights Reserved.
|
||||
*
|
||||
* Contributor(s):
|
||||
* Tom Pixley <joki@netscape.com> (original author)
|
||||
* Johnny Stenback <jst@netscape.com>
|
||||
* Johnny Stenback <jst@netscape.com> (original author)
|
||||
*
|
||||
*
|
||||
* Alternatively, the contents of this file may be used under the terms of
|
||||
|
|
|
@ -61,6 +61,7 @@
|
|||
#include "nsIDOMXMLDocument.h"
|
||||
#include "nsIDOMNSDocument.h"
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
|
||||
|
@ -1115,6 +1116,7 @@ nsDOMClassInfo::Init()
|
|||
DOM_CLASSINFO_MAP_END
|
||||
|
||||
DOM_CLASSINFO_MAP_BEGIN(Event, nsIDOMEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMKeyEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMMouseEvent)
|
||||
DOM_CLASSINFO_MAP_ENTRY(nsIDOMNSUIEvent)
|
||||
|
@ -2779,6 +2781,14 @@ nsWindowSH::GlobalResolve(nsISupports *native, JSContext *cx, JSObject *obj,
|
|||
rv = DefineInterfaceConstants(cx, cfnc_obj, primary_iid);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
// Special case for |Event|, Event needs constants from NSEvent
|
||||
// too for backwards compatibility.
|
||||
if (primary_iid->Equals(NS_GET_IID(nsIDOMEvent))) {
|
||||
rv = DefineInterfaceConstants(cx, cfnc_obj,
|
||||
&NS_GET_IID(nsIDOMNSEvent));
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIInterfaceInfoManager> iim =
|
||||
dont_AddRef(XPTI_GetInterfaceInfoManager());
|
||||
NS_ENSURE_TRUE(iim, NS_ERROR_NOT_AVAILABLE);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "nsIDOMNSHTMLInputElement.h"
|
||||
#include "nsIDOMNSHTMLTextAreaElement.h"
|
||||
#include "nsIDOMUIEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMWindowInternal.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresContext.h"
|
||||
|
@ -245,8 +246,12 @@ nsFocusController::Focus(nsIDOMEvent* aEvent)
|
|||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> t;
|
||||
aEvent->GetOriginalTarget(getter_AddRefs(t));
|
||||
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aEvent));
|
||||
if (nsevent) {
|
||||
nsevent->GetOriginalTarget(getter_AddRefs(t));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement = do_QueryInterface(t);
|
||||
if (domElement && (domElement != mCurrentElement)) {
|
||||
SetFocusedElement(domElement);
|
||||
|
@ -297,7 +302,12 @@ nsFocusController::Blur(nsIDOMEvent* aEvent)
|
|||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> t;
|
||||
aEvent->GetOriginalTarget(getter_AddRefs(t));
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->GetOriginalTarget(getter_AddRefs(t));
|
||||
}
|
||||
|
||||
nsCOMPtr<nsIDOMElement> domElement = do_QueryInterface(t);
|
||||
if (domElement) {
|
||||
|
|
|
@ -51,6 +51,7 @@
|
|||
#include "nsIDOMAttr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMKeyListener.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
|
@ -1056,8 +1057,16 @@ NS_IMETHODIMP nsHTMLEditor::CanDrag(nsIDOMEvent *aDragEvent, PRBool *aCanDrag)
|
|||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> eventTarget;
|
||||
res = aDragEvent->GetOriginalTarget(getter_AddRefs(eventTarget));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aDragEvent));
|
||||
|
||||
if (nsevent) {
|
||||
res = nsevent->GetOriginalTarget(getter_AddRefs(eventTarget));
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
if ( eventTarget )
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> eventTargetDomNode = do_QueryInterface(eventTarget);
|
||||
|
@ -1227,7 +1236,11 @@ NS_IMETHODIMP nsHTMLEditor::DoDrag(nsIDOMEvent *aDragEvent)
|
|||
rv = dragService->InvokeDragSession( domnode, transferableArray, nsnull, flags);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
aDragEvent->PreventBubble();
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aDragEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "nsString.h"
|
||||
|
||||
#include "nsIDOMEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMDocument.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIPresShell.h"
|
||||
|
@ -448,7 +449,12 @@ nsTextEditorMouseListener::MouseClick(nsIDOMEvent* aMouseEvent)
|
|||
|
||||
// Prevent the event from bubbling up to be possibly handled
|
||||
// again by the containing window:
|
||||
mouseEvent->PreventBubble();
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(mouseEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
|
||||
mouseEvent->PreventDefault();
|
||||
|
||||
// We processed the event, whether drop/paste succeeded or not
|
||||
|
@ -756,7 +762,12 @@ nsTextEditorDragListener::DragDrop(nsIDOMEvent* aMouseEvent)
|
|||
if (!nsuiEvent) return NS_OK;
|
||||
|
||||
//some day we want to use another way to stop this from bubbling.
|
||||
aMouseEvent->PreventBubble();
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aMouseEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
|
||||
aMouseEvent->PreventDefault();
|
||||
|
||||
/* for bug 47399, when dropping a drag session, if you are over your original
|
||||
|
@ -1093,7 +1104,13 @@ nsTextEditorFocusListener::Focus(nsIDOMEvent* aEvent)
|
|||
if (mEditor)
|
||||
{
|
||||
PRUint32 flags;
|
||||
aEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
|
||||
mEditor->GetFlags(&flags);
|
||||
if (! (flags & nsIPlaintextEditor::eEditorDisabledMask))
|
||||
{ // only enable caret and selection if the editor is not disabled
|
||||
|
@ -1154,7 +1171,13 @@ nsTextEditorFocusListener::Blur(nsIDOMEvent* aEvent)
|
|||
if (mEditor)
|
||||
{
|
||||
PRUint32 flags;
|
||||
aEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
|
||||
mEditor->GetFlags(&flags);
|
||||
nsCOMPtr<nsIEditor>editor = do_QueryInterface(mEditor);
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "nsIDOMAttr.h"
|
||||
#include "nsIDocument.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsIDOMKeyListener.h"
|
||||
#include "nsIDOMMouseListener.h"
|
||||
|
@ -403,8 +404,16 @@ NS_IMETHODIMP nsPlaintextEditor::CanDrag(nsIDOMEvent *aDragEvent, PRBool *aCanDr
|
|||
return NS_OK;
|
||||
|
||||
nsCOMPtr<nsIDOMEventTarget> eventTarget;
|
||||
res = aDragEvent->GetOriginalTarget(getter_AddRefs(eventTarget));
|
||||
if (NS_FAILED(res)) return res;
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aDragEvent));
|
||||
|
||||
if (nsevent) {
|
||||
res = nsevent->GetOriginalTarget(getter_AddRefs(eventTarget));
|
||||
if (NS_FAILED(res)) {
|
||||
return res;
|
||||
}
|
||||
}
|
||||
|
||||
if ( eventTarget )
|
||||
{
|
||||
nsCOMPtr<nsIDOMNode> eventTargetDomNode = do_QueryInterface(eventTarget);
|
||||
|
@ -536,7 +545,11 @@ NS_IMETHODIMP nsPlaintextEditor::DoDrag(nsIDOMEvent *aDragEvent)
|
|||
rv = dragService->InvokeDragSession( domnode, transferableArray, nsnull, flags);
|
||||
if (NS_FAILED(rv)) return rv;
|
||||
|
||||
aDragEvent->PreventBubble();
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aDragEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
#include "nsVoidArray.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
|
@ -2551,8 +2552,13 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent)
|
|||
if (IsInDropDownMode() == PR_TRUE) {
|
||||
if (!IsClickingInCombobox(aMouseEvent)) {
|
||||
aMouseEvent->PreventDefault();
|
||||
aMouseEvent->PreventCapture();
|
||||
aMouseEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aMouseEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventCapture();
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
} else {
|
||||
CaptureMouseEvents(mPresContext, PR_FALSE);
|
||||
return NS_OK;
|
||||
|
@ -2597,8 +2603,14 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent)
|
|||
IsOptionDisabled(selectedIndex, isDisabled);
|
||||
if (isDisabled) {
|
||||
aMouseEvent->PreventDefault();
|
||||
aMouseEvent->PreventCapture();
|
||||
aMouseEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aMouseEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventCapture();
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
|
||||
CaptureMouseEvents(mPresContext, PR_FALSE);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -2725,8 +2737,13 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
if (IsInDropDownMode()) {
|
||||
if (!IsClickingInCombobox(aMouseEvent)) {
|
||||
aMouseEvent->PreventDefault();
|
||||
aMouseEvent->PreventCapture();
|
||||
aMouseEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aMouseEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventCapture();
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
} else {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3068,8 +3085,13 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
mComboboxFrame->IsDroppedDown(&isDroppedDown);
|
||||
mComboboxFrame->ShowDropDown(!isDroppedDown);
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->PreventCapture();
|
||||
aKeyEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aKeyEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventCapture();
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -3093,9 +3115,14 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
} else {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// We are handling this so don't let it bubble up
|
||||
aKeyEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aKeyEvent));
|
||||
|
||||
if (nsevent) {
|
||||
// We are handling this so don't let it bubble up
|
||||
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
|
||||
// this is the new index to set
|
||||
// DOM_VK_RETURN & DOM_VK_ESCAPE will not set this
|
||||
|
@ -3175,7 +3202,7 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
|
||||
default: { // Select option with this as the first character
|
||||
// XXX Not I18N compliant
|
||||
code = (PRUint32)nsCRT::ToLower((PRUnichar)code);
|
||||
code = (PRUint32)nsCRT::ToLower((char)code);
|
||||
PRInt32 selectedIndex;
|
||||
GetSelectedIndex(&selectedIndex);
|
||||
if (selectedIndex == kNothingSelected) {
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
#include "nsIDOMMouseMotionListener.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
@ -3075,7 +3076,13 @@ nsresult nsPluginInstanceOwner::DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent)
|
|||
nsEventStatus rv = ProcessEvent(focusEvent);
|
||||
if (nsEventStatus_eConsumeNoDefault == rv) {
|
||||
aFocusEvent->PreventDefault();
|
||||
aFocusEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aFocusEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE; // means consume event
|
||||
}
|
||||
}
|
||||
|
@ -3105,7 +3112,13 @@ nsresult nsPluginInstanceOwner::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
// If this event is going to the plugin, we want to kill it.
|
||||
// Not actually sending keypress to the plugin, since we didn't before.
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aKeyEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE; // means consume event
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -3123,7 +3136,13 @@ nsresult nsPluginInstanceOwner::DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent)
|
|||
nsEventStatus rv = ProcessEvent(*keyEvent);
|
||||
if (nsEventStatus_eConsumeNoDefault == rv) {
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aKeyEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE; // means consume event
|
||||
}
|
||||
}
|
||||
|
@ -3239,7 +3258,13 @@ nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent)
|
|||
nsEventStatus rv = ProcessEvent(*mouseEvent);
|
||||
if (nsEventStatus_eConsumeNoDefault == rv) {
|
||||
aMouseEvent->PreventDefault();
|
||||
aMouseEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aMouseEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE; // means consume event
|
||||
}
|
||||
}
|
||||
|
|
|
@ -79,6 +79,7 @@
|
|||
#include "nsIDOMMouseMotionListener.h"
|
||||
#include "nsIDOMFocusListener.h"
|
||||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsIPrivateDOMEvent.h"
|
||||
#include "nsIDocumentEncoder.h"
|
||||
#include "nsXPIDLString.h"
|
||||
|
@ -3075,7 +3076,13 @@ nsresult nsPluginInstanceOwner::DispatchFocusToPlugin(nsIDOMEvent* aFocusEvent)
|
|||
nsEventStatus rv = ProcessEvent(focusEvent);
|
||||
if (nsEventStatus_eConsumeNoDefault == rv) {
|
||||
aFocusEvent->PreventDefault();
|
||||
aFocusEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aFocusEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE; // means consume event
|
||||
}
|
||||
}
|
||||
|
@ -3105,7 +3112,13 @@ nsresult nsPluginInstanceOwner::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
// If this event is going to the plugin, we want to kill it.
|
||||
// Not actually sending keypress to the plugin, since we didn't before.
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aKeyEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE; // means consume event
|
||||
}
|
||||
return NS_OK;
|
||||
|
@ -3123,7 +3136,13 @@ nsresult nsPluginInstanceOwner::DispatchKeyToPlugin(nsIDOMEvent* aKeyEvent)
|
|||
nsEventStatus rv = ProcessEvent(*keyEvent);
|
||||
if (nsEventStatus_eConsumeNoDefault == rv) {
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aKeyEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE; // means consume event
|
||||
}
|
||||
}
|
||||
|
@ -3239,7 +3258,13 @@ nsresult nsPluginInstanceOwner::DispatchMouseToPlugin(nsIDOMEvent* aMouseEvent)
|
|||
nsEventStatus rv = ProcessEvent(*mouseEvent);
|
||||
if (nsEventStatus_eConsumeNoDefault == rv) {
|
||||
aMouseEvent->PreventDefault();
|
||||
aMouseEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aMouseEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
|
||||
return NS_ERROR_FAILURE; // means consume event
|
||||
}
|
||||
}
|
||||
|
|
|
@ -74,6 +74,7 @@
|
|||
#include "nsVoidArray.h"
|
||||
#include "nsIScrollableFrame.h"
|
||||
#include "nsIDOMEventTarget.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsGUIEvent.h"
|
||||
#ifdef ACCESSIBILITY
|
||||
#include "nsIAccessibilityService.h"
|
||||
|
@ -2551,8 +2552,13 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent)
|
|||
if (IsInDropDownMode() == PR_TRUE) {
|
||||
if (!IsClickingInCombobox(aMouseEvent)) {
|
||||
aMouseEvent->PreventDefault();
|
||||
aMouseEvent->PreventCapture();
|
||||
aMouseEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aMouseEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventCapture();
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
} else {
|
||||
CaptureMouseEvents(mPresContext, PR_FALSE);
|
||||
return NS_OK;
|
||||
|
@ -2597,8 +2603,14 @@ nsListControlFrame::MouseUp(nsIDOMEvent* aMouseEvent)
|
|||
IsOptionDisabled(selectedIndex, isDisabled);
|
||||
if (isDisabled) {
|
||||
aMouseEvent->PreventDefault();
|
||||
aMouseEvent->PreventCapture();
|
||||
aMouseEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aMouseEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventCapture();
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
|
||||
CaptureMouseEvents(mPresContext, PR_FALSE);
|
||||
return NS_ERROR_FAILURE;
|
||||
}
|
||||
|
@ -2725,8 +2737,13 @@ nsListControlFrame::MouseDown(nsIDOMEvent* aMouseEvent)
|
|||
if (IsInDropDownMode()) {
|
||||
if (!IsClickingInCombobox(aMouseEvent)) {
|
||||
aMouseEvent->PreventDefault();
|
||||
aMouseEvent->PreventCapture();
|
||||
aMouseEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aMouseEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventCapture();
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
} else {
|
||||
return NS_OK;
|
||||
}
|
||||
|
@ -3068,8 +3085,13 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
mComboboxFrame->IsDroppedDown(&isDroppedDown);
|
||||
mComboboxFrame->ShowDropDown(!isDroppedDown);
|
||||
aKeyEvent->PreventDefault();
|
||||
aKeyEvent->PreventCapture();
|
||||
aKeyEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aKeyEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventCapture();
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
}
|
||||
}
|
||||
#endif
|
||||
|
@ -3093,9 +3115,14 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
} else {
|
||||
return rv;
|
||||
}
|
||||
|
||||
// We are handling this so don't let it bubble up
|
||||
aKeyEvent->PreventBubble();
|
||||
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aKeyEvent));
|
||||
|
||||
if (nsevent) {
|
||||
// We are handling this so don't let it bubble up
|
||||
|
||||
nsevent->PreventBubble();
|
||||
}
|
||||
|
||||
// this is the new index to set
|
||||
// DOM_VK_RETURN & DOM_VK_ESCAPE will not set this
|
||||
|
@ -3175,7 +3202,7 @@ nsListControlFrame::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
|
||||
default: { // Select option with this as the first character
|
||||
// XXX Not I18N compliant
|
||||
code = (PRUint32)nsCRT::ToLower((PRUnichar)code);
|
||||
code = (PRUint32)nsCRT::ToLower((char)code);
|
||||
PRInt32 selectedIndex;
|
||||
GetSelectedIndex(&selectedIndex);
|
||||
if (selectedIndex == kNothingSelected) {
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMNSUIEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
// Drag & Drop, Clipboard
|
||||
|
@ -156,8 +157,13 @@ nsMenuBarListener::KeyUp(nsIDOMEvent* aKeyEvent)
|
|||
|
||||
PRBool active = mMenuBarFrame->IsActive();
|
||||
if (active) {
|
||||
aKeyEvent->PreventBubble();
|
||||
aKeyEvent->PreventCapture();
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aKeyEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
nsevent->PreventCapture();
|
||||
}
|
||||
|
||||
aKeyEvent->PreventDefault();
|
||||
return NS_ERROR_BASE; // I am consuming event
|
||||
}
|
||||
|
@ -186,6 +192,8 @@ nsMenuBarListener::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
if (mAccessKey)
|
||||
{
|
||||
nsCOMPtr<nsIDOMNSUIEvent> nsUIEvent = do_QueryInterface(aKeyEvent);
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aKeyEvent));
|
||||
|
||||
PRBool preventDefault;
|
||||
|
||||
nsUIEvent->GetPreventDefault(&preventDefault);
|
||||
|
@ -207,8 +215,11 @@ nsMenuBarListener::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
mMenuBarFrame->ShortcutNavigation(theChar, active);
|
||||
|
||||
if (active) {
|
||||
aKeyEvent->PreventBubble();
|
||||
aKeyEvent->PreventCapture();
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
nsevent->PreventCapture();
|
||||
}
|
||||
|
||||
aKeyEvent->PreventDefault();
|
||||
|
||||
retVal = NS_ERROR_BASE; // I am consuming event
|
||||
|
@ -227,8 +238,11 @@ nsMenuBarListener::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
// In Windows, both of these activate the menu bar.
|
||||
mMenuBarFrame->ToggleMenuActiveState();
|
||||
|
||||
aKeyEvent->PreventBubble();
|
||||
aKeyEvent->PreventCapture();
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
nsevent->PreventCapture();
|
||||
}
|
||||
|
||||
aKeyEvent->PreventDefault();
|
||||
return NS_ERROR_BASE; // consume the event
|
||||
}
|
||||
|
|
|
@ -44,6 +44,7 @@
|
|||
#include "nsIDOMEventReceiver.h"
|
||||
#include "nsIDOMEventListener.h"
|
||||
#include "nsIDOMNSUIEvent.h"
|
||||
#include "nsIDOMNSEvent.h"
|
||||
#include "nsGUIEvent.h"
|
||||
|
||||
// Drag & Drop, Clipboard
|
||||
|
@ -91,9 +92,14 @@ nsMenuListener::~nsMenuListener()
|
|||
////////////////////////////////////////////////////////////////////////
|
||||
nsresult
|
||||
nsMenuListener::KeyUp(nsIDOMEvent* aKeyEvent)
|
||||
{
|
||||
aKeyEvent->PreventBubble();
|
||||
aKeyEvent->PreventCapture();
|
||||
{
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aKeyEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
nsevent->PreventCapture();
|
||||
}
|
||||
|
||||
aKeyEvent->PreventDefault();
|
||||
|
||||
return NS_ERROR_BASE; // I am consuming event
|
||||
|
@ -157,8 +163,13 @@ nsMenuListener::KeyDown(nsIDOMEvent* aKeyEvent)
|
|||
mMenuParent->DismissChain();
|
||||
}
|
||||
|
||||
aKeyEvent->PreventBubble();
|
||||
aKeyEvent->PreventCapture();
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aKeyEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
nsevent->PreventCapture();
|
||||
}
|
||||
|
||||
aKeyEvent->PreventDefault();
|
||||
|
||||
return NS_ERROR_BASE; // I am consuming event
|
||||
|
@ -235,8 +246,13 @@ nsMenuListener::KeyPress(nsIDOMEvent* aKeyEvent)
|
|||
}
|
||||
}
|
||||
|
||||
aKeyEvent->PreventBubble();
|
||||
aKeyEvent->PreventCapture();
|
||||
nsCOMPtr<nsIDOMNSEvent> nsevent(do_QueryInterface(aKeyEvent));
|
||||
|
||||
if (nsevent) {
|
||||
nsevent->PreventBubble();
|
||||
nsevent->PreventCapture();
|
||||
}
|
||||
|
||||
aKeyEvent->PreventDefault();
|
||||
|
||||
return NS_ERROR_BASE; // I am consuming event
|
||||
|
|
Загрузка…
Ссылка в новой задаче