Bug 975688 part.15 Rename nsDOMMouseEvent to mozilla::dom::MouseEvent r=smaug

--HG--
rename : dom/events/nsDOMMouseEvent.cpp => dom/events/MouseEvent.cpp
rename : dom/events/nsDOMMouseEvent.h => dom/events/MouseEvent.h
This commit is contained in:
Masayuki Nakano 2014-02-27 19:51:15 +09:00
parent d07419359a
commit 01a476057d
16 changed files with 213 additions and 184 deletions

View File

@ -62,7 +62,8 @@ DOMCI_CASTABLE_INTERFACE(nsHTMLDocument, nsIDocument, 7, _extra) \
DOMCI_CASTABLE_INTERFACE(nsStyledElement, nsStyledElement, 8, _extra) \
DOMCI_CASTABLE_INTERFACE(nsSVGElement, nsIContent, 9, _extra) \
/* NOTE: When removing the casts below, remove the nsDOMEventBase class */ \
DOMCI_CASTABLE_INTERFACE(nsDOMMouseEvent, nsDOMEventBase, 10, _extra) \
DOMCI_CASTABLE_NODECL_INTERFACE(mozilla::dom::MouseEvent, \
nsDOMEventBase, 10, _extra) \
DOMCI_CASTABLE_INTERFACE(nsDOMUIEvent, nsDOMEventBase, 11, _extra) \
DOMCI_CASTABLE_INTERFACE(nsGlobalWindow, nsIDOMEventTarget, 12, _extra)
@ -77,6 +78,7 @@ namespace mozilla {
namespace dom {
class Element;
class EventTarget;
class MouseEvent;
} // namespace dom
} // namespace mozilla

View File

