Bug 975688 part.9 Rename nsDOMDragEvent to mozilla::dom::DragEvent r=smaug

--HG--
rename : dom/events/nsDOMDragEvent.cpp => dom/events/DragEvent.cpp
rename : dom/events/nsDOMDragEvent.h => dom/events/DragEvent.h
This commit is contained in:
Masayuki Nakano 2014-02-27 19:51:13 +09:00
parent cc15e9d950
commit 90491382cc
5 changed files with 79 additions and 62 deletions

View File

@ -365,10 +365,6 @@ DOMInterfaces = {
'nativeType': 'nsDOMTokenList',
},
'DragEvent': {
'nativeType': 'nsDOMDragEvent',
},
'DummyInterface': {
'skipGen': True,
'register': False,

View File

@ -3,17 +3,17 @@
* 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 "nsDOMDragEvent.h"
#include "mozilla/dom/DragEvent.h"
#include "mozilla/MouseEvents.h"
#include "nsContentUtils.h"
#include "prtime.h"
#include "mozilla/MouseEvents.h"
using namespace mozilla;
using namespace mozilla::dom;
namespace mozilla {
namespace dom {
nsDOMDragEvent::nsDOMDragEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetDragEvent* aEvent)
DragEvent::DragEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetDragEvent* aEvent)
: nsDOMMouseEvent(aOwner, aPresContext, aEvent ? aEvent :
new WidgetDragEvent(false, 0, nullptr))
{
@ -28,22 +28,31 @@ nsDOMDragEvent::nsDOMDragEvent(EventTarget* aOwner,
}
}
NS_IMPL_ADDREF_INHERITED(nsDOMDragEvent, nsDOMMouseEvent)
NS_IMPL_RELEASE_INHERITED(nsDOMDragEvent, nsDOMMouseEvent)
NS_IMPL_ADDREF_INHERITED(DragEvent, nsDOMMouseEvent)
NS_IMPL_RELEASE_INHERITED(DragEvent, nsDOMMouseEvent)
NS_INTERFACE_MAP_BEGIN(nsDOMDragEvent)
NS_INTERFACE_MAP_BEGIN(DragEvent)
NS_INTERFACE_MAP_ENTRY(nsIDOMDragEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent)
void
nsDOMDragEvent::InitDragEvent(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,
EventTarget* aRelatedTarget,
DataTransfer* aDataTransfer, ErrorResult& aError)
DragEvent::InitDragEvent(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,
EventTarget* aRelatedTarget,
DataTransfer* aDataTransfer,
ErrorResult& aError)
{
aError =
nsDOMMouseEvent::InitMouseEvent(aType, aCanBubble, aCancelable,
@ -61,15 +70,22 @@ nsDOMDragEvent::InitDragEvent(const nsAString& aType, bool aCanBubble,
}
NS_IMETHODIMP
nsDOMDragEvent::InitDragEvent(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,
nsIDOMDataTransfer* aDataTransfer)
DragEvent::InitDragEvent(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,
nsIDOMDataTransfer* aDataTransfer)
{
nsCOMPtr<DataTransfer> dataTransfer = do_QueryInterface(aDataTransfer);
NS_ENSURE_ARG(dataTransfer);
@ -88,14 +104,14 @@ nsDOMDragEvent::InitDragEvent(const nsAString & aType,
}
NS_IMETHODIMP
nsDOMDragEvent::GetDataTransfer(nsIDOMDataTransfer** aDataTransfer)
DragEvent::GetDataTransfer(nsIDOMDataTransfer** aDataTransfer)
{
NS_IF_ADDREF(*aDataTransfer = GetDataTransfer());
return NS_OK;
}
DataTransfer*
nsDOMDragEvent::GetDataTransfer()
DragEvent::GetDataTransfer()
{
// the dataTransfer field of the event caches the DataTransfer associated
// with the drag. It is initialized when an attempt is made to retrieve it
@ -116,11 +132,18 @@ nsDOMDragEvent::GetDataTransfer()
return dragEvent->dataTransfer;
}
nsresult NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult,
EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetDragEvent* aEvent)
} // namespace dom
} // namespace mozilla
using namespace mozilla;
using namespace mozilla::dom;
nsresult
NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult,
EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetDragEvent* aEvent)
{
nsDOMDragEvent* event = new nsDOMDragEvent(aOwner, aPresContext, aEvent);
DragEvent* event = new DragEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(event, aInstancePtrResult);
}

