Bug 1436508 part 16. Remove nsIDOMSimpleGestureEvent. r=masayuki

MozReview-Commit-ID: 8JDovhthKtx
This commit is contained in:
Boris Zbarsky 2018-02-09 11:17:10 -05:00
Родитель 55a170b415
Коммит 523343906d
12 изменённых файлов: 201 добавлений и 265 удалений

Просмотреть файл

@ -37,72 +37,38 @@ 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(MouseEvent)
uint32_t
SimpleGestureEvent::AllowedDirections()
SimpleGestureEvent::AllowedDirections() const
{
return mEvent->AsSimpleGestureEvent()->mAllowedDirections;
}
NS_IMETHODIMP
SimpleGestureEvent::GetAllowedDirections(uint32_t* aAllowedDirections)
{
NS_ENSURE_ARG_POINTER(aAllowedDirections);
*aAllowedDirections = AllowedDirections();
return NS_OK;
}
NS_IMETHODIMP
void
SimpleGestureEvent::SetAllowedDirections(uint32_t aAllowedDirections)
{
mEvent->AsSimpleGestureEvent()->mAllowedDirections = aAllowedDirections;
return NS_OK;
}
uint32_t
SimpleGestureEvent::Direction()
SimpleGestureEvent::Direction() const
{
return mEvent->AsSimpleGestureEvent()->mDirection;
}
NS_IMETHODIMP
SimpleGestureEvent::GetDirection(uint32_t* aDirection)
{
NS_ENSURE_ARG_POINTER(aDirection);
*aDirection = Direction();
return NS_OK;
}
double
SimpleGestureEvent::Delta()
SimpleGestureEvent::Delta() const
{
return mEvent->AsSimpleGestureEvent()->mDelta;
}
NS_IMETHODIMP
SimpleGestureEvent::GetDelta(double* aDelta)
{
NS_ENSURE_ARG_POINTER(aDelta);
*aDelta = Delta();
return NS_OK;
}
uint32_t
SimpleGestureEvent::ClickCount()
SimpleGestureEvent::ClickCount() const
{
return mEvent->AsSimpleGestureEvent()->mClickCount;
}
NS_IMETHODIMP
SimpleGestureEvent::GetClickCount(uint32_t* aClickCount)
{
NS_ENSURE_ARG_POINTER(aClickCount);
*aClickCount = ClickCount();
return NS_OK;
}
void
SimpleGestureEvent::InitSimpleGestureEvent(const nsAString& aTypeArg,
bool aCanBubbleArg,

Просмотреть файл

@ -7,7 +7,6 @@
#ifndef mozilla_dom_SimpleGestureEvent_h_
#define mozilla_dom_SimpleGestureEvent_h_
#include "nsIDOMSimpleGestureEvent.h"
#include "mozilla/dom/MouseEvent.h"
#include "mozilla/dom/SimpleGestureEventBinding.h"
#include "mozilla/EventForwards.h"
@ -17,8 +16,7 @@ class nsPresContext;
namespace mozilla {
namespace dom {
class SimpleGestureEvent : public MouseEvent,
public nsIDOMSimpleGestureEvent
class SimpleGestureEvent : public MouseEvent
{
public:
SimpleGestureEvent(EventTarget* aOwner,
@ -27,20 +25,16 @@ public:
NS_DECL_ISUPPORTS_INHERITED
NS_DECL_NSIDOMSIMPLEGESTUREEVENT
// Forward to base class
NS_FORWARD_TO_MOUSEEVENT
virtual JSObject* WrapObjectInternal(JSContext* aCx, JS::Handle<JSObject*> aGivenProto) override
{
return SimpleGestureEventBinding::Wrap(aCx, this, aGivenProto);
}
uint32_t AllowedDirections();
uint32_t Direction();
double Delta();
uint32_t ClickCount();
uint32_t AllowedDirections() const;
void SetAllowedDirections(uint32_t aAllowedDirections);
uint32_t Direction() const;
double Delta() const;
uint32_t ClickCount() const;
void InitSimpleGestureEvent(const nsAString& aType,
bool aCanBubble,

Просмотреть файл

@ -778,7 +778,7 @@ interface nsIDOMWindowUtils : nsISupports {
* @param aType event type
* @param aX x offset in CSS pixels
* @param aY y offset in CSS pixels
* @param aDirection direction, using constants defined in nsIDOMSimpleGestureEvent
* @param aDirection direction, using constants defined in SimpleGestureEvent.webidl
* @param aDelta amount of magnification or rotation for magnify and rotation events
* @param aModifiers modifiers pressed, using constants defined in nsIDOMNSEvent
* @param aClickCount For tap gestures, the number of taps.

Просмотреть файл

@ -22,7 +22,6 @@ XPIDL_SOURCES += [
'nsIDOMNSEvent.idl',
'nsIDOMPaintRequest.idl',
'nsIDOMScrollAreaEvent.idl',
'nsIDOMSimpleGestureEvent.idl',
'nsIDOMUIEvent.idl',
'nsIDOMWheelEvent.idl',
]

Просмотреть файл

@ -1,182 +0,0 @@
/* -*- 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/. */
#include "nsIDOMMouseEvent.idl"
/**
* The nsIDOMSimpleGestureEvent interface is the datatype for all
* Mozilla-specific simple gesture events in the Document Object Model.
*
* The following events are generated:
*
* MozSwipeGestureMayStart - Generated when the user starts a horizontal
* swipe across the input device, but before we know whether the user
* is actually scrolling past a scroll edge.
* This event asks two questions: Should a swipe really be started, and
* in which directions should the user be able to swipe? The first
* question is answered by event listeners by calling or not calling
* preventDefault() on the event. Since a swipe swallows all scroll
* events, the default action of the swipe start event is *not* to
* start a swipe. Call preventDefault() if you want a swipe to be
* started. Doing so won't necessarily result in a swipe being started,
* it only communicates an intention. Once Gecko determines whether a
* swipe should actually be started, it will send a MozSwipeGestureStart
* event.
* The second question (swipe-able directions) is answered in the
* allowedDirections field.
*
* MozSwipeGestureStart - This event signals the start of a swipe.
* It guarantees a future MozSwipeGestureEnd event that will signal
* the end of a swipe animation.
*
* MozSwipeGestureUpdate - Generated periodically while the user is
* continuing a horizontal swipe gesture. The "delta" value represents
* the current absolute gesture amount. This event may even be sent
* after a MozSwipeGesture event fired in order to allow for fluid
* completion of a swipe animation. The direction value is meaningless
* on swipe update events.
*
* MozSwipeGestureEnd - Generated when the swipe animation is completed.
*
* MozSwipeGesture - Generated when the user releases a swipe across
* across the input device. This event signals that the actual swipe
* operation is complete, even though the animation might not be finished
* yet. This event can be sent without accompanying start / update / end
* events, and it can also be handled on its own if the consumer doesn't
* want to handle swipe animation events.
* Only the direction value has any significance, the delta value is
* meaningless.
*
* MozMagnifyGestureStart - Generated when the user begins the magnify
* ("pinch") gesture. The "delta" value represents the initial
* movement.
*
* MozMagnifyGestureUpdate - Generated periodically while the user is
* continuing the magnify ("pinch") gesture. The "delta" value
* represents the movement since the last MozMagnifyGestureStart or
* MozMagnifyGestureUpdate event.
*
* MozMagnifyGesture - Generated when the user has completed the
* magnify ("pinch") gesture. If you only want to receive a single
* event when the magnify gesture is complete, you only need to hook
* this event and can safely ignore the MozMagnifyGestureStart and the
* MozMagnifyGestureUpdate events. The "delta" value is the cumulative
* amount represented by the user's gesture.
*
* MozRotateGestureStart - Generated when the user begins the rotation
* gesture. The "delta" value represents the initial rotation.
*
* MozRotateGestureUpdate - Generated periodically while the user is
* continuing the rotation gesture. The "delta" value represents the
* rotation since the last MozRotateGestureStart or
* MozRotateGestureUpdate event.
*
* MozRotateGesture - Generated when the user has completed the
* rotation gesture. If you only want to receive a single event when
* the rotation gesture is complete, you only need to hook this event
* and can safely ignore the MozRotateGestureStart and the
* MozRotateGestureUpdate events. The "delta" value is the cumulative
* amount of rotation represented by the user's gesture.
*
* MozTapGesture - Generated when the user executes a two finger
* tap gesture on the input device. Client coordinates contain the
* center point of the tap.
* (XXX On OS X, only Lion (10.7) and up)
*
* MozPressTapGesture - Generated when the user executes a press
* and tap two finger gesture (first finger down, second finger down,
* second finger up, first finger up) on the input device.
* Client coordinates contain the center pivot point of the action.
* (XXX Not implemented on Mac)
*
* MozEdgeUIGesture - Generated when the user swipes the display to
* invoke edge ui.
* (XXX Win8 only)
*
* Default behavior:
*
* Some operating systems support default behaviors for gesture events
* when they are not handled by the application. Consumers should
* use event.preventDefault() to prevent default behavior when
* consuming events.
*/
[builtinclass, uuid(c397f9a2-4266-4291-b282-3efd6d7afc57)]
interface nsIDOMSimpleGestureEvent : nsIDOMMouseEvent
{
/* Swipe direction constants */
const unsigned long DIRECTION_UP = 1;
const unsigned long DIRECTION_DOWN = 2;
const unsigned long DIRECTION_LEFT = 4;
const unsigned long DIRECTION_RIGHT = 8;
/* Rotational direction constants */
const unsigned long ROTATION_COUNTERCLOCKWISE = 1;
const unsigned long ROTATION_CLOCKWISE = 2;
/* Read-write value for swipe events.
*
* Reports the directions that can be swiped to; multiple directions
* should be OR'ed together.
*
* The allowedDirections field is designed to be set on SwipeGestureMayStart
* events by event listeners. Its value after event dispatch determines
* the behavior of the swipe animation that might be about to begin.
* Specifically, if the user swipes in a direction that can't be swiped
* to, the animation will have a bounce effect.
* Future SwipeGestureUpdate, SwipeGesture and SwipeGestureEnd events
* will carry the allowDirections value that was set on the SwipeMayStart
* event. Changing this field on non-SwipeGestureMayStart events doesn't
* have any effect.
*/
attribute unsigned long allowedDirections;
/* Direction of a gesture. Diagonals are indicated by OR'ing the
* applicable constants together.
*
* Swipes gestures may occur in any direction.
*
* Magnify gestures do not have a direction.
*
* Rotation gestures will be either ROTATION_COUNTERCLOCKWISE or
* ROTATION_CLOCKWISE.
*/
readonly attribute unsigned long direction;
/* Delta value for magnify, rotate and swipe gestures.
*
* For rotation, the value is in degrees and is positive for
* clockwise rotation and negative for counterclockwise
* rotation.
*
* For magnification, the value will be positive for a "zoom in"
* (i.e, increased magnification) and negative for a "zoom out"
* (i.e., decreased magnification). The particular units
* represented by the "delta" are currently implementation specific.
*
* XXX - The units for measuring magnification are currently
* unspecified because the units used by Mac OS X are currently
* undocumented. The values are typically in the range of 0.0 to
* 100.0, but it is only safe currently to rely on the delta being
* positive or negative.
*
* For swipe start, update and end events, the value is a fraction
* of one "page". If the resulting swipe will have DIRECTION_LEFT, the
* delta value will be positive; for DIRECTION_RIGHT, delta is negative.
* If this seems backwards to you, look at it this way: If the current
* page is pushed to the right during the animation (positive delta),
* the page left to the current page will be visible after the swipe
* (DIRECTION_LEFT).
*
* Units on Windows represent the difference between the initial
* and current/final width between the two touch points on the input
* device and are measured in pixels.
*/
readonly attribute double delta;
/* Click count value for taps. */
readonly attribute unsigned long clickCount;
};

Просмотреть файл

@ -2,27 +2,180 @@
/* 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/.
*/
/**
* The SimpleGestureEvent interface is the datatype for all
* Mozilla-specific simple gesture events in the Document Object Model.
*
* For more information see nsIDOMSimpleGestureEvent.idl.
* The following events are generated:
*
* MozSwipeGestureMayStart - Generated when the user starts a horizontal
* swipe across the input device, but before we know whether the user
* is actually scrolling past a scroll edge.
* This event asks two questions: Should a swipe really be started, and
* in which directions should the user be able to swipe? The first
* question is answered by event listeners by calling or not calling
* preventDefault() on the event. Since a swipe swallows all scroll
* events, the default action of the swipe start event is *not* to
* start a swipe. Call preventDefault() if you want a swipe to be
* started. Doing so won't necessarily result in a swipe being started,
* it only communicates an intention. Once Gecko determines whether a
* swipe should actually be started, it will send a MozSwipeGestureStart
* event.
* The second question (swipe-able directions) is answered in the
* allowedDirections field.
*
* MozSwipeGestureStart - This event signals the start of a swipe.
* It guarantees a future MozSwipeGestureEnd event that will signal
* the end of a swipe animation.
*
* MozSwipeGestureUpdate - Generated periodically while the user is
* continuing a horizontal swipe gesture. The "delta" value represents
* the current absolute gesture amount. This event may even be sent
* after a MozSwipeGesture event fired in order to allow for fluid
* completion of a swipe animation. The direction value is meaningless
* on swipe update events.
*
* MozSwipeGestureEnd - Generated when the swipe animation is completed.
*
* MozSwipeGesture - Generated when the user releases a swipe across
* across the input device. This event signals that the actual swipe
* operation is complete, even though the animation might not be finished
* yet. This event can be sent without accompanying start / update / end
* events, and it can also be handled on its own if the consumer doesn't
* want to handle swipe animation events.
* Only the direction value has any significance, the delta value is
* meaningless.
*
* MozMagnifyGestureStart - Generated when the user begins the magnify
* ("pinch") gesture. The "delta" value represents the initial
* movement.
*
* MozMagnifyGestureUpdate - Generated periodically while the user is
* continuing the magnify ("pinch") gesture. The "delta" value
* represents the movement since the last MozMagnifyGestureStart or
* MozMagnifyGestureUpdate event.
*
* MozMagnifyGesture - Generated when the user has completed the
* magnify ("pinch") gesture. If you only want to receive a single
* event when the magnify gesture is complete, you only need to hook
* this event and can safely ignore the MozMagnifyGestureStart and the
* MozMagnifyGestureUpdate events. The "delta" value is the cumulative
* amount represented by the user's gesture.
*
* MozRotateGestureStart - Generated when the user begins the rotation
* gesture. The "delta" value represents the initial rotation.
*
* MozRotateGestureUpdate - Generated periodically while the user is
* continuing the rotation gesture. The "delta" value represents the
* rotation since the last MozRotateGestureStart or
* MozRotateGestureUpdate event.
*
* MozRotateGesture - Generated when the user has completed the
* rotation gesture. If you only want to receive a single event when
* the rotation gesture is complete, you only need to hook this event
* and can safely ignore the MozRotateGestureStart and the
* MozRotateGestureUpdate events. The "delta" value is the cumulative
* amount of rotation represented by the user's gesture.
*
* MozTapGesture - Generated when the user executes a two finger
* tap gesture on the input device. Client coordinates contain the
* center point of the tap.
* (XXX On OS X, only Lion (10.7) and up)
*
* MozPressTapGesture - Generated when the user executes a press
* and tap two finger gesture (first finger down, second finger down,
* second finger up, first finger up) on the input device.
* Client coordinates contain the center pivot point of the action.
* (XXX Not implemented on Mac)
*
* MozEdgeUIGesture - Generated when the user swipes the display to
* invoke edge ui.
* (XXX Win8 only)
*
* Default behavior:
*
* Some operating systems support default behaviors for gesture events
* when they are not handled by the application. Consumers should
* use event.preventDefault() to prevent default behavior when
* consuming events.
*/
[Func="IsChromeOrXBL"]
interface SimpleGestureEvent : MouseEvent
{
/* Swipe direction constants */
const unsigned long DIRECTION_UP = 1;
const unsigned long DIRECTION_DOWN = 2;
const unsigned long DIRECTION_LEFT = 4;
const unsigned long DIRECTION_RIGHT = 8;
/* Rotational direction constants */
const unsigned long ROTATION_COUNTERCLOCKWISE = 1;
const unsigned long ROTATION_CLOCKWISE = 2;
/* Read-write value for swipe events.
*
* Reports the directions that can be swiped to; multiple directions
* should be OR'ed together.
*
* The allowedDirections field is designed to be set on SwipeGestureMayStart
* events by event listeners. Its value after event dispatch determines
* the behavior of the swipe animation that might be about to begin.
* Specifically, if the user swipes in a direction that can't be swiped
* to, the animation will have a bounce effect.
* Future SwipeGestureUpdate, SwipeGesture and SwipeGestureEnd events
* will carry the allowDirections value that was set on the SwipeMayStart
* event. Changing this field on non-SwipeGestureMayStart events doesn't
* have any effect.
*/
attribute unsigned long allowedDirections;
/* Direction of a gesture. Diagonals are indicated by OR'ing the
* applicable constants together.
*
* Swipes gestures may occur in any direction.
*
* Magnify gestures do not have a direction.
*
* Rotation gestures will be either ROTATION_COUNTERCLOCKWISE or
* ROTATION_CLOCKWISE.
*/
readonly attribute unsigned long direction;
/* Delta value for magnify, rotate and swipe gestures.
*
* For rotation, the value is in degrees and is positive for
* clockwise rotation and negative for counterclockwise
* rotation.
*
* For magnification, the value will be positive for a "zoom in"
* (i.e, increased magnification) and negative for a "zoom out"
* (i.e., decreased magnification). The particular units
* represented by the "delta" are currently implementation specific.
*
* XXX - The units for measuring magnification are currently
* unspecified because the units used by Mac OS X are currently
* undocumented. The values are typically in the range of 0.0 to
* 100.0, but it is only safe currently to rely on the delta being
* positive or negative.
*
* For swipe start, update and end events, the value is a fraction
* of one "page". If the resulting swipe will have DIRECTION_LEFT, the
* delta value will be positive; for DIRECTION_RIGHT, delta is negative.
* If this seems backwards to you, look at it this way: If the current
* page is pushed to the right during the animation (positive delta),
* the page left to the current page will be visible after the swipe
* (DIRECTION_LEFT).
*
* Units on Windows represent the difference between the initial
* and current/final width between the two touch points on the input
* device and are measured in pixels.
*/
readonly attribute double delta;
/* Click count value for taps. */
readonly attribute unsigned long clickCount;
void initSimpleGestureEvent(DOMString typeArg,

Просмотреть файл

@ -11,7 +11,6 @@
#include "mozilla/dom/Touch.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/RefPtr.h"
#include "nsIDOMSimpleGestureEvent.h"
#include "nsTArray.h"
namespace mozilla {
@ -128,9 +127,9 @@ public:
return result;
}
// See nsIDOMSimpleGestureEvent for values
// See SimpleGestureEvent.webidl for values
uint32_t mAllowedDirections;
// See nsIDOMSimpleGestureEvent for values
// See SimpleGestureEvent.webidl for values
uint32_t mDirection;
// The number of taps for tap events
uint32_t mClickCount;

Просмотреть файл

@ -47,8 +47,6 @@ using mozilla::Unused;
#include "nsContentUtils.h"
#include "WidgetUtils.h"
#include "nsIDOMSimpleGestureEvent.h"
#include "nsGkAtoms.h"
#include "nsWidgetsCID.h"
#include "nsGfxCIID.h"

Просмотреть файл

@ -10,6 +10,7 @@
#include "mozilla/FlushType.h"
#include "mozilla/TimeStamp.h"
#include "mozilla/TouchEvents.h"
#include "mozilla/dom/SimpleGestureEventBinding.h"
#include "nsAlgorithm.h"
#include "nsChildView.h"
#include "UnitTransforms.h"
@ -70,7 +71,8 @@ SwipeTracker::~SwipeTracker()
double
SwipeTracker::SwipeSuccessTargetValue() const
{
return (mSwipeDirection == nsIDOMSimpleGestureEvent::DIRECTION_RIGHT) ? -1.0 : 1.0;
return (mSwipeDirection == dom::SimpleGestureEventBinding::DIRECTION_RIGHT) ?
-1.0 : 1.0;
}
double
@ -78,8 +80,12 @@ SwipeTracker::ClampToAllowedRange(double aGestureAmount) const
{
// gestureAmount needs to stay between -1 and 0 when swiping right and
// between 0 and 1 when swiping left.
double min = (mSwipeDirection == nsIDOMSimpleGestureEvent::DIRECTION_RIGHT) ? -1.0 : 0.0;
double max = (mSwipeDirection == nsIDOMSimpleGestureEvent::DIRECTION_LEFT) ? 1.0 : 0.0;
double min =
(mSwipeDirection == dom::SimpleGestureEventBinding::DIRECTION_RIGHT) ?
-1.0 : 0.0;
double max =
(mSwipeDirection == dom::SimpleGestureEventBinding::DIRECTION_LEFT) ?
1.0 : 0.0;
return clamped(aGestureAmount, min, max);
}

Просмотреть файл

@ -17,6 +17,7 @@
#include "mozilla/MouseEvents.h"
#include "mozilla/TextEvents.h"
#include "mozilla/TouchEvents.h"
#include "mozilla/dom/SimpleGestureEventBinding.h"
#include "nsArrayUtils.h"
#include "nsExceptionHandler.h"
@ -33,7 +34,6 @@
#include "nsIFile.h"
#include "nsILocalFileMac.h"
#include "nsGfxCIID.h"
#include "nsIDOMSimpleGestureEvent.h"
#include "nsThemeConstants.h"
#include "nsIWidgetListener.h"
#include "nsIPresShell.h"
@ -2702,8 +2702,8 @@ nsChildView::SendMayStartSwipe(const mozilla::PanGestureInput& aSwipeStartEvent)
nsCOMPtr<nsIWidget> kungFuDeathGrip(this);
uint32_t direction = (aSwipeStartEvent.mPanDisplacement.x > 0.0)
? (uint32_t)nsIDOMSimpleGestureEvent::DIRECTION_RIGHT
: (uint32_t)nsIDOMSimpleGestureEvent::DIRECTION_LEFT;
? (uint32_t)dom::SimpleGestureEventBinding::DIRECTION_RIGHT
: (uint32_t)dom::SimpleGestureEventBinding::DIRECTION_LEFT;
// We're ready to start the animation. Tell Gecko about it, and at the same
// time ask it if it really wants to start an animation for this event.
@ -2736,8 +2736,8 @@ nsChildView::TrackScrollEventAsSwipe(const mozilla::PanGestureInput& aSwipeStart
}
uint32_t direction = (aSwipeStartEvent.mPanDisplacement.x > 0.0)
? (uint32_t)nsIDOMSimpleGestureEvent::DIRECTION_RIGHT
: (uint32_t)nsIDOMSimpleGestureEvent::DIRECTION_LEFT;
? (uint32_t)dom::SimpleGestureEventBinding::DIRECTION_RIGHT
: (uint32_t)dom::SimpleGestureEventBinding::DIRECTION_LEFT;
mSwipeTracker = new SwipeTracker(*this, aSwipeStartEvent,
aAllowedDirections, direction);
@ -4177,15 +4177,15 @@ NSEvent* gLastDragMouseDownEvent = nil;
// Record the left/right direction.
if (deltaX > 0.0)
geckoEvent.mDirection |= nsIDOMSimpleGestureEvent::DIRECTION_LEFT;
geckoEvent.mDirection |= dom::SimpleGestureEventBinding::DIRECTION_LEFT;
else if (deltaX < 0.0)
geckoEvent.mDirection |= nsIDOMSimpleGestureEvent::DIRECTION_RIGHT;
geckoEvent.mDirection |= dom::SimpleGestureEventBinding::DIRECTION_RIGHT;
// Record the up/down direction.
if (deltaY > 0.0)
geckoEvent.mDirection |= nsIDOMSimpleGestureEvent::DIRECTION_UP;
geckoEvent.mDirection |= dom::SimpleGestureEventBinding::DIRECTION_UP;
else if (deltaY < 0.0)
geckoEvent.mDirection |= nsIDOMSimpleGestureEvent::DIRECTION_DOWN;
geckoEvent.mDirection |= dom::SimpleGestureEventBinding::DIRECTION_DOWN;
// Send the event.
mGeckoChild->DispatchWindowEvent(geckoEvent);
@ -4324,9 +4324,10 @@ NSEvent* gLastDragMouseDownEvent = nil;
[self convertCocoaMouseEvent:anEvent toGeckoEvent:&geckoEvent];
geckoEvent.mDelta = -rotation;
if (rotation > 0.0) {
geckoEvent.mDirection = nsIDOMSimpleGestureEvent::ROTATION_COUNTERCLOCKWISE;
geckoEvent.mDirection =
dom::SimpleGestureEventBinding::ROTATION_COUNTERCLOCKWISE;
} else {
geckoEvent.mDirection = nsIDOMSimpleGestureEvent::ROTATION_CLOCKWISE;
geckoEvent.mDirection = dom::SimpleGestureEventBinding::ROTATION_CLOCKWISE;
}
// Send the event.
@ -4416,9 +4417,11 @@ NSEvent* gLastDragMouseDownEvent = nil;
[self convertCocoaMouseEvent:anEvent toGeckoEvent:&geckoEvent];
geckoEvent.mDelta = -mCumulativeRotation;
if (mCumulativeRotation > 0.0) {
geckoEvent.mDirection = nsIDOMSimpleGestureEvent::ROTATION_COUNTERCLOCKWISE;
geckoEvent.mDirection =
dom::SimpleGestureEventBinding::ROTATION_COUNTERCLOCKWISE;
} else {
geckoEvent.mDirection = nsIDOMSimpleGestureEvent::ROTATION_CLOCKWISE;
geckoEvent.mDirection =
dom::SimpleGestureEventBinding::ROTATION_CLOCKWISE;
}
// Send the event.

Просмотреть файл

@ -10,12 +10,12 @@
#include "nscore.h"
#include "nsWinGesture.h"
#include "nsUXThemeData.h"
#include "nsIDOMSimpleGestureEvent.h"
#include "nsIDOMWheelEvent.h"
#include "mozilla/Logging.h"
#include "mozilla/MouseEvents.h"
#include "mozilla/Preferences.h"
#include "mozilla/TouchEvents.h"
#include "mozilla/dom/SimpleGestureEventBinding.h"
#include <cmath>
@ -207,10 +207,13 @@ nsWinGesture::ProcessGestureMessage(HWND hWnd, WPARAM wParam, LPARAM lParam,
evt.mDelta = degrees - mRotateIntermediate;
mRotateIntermediate = degrees;
if (evt.mDelta > 0)
evt.mDirection = nsIDOMSimpleGestureEvent::ROTATION_COUNTERCLOCKWISE;
else if (evt.mDelta < 0)
evt.mDirection = nsIDOMSimpleGestureEvent::ROTATION_CLOCKWISE;
if (evt.mDelta > 0) {
evt.mDirection =
dom::SimpleGestureEventBinding::ROTATION_COUNTERCLOCKWISE;
}
else if (evt.mDelta < 0) {
evt.mDirection = dom::SimpleGestureEventBinding::ROTATION_CLOCKWISE;
}
if (gi.dwFlags & GF_BEGIN) {
evt.mMessage = eRotateGestureStart;

Просмотреть файл

@ -52,7 +52,6 @@
#include "nsIDOMScreen.h"
#include "nsIDOMScrollAreaEvent.h"
#include "nsIDOMSerializer.h"
#include "nsIDOMSimpleGestureEvent.h"
#include "nsIDOMText.h"
#include "nsIDOMTimeRanges.h"
#include "nsIDOMUIEvent.h"
@ -132,7 +131,6 @@
#include "mozilla/dom/ScrollBoxObjectBinding.h"
#include "mozilla/dom/SelectionBinding.h"
#include "mozilla/dom/ScrollAreaEventBinding.h"
#include "mozilla/dom/SimpleGestureEventBinding.h"
#include "mozilla/dom/StorageEventBinding.h"
#include "mozilla/dom/StyleSheetBinding.h"
#include "mozilla/dom/StyleSheetListBinding.h"
@ -256,7 +254,6 @@ const ComponentsInterfaceShimEntry kComponentsInterfaceShimMap[] =
DEFINE_SHIM(ScrollAreaEvent),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIScrollBoxObject, ScrollBoxObject),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsIDOMSerializer, XMLSerializer),
DEFINE_SHIM(SimpleGestureEvent),
DEFINE_SHIM(Text),
DEFINE_SHIM(TimeRanges),
DEFINE_SHIM_WITH_CUSTOM_INTERFACE(nsITreeBoxObject, TreeBoxObject),