2007-03-22 10:30:00 -07:00
|
|
|
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
|
|
|
|
/* ***** BEGIN LICENSE BLOCK *****
|
|
|
|
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
|
|
|
|
*
|
|
|
|
* The contents of this file are subject to the Mozilla Public License Version
|
|
|
|
* 1.1 (the "License"); you may not use this file except in compliance with
|
|
|
|
* the License. You may obtain a copy of the License at
|
|
|
|
* http://www.mozilla.org/MPL/
|
|
|
|
*
|
|
|
|
* Software distributed under the License is distributed on an "AS IS" basis,
|
|
|
|
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
|
|
|
|
* for the specific language governing rights and limitations under the
|
|
|
|
* License.
|
|
|
|
*
|
|
|
|
* The Original Code is mozilla.org code.
|
|
|
|
*
|
|
|
|
* The Initial Developer of the Original Code is
|
|
|
|
* Netscape Communications Corporation.
|
|
|
|
* Portions created by the Initial Developer are Copyright (C) 1998
|
|
|
|
* the Initial Developer. All Rights Reserved.
|
|
|
|
*
|
|
|
|
* Contributor(s):
|
|
|
|
*
|
|
|
|
* Alternatively, the contents of this file may be used under the terms of
|
|
|
|
* either of the GNU General Public License Version 2 or later (the "GPL"),
|
|
|
|
* or the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
|
|
|
|
* in which case the provisions of the GPL or the LGPL are applicable instead
|
|
|
|
* of those above. If you wish to allow use of your version of this file only
|
|
|
|
* under the terms of either the GPL or the LGPL, and not to allow others to
|
|
|
|
* use your version of this file under the terms of the MPL, indicate your
|
|
|
|
* decision by deleting the provisions above and replace them with the notice
|
|
|
|
* and other provisions required by the GPL or the LGPL. If you do not delete
|
|
|
|
* the provisions above, a recipient may use your version of this file under
|
|
|
|
* the terms of any one of the MPL, the GPL or the LGPL.
|
|
|
|
*
|
|
|
|
* ***** END LICENSE BLOCK ***** */
|
|
|
|
|
|
|
|
#ifndef nsDOMEvent_h__
|
|
|
|
#define nsDOMEvent_h__
|
|
|
|
|
|
|
|
#include "nsIDOMEvent.h"
|
|
|
|
#include "nsIDOMNSEvent.h"
|
|
|
|
#include "nsISupports.h"
|
|
|
|
#include "nsIPrivateDOMEvent.h"
|
|
|
|
#include "nsCOMPtr.h"
|
|
|
|
#include "nsIDOMEventTarget.h"
|
|
|
|
#include "nsPIDOMWindow.h"
|
|
|
|
#include "nsPoint.h"
|
|
|
|
#include "nsGUIEvent.h"
|
2007-06-26 01:21:42 -07:00
|
|
|
#include "nsCycleCollectionParticipant.h"
|
2010-04-10 13:10:12 -07:00
|
|
|
#include "nsAutoPtr.h"
|
2011-12-14 11:53:48 -08:00
|
|
|
#include "nsIJSNativeInitializer.h"
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsIContent;
|
2010-04-10 13:10:12 -07:00
|
|
|
class nsPresContext;
|
2011-12-15 00:48:09 -08:00
|
|
|
struct JSContext;
|
|
|
|
struct JSObject;
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
class nsDOMEvent : public nsIDOMEvent,
|
|
|
|
public nsIDOMNSEvent,
|
2011-12-14 11:53:48 -08:00
|
|
|
public nsIPrivateDOMEvent,
|
|
|
|
public nsIJSNativeInitializer
|
2007-03-22 10:30:00 -07:00
|
|
|
{
|
|
|
|
public:
|
|
|
|
|
2009-09-01 09:45:05 -07:00
|
|
|
// Note: this enum must be kept in sync with sEventNames in nsDOMEvent.cpp
|
2007-03-22 10:30:00 -07:00
|
|
|
enum nsDOMEvents {
|
|
|
|
eDOMEvents_mousedown=0,
|
|
|
|
eDOMEvents_mouseup,
|
|
|
|
eDOMEvents_click,
|
|
|
|
eDOMEvents_dblclick,
|
2011-09-18 00:45:14 -07:00
|
|
|
eDOMEvents_mouseenter,
|
|
|
|
eDOMEvents_mouseleave,
|
2007-03-22 10:30:00 -07:00
|
|
|
eDOMEvents_mouseover,
|
|
|
|
eDOMEvents_mouseout,
|
2010-06-27 23:04:05 -07:00
|
|
|
eDOMEvents_MozMouseHittest,
|
2007-03-22 10:30:00 -07:00
|
|
|
eDOMEvents_mousemove,
|
|
|
|
eDOMEvents_contextmenu,
|
|
|
|
eDOMEvents_keydown,
|
|
|
|
eDOMEvents_keyup,
|
|
|
|
eDOMEvents_keypress,
|
|
|
|
eDOMEvents_focus,
|
|
|
|
eDOMEvents_blur,
|
|
|
|
eDOMEvents_load,
|
2009-09-01 09:45:05 -07:00
|
|
|
eDOMEvents_popstate,
|
2010-09-16 01:48:47 -07:00
|
|
|
eDOMEvents_beforescriptexecute,
|
|
|
|
eDOMEvents_afterscriptexecute,
|
2007-03-22 10:30:00 -07:00
|
|
|
eDOMEvents_beforeunload,
|
|
|
|
eDOMEvents_unload,
|
2009-06-26 10:16:50 -07:00
|
|
|
eDOMEvents_hashchange,
|
2010-06-23 18:12:07 -07:00
|
|
|
eDOMEvents_readystatechange,
|
2007-03-22 10:30:00 -07:00
|
|
|
eDOMEvents_abort,
|
|
|
|
eDOMEvents_error,
|
|
|
|
eDOMEvents_submit,
|
|
|
|
eDOMEvents_reset,
|
|
|
|
eDOMEvents_change,
|
|
|
|
eDOMEvents_select,
|
|
|
|
eDOMEvents_input,
|
2010-08-18 11:28:08 -07:00
|
|
|
eDOMEvents_invalid,
|
2007-03-22 10:30:00 -07:00
|
|
|
eDOMEvents_text,
|
|
|
|
eDOMEvents_compositionstart,
|
|
|
|
eDOMEvents_compositionend,
|
2011-09-22 02:17:40 -07:00
|
|
|
eDOMEvents_compositionupdate,
|
2007-03-22 10:30:00 -07:00
|
|
|
eDOMEvents_popupShowing,
|
|
|
|
eDOMEvents_popupShown,
|
|
|
|
eDOMEvents_popupHiding,
|
|
|
|
eDOMEvents_popupHidden,
|
|
|
|
eDOMEvents_close,
|
|
|
|
eDOMEvents_command,
|
|
|
|
eDOMEvents_broadcast,
|
|
|
|
eDOMEvents_commandupdate,
|
|
|
|
eDOMEvents_dragenter,
|
|
|
|
eDOMEvents_dragover,
|
|
|
|
eDOMEvents_dragexit,
|
|
|
|
eDOMEvents_dragdrop,
|
|
|
|
eDOMEvents_draggesture,
|
2007-04-11 21:37:39 -07:00
|
|
|
eDOMEvents_drag,
|
|
|
|
eDOMEvents_dragend,
|
2008-08-27 05:07:27 -07:00
|
|
|
eDOMEvents_dragstart,
|
|
|
|
eDOMEvents_dragleave,
|
|
|
|
eDOMEvents_drop,
|
2007-03-22 10:30:00 -07:00
|
|
|
eDOMEvents_resize,
|
|
|
|
eDOMEvents_scroll,
|
|
|
|
eDOMEvents_overflow,
|
|
|
|
eDOMEvents_underflow,
|
|
|
|
eDOMEvents_overflowchanged,
|
|
|
|
eDOMEvents_subtreemodified,
|
|
|
|
eDOMEvents_nodeinserted,
|
|
|
|
eDOMEvents_noderemoved,
|
|
|
|
eDOMEvents_noderemovedfromdocument,
|
|
|
|
eDOMEvents_nodeinsertedintodocument,
|
|
|
|
eDOMEvents_attrmodified,
|
|
|
|
eDOMEvents_characterdatamodified,
|
|
|
|
eDOMEvents_DOMActivate,
|
|
|
|
eDOMEvents_DOMFocusIn,
|
|
|
|
eDOMEvents_DOMFocusOut,
|
|
|
|
eDOMEvents_pageshow,
|
|
|
|
eDOMEvents_pagehide,
|
2007-06-06 20:28:04 -07:00
|
|
|
eDOMEvents_DOMMouseScroll,
|
2008-09-17 04:27:19 -07:00
|
|
|
eDOMEvents_MozMousePixelScroll,
|
2007-06-06 20:28:04 -07:00
|
|
|
eDOMEvents_offline,
|
2007-07-25 21:14:33 -07:00
|
|
|
eDOMEvents_online,
|
|
|
|
eDOMEvents_copy,
|
|
|
|
eDOMEvents_cut,
|
2008-09-18 02:47:21 -07:00
|
|
|
eDOMEvents_paste,
|
2011-05-22 14:30:07 -07:00
|
|
|
eDOMEvents_open,
|
|
|
|
eDOMEvents_message,
|
2011-08-08 10:31:32 -07:00
|
|
|
eDOMEvents_show,
|
2007-03-22 10:30:00 -07:00
|
|
|
eDOMEvents_SVGLoad,
|
|
|
|
eDOMEvents_SVGUnload,
|
|
|
|
eDOMEvents_SVGAbort,
|
|
|
|
eDOMEvents_SVGError,
|
|
|
|
eDOMEvents_SVGResize,
|
|
|
|
eDOMEvents_SVGScroll,
|
2008-09-18 02:47:21 -07:00
|
|
|
eDOMEvents_SVGZoom,
|
2010-07-31 00:02:52 -07:00
|
|
|
eDOMEvents_beginEvent,
|
|
|
|
eDOMEvents_endEvent,
|
|
|
|
eDOMEvents_repeatEvent,
|
2008-07-09 01:22:20 -07:00
|
|
|
#ifdef MOZ_MEDIA
|
|
|
|
eDOMEvents_loadstart,
|
|
|
|
eDOMEvents_progress,
|
2009-02-26 03:55:30 -08:00
|
|
|
eDOMEvents_suspend,
|
2008-07-09 01:22:20 -07:00
|
|
|
eDOMEvents_emptied,
|
|
|
|
eDOMEvents_stalled,
|
|
|
|
eDOMEvents_play,
|
|
|
|
eDOMEvents_pause,
|
2009-02-26 03:55:30 -08:00
|
|
|
eDOMEvents_loadedmetadata,
|
|
|
|
eDOMEvents_loadeddata,
|
2008-07-09 01:22:20 -07:00
|
|
|
eDOMEvents_waiting,
|
2009-02-26 03:55:30 -08:00
|
|
|
eDOMEvents_playing,
|
|
|
|
eDOMEvents_canplay,
|
|
|
|
eDOMEvents_canplaythrough,
|
2008-07-09 01:22:20 -07:00
|
|
|
eDOMEvents_seeking,
|
|
|
|
eDOMEvents_seeked,
|
|
|
|
eDOMEvents_timeupdate,
|
|
|
|
eDOMEvents_ended,
|
|
|
|
eDOMEvents_ratechange,
|
|
|
|
eDOMEvents_durationchange,
|
2008-09-18 02:47:21 -07:00
|
|
|
eDOMEvents_volumechange,
|
2010-08-25 06:10:00 -07:00
|
|
|
eDOMEvents_mozaudioavailable,
|
2008-07-09 01:22:20 -07:00
|
|
|
#endif
|
2008-10-23 13:15:20 -07:00
|
|
|
eDOMEvents_afterpaint,
|
2010-11-17 05:46:00 -08:00
|
|
|
eDOMEvents_beforeresize,
|
2011-09-04 13:40:11 -07:00
|
|
|
eDOMEvents_mozfullscreenchange,
|
2011-11-01 17:02:47 -07:00
|
|
|
eDOMEvents_mozfullscreenerror,
|
2008-10-23 13:15:20 -07:00
|
|
|
eDOMEvents_MozSwipeGesture,
|
|
|
|
eDOMEvents_MozMagnifyGestureStart,
|
|
|
|
eDOMEvents_MozMagnifyGestureUpdate,
|
|
|
|
eDOMEvents_MozMagnifyGesture,
|
|
|
|
eDOMEvents_MozRotateGestureStart,
|
|
|
|
eDOMEvents_MozRotateGestureUpdate,
|
2009-04-02 12:34:31 -07:00
|
|
|
eDOMEvents_MozRotateGesture,
|
|
|
|
eDOMEvents_MozTapGesture,
|
2009-09-11 16:13:56 -07:00
|
|
|
eDOMEvents_MozPressTapGesture,
|
2010-08-02 06:34:54 -07:00
|
|
|
eDOMEvents_MozTouchDown,
|
|
|
|
eDOMEvents_MozTouchMove,
|
|
|
|
eDOMEvents_MozTouchUp,
|
2009-12-23 11:10:31 -08:00
|
|
|
eDOMEvents_MozScrolledAreaChanged,
|
2011-06-20 16:47:09 -07:00
|
|
|
eDOMEvents_transitionend,
|
2011-04-11 23:18:44 -07:00
|
|
|
eDOMEvents_animationstart,
|
|
|
|
eDOMEvents_animationend,
|
2011-06-28 15:37:31 -07:00
|
|
|
eDOMEvents_animationiteration,
|
|
|
|
eDOMEvents_devicemotion,
|
|
|
|
eDOMEvents_deviceorientation
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
nsDOMEvent(nsPresContext* aPresContext, nsEvent* aEvent);
|
|
|
|
virtual ~nsDOMEvent();
|
|
|
|
|
2007-06-26 01:21:42 -07:00
|
|
|
NS_DECL_CYCLE_COLLECTING_ISUPPORTS
|
|
|
|
NS_DECL_CYCLE_COLLECTION_CLASS_AMBIGUOUS(nsDOMEvent, nsIDOMEvent)
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
// nsIDOMEvent Interface
|
|
|
|
NS_DECL_NSIDOMEVENT
|
|
|
|
|
|
|
|
// nsIDOMNSEvent Interface
|
|
|
|
NS_DECL_NSIDOMNSEVENT
|
|
|
|
|
|
|
|
// nsIPrivateDOMEvent interface
|
|
|
|
NS_IMETHOD DuplicatePrivateData();
|
|
|
|
NS_IMETHOD SetTarget(nsIDOMEventTarget* aTarget);
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD_(bool) IsDispatchStopped();
|
2008-10-09 16:23:07 -07:00
|
|
|
NS_IMETHOD_(nsEvent*) GetInternalNSEvent();
|
2011-09-28 23:19:26 -07:00
|
|
|
NS_IMETHOD SetTrusted(bool aTrusted);
|
2007-03-22 10:30:00 -07:00
|
|
|
|
2011-12-14 11:53:48 -08:00
|
|
|
// nsIJSNativeInitializer
|
|
|
|
NS_IMETHOD Initialize(nsISupports* aOwner, JSContext* aCx, JSObject* aObj,
|
|
|
|
PRUint32 aArgc, jsval* aArgv);
|
|
|
|
|
|
|
|
virtual const nsIID& EventInitIID() { return NS_GET_IID(nsIEventInit); }
|
2011-12-14 11:55:32 -08:00
|
|
|
virtual nsresult InitFromCtor(const nsAString& aType, nsISupports* aDict,
|
|
|
|
JSContext* aCx, JSObject* aObj);
|
2011-12-14 11:53:48 -08:00
|
|
|
|
|
|
|
void InitPresContextData(nsPresContext* aPresContext);
|
|
|
|
|
2011-09-28 23:19:26 -07:00
|
|
|
virtual void Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType);
|
|
|
|
virtual bool Deserialize(const IPC::Message* aMsg, void** aIter);
|
2009-11-17 06:22:23 -08:00
|
|
|
|
2007-03-22 10:30:00 -07:00
|
|
|
static PopupControlState GetEventPopupControlState(nsEvent *aEvent);
|
|
|
|
|
|
|
|
static void PopupAllowedEventsChanged();
|
|
|
|
|
|
|
|
static void Shutdown();
|
|
|
|
|
2009-10-16 01:57:32 -07:00
|
|
|
static const char* GetEventName(PRUint32 aEventType);
|
2007-03-22 10:30:00 -07:00
|
|
|
protected:
|
|
|
|
|
|
|
|
// Internal helper functions
|
|
|
|
nsresult SetEventType(const nsAString& aEventTypeArg);
|
2010-06-11 04:10:51 -07:00
|
|
|
already_AddRefed<nsIContent> GetTargetFromFrame();
|
2007-03-22 10:30:00 -07:00
|
|
|
|
|
|
|
nsEvent* mEvent;
|
2010-03-25 06:17:11 -07:00
|
|
|
nsRefPtr<nsPresContext> mPresContext;
|
2007-03-22 10:30:00 -07:00
|
|
|
nsCOMPtr<nsIDOMEventTarget> mTmpRealOriginalTarget;
|
2010-06-11 04:10:51 -07:00
|
|
|
nsIDOMEventTarget* mExplicitOriginalTarget;
|
2009-10-24 08:06:01 -07:00
|
|
|
nsString mCachedType;
|
2011-09-28 23:19:26 -07:00
|
|
|
bool mEventIsInternal;
|
|
|
|
bool mPrivateDataDuplicated;
|
2007-03-22 10:30:00 -07:00
|
|
|
};
|
|
|
|
|
|
|
|
#define NS_FORWARD_TO_NSDOMEVENT \
|
|
|
|
NS_FORWARD_NSIDOMEVENT(nsDOMEvent::)
|
|
|
|
|
|
|
|
#endif // nsDOMEvent_h__
|