Bug 920425 part.16 Use mozilla::WidgetEvent::AsSimpleGestureEvent() r=smaug

This commit is contained in:
Masayuki Nakano 2013-10-18 15:10:23 +09:00
parent 0260e27697
commit db9ba3fb1b
4 changed files with 34 additions and 29 deletions

View File

@ -698,7 +698,7 @@ nsDOMEvent::DuplicatePrivateData()
case NS_SIMPLE_GESTURE_EVENT:
{
WidgetSimpleGestureEvent* oldSimpleGestureEvent =
static_cast<WidgetSimpleGestureEvent*>(mEvent);
mEvent->AsSimpleGestureEvent();
WidgetSimpleGestureEvent* simpleGestureEvent =
new WidgetSimpleGestureEvent(false, msg, nullptr, 0, 0.0);
simpleGestureEvent->

View File

@ -38,24 +38,34 @@ NS_INTERFACE_MAP_BEGIN(nsDOMSimpleGestureEvent)
NS_INTERFACE_MAP_END_INHERITING(nsDOMMouseEvent)
/* attribute unsigned long allowedDirections; */
uint32_t
nsDOMSimpleGestureEvent::AllowedDirections()
{
return mEvent->AsSimpleGestureEvent()->allowedDirections;
}
NS_IMETHODIMP
nsDOMSimpleGestureEvent::GetAllowedDirections(uint32_t *aAllowedDirections)
{
NS_ENSURE_ARG_POINTER(aAllowedDirections);
*aAllowedDirections =
static_cast<WidgetSimpleGestureEvent*>(mEvent)->allowedDirections;
*aAllowedDirections = AllowedDirections();
return NS_OK;
}
NS_IMETHODIMP
nsDOMSimpleGestureEvent::SetAllowedDirections(uint32_t aAllowedDirections)
{
static_cast<WidgetSimpleGestureEvent*>(mEvent)->allowedDirections =
aAllowedDirections;
mEvent->AsSimpleGestureEvent()->allowedDirections = aAllowedDirections;
return NS_OK;
}
/* readonly attribute unsigned long direction; */
uint32_t
nsDOMSimpleGestureEvent::Direction()
{
return mEvent->AsSimpleGestureEvent()->direction;
}
NS_IMETHODIMP
nsDOMSimpleGestureEvent::GetDirection(uint32_t *aDirection)
{
@ -65,6 +75,12 @@ nsDOMSimpleGestureEvent::GetDirection(uint32_t *aDirection)
}
/* readonly attribute float delta; */
double
nsDOMSimpleGestureEvent::Delta()
{
return mEvent->AsSimpleGestureEvent()->delta;
}
NS_IMETHODIMP
nsDOMSimpleGestureEvent::GetDelta(double *aDelta)
{
@ -74,6 +90,12 @@ nsDOMSimpleGestureEvent::GetDelta(double *aDelta)
}
/* readonly attribute unsigned long clickCount; */
uint32_t
nsDOMSimpleGestureEvent::ClickCount()
{
return mEvent->AsSimpleGestureEvent()->clickCount;
}
NS_IMETHODIMP
nsDOMSimpleGestureEvent::GetClickCount(uint32_t *aClickCount)
{
@ -120,8 +142,7 @@ nsDOMSimpleGestureEvent::InitSimpleGestureEvent(const nsAString& aTypeArg,
aRelatedTarget);
NS_ENSURE_SUCCESS(rv, rv);
WidgetSimpleGestureEvent* simpleGestureEvent =
static_cast<WidgetSimpleGestureEvent*>(mEvent);
WidgetSimpleGestureEvent* simpleGestureEvent = mEvent->AsSimpleGestureEvent();
simpleGestureEvent->allowedDirections = aAllowedDirectionsArg;
simpleGestureEvent->direction = aDirectionArg;
simpleGestureEvent->delta = aDeltaArg;

View File

@ -7,7 +7,7 @@
#include "nsIDOMSimpleGestureEvent.h"
#include "nsDOMMouseEvent.h"
#include "mozilla/TouchEvents.h"
#include "mozilla/EventForwards.h"
#include "mozilla/dom/SimpleGestureEventBinding.h"
class nsPresContext;
@ -32,26 +32,10 @@ public:
return mozilla::dom::SimpleGestureEventBinding::Wrap(aCx, aScope, this);
}
uint32_t AllowedDirections()
{
return static_cast<mozilla::WidgetSimpleGestureEvent*>(mEvent)->
allowedDirections;
}
uint32_t Direction()
{
return static_cast<mozilla::WidgetSimpleGestureEvent*>(mEvent)->direction;
}
double Delta()
{
return static_cast<mozilla::WidgetSimpleGestureEvent*>(mEvent)->delta;
}
uint32_t ClickCount()
{
return static_cast<mozilla::WidgetSimpleGestureEvent*>(mEvent)->clickCount;
}
uint32_t AllowedDirections();
uint32_t Direction();
double Delta();
uint32_t ClickCount();
void InitSimpleGestureEvent(const nsAString& aType,
bool aCanBubble,

View File

@ -740,7 +740,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
aEvent->AsCommandEvent());
case NS_SIMPLE_GESTURE_EVENT:
return NS_NewDOMSimpleGestureEvent(aDOMEvent, aOwner, aPresContext,
static_cast<WidgetSimpleGestureEvent*>(aEvent));
aEvent->AsSimpleGestureEvent());
case NS_TOUCH_EVENT:
return NS_NewDOMTouchEvent(aDOMEvent, aOwner, aPresContext,
aEvent->AsTouchEvent());