Bug 854999 - Paris binding for SimpleGestureEvent, r=peterv

--HG--
extra : rebase_source : af491dbd2066c00a80a46d8a82e65403d12e83d5
This commit is contained in:
Olli Pettay 2013-03-28 16:24:28 +02:00
parent 856e4310fd
commit 7e7d4afa9a
5 changed files with 104 additions and 3 deletions

View File

@ -22,6 +22,7 @@ nsDOMSimpleGestureEvent::nsDOMSimpleGestureEvent(mozilla::dom::EventTarget* aOwn
mEvent->refPoint.x = mEvent->refPoint.y = 0;
static_cast<nsMouseEvent*>(mEvent)->inputSource = nsIDOMMouseEvent::MOZ_SOURCE_UNKNOWN;
}
SetIsDOMBinding();
}
nsDOMSimpleGestureEvent::~nsDOMSimpleGestureEvent()
@ -47,7 +48,7 @@ NS_IMETHODIMP
nsDOMSimpleGestureEvent::GetDirection(uint32_t *aDirection)
{
NS_ENSURE_ARG_POINTER(aDirection);
*aDirection = static_cast<nsSimpleGestureEvent*>(mEvent)->direction;
*aDirection = Direction();
return NS_OK;
}
@ -56,7 +57,7 @@ NS_IMETHODIMP
nsDOMSimpleGestureEvent::GetDelta(double *aDelta)
{
NS_ENSURE_ARG_POINTER(aDelta);
*aDelta = static_cast<nsSimpleGestureEvent*>(mEvent)->delta;
*aDelta = Delta();
return NS_OK;
}
@ -65,7 +66,7 @@ NS_IMETHODIMP
nsDOMSimpleGestureEvent::GetClickCount(uint32_t *aClickCount)
{
NS_ENSURE_ARG_POINTER(aClickCount);
*aClickCount = static_cast<nsSimpleGestureEvent*>(mEvent)->clickCount;
*aClickCount = ClickCount();
return NS_OK;
}

View File

@ -7,6 +7,7 @@
#include "nsIDOMSimpleGestureEvent.h"
#include "nsDOMMouseEvent.h"
#include "mozilla/dom/SimpleGestureEventBinding.h"
class nsPresContext;
@ -24,6 +25,54 @@ public:
// Forward to base class
NS_FORWARD_TO_NSDOMMOUSEEVENT
virtual JSObject* WrapObject(JSContext* aCx, JSObject* aScope)
{
return mozilla::dom::SimpleGestureEventBinding::Wrap(aCx, aScope, this);
}
uint32_t Direction()
{
return static_cast<nsSimpleGestureEvent*>(mEvent)->direction;
}
double Delta()
{
return static_cast<nsSimpleGestureEvent*>(mEvent)->delta;
}
uint32_t ClickCount()
{
return static_cast<nsSimpleGestureEvent*>(mEvent)->clickCount;
}
void InitSimpleGestureEvent(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,
uint32_t aDirection,
double aDelta,
uint32_t aClickCount,
mozilla::ErrorResult& aRv)
{
aRv = InitSimpleGestureEvent(aType, aCanBubble, aCancelable,
aView, aDetail, aScreenX, aScreenY,
aClientX, aClientY, aCtrlKey, aAltKey,
aShiftKey, aMetaKey, aButton,
aRelatedTarget, aDirection,
aDelta, aClickCount);
}
};
#endif

View File

@ -669,6 +669,10 @@ DOMInterfaces = {
'nativeType': 'nsDOMScrollAreaEvent',
},
'SimpleGestureEvent': {
'nativeType': 'nsDOMSimpleGestureEvent',
},
'StyleSheet': {
'nativeType': 'nsCSSStyleSheet',
},

View File

@ -0,0 +1,46 @@
/* -*- Mode: IDL; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* This Source Code Form is subject to the terms of the Mozilla Public
* 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/.
*
* For more information see nsIDOMSimpleGestureEvent.idl.
*/
interface WindowProxy;
interface SimpleGestureEvent : MouseEvent
{
const unsigned long DIRECTION_UP = 1;
const unsigned long DIRECTION_DOWN = 2;
const unsigned long DIRECTION_LEFT = 4;
const unsigned long DIRECTION_RIGHT = 8;
const unsigned long ROTATION_COUNTERCLOCKWISE = 1;
const unsigned long ROTATION_CLOCKWISE = 2;
readonly attribute unsigned long direction;
readonly attribute double delta;
readonly attribute unsigned long clickCount;
[Throws]
void initSimpleGestureEvent(DOMString typeArg,
boolean canBubbleArg,
boolean cancelableArg,
WindowProxy? viewArg,
long detailArg,
long screenXArg,
long screenYArg,
long clientXArg,
long clientYArg,
boolean ctrlKeyArg,
boolean altKeyArg,
boolean shiftKeyArg,
boolean metaKeyArg,
unsigned short buttonArg,
EventTarget? relatedTargetArg,
unsigned long directionArg,
double deltaArg,
unsigned long clickCount);
};

View File

@ -165,6 +165,7 @@ webidl_files = \
RTCConfiguration.webidl \
Screen.webidl \
ScrollAreaEvent.webidl \
SimpleGestureEvent.webidl \
StyleSheet.webidl \
SVGAElement.webidl \
SVGAltGlyphElement.webidl \