@ -761,10 +761,6 @@ DOMInterfaces = {
'resultNotAddRefed': [ 'item', 'namedItem' ]
},
'MouseEvent': {
'nativeType': 'nsDOMMouseEvent',
},
'MozCanvasPrintState': {
'headerFile': 'mozilla/dom/HTMLCanvasElement.h',
'nativeType': 'mozilla::dom::HTMLCanvasPrintState',

View File

@ -14,8 +14,8 @@ namespace dom {
DragEvent::DragEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetDragEvent* aEvent)
: nsDOMMouseEvent(aOwner, aPresContext, aEvent ? aEvent :
new WidgetDragEvent(false, 0, nullptr))
: MouseEvent(aOwner, aPresContext,
aEvent ? aEvent : new WidgetDragEvent(false, 0, nullptr))
{
if (aEvent) {
mEventIsInternal = false;
@ -28,12 +28,12 @@ DragEvent::DragEvent(EventTarget* aOwner,
}
}
NS_IMPL_ADDREF_INHERITED(DragEvent, nsDOMMouseEvent)
NS_IMPL_RELEASE_INHERITED(DragEvent, nsDOMMouseEvent)
NS_IMPL_ADDREF_INHERITED(DragEvent, MouseEvent)
NS_IMPL_RELEASE_INHERITED(DragEvent, MouseEvent)
NS_INTERFACE_MAP_BEGIN(DragEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMDragEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent)
NS_INTERFACE_MAP_END_INHERITING(MouseEvent)
void
DragEvent::InitDragEvent(const nsAString& aType,
@ -55,11 +55,10 @@ DragEvent::InitDragEvent(const nsAString& aType,
ErrorResult& aError)
{
aError =
nsDOMMouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable,
aView, aDetail, aScreenX, aScreenY,
aClientX, aClientY, aCtrlKey, aAltKey,
aShiftKey, aMetaKey, aButton,
aRelatedTarget);
MouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable,
aView, aDetail, aScreenX, aScreenY,
aClientX, aClientY, aCtrlKey, aAltKey,
aShiftKey, aMetaKey, aButton, aRelatedTarget);
if (aError.Failed()) {
return;
}
@ -90,10 +89,11 @@ DragEvent::InitDragEvent(const nsAString& aType,
nsCOMPtr<DataTransfer> dataTransfer = do_QueryInterface(aDataTransfer);
NS_ENSURE_ARG(dataTransfer);
nsresult rv = nsDOMMouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable,
aView, aDetail, aScreenX, aScreenY, aClientX, aClientY,
aCtrlKey, aAltKey, aShiftKey, aMetaKey, aButton,
aRelatedTarget);
nsresult rv =
MouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable, aView, aDetail,
aScreenX, aScreenY, aClientX, aClientY,
aCtrlKey, aAltKey, aShiftKey, aMetaKey, aButton,
aRelatedTarget);
NS_ENSURE_SUCCESS(rv, rv);
if (mEventIsInternal && mEvent) {

View File

@ -7,7 +7,7 @@
#define mozilla_dom_DragEvent_h_
#include "nsIDOMDragEvent.h"
#include "nsDOMMouseEvent.h"
#include "mozilla/dom/MouseEvent.h"
#include "mozilla/dom/DragEventBinding.h"
#include "mozilla/EventForwards.h"
@ -16,7 +16,7 @@ namespace dom {
class DataTransfer;
class DragEvent : public nsDOMMouseEvent,
class DragEvent : public MouseEvent,
public nsIDOMDragEvent
{
public:
@ -28,7 +28,7 @@ public:
NS_DECL_NSIDOMDRAGEVENT
NS_FORWARD_TO_NSDOMMOUSEEVENT
NS_FORWARD_TO_MOUSEEVENT
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE

View File

@ -3,17 +3,18 @@
* 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/. */
#include "nsDOMMouseEvent.h"
#include "nsIContent.h"
#include "nsContentUtils.h"
#include "prtime.h"
#include "mozilla/dom/MouseEvent.h"
#include "mozilla/MouseEvents.h"
#include "nsContentUtils.h"
#include "nsIContent.h"
#include "prtime.h"
using namespace mozilla;
namespace mozilla {
namespace dom {
nsDOMMouseEvent::nsDOMMouseEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetMouseEventBase* aEvent)
MouseEvent::MouseEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetMouseEventBase* aEvent)
: nsDOMUIEvent(aOwner, aPresContext, aEvent ? aEvent :
new WidgetMouseEvent(false, 0, nullptr,
WidgetMouseEvent::eReal))
@ -40,19 +41,29 @@ nsDOMMouseEvent::nsDOMMouseEvent(mozilla::dom::EventTarget* aOwner,
}
}
NS_IMPL_ADDREF_INHERITED(nsDOMMouseEvent, nsDOMUIEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMMouseEvent, nsDOMUIEvent)
NS_IMPL_ADDREF_INHERITED(MouseEvent, nsDOMUIEvent)
NS_IMPL_RELEASE_INHERITED(MouseEvent, nsDOMUIEvent)
NS_INTERFACE_MAP_BEGIN(nsDOMMouseEvent)
NS_INTERFACE_MAP_BEGIN(MouseEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMUIEvent)
NS_IMETHODIMP
nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, bool aCanBubble, bool aCancelable,
nsIDOMWindow* aView, int32_t aDetail, int32_t aScreenX,
int32_t aScreenY, int32_t aClientX, int32_t aClientY,
bool aCtrlKey, bool aAltKey, bool aShiftKey,
bool aMetaKey, uint16_t aButton, nsIDOMEventTarget *aRelatedTarget)
MouseEvent::InitMouseEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsIDOMWindow* aView,
int32_t aDetail,
int32_t aScreenX,
int32_t aScreenY,
int32_t aClientX,
int32_t aClientY,
bool aCtrlKey,
bool aAltKey,
bool aShiftKey,
bool aMetaKey,
uint16_t aButton,
nsIDOMEventTarget* aRelatedTarget)
{
nsresult rv = nsDOMUIEvent::InitUIEvent(aType, aCanBubble, aCancelable, aView, aDetail);
NS_ENSURE_SUCCESS(rv, rv);
@ -87,18 +98,18 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString & aType, bool aCanBubble, bool a
}
nsresult
nsDOMMouseEvent::InitMouseEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsIDOMWindow* aView,
int32_t aDetail,
int32_t aScreenX,
int32_t aScreenY,
int32_t aClientX,
int32_t aClientY,
int16_t aButton,
nsIDOMEventTarget *aRelatedTarget,
const nsAString& aModifiersList)
MouseEvent::InitMouseEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsIDOMWindow* aView,
int32_t aDetail,
int32_t aScreenX,
int32_t aScreenY,
int32_t aClientX,
int32_t aClientY,
int16_t aButton,
nsIDOMEventTarget* aRelatedTarget,
const nsAString& aModifiersList)
{
Modifiers modifiers = ComputeModifierState(aModifiersList);
@ -125,14 +136,14 @@ nsDOMMouseEvent::InitMouseEvent(const nsAString& aType,
}
}
already_AddRefed<nsDOMMouseEvent>
nsDOMMouseEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
const nsAString& aType,
const mozilla::dom::MouseEventInit& aParam,
mozilla::ErrorResult& aRv)
already_AddRefed<MouseEvent>
MouseEvent::Constructor(const GlobalObject& aGlobal,
const nsAString& aType,
const MouseEventInit& aParam,
ErrorResult& aRv)
{
nsCOMPtr<mozilla::dom::EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
nsRefPtr<nsDOMMouseEvent> e = new nsDOMMouseEvent(t, nullptr, nullptr);
nsCOMPtr<EventTarget> t = do_QueryInterface(aGlobal.GetAsSupports());
nsRefPtr<MouseEvent> e = new MouseEvent(t, nullptr, nullptr);
bool trusted = e->Init(t);
e->InitMouseEvent(aType, aParam.mBubbles, aParam.mCancelable,
aParam.mView, aParam.mDetail, aParam.mScreenX,
@ -159,17 +170,29 @@ nsDOMMouseEvent::Constructor(const mozilla::dom::GlobalObject& aGlobal,
}
NS_IMETHODIMP
nsDOMMouseEvent::InitNSMouseEvent(const nsAString & aType, bool aCanBubble, bool aCancelable,
nsIDOMWindow *aView, int32_t aDetail, int32_t aScreenX,
int32_t aScreenY, int32_t aClientX, int32_t aClientY,
bool aCtrlKey, bool aAltKey, bool aShiftKey,
bool aMetaKey, uint16_t aButton, nsIDOMEventTarget *aRelatedTarget,
float aPressure, uint16_t aInputSource)
MouseEvent::InitNSMouseEvent(const nsAString& aType,
bool aCanBubble,
bool aCancelable,
nsIDOMWindow* aView,
int32_t aDetail,
int32_t aScreenX,
int32_t aScreenY,
int32_t aClientX,
int32_t aClientY,
bool aCtrlKey,
bool aAltKey,
bool aShiftKey,
bool aMetaKey,
uint16_t aButton,
nsIDOMEventTarget* aRelatedTarget,
float aPressure,
uint16_t aInputSource)
{
nsresult rv = nsDOMMouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable,
aView, aDetail, aScreenX, aScreenY,
aClientX, aClientY, aCtrlKey, aAltKey, aShiftKey,
aMetaKey, aButton, aRelatedTarget);
nsresult rv = MouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable,
aView, aDetail, aScreenX, aScreenY,
aClientX, aClientY,
aCtrlKey, aAltKey, aShiftKey,
aMetaKey, aButton, aRelatedTarget);
NS_ENSURE_SUCCESS(rv, rv);
WidgetMouseEventBase* mouseEventBase = mEvent->AsMouseEventBase();
@ -179,7 +202,7 @@ nsDOMMouseEvent::InitNSMouseEvent(const nsAString & aType, bool aCanBubble, bool
}
NS_IMETHODIMP
nsDOMMouseEvent::GetButton(int16_t* aButton)
MouseEvent::GetButton(int16_t* aButton)
{
NS_ENSURE_ARG_POINTER(aButton);
*aButton = Button();
@ -187,7 +210,7 @@ nsDOMMouseEvent::GetButton(int16_t* aButton)
}
int16_t
nsDOMMouseEvent::Button()
MouseEvent::Button()
{
switch(mEvent->eventStructType)
{
@ -205,7 +228,7 @@ nsDOMMouseEvent::Button()
}
NS_IMETHODIMP
nsDOMMouseEvent::GetButtons(uint16_t* aButtons)
MouseEvent::GetButtons(uint16_t* aButtons)
{
NS_ENSURE_ARG_POINTER(aButtons);
*aButtons = Buttons();
@ -213,7 +236,7 @@ nsDOMMouseEvent::GetButtons(uint16_t* aButtons)
}
uint16_t
nsDOMMouseEvent::Buttons()
MouseEvent::Buttons()
{
switch(mEvent->eventStructType)
{
@ -230,17 +253,17 @@ nsDOMMouseEvent::Buttons()
}
NS_IMETHODIMP
nsDOMMouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
MouseEvent::GetRelatedTarget(nsIDOMEventTarget** aRelatedTarget)
{
NS_ENSURE_ARG_POINTER(aRelatedTarget);
*aRelatedTarget = GetRelatedTarget().get();
return NS_OK;
}
already_AddRefed<mozilla::dom::EventTarget>
nsDOMMouseEvent::GetRelatedTarget()
already_AddRefed<EventTarget>
MouseEvent::GetRelatedTarget()
{
nsCOMPtr<mozilla::dom::EventTarget> relatedTarget;
nsCOMPtr<EventTarget> relatedTarget;
switch(mEvent->eventStructType)
{
case NS_MOUSE_EVENT:
@ -272,7 +295,7 @@ nsDOMMouseEvent::GetRelatedTarget()
}
NS_IMETHODIMP
nsDOMMouseEvent::GetMozMovementX(int32_t* aMovementX)
MouseEvent::GetMozMovementX(int32_t* aMovementX)
{
NS_ENSURE_ARG_POINTER(aMovementX);
*aMovementX = MozMovementX();
@ -281,7 +304,7 @@ nsDOMMouseEvent::GetMozMovementX(int32_t* aMovementX)
}
NS_IMETHODIMP
nsDOMMouseEvent::GetMozMovementY(int32_t* aMovementY)
MouseEvent::GetMozMovementY(int32_t* aMovementY)
{
NS_ENSURE_ARG_POINTER(aMovementY);
*aMovementY = MozMovementY();
@ -289,7 +312,8 @@ nsDOMMouseEvent::GetMozMovementY(int32_t* aMovementY)
return NS_OK;
}
NS_METHOD nsDOMMouseEvent::GetScreenX(int32_t* aScreenX)
NS_IMETHODIMP
MouseEvent::GetScreenX(int32_t* aScreenX)
{
NS_ENSURE_ARG_POINTER(aScreenX);
*aScreenX = ScreenX();
@ -297,7 +321,7 @@ NS_METHOD nsDOMMouseEvent::GetScreenX(int32_t* aScreenX)
}
int32_t
nsDOMMouseEvent::ScreenX()
MouseEvent::ScreenX()
{
return nsDOMEvent::GetScreenCoords(mPresContext,
mEvent,
@ -305,7 +329,7 @@ nsDOMMouseEvent::ScreenX()
}
NS_IMETHODIMP
nsDOMMouseEvent::GetScreenY(int32_t* aScreenY)
MouseEvent::GetScreenY(int32_t* aScreenY)
{
NS_ENSURE_ARG_POINTER(aScreenY);
*aScreenY = ScreenY();
@ -313,7 +337,7 @@ nsDOMMouseEvent::GetScreenY(int32_t* aScreenY)
}
int32_t
nsDOMMouseEvent::ScreenY()
MouseEvent::ScreenY()
{
return nsDOMEvent::GetScreenCoords(mPresContext,
mEvent,
@ -321,7 +345,8 @@ nsDOMMouseEvent::ScreenY()
}
NS_METHOD nsDOMMouseEvent::GetClientX(int32_t* aClientX)
NS_IMETHODIMP
MouseEvent::GetClientX(int32_t* aClientX)
{
NS_ENSURE_ARG_POINTER(aClientX);
*aClientX = ClientX();
@ -329,7 +354,7 @@ NS_METHOD nsDOMMouseEvent::GetClientX(int32_t* aClientX)
}
int32_t
nsDOMMouseEvent::ClientX()
MouseEvent::ClientX()
{
return nsDOMEvent::GetClientCoords(mPresContext,
mEvent,
@ -338,7 +363,7 @@ nsDOMMouseEvent::ClientX()
}
NS_IMETHODIMP
nsDOMMouseEvent::GetClientY(int32_t* aClientY)
MouseEvent::GetClientY(int32_t* aClientY)
{
NS_ENSURE_ARG_POINTER(aClientY);
*aClientY = ClientY();
@ -346,7 +371,7 @@ nsDOMMouseEvent::GetClientY(int32_t* aClientY)
}
int32_t
nsDOMMouseEvent::ClientY()
MouseEvent::ClientY()
{
return nsDOMEvent::GetClientCoords(mPresContext,
mEvent,
@ -355,13 +380,13 @@ nsDOMMouseEvent::ClientY()
}
bool
nsDOMMouseEvent::AltKey()
MouseEvent::AltKey()
{
return mEvent->AsInputEvent()->IsAlt();
}
NS_IMETHODIMP
nsDOMMouseEvent::GetAltKey(bool* aIsDown)
MouseEvent::GetAltKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = AltKey();
@ -369,13 +394,13 @@ nsDOMMouseEvent::GetAltKey(bool* aIsDown)
}
bool
nsDOMMouseEvent::CtrlKey()
MouseEvent::CtrlKey()
{
return mEvent->AsInputEvent()->IsControl();
}
NS_IMETHODIMP
nsDOMMouseEvent::GetCtrlKey(bool* aIsDown)
MouseEvent::GetCtrlKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = CtrlKey();
@ -383,13 +408,13 @@ nsDOMMouseEvent::GetCtrlKey(bool* aIsDown)
}
bool
nsDOMMouseEvent::ShiftKey()
MouseEvent::ShiftKey()
{
return mEvent->AsInputEvent()->IsShift();
}
NS_IMETHODIMP
nsDOMMouseEvent::GetShiftKey(bool* aIsDown)
MouseEvent::GetShiftKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = ShiftKey();
@ -397,13 +422,13 @@ nsDOMMouseEvent::GetShiftKey(bool* aIsDown)
}
bool
nsDOMMouseEvent::MetaKey()
MouseEvent::MetaKey()
{
return mEvent->AsInputEvent()->IsMeta();
}
NS_IMETHODIMP
nsDOMMouseEvent::GetMetaKey(bool* aIsDown)
MouseEvent::GetMetaKey(bool* aIsDown)
{
NS_ENSURE_ARG_POINTER(aIsDown);
*aIsDown = MetaKey();
@ -411,7 +436,7 @@ nsDOMMouseEvent::GetMetaKey(bool* aIsDown)
}
NS_IMETHODIMP
nsDOMMouseEvent::GetModifierState(const nsAString& aKey,
MouseEvent::GetModifierState(const nsAString& aKey,
bool* aState)
{
NS_ENSURE_ARG_POINTER(aState);
@ -421,13 +446,13 @@ nsDOMMouseEvent::GetModifierState(const nsAString& aKey,
}
float
nsDOMMouseEvent::MozPressure() const
MouseEvent::MozPressure() const
{
return mEvent->AsMouseEventBase()->pressure;
}
NS_IMETHODIMP
nsDOMMouseEvent::GetMozPressure(float* aPressure)
MouseEvent::GetMozPressure(float* aPressure)
{
NS_ENSURE_ARG_POINTER(aPressure);
*aPressure = MozPressure();
@ -435,24 +460,31 @@ nsDOMMouseEvent::GetMozPressure(float* aPressure)
}
uint16_t
nsDOMMouseEvent::MozInputSource() const
MouseEvent::MozInputSource() const
{
return mEvent->AsMouseEventBase()->inputSource;
}
NS_IMETHODIMP
nsDOMMouseEvent::GetMozInputSource(uint16_t* aInputSource)
MouseEvent::GetMozInputSource(uint16_t* aInputSource)
{
NS_ENSURE_ARG_POINTER(aInputSource);
*aInputSource = MozInputSource();
return NS_OK;
}
nsresult NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetMouseEvent* aEvent)
} // namespace dom
} // namespace mozilla
using namespace mozilla;
using namespace mozilla::dom;
nsresult
NS_NewDOMMouseEvent(nsIDOMEvent** aInstancePtrResult,
EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetMouseEvent* aEvent)
{
nsDOMMouseEvent* it = new nsDOMMouseEvent(aOwner, aPresContext, aEvent);
MouseEvent* it = new MouseEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(it, aInstancePtrResult);
}

View File

@ -3,21 +3,24 @@
* 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 nsDOMMouseEvent_h__
#define nsDOMMouseEvent_h__
#ifndef mozilla_dom_MouseEvent_h_
#define mozilla_dom_MouseEvent_h_
#include "nsIDOMMouseEvent.h"
#include "nsDOMUIEvent.h"
#include "mozilla/dom/MouseEventBinding.h"
#include "mozilla/EventForwards.h"
class nsDOMMouseEvent : public nsDOMUIEvent,
public nsIDOMMouseEvent
namespace mozilla {
namespace dom {
class MouseEvent : public nsDOMUIEvent,
public nsIDOMMouseEvent
{
public:
nsDOMMouseEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
mozilla::WidgetMouseEventBase* aEvent);
MouseEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetMouseEventBase* aEvent);
NS_DECL_ISUPPORTS_INHERITED
@ -30,7 +33,7 @@ public:
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{
return mozilla::dom::MouseEventBinding::Wrap(aCx, aScope, this);
return MouseEventBinding::Wrap(aCx, aScope, this);
}
// Web IDL binding methods
@ -49,14 +52,13 @@ public:
bool MetaKey();
int16_t Button();
uint16_t Buttons();
already_AddRefed<mozilla::dom::EventTarget> GetRelatedTarget();
void InitMouseEvent(const nsAString & aType, bool aCanBubble, bool aCancelable,
already_AddRefed<EventTarget> GetRelatedTarget();
void InitMouseEvent(const nsAString& aType, bool aCanBubble, bool aCancelable,
nsIDOMWindow* aView, int32_t aDetail, int32_t aScreenX,
int32_t aScreenY, int32_t aClientX, int32_t aClientY,
bool aCtrlKey, bool aAltKey, bool aShiftKey,
bool aMetaKey, uint16_t aButton,
mozilla::dom::EventTarget *aRelatedTarget,
mozilla::ErrorResult& aRv)
EventTarget* aRelatedTarget, ErrorResult& aRv)
{
aRv = InitMouseEvent(aType, aCanBubble, aCancelable,
aView, aDetail, aScreenX, aScreenY,
@ -68,10 +70,10 @@ public:
{
return GetModifierStateInternal(aKeyArg);
}
static already_AddRefed<nsDOMMouseEvent> Constructor(const mozilla::dom::GlobalObject& aGlobal,
const nsAString& aType,
const mozilla::dom::MouseEventInit& aParam,
mozilla::ErrorResult& aRv);
static already_AddRefed<MouseEvent> Constructor(const GlobalObject& aGlobal,
const nsAString& aType,
const MouseEventInit& aParam,
ErrorResult& aRv);
int32_t MozMovementX()
{
return GetMovementPoint().x;
@ -82,14 +84,15 @@ public:
}
float MozPressure() const;
uint16_t MozInputSource() const;
void InitNSMouseEvent(const nsAString & aType, bool aCanBubble, bool aCancelable,
nsIDOMWindow *aView, int32_t aDetail, int32_t aScreenX,
void InitNSMouseEvent(const nsAString& aType,
bool aCanBubble, bool aCancelable,
nsIDOMWindow* aView, int32_t aDetail, int32_t aScreenX,
int32_t aScreenY, int32_t aClientX, int32_t aClientY,
bool aCtrlKey, bool aAltKey, bool aShiftKey,
bool aMetaKey, uint16_t aButton,
mozilla::dom::EventTarget *aRelatedTarget,
EventTarget* aRelatedTarget,
float aPressure, uint16_t aInputSource,
mozilla::ErrorResult& aRv)
ErrorResult& aRv)
{
aRv = InitNSMouseEvent(aType, aCanBubble, aCancelable,
aView, aDetail, aScreenX, aScreenY,
@ -109,12 +112,15 @@ protected:
int32_t aClientX,
int32_t aClientY,
int16_t aButton,
nsIDOMEventTarget *aRelatedTarget,
nsIDOMEventTarget* aRelatedTarget,
const nsAString& aModifiersList);
};
#define NS_FORWARD_TO_NSDOMMOUSEEVENT \
NS_FORWARD_NSIDOMMOUSEEVENT(nsDOMMouseEvent::) \
} // namespace dom
} // namespace mozilla
#define NS_FORWARD_TO_MOUSEEVENT \
NS_FORWARD_NSIDOMMOUSEEVENT(MouseEvent::) \
NS_FORWARD_TO_NSDOMUIEVENT
#endif // nsDOMMouseEvent_h__
#endif // mozilla_dom_MouseEvent_h_

View File

@ -13,9 +13,8 @@ namespace dom {
MouseScrollEvent::MouseScrollEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetMouseScrollEvent* aEvent)
: nsDOMMouseEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetMouseScrollEvent(false, 0, nullptr))
: MouseEvent(aOwner, aPresContext,
aEvent ? aEvent : new WidgetMouseScrollEvent(false, 0, nullptr))
{
if (aEvent) {
mEventIsInternal = false;
@ -30,12 +29,12 @@ MouseScrollEvent::MouseScrollEvent(EventTarget* aOwner,
mDetail = mEvent->AsMouseScrollEvent()->delta;
}
NS_IMPL_ADDREF_INHERITED(MouseScrollEvent, nsDOMMouseEvent)
NS_IMPL_RELEASE_INHERITED(MouseScrollEvent, nsDOMMouseEvent)
NS_IMPL_ADDREF_INHERITED(MouseScrollEvent, MouseEvent)
NS_IMPL_RELEASE_INHERITED(MouseScrollEvent, MouseEvent)
NS_INTERFACE_MAP_BEGIN(MouseScrollEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMMouseScrollEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent)
NS_INTERFACE_MAP_END_INHERITING(MouseEvent)
NS_IMETHODIMP
MouseScrollEvent::InitMouseScrollEvent(const nsAString& aType,
@ -55,9 +54,11 @@ MouseScrollEvent::InitMouseScrollEvent(const nsAString& aType,
nsIDOMEventTarget* aRelatedTarget,
int32_t aAxis)
{
nsresult rv = nsDOMMouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable, aView, aDetail,
aScreenX, aScreenY, aClientX, aClientY, aCtrlKey,
aAltKey, aShiftKey, aMetaKey, aButton, aRelatedTarget);
nsresult rv =
MouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable, aView, aDetail,
aScreenX, aScreenY, aClientX, aClientY,
aCtrlKey, aAltKey, aShiftKey, aMetaKey, aButton,
aRelatedTarget);
NS_ENSURE_SUCCESS(rv, rv);
mEvent->AsMouseScrollEvent()->isHorizontal = (aAxis == HORIZONTAL_AXIS);
return NS_OK;

View File

@ -7,13 +7,13 @@
#define mozilla_dom_MouseScrollEvent_h_
#include "nsIDOMMouseScrollEvent.h"
#include "nsDOMMouseEvent.h"
#include "mozilla/dom/MouseEvent.h"
#include "mozilla/dom/MouseScrollEventBinding.h"
namespace mozilla {
namespace dom {
class MouseScrollEvent : public nsDOMMouseEvent,
class MouseScrollEvent : public MouseEvent,
public nsIDOMMouseScrollEvent
{
public:
@ -27,7 +27,7 @@ public:
NS_DECL_NSIDOMMOUSESCROLLEVENT
// Forward to base class
NS_FORWARD_TO_NSDOMMOUSEEVENT
NS_FORWARD_TO_MOUSEEVENT
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE

View File

@ -15,7 +15,8 @@ namespace dom {
PointerEvent::PointerEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetPointerEvent* aEvent)
: nsDOMMouseEvent(aOwner, aPresContext, aEvent ? aEvent : new WidgetPointerEvent(false, 0, nullptr))
: MouseEvent(aOwner, aPresContext,
aEvent ? aEvent : new WidgetPointerEvent(false, 0, nullptr))
{
NS_ASSERTION(mEvent->eventStructType == NS_POINTER_EVENT, "event type mismatch NS_POINTER_EVENT");

View File

@ -7,7 +7,7 @@
#ifndef PointerEvent_h__
#define PointerEvent_h__
#include "nsDOMMouseEvent.h"
#include "mozilla/dom/MouseEvent.h"
#include "mozilla/dom/PointerEventBinding.h"
class nsPresContext;
@ -15,7 +15,7 @@ class nsPresContext;
namespace mozilla {
namespace dom {
class PointerEvent : public nsDOMMouseEvent
class PointerEvent : public MouseEvent
{
public:
PointerEvent(EventTarget* aOwner,

View File

@ -13,9 +13,9 @@ namespace dom {
SimpleGestureEvent::SimpleGestureEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetSimpleGestureEvent* aEvent)
: nsDOMMouseEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetSimpleGestureEvent(false, 0, nullptr))
: MouseEvent(aOwner, aPresContext,
aEvent ? aEvent :
new WidgetSimpleGestureEvent(false, 0, nullptr))
{
NS_ASSERTION(mEvent->eventStructType == NS_SIMPLE_GESTURE_EVENT, "event type mismatch");
@ -30,12 +30,12 @@ SimpleGestureEvent::SimpleGestureEvent(EventTarget* aOwner,
}
}
NS_IMPL_ADDREF_INHERITED(SimpleGestureEvent, nsDOMUIEvent)
NS_IMPL_RELEASE_INHERITED(SimpleGestureEvent, nsDOMUIEvent)
NS_IMPL_ADDREF_INHERITED(SimpleGestureEvent, MouseEvent)
NS_IMPL_RELEASE_INHERITED(SimpleGestureEvent, MouseEvent)
NS_INTERFACE_MAP_BEGIN(SimpleGestureEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMSimpleGestureEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent)
NS_INTERFACE_MAP_END_INHERITING(MouseEvent)
/* attribute unsigned long allowedDirections; */
uint32_t
@ -125,21 +125,12 @@ SimpleGestureEvent::InitSimpleGestureEvent(const nsAString& aTypeArg,
double aDeltaArg,
uint32_t aClickCountArg)
{
nsresult rv = nsDOMMouseEvent::InitMouseEvent(aTypeArg,
aCanBubbleArg,
aCancelableArg,
aViewArg,
aDetailArg,
aScreenX,
aScreenY,
aClientX,
aClientY,
aCtrlKeyArg,
aAltKeyArg,
aShiftKeyArg,
aMetaKeyArg,
aButton,
aRelatedTarget);
nsresult rv =
MouseEvent::InitMouseEvent(aTypeArg, aCanBubbleArg, aCancelableArg,
aViewArg, aDetailArg,
aScreenX, aScreenY, aClientX, aClientY,
aCtrlKeyArg, aAltKeyArg, aShiftKeyArg,
aMetaKeyArg, aButton, aRelatedTarget);
NS_ENSURE_SUCCESS(rv, rv);
WidgetSimpleGestureEvent* simpleGestureEvent = mEvent->AsSimpleGestureEvent();

View File

@ -6,16 +6,16 @@
#define mozilla_dom_SimpleGestureEvent_h_
#include "nsIDOMSimpleGestureEvent.h"
#include "nsDOMMouseEvent.h"
#include "mozilla/EventForwards.h"
#include "mozilla/dom/MouseEvent.h"
#include "mozilla/dom/SimpleGestureEventBinding.h"
#include "mozilla/EventForwards.h"
class nsPresContext;
namespace mozilla {
namespace dom {
class SimpleGestureEvent : public nsDOMMouseEvent,
class SimpleGestureEvent : public MouseEvent,
public nsIDOMSimpleGestureEvent
{
public:
@ -28,7 +28,7 @@ public:
NS_DECL_NSIDOMSIMPLEGESTUREEVENT
// Forward to base class
NS_FORWARD_TO_NSDOMMOUSEEVENT
NS_FORWARD_TO_MOUSEEVENT
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE

View File

@ -14,9 +14,9 @@ namespace dom {
WheelEvent::WheelEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetWheelEvent* aWheelEvent)
: nsDOMMouseEvent(aOwner, aPresContext,
aWheelEvent ? aWheelEvent :
new WidgetWheelEvent(false, 0, nullptr))
: MouseEvent(aOwner, aPresContext,
aWheelEvent ? aWheelEvent :
new WidgetWheelEvent(false, 0, nullptr))
{
if (aWheelEvent) {
mEventIsInternal = false;
@ -28,12 +28,12 @@ WheelEvent::WheelEvent(EventTarget* aOwner,
}
}
NS_IMPL_ADDREF_INHERITED(WheelEvent, nsDOMMouseEvent)
NS_IMPL_RELEASE_INHERITED(WheelEvent, nsDOMMouseEvent)
NS_IMPL_ADDREF_INHERITED(WheelEvent, MouseEvent)
NS_IMPL_RELEASE_INHERITED(WheelEvent, MouseEvent)
NS_INTERFACE_MAP_BEGIN(WheelEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMWheelEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent)
NS_INTERFACE_MAP_END_INHERITING(MouseEvent)
NS_IMETHODIMP
WheelEvent::InitWheelEvent(const nsAString& aType,
@ -54,10 +54,9 @@ WheelEvent::InitWheelEvent(const nsAString& aType,
uint32_t aDeltaMode)
{
nsresult rv =
nsDOMMouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable, aView,
aDetail, aScreenX, aScreenY,
aClientX, aClientY, aButton,
aRelatedTarget, aModifiersList);
MouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable, aView, aDetail,
aScreenX, aScreenY, aClientX, aClientY, aButton,
aRelatedTarget, aModifiersList);
NS_ENSURE_SUCCESS(rv, rv);
WidgetWheelEvent* wheelEvent = mEvent->AsWheelEvent();

View File

@ -8,14 +8,14 @@
#define mozilla_dom_WheelEvent_h_
#include "nsIDOMWheelEvent.h"
#include "nsDOMMouseEvent.h"
#include "mozilla/EventForwards.h"
#include "mozilla/dom/MouseEvent.h"
#include "mozilla/dom/WheelEventBinding.h"
#include "mozilla/EventForwards.h"
namespace mozilla {
namespace dom {
class WheelEvent : public nsDOMMouseEvent,
class WheelEvent : public MouseEvent,
public nsIDOMWheelEvent
{
public:
@ -29,7 +29,7 @@ public:
NS_DECL_NSIDOMWHEELEVENT
// Forward to base class
NS_FORWARD_TO_NSDOMMOUSEEVENT
NS_FORWARD_TO_MOUSEEVENT
static
already_AddRefed<WheelEvent> Constructor(const GlobalObject& aGlobal,

View File

@ -49,6 +49,7 @@ EXPORTS.mozilla.dom += [
'FocusEvent.h',
'KeyboardEvent.h',
'MessageEvent.h',
'MouseEvent.h',
'MouseScrollEvent.h',
'PointerEvent.h',
'SimpleGestureEvent.h',
@ -73,11 +74,11 @@ UNIFIED_SOURCES += [
'FocusEvent.cpp',
'KeyboardEvent.cpp',
'MessageEvent.cpp',
'MouseEvent.cpp',
'MouseScrollEvent.cpp',
'nsAsyncDOMEvent.cpp',
'nsContentEventHandler.cpp',
'nsDOMEventTargetHelper.cpp',
'nsDOMMouseEvent.cpp',
'nsDOMMutationEvent.cpp',
'nsDOMNotifyAudioAvailableEvent.cpp',
'nsDOMTextEvent.cpp',

View File

@ -17,8 +17,8 @@
#include "nsICSSDeclaration.h"
#include "nsSVGElement.h"
#include "nsDOMEvent.h"
#include "nsDOMMouseEvent.h"
#include "nsDOMUIEvent.h"
#include "mozilla/dom/MouseEvent.h"
#include "mozilla/dom/EventTargetBinding.h"
#include "mozilla/dom/NodeBinding.h"
#include "mozilla/dom/ElementBinding.h"
@ -58,8 +58,8 @@ NEW_BINDING(nsDocument, Document);
NEW_BINDING(nsHTMLDocument, HTMLDocument);
NEW_BINDING(nsSVGElement, SVGElement);
NEW_BINDING(nsDOMEvent, Event);
NEW_BINDING(nsDOMMouseEvent, MouseEvent);
NEW_BINDING(nsDOMUIEvent, UIEvent);
NEW_BINDING(mozilla::dom::MouseEvent, MouseEvent);
#define DEFINE_UNWRAP_CAST(_interface, _base, _bit) \
template <> \