View File

@ -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 nsDOMDragEvent_h__
#define nsDOMDragEvent_h__
#ifndef mozilla_dom_DragEvent_h_
#define mozilla_dom_DragEvent_h_
#include "nsIDOMDragEvent.h"
#include "nsDOMMouseEvent.h"
@ -13,31 +13,30 @@
namespace mozilla {
namespace dom {
class DataTransfer;
}
}
class nsDOMDragEvent : public nsDOMMouseEvent,
public nsIDOMDragEvent
class DataTransfer;
class DragEvent : public nsDOMMouseEvent,
public nsIDOMDragEvent
{
public:
nsDOMDragEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
mozilla::WidgetDragEvent* aEvent);
DragEvent(EventTarget* aOwner,
nsPresContext* aPresContext,
WidgetDragEvent* aEvent);
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMDRAGEVENT
NS_FORWARD_TO_NSDOMMOUSEEVENT
virtual JSObject* WrapObject(JSContext* aCx,
JS::Handle<JSObject*> aScope) MOZ_OVERRIDE
{
return mozilla::dom::DragEventBinding::Wrap(aCx, aScope, this);
return DragEventBinding::Wrap(aCx, aScope, this);
}
mozilla::dom::DataTransfer* GetDataTransfer();
DataTransfer* GetDataTransfer();
void InitDragEvent(const nsAString& aType,
bool aCanBubble, bool aCancelable,
@ -46,14 +45,12 @@ public:
int32_t aClientX, int32_t aClientY,
bool aCtrlKey, bool aAltKey, bool aShiftKey,
bool aMetaKey, uint16_t aButton,
mozilla::dom::EventTarget* aRelatedTarget,
mozilla::dom::DataTransfer* aDataTransfer,
mozilla::ErrorResult& aError);
EventTarget* aRelatedTarget,
DataTransfer* aDataTransfer,
ErrorResult& aError);
};
nsresult NS_NewDOMDragEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
mozilla::WidgetDragEvent* aEvent);
} // namespace dom
} // namespace mozilla
#endif // nsDOMDragEvent_h__
#endif // mozilla_dom_DragEvent_h_

View File

@ -44,6 +44,7 @@ EXPORTS.mozilla.dom += [
'DataContainerEvent.h',
'DataTransfer.h',
'DeviceMotionEvent.h',
'DragEvent.h',
'EventTarget.h',
'PointerEvent.h',
'Touch.h',
@ -62,10 +63,10 @@ UNIFIED_SOURCES += [
'DataContainerEvent.cpp',
'DataTransfer.cpp',
'DeviceMotionEvent.cpp',
'DragEvent.cpp',
'EventTarget.cpp',
'nsAsyncDOMEvent.cpp',
'nsContentEventHandler.cpp',
'nsDOMDragEvent.cpp',
'nsDOMEventTargetHelper.cpp',
'nsDOMFocusEvent.cpp',
'nsDOMKeyboardEvent.cpp',

View File

@ -50,7 +50,7 @@
#include "nsIDOMWheelEvent.h"
#include "nsIDOMDragEvent.h"
#include "nsIDOMUIEvent.h"
#include "nsDOMDragEvent.h"
#include "nsDOMUIEvent.h"
#include "nsIMozBrowserFrame.h"
#include "nsSubDocumentFrame.h"
@ -3566,7 +3566,7 @@ nsEventStateManager::PostHandleEvent(nsPresContext* aPresContext,
// made to access the dataTransfer during the event, yet the event
// was cancelled. Instead, use the initial data transfer available
// from the drag session. The drop effect would not have been
// initialized (which is done in nsDOMDragEvent::GetDataTransfer),
// initialized (which is done in DragEvent::GetDataTransfer),
// so set it from the drag action. We'll still want to filter it
// based on the effectAllowed below.
dataTransfer = initialDataTransfer;