зеркало из https://github.com/mozilla/gecko-dev.git
Bug 975688 part.26 Rename nsDOMUIEvent to mozilla::dom::UIEvent r=smaug
--HG-- rename : dom/events/nsDOMUIEvent.cpp => dom/events/UIEvent.cpp rename : dom/events/nsDOMUIEvent.h => dom/events/UIEvent.h
This commit is contained in:
Родитель
3e1e0f7de6
Коммит
e4686896dc
|
@ -20,8 +20,8 @@ namespace dom {
|
|||
SVGZoomEvent::SVGZoomEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetGUIEvent* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetGUIEvent(false, NS_SVG_ZOOM, 0))
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetGUIEvent(false, NS_SVG_ZOOM, 0))
|
||||
, mPreviousScale(0)
|
||||
, mNewScale(0)
|
||||
{
|
||||
|
|
|
@ -6,11 +6,11 @@
|
|||
#ifndef mozilla_dom_SVGZoomEvent_h
|
||||
#define mozilla_dom_SVGZoomEvent_h
|
||||
|
||||
#include "nsAutoPtr.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "DOMSVGPoint.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/dom/SVGZoomEventBinding.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsAutoPtr.h"
|
||||
|
||||
class nsPresContext;
|
||||
|
||||
|
@ -20,14 +20,14 @@ class nsISVGPoint;
|
|||
|
||||
namespace dom {
|
||||
|
||||
class SVGZoomEvent MOZ_FINAL : public nsDOMUIEvent
|
||||
class SVGZoomEvent MOZ_FINAL : public UIEvent
|
||||
{
|
||||
public:
|
||||
SVGZoomEvent(EventTarget* aOwner, nsPresContext* aPresContext,
|
||||
WidgetGUIEvent* aEvent);
|
||||
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
NS_FORWARD_TO_UIEVENT
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
|
|
|
@ -64,7 +64,8 @@ DOMCI_CASTABLE_INTERFACE(nsSVGElement, nsIContent, 9, _extra) \
|
|||
/* NOTE: When removing the casts below, remove the nsDOMEventBase class */ \
|
||||
DOMCI_CASTABLE_NODECL_INTERFACE(mozilla::dom::MouseEvent, \
|
||||
nsDOMEventBase, 10, _extra) \
|
||||
DOMCI_CASTABLE_INTERFACE(nsDOMUIEvent, nsDOMEventBase, 11, _extra) \
|
||||
DOMCI_CASTABLE_NODECL_INTERFACE(mozilla::dom::UIEvent, \
|
||||
nsDOMEventBase, 11, _extra) \
|
||||
DOMCI_CASTABLE_INTERFACE(nsGlobalWindow, nsIDOMEventTarget, 12, _extra)
|
||||
|
||||
// Make sure all classes mentioned in DOMCI_CASTABLE_INTERFACES
|
||||
|
@ -79,6 +80,7 @@ namespace dom {
|
|||
class Element;
|
||||
class EventTarget;
|
||||
class MouseEvent;
|
||||
class UIEvent;
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
|
|
|
@ -1232,10 +1232,6 @@ DOMInterfaces = {
|
|||
'resultNotAddRefed': [ 'root', 'currentNode' ],
|
||||
},
|
||||
|
||||
'UIEvent': {
|
||||
'nativeType': 'nsDOMUIEvent',
|
||||
},
|
||||
|
||||
'UndoManager': {
|
||||
'implicitJSContext' : [ 'undo', 'redo', 'transact' ],
|
||||
},
|
||||
|
|
|
@ -14,8 +14,8 @@ namespace dom {
|
|||
CompositionEvent::CompositionEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetCompositionEvent* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent :
|
||||
new WidgetCompositionEvent(false, 0, nullptr))
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetCompositionEvent(false, 0, nullptr))
|
||||
{
|
||||
NS_ASSERTION(mEvent->eventStructType == NS_COMPOSITION_EVENT,
|
||||
"event type mismatch");
|
||||
|
@ -36,12 +36,12 @@ CompositionEvent::CompositionEvent(EventTarget* aOwner,
|
|||
// TODO: Native event should have locale information.
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(CompositionEvent, nsDOMUIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(CompositionEvent, nsDOMUIEvent)
|
||||
NS_IMPL_ADDREF_INHERITED(CompositionEvent, UIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(CompositionEvent, UIEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(CompositionEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMCompositionEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
CompositionEvent::GetData(nsAString& aData)
|
||||
|
@ -65,8 +65,7 @@ CompositionEvent::InitCompositionEvent(const nsAString& aType,
|
|||
const nsAString& aData,
|
||||
const nsAString& aLocale)
|
||||
{
|
||||
nsresult rv =
|
||||
nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, 0);
|
||||
nsresult rv = UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, 0);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mData = aData;
|
||||
|
|
|
@ -7,15 +7,15 @@
|
|||
#ifndef mozilla_dom_CompositionEvent_h_
|
||||
#define mozilla_dom_CompositionEvent_h_
|
||||
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIDOMCompositionEvent.h"
|
||||
#include "mozilla/dom/CompositionEventBinding.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsIDOMCompositionEvent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class CompositionEvent : public nsDOMUIEvent,
|
||||
class CompositionEvent : public UIEvent,
|
||||
public nsIDOMCompositionEvent
|
||||
{
|
||||
public:
|
||||
|
@ -24,7 +24,7 @@ public:
|
|||
WidgetCompositionEvent* aEvent);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
NS_FORWARD_TO_UIEVENT
|
||||
NS_DECL_NSIDOMCOMPOSITIONEVENT
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
|
|
|
@ -10,14 +10,13 @@
|
|||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(FocusEvent, nsDOMUIEvent, nsIDOMFocusEvent)
|
||||
NS_IMPL_ISUPPORTS_INHERITED1(FocusEvent, UIEvent, nsIDOMFocusEvent)
|
||||
|
||||
FocusEvent::FocusEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
InternalFocusEvent* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent :
|
||||
new InternalFocusEvent(false, NS_FOCUS_CONTENT))
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalFocusEvent(false, NS_FOCUS_CONTENT))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
|
@ -50,7 +49,8 @@ FocusEvent::InitFocusEvent(const nsAString& aType,
|
|||
int32_t aDetail,
|
||||
EventTarget* aRelatedTarget)
|
||||
{
|
||||
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
|
||||
nsresult rv =
|
||||
UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
mEvent->AsFocusEvent()->relatedTarget = aRelatedTarget;
|
||||
return NS_OK;
|
||||
|
|
|
@ -5,15 +5,15 @@
|
|||
#ifndef mozilla_dom_FocusEvent_h_
|
||||
#define mozilla_dom_FocusEvent_h_
|
||||
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIDOMFocusEvent.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/dom/FocusEventBinding.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsIDOMFocusEvent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class FocusEvent : public nsDOMUIEvent,
|
||||
class FocusEvent : public UIEvent,
|
||||
public nsIDOMFocusEvent
|
||||
{
|
||||
public:
|
||||
|
@ -21,7 +21,7 @@ public:
|
|||
NS_DECL_NSIDOMFOCUSEVENT
|
||||
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
NS_FORWARD_TO_UIEVENT
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
|
|
|
@ -13,8 +13,8 @@ namespace dom {
|
|||
KeyboardEvent::KeyboardEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetKeyboardEvent* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent :
|
||||
new WidgetKeyboardEvent(false, 0, nullptr))
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetKeyboardEvent(false, 0, nullptr))
|
||||
{
|
||||
NS_ASSERTION(mEvent->eventStructType == NS_KEY_EVENT, "event type mismatch");
|
||||
|
||||
|
@ -28,12 +28,12 @@ KeyboardEvent::KeyboardEvent(EventTarget* aOwner,
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(KeyboardEvent, nsDOMUIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(KeyboardEvent, nsDOMUIEvent)
|
||||
NS_IMPL_ADDREF_INHERITED(KeyboardEvent, UIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(KeyboardEvent, UIEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(KeyboardEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMKeyEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
|
||||
|
||||
bool
|
||||
KeyboardEvent::AltKey()
|
||||
|
@ -212,7 +212,7 @@ KeyboardEvent::InitKeyEvent(const nsAString& aType,
|
|||
uint32_t aKeyCode,
|
||||
uint32_t aCharCode)
|
||||
{
|
||||
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, 0);
|
||||
nsresult rv = UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, 0);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
WidgetKeyboardEvent* keyEvent = mEvent->AsKeyboardEvent();
|
||||
|
|
|
@ -6,15 +6,15 @@
|
|||
#ifndef mozilla_dom_KeyboardEvent_h_
|
||||
#define mozilla_dom_KeyboardEvent_h_
|
||||
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/dom/KeyboardEventBinding.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsIDOMKeyEvent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class KeyboardEvent : public nsDOMUIEvent,
|
||||
class KeyboardEvent : public UIEvent,
|
||||
public nsIDOMKeyEvent
|
||||
{
|
||||
public:
|
||||
|
@ -28,7 +28,7 @@ public:
|
|||
NS_DECL_NSIDOMKEYEVENT
|
||||
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
NS_FORWARD_TO_UIEVENT
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
|
|
|
@ -15,9 +15,9 @@ namespace dom {
|
|||
MouseEvent::MouseEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetMouseEventBase* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent :
|
||||
new WidgetMouseEvent(false, 0, nullptr,
|
||||
WidgetMouseEvent::eReal))
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetMouseEvent(false, 0, nullptr,
|
||||
WidgetMouseEvent::eReal))
|
||||
{
|
||||
// There's no way to make this class' ctor allocate an WidgetMouseScrollEvent.
|
||||
// It's not that important, though, since a scroll event is not a real
|
||||
|
@ -41,12 +41,12 @@ MouseEvent::MouseEvent(EventTarget* aOwner,
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(MouseEvent, nsDOMUIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(MouseEvent, nsDOMUIEvent)
|
||||
NS_IMPL_ADDREF_INHERITED(MouseEvent, UIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(MouseEvent, UIEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(MouseEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
|
||||
|
||||
NS_IMETHODIMP
|
||||
MouseEvent::InitMouseEvent(const nsAString& aType,
|
||||
|
@ -65,7 +65,8 @@ MouseEvent::InitMouseEvent(const nsAString& aType,
|
|||
uint16_t aButton,
|
||||
nsIDOMEventTarget* aRelatedTarget)
|
||||
{
|
||||
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
|
||||
nsresult rv =
|
||||
UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
switch(mEvent->eventStructType) {
|
||||
|
|
|
@ -6,15 +6,15 @@
|
|||
#ifndef mozilla_dom_MouseEvent_h_
|
||||
#define mozilla_dom_MouseEvent_h_
|
||||
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/dom/MouseEventBinding.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsIDOMMouseEvent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class MouseEvent : public nsDOMUIEvent,
|
||||
class MouseEvent : public UIEvent,
|
||||
public nsIDOMMouseEvent
|
||||
{
|
||||
public:
|
||||
|
@ -28,7 +28,7 @@ public:
|
|||
NS_DECL_NSIDOMMOUSEEVENT
|
||||
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
NS_FORWARD_TO_UIEVENT
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
|
@ -121,6 +121,6 @@ protected:
|
|||
|
||||
#define NS_FORWARD_TO_MOUSEEVENT \
|
||||
NS_FORWARD_NSIDOMMOUSEEVENT(MouseEvent::) \
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
NS_FORWARD_TO_UIEVENT
|
||||
|
||||
#endif // mozilla_dom_MouseEvent_h_
|
||||
|
|
|
@ -15,18 +15,18 @@ namespace dom {
|
|||
ScrollAreaEvent::ScrollAreaEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
InternalScrollAreaEvent* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext, aEvent)
|
||||
: UIEvent(aOwner, aPresContext, aEvent)
|
||||
, mClientArea(nullptr)
|
||||
{
|
||||
mClientArea.SetLayoutRect(aEvent ? aEvent->mArea : nsRect());
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(ScrollAreaEvent, nsDOMUIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(ScrollAreaEvent, nsDOMUIEvent)
|
||||
NS_IMPL_ADDREF_INHERITED(ScrollAreaEvent, UIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(ScrollAreaEvent, UIEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(ScrollAreaEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMScrollAreaEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
|
||||
|
||||
|
||||
#define FORWARD_GETTER(_name) \
|
||||
|
@ -53,7 +53,8 @@ ScrollAreaEvent::InitScrollAreaEvent(const nsAString& aEventType,
|
|||
float aWidth,
|
||||
float aHeight)
|
||||
{
|
||||
nsresult rv = nsDOMUIEvent::InitUIEvent(aEventType, aCanBubble, aCancelable, aView, aDetail);
|
||||
nsresult rv =
|
||||
UIEvent::InitUIEvent(aEventType, aCanBubble, aCancelable, aView, aDetail);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mClientArea.SetRect(aX, aY, aWidth, aHeight);
|
||||
|
|
|
@ -6,18 +6,17 @@
|
|||
#ifndef mozilla_dom_ScrollAreaEvent_h_
|
||||
#define mozilla_dom_ScrollAreaEvent_h_
|
||||
|
||||
#include "mozilla/dom/DOMRect.h"
|
||||
#include "mozilla/dom/ScrollAreaEventBinding.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsIDOMScrollAreaEvent.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
|
||||
#include "mozilla/dom/DOMRect.h"
|
||||
#include "mozilla/dom/ScrollAreaEventBinding.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class ScrollAreaEvent : public nsDOMUIEvent,
|
||||
class ScrollAreaEvent : public UIEvent,
|
||||
public nsIDOMScrollAreaEvent
|
||||
{
|
||||
public:
|
||||
|
@ -29,7 +28,7 @@ public:
|
|||
|
||||
NS_DECL_NSIDOMSCROLLAREAEVENT
|
||||
|
||||
NS_FORWARD_NSIDOMUIEVENT(nsDOMUIEvent::)
|
||||
NS_FORWARD_NSIDOMUIEVENT(UIEvent::)
|
||||
|
||||
NS_FORWARD_TO_NSDOMEVENT_NO_SERIALIZATION_NO_DUPLICATION
|
||||
NS_IMETHOD DuplicatePrivateData()
|
||||
|
|
|
@ -67,8 +67,8 @@ TouchList::IdentifiedTouch(int32_t aIdentifier) const
|
|||
TouchEvent::TouchEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetTouchEvent* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetTouchEvent(false, 0, nullptr))
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetTouchEvent(false, 0, nullptr))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
|
@ -83,16 +83,16 @@ TouchEvent::TouchEvent(EventTarget* aOwner,
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_3(TouchEvent, nsDOMUIEvent,
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_3(TouchEvent, UIEvent,
|
||||
mTouches,
|
||||
mTargetTouches,
|
||||
mChangedTouches)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(TouchEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(TouchEvent, nsDOMUIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(TouchEvent, nsDOMUIEvent)
|
||||
NS_IMPL_ADDREF_INHERITED(TouchEvent, UIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(TouchEvent, UIEvent)
|
||||
|
||||
void
|
||||
TouchEvent::InitTouchEvent(const nsAString& aType,
|
||||
|
@ -109,11 +109,7 @@ TouchEvent::InitTouchEvent(const nsAString& aType,
|
|||
TouchList* aChangedTouches,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
aRv = nsDOMUIEvent::InitUIEvent(aType,
|
||||
aCanBubble,
|
||||
aCancelable,
|
||||
aView,
|
||||
aDetail);
|
||||
aRv = UIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
|
||||
if (aRv.Failed()) {
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -5,13 +5,13 @@
|
|||
#ifndef mozilla_dom_TouchEvent_h_
|
||||
#define mozilla_dom_TouchEvent_h_
|
||||
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsTArray.h"
|
||||
#include "mozilla/dom/Touch.h"
|
||||
#include "mozilla/dom/TouchEventBinding.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsJSEnvironment.h"
|
||||
#include "mozilla/dom/Touch.h"
|
||||
#include "mozilla/dom/TouchEventBinding.h"
|
||||
#include "nsTArray.h"
|
||||
#include "nsWrapperCache.h"
|
||||
|
||||
class nsAString;
|
||||
|
@ -80,7 +80,7 @@ protected:
|
|||
nsTArray<nsRefPtr<Touch> > mPoints;
|
||||
};
|
||||
|
||||
class TouchEvent : public nsDOMUIEvent
|
||||
class TouchEvent : public UIEvent
|
||||
{
|
||||
public:
|
||||
TouchEvent(EventTarget* aOwner,
|
||||
|
@ -88,7 +88,7 @@ public:
|
|||
WidgetTouchEvent* aEvent);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TouchEvent, nsDOMUIEvent)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(TouchEvent, UIEvent)
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
|
|
|
@ -5,28 +5,33 @@
|
|||
|
||||
#include "base/basictypes.h"
|
||||
#include "ipc/IPCMessageUtils.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/ArrayUtils.h"
|
||||
#include "mozilla/Assertions.h"
|
||||
#include "mozilla/ContentEvents.h"
|
||||
#include "mozilla/TextEvents.h"
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsContentUtils.h"
|
||||
#include "nsEventStateManager.h"
|
||||
#include "nsIContent.h"
|
||||
#include "nsIInterfaceRequestorUtils.h"
|
||||
#include "nsIDOMWindow.h"
|
||||
#include "nsIDOMNode.h"
|
||||
#include "nsIFrame.h"
|
||||
#include "prtime.h"
|
||||
|
||||
using namespace mozilla;
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
nsDOMUIEvent::nsDOMUIEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext, WidgetGUIEvent* aEvent)
|
||||
UIEvent::UIEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetGUIEvent* aEvent)
|
||||
: nsDOMEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new InternalUIEvent(false, 0))
|
||||
, mClientPoint(0, 0), mLayerPoint(0, 0), mPagePoint(0, 0), mMovementPoint(0, 0)
|
||||
, mClientPoint(0, 0)
|
||||
, mLayerPoint(0, 0)
|
||||
, mPagePoint(0, 0)
|
||||
, mMovementPoint(0, 0)
|
||||
, mIsPointerLocked(nsEventStateManager::sIsPointerLocked)
|
||||
, mLastClientPoint(nsEventStateManager::sLastClientPoint)
|
||||
{
|
||||
|
@ -73,15 +78,15 @@ nsDOMUIEvent::nsDOMUIEvent(mozilla::dom::EventTarget* aOwner,
|
|||
}
|
||||
}
|
||||
|
||||
//static
|
||||
already_AddRefed<nsDOMUIEvent>
|
||||
nsDOMUIEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
|
||||
const nsAString& aType,
|
||||
const mozilla::dom::UIEventInit& aParam,
|
||||
mozilla::ErrorResult& aRv)
|
||||
// static
|
||||
already_AddRefed<UIEvent>
|
||||
UIEvent::Constructor(const GlobalObject& aGlobal,
|
||||
const nsAString& aType,
|
||||
const UIEventInit& aParam,
|
||||
ErrorResult& aRv)
|
||||
{
|
||||
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
nsRefPtr<nsDOMUIEvent> e = new nsDOMUIEvent(t, nullptr, nullptr);
|
||||
nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
|
||||
nsRefPtr<UIEvent> e = new UIEvent(t, nullptr, nullptr);
|
||||
bool trusted = e->Init(t);
|
||||
aRv = e->InitUIEvent(aType, aParam.mBubbles, aParam.mCancelable, aParam.mView,
|
||||
aParam.mDetail);
|
||||
|
@ -89,13 +94,13 @@ nsDOMUIEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
|
|||
return e.forget();
|
||||
}
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(nsDOMUIEvent, nsDOMEvent,
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(UIEvent, nsDOMEvent,
|
||||
mView)
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMUIEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMUIEvent, nsDOMEvent)
|
||||
NS_IMPL_ADDREF_INHERITED(UIEvent, nsDOMEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(UIEvent, nsDOMEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(nsDOMUIEvent)
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(UIEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMUIEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMEvent)
|
||||
|
||||
|
@ -108,7 +113,7 @@ DevPixelsToCSSPixels(const LayoutDeviceIntPoint& aPoint,
|
|||
}
|
||||
|
||||
nsIntPoint
|
||||
nsDOMUIEvent::GetMovementPoint()
|
||||
UIEvent::GetMovementPoint()
|
||||
{
|
||||
if (mPrivateDataDuplicated) {
|
||||
return mMovementPoint;
|
||||
|
@ -132,7 +137,7 @@ nsDOMUIEvent::GetMovementPoint()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetView(nsIDOMWindow** aView)
|
||||
UIEvent::GetView(nsIDOMWindow** aView)
|
||||
{
|
||||
*aView = mView;
|
||||
NS_IF_ADDREF(*aView);
|
||||
|
@ -140,18 +145,18 @@ nsDOMUIEvent::GetView(nsIDOMWindow** aView)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetDetail(int32_t* aDetail)
|
||||
UIEvent::GetDetail(int32_t* aDetail)
|
||||
{
|
||||
*aDetail = mDetail;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::InitUIEvent(const nsAString& typeArg,
|
||||
bool canBubbleArg,
|
||||
bool cancelableArg,
|
||||
nsIDOMWindow* viewArg,
|
||||
int32_t detailArg)
|
||||
UIEvent::InitUIEvent(const nsAString& typeArg,
|
||||
bool canBubbleArg,
|
||||
bool cancelableArg,
|
||||
nsIDOMWindow* viewArg,
|
||||
int32_t detailArg)
|
||||
{
|
||||
if (viewArg) {
|
||||
nsCOMPtr<nsPIDOMWindow> view = do_QueryInterface(viewArg);
|
||||
|
@ -166,9 +171,8 @@ nsDOMUIEvent::InitUIEvent(const nsAString& typeArg,
|
|||
return NS_OK;
|
||||
}
|
||||
|
||||
// ---- nsDOMNSUIEvent implementation -------------------
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetPageX(int32_t* aPageX)
|
||||
UIEvent::GetPageX(int32_t* aPageX)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPageX);
|
||||
*aPageX = PageX();
|
||||
|
@ -176,7 +180,7 @@ nsDOMUIEvent::GetPageX(int32_t* aPageX)
|
|||
}
|
||||
|
||||
int32_t
|
||||
nsDOMUIEvent::PageX() const
|
||||
UIEvent::PageX() const
|
||||
{
|
||||
if (mPrivateDataDuplicated) {
|
||||
return mPagePoint.x;
|
||||
|
@ -189,7 +193,7 @@ nsDOMUIEvent::PageX() const
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetPageY(int32_t* aPageY)
|
||||
UIEvent::GetPageY(int32_t* aPageY)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aPageY);
|
||||
*aPageY = PageY();
|
||||
|
@ -197,7 +201,7 @@ nsDOMUIEvent::GetPageY(int32_t* aPageY)
|
|||
}
|
||||
|
||||
int32_t
|
||||
nsDOMUIEvent::PageY() const
|
||||
UIEvent::PageY() const
|
||||
{
|
||||
if (mPrivateDataDuplicated) {
|
||||
return mPagePoint.y;
|
||||
|
@ -210,7 +214,7 @@ nsDOMUIEvent::PageY() const
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetWhich(uint32_t* aWhich)
|
||||
UIEvent::GetWhich(uint32_t* aWhich)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aWhich);
|
||||
*aWhich = Which();
|
||||
|
@ -218,7 +222,7 @@ nsDOMUIEvent::GetWhich(uint32_t* aWhich)
|
|||
}
|
||||
|
||||
already_AddRefed<nsINode>
|
||||
nsDOMUIEvent::GetRangeParent()
|
||||
UIEvent::GetRangeParent()
|
||||
{
|
||||
nsIFrame* targetFrame = nullptr;
|
||||
|
||||
|
@ -243,7 +247,7 @@ nsDOMUIEvent::GetRangeParent()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetRangeParent(nsIDOMNode** aRangeParent)
|
||||
UIEvent::GetRangeParent(nsIDOMNode** aRangeParent)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRangeParent);
|
||||
*aRangeParent = nullptr;
|
||||
|
@ -255,7 +259,7 @@ nsDOMUIEvent::GetRangeParent(nsIDOMNode** aRangeParent)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetRangeOffset(int32_t* aRangeOffset)
|
||||
UIEvent::GetRangeOffset(int32_t* aRangeOffset)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aRangeOffset);
|
||||
*aRangeOffset = RangeOffset();
|
||||
|
@ -263,7 +267,7 @@ nsDOMUIEvent::GetRangeOffset(int32_t* aRangeOffset)
|
|||
}
|
||||
|
||||
int32_t
|
||||
nsDOMUIEvent::RangeOffset() const
|
||||
UIEvent::RangeOffset() const
|
||||
{
|
||||
if (!mPresContext) {
|
||||
return 0;
|
||||
|
@ -280,7 +284,7 @@ nsDOMUIEvent::RangeOffset() const
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetCancelBubble(bool* aCancelBubble)
|
||||
UIEvent::GetCancelBubble(bool* aCancelBubble)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aCancelBubble);
|
||||
*aCancelBubble = CancelBubble();
|
||||
|
@ -288,14 +292,14 @@ nsDOMUIEvent::GetCancelBubble(bool* aCancelBubble)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::SetCancelBubble(bool aCancelBubble)
|
||||
UIEvent::SetCancelBubble(bool aCancelBubble)
|
||||
{
|
||||
mEvent->mFlags.mPropagationStopped = aCancelBubble;
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
nsIntPoint
|
||||
nsDOMUIEvent::GetLayerPoint() const
|
||||
UIEvent::GetLayerPoint() const
|
||||
{
|
||||
if (!mEvent ||
|
||||
(mEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
|
@ -320,7 +324,7 @@ nsDOMUIEvent::GetLayerPoint() const
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetLayerX(int32_t* aLayerX)
|
||||
UIEvent::GetLayerX(int32_t* aLayerX)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLayerX);
|
||||
*aLayerX = GetLayerPoint().x;
|
||||
|
@ -328,7 +332,7 @@ nsDOMUIEvent::GetLayerX(int32_t* aLayerX)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetLayerY(int32_t* aLayerY)
|
||||
UIEvent::GetLayerY(int32_t* aLayerY)
|
||||
{
|
||||
NS_ENSURE_ARG_POINTER(aLayerY);
|
||||
*aLayerY = GetLayerPoint().y;
|
||||
|
@ -336,14 +340,14 @@ nsDOMUIEvent::GetLayerY(int32_t* aLayerY)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::GetIsChar(bool* aIsChar)
|
||||
UIEvent::GetIsChar(bool* aIsChar)
|
||||
{
|
||||
*aIsChar = IsChar();
|
||||
return NS_OK;
|
||||
}
|
||||
|
||||
bool
|
||||
nsDOMUIEvent::IsChar() const
|
||||
UIEvent::IsChar() const
|
||||
{
|
||||
WidgetKeyboardEvent* keyEvent = mEvent->AsKeyboardEvent();
|
||||
if (keyEvent) {
|
||||
|
@ -354,7 +358,7 @@ nsDOMUIEvent::IsChar() const
|
|||
}
|
||||
|
||||
NS_IMETHODIMP
|
||||
nsDOMUIEvent::DuplicatePrivateData()
|
||||
UIEvent::DuplicatePrivateData()
|
||||
{
|
||||
mClientPoint = nsDOMEvent::GetClientCoords(mPresContext,
|
||||
mEvent,
|
||||
|
@ -378,7 +382,7 @@ nsDOMUIEvent::DuplicatePrivateData()
|
|||
}
|
||||
|
||||
NS_IMETHODIMP_(void)
|
||||
nsDOMUIEvent::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType)
|
||||
UIEvent::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType)
|
||||
{
|
||||
if (aSerializeInterfaceType) {
|
||||
IPC::WriteParam(aMsg, NS_LITERAL_STRING("uievent"));
|
||||
|
@ -392,7 +396,7 @@ nsDOMUIEvent::Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType)
|
|||
}
|
||||
|
||||
NS_IMETHODIMP_(bool)
|
||||
nsDOMUIEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
UIEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
||||
{
|
||||
NS_ENSURE_TRUE(nsDOMEvent::Deserialize(aMsg, aIter), false);
|
||||
NS_ENSURE_TRUE(IPC::ReadParam(aMsg, aIter, &mDetail), false);
|
||||
|
@ -400,14 +404,14 @@ nsDOMUIEvent::Deserialize(const IPC::Message* aMsg, void** aIter)
|
|||
}
|
||||
|
||||
// XXX Following struct and array are used only in
|
||||
// nsDOMUIEvent::ComputeModifierState(), but if we define them in it,
|
||||
// UIEvent::ComputeModifierState(), but if we define them in it,
|
||||
// we fail to build on Mac at calling mozilla::ArrayLength().
|
||||
struct nsModifierPair
|
||||
struct ModifierPair
|
||||
{
|
||||
mozilla::Modifier modifier;
|
||||
Modifier modifier;
|
||||
const char* name;
|
||||
};
|
||||
static const nsModifierPair kPairs[] = {
|
||||
static const ModifierPair kPairs[] = {
|
||||
{ MODIFIER_ALT, NS_DOM_KEYNAME_ALT },
|
||||
{ MODIFIER_ALTGRAPH, NS_DOM_KEYNAME_ALTGRAPH },
|
||||
{ MODIFIER_CAPSLOCK, NS_DOM_KEYNAME_CAPSLOCK },
|
||||
|
@ -421,9 +425,9 @@ static const nsModifierPair kPairs[] = {
|
|||
{ MODIFIER_OS, NS_DOM_KEYNAME_OS }
|
||||
};
|
||||
|
||||
/* static */
|
||||
mozilla::Modifiers
|
||||
nsDOMUIEvent::ComputeModifierState(const nsAString& aModifiersList)
|
||||
// static
|
||||
Modifiers
|
||||
UIEvent::ComputeModifierState(const nsAString& aModifiersList)
|
||||
{
|
||||
if (aModifiersList.IsEmpty()) {
|
||||
return 0;
|
||||
|
@ -439,7 +443,7 @@ nsDOMUIEvent::ComputeModifierState(const nsAString& aModifiersList)
|
|||
aModifiersList.BeginReading(listStart);
|
||||
aModifiersList.EndReading(listEnd);
|
||||
|
||||
for (uint32_t i = 0; i < mozilla::ArrayLength(kPairs); i++) {
|
||||
for (uint32_t i = 0; i < ArrayLength(kPairs); i++) {
|
||||
nsAString::const_iterator start(listStart), end(listEnd);
|
||||
if (!FindInReadable(NS_ConvertASCIItoUTF16(kPairs[i].name), start, end)) {
|
||||
continue;
|
||||
|
@ -456,7 +460,7 @@ nsDOMUIEvent::ComputeModifierState(const nsAString& aModifiersList)
|
|||
}
|
||||
|
||||
bool
|
||||
nsDOMUIEvent::GetModifierStateInternal(const nsAString& aKey)
|
||||
UIEvent::GetModifierStateInternal(const nsAString& aKey)
|
||||
{
|
||||
WidgetInputEvent* inputEvent = mEvent->AsInputEvent();
|
||||
MOZ_ASSERT(inputEvent, "mEvent must be WidgetInputEvent or derived class");
|
||||
|
@ -499,12 +503,18 @@ nsDOMUIEvent::GetModifierStateInternal(const nsAString& aKey)
|
|||
return false;
|
||||
}
|
||||
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
nsresult NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetGUIEvent* aEvent)
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsresult
|
||||
NS_NewDOMUIEvent(nsIDOMEvent** aInstancePtrResult,
|
||||
EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetGUIEvent* aEvent)
|
||||
{
|
||||
nsDOMUIEvent* it = new nsDOMUIEvent(aOwner, aPresContext, aEvent);
|
||||
UIEvent* it = new UIEvent(aOwner, aPresContext, aEvent);
|
||||
return CallQueryInterface(it, aInstancePtrResult);
|
||||
}
|
|
@ -3,8 +3,8 @@
|
|||
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
||||
* file, You can obtain one at http://mozilla.org/MPL/2.0/. */
|
||||
|
||||
#ifndef nsDOMUIEvent_h
|
||||
#define nsDOMUIEvent_h
|
||||
#ifndef mozilla_dom_UIEvent_h_
|
||||
#define mozilla_dom_UIEvent_h_
|
||||
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "nsIDOMUIEvent.h"
|
||||
|
@ -16,30 +16,31 @@
|
|||
|
||||
class nsINode;
|
||||
|
||||
class nsDOMUIEvent : public nsDOMEvent,
|
||||
public nsIDOMUIEvent
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class UIEvent : public nsDOMEvent,
|
||||
public nsIDOMUIEvent
|
||||
{
|
||||
typedef mozilla::CSSIntPoint CSSIntPoint;
|
||||
public:
|
||||
nsDOMUIEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
mozilla::WidgetGUIEvent* aEvent);
|
||||
UIEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetGUIEvent* aEvent);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(nsDOMUIEvent, nsDOMEvent)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(UIEvent, nsDOMEvent)
|
||||
|
||||
// nsIDOMUIEvent Interface
|
||||
NS_DECL_NSIDOMUIEVENT
|
||||
|
||||
|
||||
// Forward to nsDOMEvent
|
||||
NS_FORWARD_TO_NSDOMEVENT_NO_SERIALIZATION_NO_DUPLICATION
|
||||
NS_IMETHOD DuplicatePrivateData() MOZ_OVERRIDE;
|
||||
NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, bool aSerializeInterfaceType) MOZ_OVERRIDE;
|
||||
NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, void** aIter) MOZ_OVERRIDE;
|
||||
|
||||
static nsIntPoint
|
||||
CalculateScreenPoint(nsPresContext* aPresContext,
|
||||
mozilla::WidgetEvent* aEvent)
|
||||
static nsIntPoint CalculateScreenPoint(nsPresContext* aPresContext,
|
||||
WidgetEvent* aEvent)
|
||||
{
|
||||
if (!aEvent ||
|
||||
(aEvent->eventStructType != NS_MOUSE_EVENT &&
|
||||
|
@ -51,20 +52,21 @@ public:
|
|||
return nsIntPoint(0, 0);
|
||||
}
|
||||
|
||||
mozilla::WidgetGUIEvent* event = aEvent->AsGUIEvent();
|
||||
WidgetGUIEvent* event = aEvent->AsGUIEvent();
|
||||
if (!event->widget) {
|
||||
return mozilla::LayoutDeviceIntPoint::ToUntyped(aEvent->refPoint);
|
||||
return LayoutDeviceIntPoint::ToUntyped(aEvent->refPoint);
|
||||
}
|
||||
|
||||
mozilla::LayoutDeviceIntPoint offset = aEvent->refPoint +
|
||||
mozilla::LayoutDeviceIntPoint::FromUntyped(event->widget->WidgetToScreenOffset());
|
||||
nscoord factor = aPresContext->DeviceContext()->UnscaledAppUnitsPerDevPixel();
|
||||
LayoutDeviceIntPoint offset = aEvent->refPoint +
|
||||
LayoutDeviceIntPoint::FromUntyped(event->widget->WidgetToScreenOffset());
|
||||
nscoord factor =
|
||||
aPresContext->DeviceContext()->UnscaledAppUnitsPerDevPixel();
|
||||
return nsIntPoint(nsPresContext::AppUnitsToIntCSSPixels(offset.x * factor),
|
||||
nsPresContext::AppUnitsToIntCSSPixels(offset.y * factor));
|
||||
}
|
||||
|
||||
static CSSIntPoint CalculateClientPoint(nsPresContext* aPresContext,
|
||||
mozilla::WidgetEvent* aEvent,
|
||||
WidgetEvent* aEvent,
|
||||
CSSIntPoint* aDefaultClientPoint)
|
||||
{
|
||||
if (!aEvent ||
|
||||
|
@ -95,15 +97,15 @@ public:
|
|||
return CSSIntPoint::FromAppUnitsRounded(pt);
|
||||
}
|
||||
|
||||
static already_AddRefed<nsDOMUIEvent> Constructor(const mozilla::dom::GlobalObject& aGlobal,
|
||||
const nsAString& aType,
|
||||
const mozilla::dom::UIEventInit& aParam,
|
||||
mozilla::ErrorResult& aRv);
|
||||
static already_AddRefed<UIEvent> Constructor(const GlobalObject& aGlobal,
|
||||
const nsAString& aType,
|
||||
const UIEventInit& aParam,
|
||||
ErrorResult& aRv);
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
{
|
||||
return mozilla::dom::UIEventBinding::Wrap(aCx, aScope, this);
|
||||
return UIEventBinding::Wrap(aCx, aScope, this);
|
||||
}
|
||||
|
||||
nsIDOMWindow* GetView() const
|
||||
|
@ -164,27 +166,29 @@ protected:
|
|||
bool mIsPointerLocked;
|
||||
CSSIntPoint mLastClientPoint;
|
||||
|
||||
typedef mozilla::Modifiers Modifiers;
|
||||
static Modifiers ComputeModifierState(const nsAString& aModifiersList);
|
||||
bool GetModifierStateInternal(const nsAString& aKey);
|
||||
};
|
||||
|
||||
#define NS_FORWARD_TO_NSDOMUIEVENT \
|
||||
NS_FORWARD_NSIDOMUIEVENT(nsDOMUIEvent::) \
|
||||
} // namespace dom
|
||||
} // namespace mozilla
|
||||
|
||||
#define NS_FORWARD_TO_UIEVENT \
|
||||
NS_FORWARD_NSIDOMUIEVENT(UIEvent::) \
|
||||
NS_FORWARD_TO_NSDOMEVENT_NO_SERIALIZATION_NO_DUPLICATION \
|
||||
NS_IMETHOD DuplicatePrivateData() \
|
||||
{ \
|
||||
return nsDOMUIEvent::DuplicatePrivateData(); \
|
||||
return UIEvent::DuplicatePrivateData(); \
|
||||
} \
|
||||
NS_IMETHOD_(void) Serialize(IPC::Message* aMsg, \
|
||||
bool aSerializeInterfaceType) \
|
||||
{ \
|
||||
nsDOMUIEvent::Serialize(aMsg, aSerializeInterfaceType); \
|
||||
UIEvent::Serialize(aMsg, aSerializeInterfaceType); \
|
||||
} \
|
||||
NS_IMETHOD_(bool) Deserialize(const IPC::Message* aMsg, \
|
||||
void** aIter) \
|
||||
{ \
|
||||
return nsDOMUIEvent::Deserialize(aMsg, aIter); \
|
||||
return UIEvent::Deserialize(aMsg, aIter); \
|
||||
}
|
||||
|
||||
#endif // nsDOMUIEvent_h
|
||||
#endif // mozilla_dom_UIEvent_h_
|
|
@ -13,8 +13,8 @@ namespace dom {
|
|||
XULCommandEvent::XULCommandEvent(EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetInputEvent* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetInputEvent(false, 0, nullptr))
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetInputEvent(false, 0, nullptr))
|
||||
{
|
||||
if (aEvent) {
|
||||
mEventIsInternal = false;
|
||||
|
@ -25,15 +25,15 @@ XULCommandEvent::XULCommandEvent(EventTarget* aOwner,
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(XULCommandEvent, nsDOMUIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(XULCommandEvent, nsDOMUIEvent)
|
||||
NS_IMPL_ADDREF_INHERITED(XULCommandEvent, UIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(XULCommandEvent, UIEvent)
|
||||
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(XULCommandEvent, nsDOMUIEvent,
|
||||
NS_IMPL_CYCLE_COLLECTION_INHERITED_1(XULCommandEvent, UIEvent,
|
||||
mSourceEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN_CYCLE_COLLECTION_INHERITED(XULCommandEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIDOMXULCommandEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
|
||||
|
||||
bool
|
||||
XULCommandEvent::AltKey()
|
||||
|
@ -111,8 +111,8 @@ XULCommandEvent::InitCommandEvent(const nsAString& aType,
|
|||
bool aMetaKey,
|
||||
nsIDOMEvent* aSourceEvent)
|
||||
{
|
||||
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable,
|
||||
aView, aDetail);
|
||||
nsresult rv = UIEvent::InitUIEvent(aType, aCanBubble, aCancelable,
|
||||
aView, aDetail);
|
||||
NS_ENSURE_SUCCESS(rv, rv);
|
||||
|
||||
mEvent->AsInputEvent()->InitBasicModifiers(aCtrlKey, aAltKey,
|
||||
|
|
|
@ -9,14 +9,14 @@
|
|||
#ifndef mozilla_dom_XULCommandEvent_h_
|
||||
#define mozilla_dom_XULCommandEvent_h_
|
||||
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIDOMXULCommandEvent.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/dom/XULCommandEventBinding.h"
|
||||
#include "nsIDOMXULCommandEvent.h"
|
||||
|
||||
namespace mozilla {
|
||||
namespace dom {
|
||||
|
||||
class XULCommandEvent : public nsDOMUIEvent,
|
||||
class XULCommandEvent : public UIEvent,
|
||||
public nsIDOMXULCommandEvent
|
||||
{
|
||||
public:
|
||||
|
@ -25,11 +25,11 @@ public:
|
|||
WidgetInputEvent* aEvent);
|
||||
|
||||
NS_DECL_ISUPPORTS_INHERITED
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULCommandEvent, nsDOMUIEvent)
|
||||
NS_DECL_CYCLE_COLLECTION_CLASS_INHERITED(XULCommandEvent, UIEvent)
|
||||
NS_DECL_NSIDOMXULCOMMANDEVENT
|
||||
|
||||
// Forward our inherited virtual methods to the base class
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
NS_FORWARD_TO_UIEVENT
|
||||
|
||||
virtual JSObject* WrapObject(JSContext* aCx,
|
||||
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
|
||||
|
|
|
@ -18,7 +18,6 @@ EXPORTS += [
|
|||
'nsDOMEvent.h',
|
||||
'nsDOMEventTargetHelper.h',
|
||||
'nsDOMKeyNameList.h',
|
||||
'nsDOMUIEvent.h',
|
||||
'nsEventDispatcher.h',
|
||||
'nsEventListenerManager.h',
|
||||
'nsEventNameList.h',
|
||||
|
@ -59,6 +58,7 @@ EXPORTS.mozilla.dom += [
|
|||
'Touch.h',
|
||||
'TouchEvent.h',
|
||||
'TransitionEvent.h',
|
||||
'UIEvent.h',
|
||||
'WheelEvent.h',
|
||||
'XULCommandEvent.h',
|
||||
]
|
||||
|
@ -112,9 +112,6 @@ SOURCES += [
|
|||
# ipc/IPCMessageUtils.h, which on Windows includes windows.h.
|
||||
'nsDOMEvent.cpp',
|
||||
# nsDOMEvent.cpp should be built separately because it includes
|
||||
# ipc/IPCMessageUtils.h, which on Windows includes windows.h.
|
||||
'nsDOMUIEvent.cpp',
|
||||
# nsDOMEvent.cpp should be built separately because it includes
|
||||
# mozilla/HalSensor.h, which includes ipc/IPCMessageUtils.h, which
|
||||
# on Windows includes windows.h.
|
||||
'nsEventListenerManager.cpp',
|
||||
|
@ -123,6 +120,9 @@ SOURCES += [
|
|||
# nsDOMEvent.cpp should be built separately because it includes
|
||||
# ipc/IPCMessageUtils.h, which on Windows includes windows.h.
|
||||
'ScrollAreaEvent.cpp',
|
||||
# nsDOMEvent.cpp should be built separately because it includes
|
||||
# ipc/IPCMessageUtils.h, which on Windows includes windows.h.
|
||||
'UIEvent.cpp',
|
||||
]
|
||||
|
||||
if CONFIG['MOZ_WEBSPEECH']:
|
||||
|
|
|
@ -10,12 +10,13 @@
|
|||
#include "mozilla/TextEvents.h"
|
||||
|
||||
using namespace mozilla;
|
||||
using namespace mozilla::dom;
|
||||
|
||||
nsDOMTextEvent::nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
WidgetTextEvent* aEvent)
|
||||
: nsDOMUIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetTextEvent(false, 0, nullptr))
|
||||
: UIEvent(aOwner, aPresContext,
|
||||
aEvent ? aEvent : new WidgetTextEvent(false, 0, nullptr))
|
||||
{
|
||||
NS_ASSERTION(mEvent->eventStructType == NS_TEXT_EVENT, "event type mismatch");
|
||||
|
||||
|
@ -53,12 +54,12 @@ nsDOMTextEvent::nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
|
|||
}
|
||||
}
|
||||
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMTextEvent, nsDOMUIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMTextEvent, nsDOMUIEvent)
|
||||
NS_IMPL_ADDREF_INHERITED(nsDOMTextEvent, UIEvent)
|
||||
NS_IMPL_RELEASE_INHERITED(nsDOMTextEvent, UIEvent)
|
||||
|
||||
NS_INTERFACE_MAP_BEGIN(nsDOMTextEvent)
|
||||
NS_INTERFACE_MAP_ENTRY(nsIPrivateTextEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
|
||||
NS_INTERFACE_MAP_END_INHERITING(UIEvent)
|
||||
|
||||
NS_METHOD nsDOMTextEvent::GetText(nsString& aText)
|
||||
{
|
||||
|
|
|
@ -6,15 +6,17 @@
|
|||
#ifndef nsDOMTextEvent_h__
|
||||
#define nsDOMTextEvent_h__
|
||||
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/Attributes.h"
|
||||
#include "mozilla/EventForwards.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIPrivateTextEvent.h"
|
||||
#include "nsPrivateTextRange.h"
|
||||
|
||||
class nsDOMTextEvent : public nsDOMUIEvent,
|
||||
class nsDOMTextEvent : public mozilla::dom::UIEvent,
|
||||
public nsIPrivateTextEvent
|
||||
{
|
||||
typedef mozilla::dom::UIEvent UIEvent;
|
||||
|
||||
public:
|
||||
nsDOMTextEvent(mozilla::dom::EventTarget* aOwner,
|
||||
nsPresContext* aPresContext,
|
||||
|
@ -23,7 +25,7 @@ public:
|
|||
NS_DECL_ISUPPORTS_INHERITED
|
||||
|
||||
// Forward to base class
|
||||
NS_FORWARD_TO_NSDOMUIEVENT
|
||||
NS_FORWARD_TO_UIEVENT
|
||||
|
||||
// nsIPrivateTextEvent interface
|
||||
NS_IMETHOD GetText(nsString& aText) MOZ_OVERRIDE;
|
||||
|
|
|
@ -11,6 +11,7 @@
|
|||
#include "mozilla/TextEvents.h"
|
||||
#include "mozilla/TouchEvents.h"
|
||||
#include "mozilla/dom/TabParent.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
|
||||
#include "nsCOMPtr.h"
|
||||
#include "nsEventStateManager.h"
|
||||
|
@ -50,7 +51,6 @@
|
|||
#include "nsIDOMWheelEvent.h"
|
||||
#include "nsIDOMDragEvent.h"
|
||||
#include "nsIDOMUIEvent.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "nsIMozBrowserFrame.h"
|
||||
|
||||
#include "nsSubDocumentFrame.h"
|
||||
|
@ -1030,9 +1030,9 @@ nsEventStateManager::PreHandleEvent(nsPresContext* aPresContext,
|
|||
aEvent->eventStructType == NS_WHEEL_EVENT) &&
|
||||
!sIsPointerLocked) {
|
||||
sLastScreenPoint =
|
||||
nsDOMUIEvent::CalculateScreenPoint(aPresContext, aEvent);
|
||||
UIEvent::CalculateScreenPoint(aPresContext, aEvent);
|
||||
sLastClientPoint =
|
||||
nsDOMUIEvent::CalculateClientPoint(aPresContext, aEvent, nullptr);
|
||||
UIEvent::CalculateClientPoint(aPresContext, aEvent, nullptr);
|
||||
}
|
||||
|
||||
// Do not take account NS_MOUSE_ENTER/EXIT so that loading a page
|
||||
|
@ -4332,7 +4332,7 @@ nsEventStateManager::NotifyMouseOver(WidgetMouseEvent* aMouseEvent,
|
|||
// Returns the center point of the window's inner content area.
|
||||
// This is in widget coordinates, i.e. relative to the widget's top
|
||||
// left corner, not in screen coordinates, the same units that
|
||||
// nsDOMUIEvent::refPoint is in.
|
||||
// UIEvent::refPoint is in.
|
||||
//
|
||||
// XXX Hack alert: XXX
|
||||
// However, we do the computation in integer CSS pixels, NOT device pix,
|
||||
|
@ -4386,7 +4386,7 @@ nsEventStateManager::GenerateMouseEnterExit(WidgetMouseEvent* aMouseEvent)
|
|||
case NS_MOUSE_MOVE:
|
||||
{
|
||||
// Mouse movement is reported on the MouseEvent.movement{X,Y} fields.
|
||||
// Movement is calculated in nsDOMUIEvent::GetMovementPoint() as:
|
||||
// Movement is calculated in UIEvent::GetMovementPoint() as:
|
||||
// previous_mousemove_refPoint - current_mousemove_refPoint.
|
||||
if (sIsPointerLocked && aMouseEvent->widget) {
|
||||
// The pointer is locked. If the pointer is not located at the center of
|
||||
|
|
|
@ -17,7 +17,7 @@
|
|||
#include "nsICSSDeclaration.h"
|
||||
#include "nsSVGElement.h"
|
||||
#include "nsDOMEvent.h"
|
||||
#include "nsDOMUIEvent.h"
|
||||
#include "mozilla/dom/UIEvent.h"
|
||||
#include "mozilla/dom/MouseEvent.h"
|
||||
#include "mozilla/dom/EventTargetBinding.h"
|
||||
#include "mozilla/dom/NodeBinding.h"
|
||||
|
@ -58,7 +58,7 @@ NEW_BINDING(nsDocument, Document);
|
|||
NEW_BINDING(nsHTMLDocument, HTMLDocument);
|
||||
NEW_BINDING(nsSVGElement, SVGElement);
|
||||
NEW_BINDING(nsDOMEvent, Event);
|
||||
NEW_BINDING(nsDOMUIEvent, UIEvent);
|
||||
NEW_BINDING(mozilla::dom::UIEvent, UIEvent);
|
||||
NEW_BINDING(mozilla::dom::MouseEvent, MouseEvent);
|
||||
|
||||
#define DEFINE_UNWRAP_CAST(_interface, _base, _bit) \
|
||||
|
|
Загрузка…
Ссылка в новой задаче