Bug 920377 part.13 Get rid of nsTouchEvent r=roc

This commit is contained in:
Masayuki Nakano
2013-09-27 15:20:57 +09:00
parent 395a56d9cb
commit fb9f3a20a8
31 changed files with 102 additions and 96 deletions

View File

@@ -144,7 +144,7 @@ nsCoreUtils::DispatchTouchEvent(uint32_t aEventType, int32_t aX, int32_t aY,
if (!nsDOMTouchEvent::PrefEnabled())
return;
nsTouchEvent event(true, aEventType, aRootWidget);
WidgetTouchEvent event(true, aEventType, aRootWidget);
event.time = PR_IntervalNow();

View File

@@ -741,8 +741,8 @@ nsDOMEvent::DuplicatePrivateData()
}
case NS_TOUCH_EVENT:
{
nsTouchEvent* oldTouchEvent = static_cast<nsTouchEvent*>(mEvent);
nsTouchEvent* touchEvent = new nsTouchEvent(false, oldTouchEvent);
WidgetTouchEvent* oldTouchEvent = static_cast<WidgetTouchEvent*>(mEvent);
WidgetTouchEvent* touchEvent = new WidgetTouchEvent(false, oldTouchEvent);
touchEvent->AssignTouchEventData(*oldTouchEvent, true);
newEvent = touchEvent;
break;

View File

@@ -54,9 +54,9 @@ nsDOMTouchList::IdentifiedTouch(int32_t aIdentifier) const
nsDOMTouchEvent::nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsTouchEvent* aEvent)
WidgetTouchEvent* aEvent)
: nsDOMUIEvent(aOwner, aPresContext,
aEvent ? aEvent : new nsTouchEvent(false, 0, nullptr))
aEvent ? aEvent : new WidgetTouchEvent(false, 0, nullptr))
{
if (aEvent) {
mEventIsInternal = false;
@@ -74,7 +74,7 @@ nsDOMTouchEvent::nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
nsDOMTouchEvent::~nsDOMTouchEvent()
{
if (mEventIsInternal && mEvent) {
delete static_cast<nsTouchEvent*>(mEvent);
delete static_cast<WidgetTouchEvent*>(mEvent);
mEvent = nullptr;
}
}
@@ -126,7 +126,7 @@ nsDOMTouchList*
nsDOMTouchEvent::Touches()
{
if (!mTouches) {
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(mEvent);
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(mEvent);
if (mEvent->message == NS_TOUCH_END || mEvent->message == NS_TOUCH_CANCEL) {
// for touchend events, remove any changed touches from the touches array
nsTArray< nsRefPtr<Touch> > unchangedTouches;
@@ -149,7 +149,7 @@ nsDOMTouchEvent::TargetTouches()
{
if (!mTargetTouches) {
nsTArray< nsRefPtr<Touch> > targetTouches;
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(mEvent);
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(mEvent);
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
for (uint32_t i = 0; i < touches.Length(); ++i) {
// for touchend/cancel events, don't append to the target list if this is a
@@ -171,7 +171,7 @@ nsDOMTouchEvent::ChangedTouches()
{
if (!mChangedTouches) {
nsTArray< nsRefPtr<Touch> > changedTouches;
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(mEvent);
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(mEvent);
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
for (uint32_t i = 0; i < touches.Length(); ++i) {
if (touches[i]->mChanged) {
@@ -225,7 +225,7 @@ nsresult
NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsTouchEvent *aEvent)
WidgetTouchEvent* aEvent)
{
nsDOMTouchEvent* it = new nsDOMTouchEvent(aOwner, aPresContext, aEvent);
return CallQueryInterface(it, aInstancePtrResult);

View File

@@ -82,7 +82,8 @@ class nsDOMTouchEvent : public nsDOMUIEvent
{
public:
nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext, nsTouchEvent* aEvent);
nsPresContext* aPresContext,
mozilla::WidgetTouchEvent* aEvent);
virtual ~nsDOMTouchEvent();
NS_DECL_ISUPPORTS_INHERITED

View File

@@ -741,7 +741,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
static_cast<nsSimpleGestureEvent*>(aEvent));
case NS_TOUCH_EVENT:
return NS_NewDOMTouchEvent(aDOMEvent, aOwner, aPresContext,
static_cast<nsTouchEvent*>(aEvent));
static_cast<WidgetTouchEvent*>(aEvent));
case NS_TRANSITION_EVENT:
return NS_NewDOMTransitionEvent(aDOMEvent, aOwner, aPresContext,
static_cast<InternalTransitionEvent*>(aEvent));

View File

@@ -1399,7 +1399,7 @@ nsEventStateManager::DispatchCrossProcessEvent(nsEvent* aEvent,
// Let the child process synthesize a mouse event if needed, and
// ensure we don't synthesize one in this process.
*aStatus = nsEventStatus_eConsumeNoDefault;
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
return remote->SendRealTouchEvent(*touchEvent);
}
default: {
@@ -1516,7 +1516,7 @@ nsEventStateManager::HandleCrossProcessEvent(nsEvent *aEvent,
//
// This loop is similar to the one used in
// PresShell::DispatchTouchEvent().
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
for (uint32_t i = 0; i < touches.Length(); ++i) {
Touch* touch = touches[i];

View File

@@ -3709,7 +3709,8 @@ HTMLInputElement::PostHandleEventForRangeThumb(nsEventChainPostVisitor& aVisitor
CancelRangeThumbDrag();
}
} else {
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aVisitor.mEvent);
WidgetTouchEvent* touchEvent =
static_cast<WidgetTouchEvent*>(aVisitor.mEvent);
if (touchEvent->touches.Length() == 1) {
StartRangeThumbDrag(inputEvent);
} else if (mIsDraggingRange) {

View File

@@ -876,7 +876,7 @@ nsDOMWindowUtils::SendTouchEvent(const nsAString& aType,
} else {
return NS_ERROR_UNEXPECTED;
}
nsTouchEvent event(true, msg, widget);
WidgetTouchEvent event(true, msg, widget);
event.modifiers = GetWidgetModifiers(aModifiers);
event.widget = widget;
event.time = PR_Now();

View File

@@ -375,7 +375,7 @@ nsresult
NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,
nsPresContext* aPresContext,
nsTouchEvent* aEvent);
mozilla::WidgetTouchEvent* aEvent);
nsresult
NS_NewDOMMozSettingsEvent(nsIDOMEvent** aInstancePtrResult,
mozilla::dom::EventTarget* aOwner,

View File

@@ -49,7 +49,7 @@ using nsQueryContentEvent;
using nsRect;
using nsSelectionEvent;
using nsTextEvent;
using nsTouchEvent;
using mozilla::WidgetTouchEvent;
using RemoteDOMEvent;
using mozilla::dom::ScreenOrientation;
using mozilla::layers::TextureFactoryIdentifier;
@@ -367,10 +367,10 @@ child:
RealMouseEvent(nsMouseEvent event);
RealKeyEvent(nsKeyEvent event);
MouseWheelEvent(WheelEvent event);
RealTouchEvent(nsTouchEvent event);
RealTouchEvent(WidgetTouchEvent event);
// We use a separate message for touchmove events only to apply
// compression to them.
RealTouchMoveEvent(nsTouchEvent event) compress;
RealTouchMoveEvent(WidgetTouchEvent event) compress;
/**
* @see nsIDOMWindowUtils sendKeyEvent.

View File

@@ -1702,7 +1702,7 @@ TabChild::DispatchSynthesizedMouseEvent(uint32_t aMsg, uint64_t aTime,
}
static Touch*
GetTouchForIdentifier(const nsTouchEvent& aEvent, int32_t aId)
GetTouchForIdentifier(const WidgetTouchEvent& aEvent, int32_t aId)
{
for (uint32_t i = 0; i < aEvent.touches.Length(); ++i) {
Touch* touch = static_cast<Touch*>(aEvent.touches[i].get());
@@ -1714,7 +1714,7 @@ GetTouchForIdentifier(const nsTouchEvent& aEvent, int32_t aId)
}
void
TabChild::UpdateTapState(const nsTouchEvent& aEvent, nsEventStatus aStatus)
TabChild::UpdateTapState(const WidgetTouchEvent& aEvent, nsEventStatus aStatus)
{
static bool sHavePrefs;
static bool sClickHoldContextMenusEnabled;
@@ -1833,9 +1833,9 @@ TabChild::CancelTapTracking()
}
bool
TabChild::RecvRealTouchEvent(const nsTouchEvent& aEvent)
TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent)
{
nsTouchEvent localEvent(aEvent);
WidgetTouchEvent localEvent(aEvent);
nsEventStatus status = DispatchWidgetEvent(localEvent);
if (IsAsyncPanZoomEnabled()) {
@@ -1853,7 +1853,7 @@ TabChild::RecvRealTouchEvent(const nsTouchEvent& aEvent)
}
bool
TabChild::RecvRealTouchMoveEvent(const nsTouchEvent& aEvent)
TabChild::RecvRealTouchMoveEvent(const WidgetTouchEvent& aEvent)
{
return RecvRealTouchEvent(aEvent);
}

View File

@@ -218,8 +218,8 @@ public:
virtual bool RecvRealMouseEvent(const nsMouseEvent& event);
virtual bool RecvRealKeyEvent(const nsKeyEvent& event);
virtual bool RecvMouseWheelEvent(const mozilla::WheelEvent& event);
virtual bool RecvRealTouchEvent(const nsTouchEvent& event);
virtual bool RecvRealTouchMoveEvent(const nsTouchEvent& event);
virtual bool RecvRealTouchEvent(const WidgetTouchEvent& event);
virtual bool RecvRealTouchMoveEvent(const WidgetTouchEvent& event);
virtual bool RecvKeyEvent(const nsString& aType,
const int32_t& aKeyCode,
const int32_t& aCharCode,
@@ -442,7 +442,7 @@ private:
// FireContextMenuEvent().
void FireContextMenuEvent();
void CancelTapTracking();
void UpdateTapState(const nsTouchEvent& aEvent, nsEventStatus aStatus);
void UpdateTapState(const WidgetTouchEvent& aEvent, nsEventStatus aStatus);
nsresult
BrowserFrameProvideWindow(nsIDOMWindow* aOpener,

View File

@@ -621,7 +621,7 @@ TabParent::MapEventCoordinatesForChildProcess(
aEvent->refPoint = aOffset;
} else {
aEvent->refPoint = LayoutDeviceIntPoint();
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
// Then offset all the touch points by that distance, to put them
// in the space where top-left is 0,0.
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
@@ -673,7 +673,7 @@ bool TabParent::SendRealKeyEvent(nsKeyEvent& event)
return PBrowserParent::SendRealKeyEvent(e);
}
bool TabParent::SendRealTouchEvent(nsTouchEvent& event)
bool TabParent::SendRealTouchEvent(WidgetTouchEvent& event)
{
if (mIsDestroyed) {
return false;
@@ -699,7 +699,7 @@ bool TabParent::SendRealTouchEvent(nsTouchEvent& event)
++mEventCaptureDepth;
}
nsTouchEvent e(event);
WidgetTouchEvent e(event);
// PresShell::HandleEventInternal adds touches on touch end/cancel.
// This confuses remote content into thinking that the added touches
// are part of the touchend/cancel, when actually they're not.
@@ -736,7 +736,7 @@ TabParent::TryCapture(const nsGUIEvent& aEvent)
return false;
}
nsTouchEvent event(static_cast<const nsTouchEvent&>(aEvent));
WidgetTouchEvent event(static_cast<const WidgetTouchEvent&>(aEvent));
bool isTouchPointUp = (event.message == NS_TOUCH_END ||
event.message == NS_TOUCH_CANCEL);

View File

@@ -196,7 +196,7 @@ public:
bool SendRealMouseEvent(nsMouseEvent& event);
bool SendMouseWheelEvent(mozilla::WheelEvent& event);
bool SendRealKeyEvent(nsKeyEvent& event);
bool SendRealTouchEvent(nsTouchEvent& event);
bool SendRealTouchEvent(WidgetTouchEvent& event);
virtual PDocumentRendererParent*
AllocPDocumentRendererParent(const nsRect& documentRect, const gfxMatrix& transform,

View File

@@ -297,7 +297,8 @@ APZCTreeManager::ReceiveInputEvent(const InputData& aEvent)
}
AsyncPanZoomController*
APZCTreeManager::GetTouchInputBlockAPZC(const nsTouchEvent& aEvent, ScreenPoint aPoint)
APZCTreeManager::GetTouchInputBlockAPZC(const WidgetTouchEvent& aEvent,
ScreenPoint aPoint)
{
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aPoint);
gfx3DMatrix transformToApzc, transformToScreen;
@@ -325,8 +326,8 @@ APZCTreeManager::GetTouchInputBlockAPZC(const nsTouchEvent& aEvent, ScreenPoint
}
nsEventStatus
APZCTreeManager::ProcessTouchEvent(const nsTouchEvent& aEvent,
nsTouchEvent* aOutEvent)
APZCTreeManager::ProcessTouchEvent(const WidgetTouchEvent& aEvent,
WidgetTouchEvent* aOutEvent)
{
// For computing the input for the APZC, used the cached transform.
// This ensures that the sequence of touch points an APZC sees in an
@@ -344,7 +345,7 @@ APZCTreeManager::ProcessTouchEvent(const nsTouchEvent& aEvent,
gfx3DMatrix transformToScreen;
GetInputTransforms(mApzcForInputBlock, transformToApzc, transformToScreen);
gfx3DMatrix outTransform = transformToApzc * transformToScreen;
nsTouchEvent* outEvent = static_cast<nsTouchEvent*>(aOutEvent);
WidgetTouchEvent* outEvent = static_cast<WidgetTouchEvent*>(aOutEvent);
for (size_t i = 0; i < outEvent->touches.Length(); i++) {
ApplyTransform(&(outEvent->touches[i]->mRefPoint), outTransform);
}
@@ -402,7 +403,8 @@ APZCTreeManager::ReceiveInputEvent(const nsInputEvent& aEvent,
switch (aEvent.eventStructType) {
case NS_TOUCH_EVENT: {
const nsTouchEvent& touchEvent = static_cast<const nsTouchEvent&>(aEvent);
const WidgetTouchEvent& touchEvent =
static_cast<const WidgetTouchEvent&>(aEvent);
if (!touchEvent.touches.Length()) {
return nsEventStatus_eIgnore;
}
@@ -413,7 +415,7 @@ APZCTreeManager::ReceiveInputEvent(const nsInputEvent& aEvent,
if (!mApzcForInputBlock) {
return nsEventStatus_eIgnore;
}
nsTouchEvent* outEvent = static_cast<nsTouchEvent*>(aOutEvent);
WidgetTouchEvent* outEvent = static_cast<WidgetTouchEvent*>(aOutEvent);
return ProcessTouchEvent(touchEvent, outEvent);
}
case NS_MOUSE_EVENT: {
@@ -435,7 +437,7 @@ APZCTreeManager::ReceiveInputEvent(nsInputEvent& aEvent)
switch (aEvent.eventStructType) {
case NS_TOUCH_EVENT: {
nsTouchEvent& touchEvent = static_cast<nsTouchEvent&>(aEvent);
WidgetTouchEvent& touchEvent = static_cast<WidgetTouchEvent&>(aEvent);
if (!touchEvent.touches.Length()) {
return nsEventStatus_eIgnore;
}

View File

@@ -148,7 +148,7 @@ public:
/**
* nsInputEvent handler. Sets |aOutEvent| (which is assumed to be an
* already-existing instance of an nsInputEvent which may be an
* nsTouchEvent) to have its coordinates in DOM space. This is so that the
* WidgetTouchEvent) to have its coordinates in DOM space. This is so that the
* event can be passed through the DOM and content can handle them.
*
* NOTE: Be careful of invoking the nsInputEvent variant. This can only be
@@ -300,8 +300,8 @@ private:
AsyncPanZoomController* GetAPZCAtPoint(AsyncPanZoomController* aApzc, const gfxPoint& aHitTestPoint);
AsyncPanZoomController* CommonAncestor(AsyncPanZoomController* aApzc1, AsyncPanZoomController* aApzc2);
AsyncPanZoomController* RootAPZCForLayersId(AsyncPanZoomController* aApzc);
AsyncPanZoomController* GetTouchInputBlockAPZC(const nsTouchEvent& aEvent, ScreenPoint aPoint);
nsEventStatus ProcessTouchEvent(const nsTouchEvent& touchEvent, nsTouchEvent* aOutEvent);
AsyncPanZoomController* GetTouchInputBlockAPZC(const WidgetTouchEvent& aEvent, ScreenPoint aPoint);
nsEventStatus ProcessTouchEvent(const WidgetTouchEvent& touchEvent, WidgetTouchEvent* aOutEvent);
nsEventStatus ProcessMouseEvent(const nsMouseEvent& mouseEvent, nsMouseEvent* aOutEvent);
nsEventStatus ProcessEvent(const nsInputEvent& inputEvent, nsInputEvent* aOutEvent);

View File

@@ -5960,7 +5960,7 @@ EvictTouchPoint(nsRefPtr<dom::Touch>& aTouch)
return;
}
nsTouchEvent event(true, NS_TOUCH_END, widget);
WidgetTouchEvent event(true, NS_TOUCH_END, widget);
event.widget = widget;
event.time = PR_IntervalNow();
event.touches.AppendElement(aTouch);
@@ -6202,7 +6202,7 @@ PresShell::HandleEvent(nsIFrame *aFrame,
uint32_t flags = 0;
if (aEvent->message == NS_TOUCH_START) {
flags |= INPUT_IGNORE_ROOT_SCROLL_FRAME;
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
// if this is a continuing session, ensure that all these events are
// in the same document by taking the target of the events already in
// the capture list
@@ -6334,7 +6334,7 @@ PresShell::HandleEvent(nsIFrame *aFrame,
case NS_TOUCH_CANCEL:
case NS_TOUCH_END: {
// get the correct shell to dispatch to
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
nsTArray< nsRefPtr<dom::Touch> >& touches = touchEvent->touches;
for (uint32_t i = 0; i < touches.Length(); ++i) {
dom::Touch* touch = touches[i];
@@ -6723,7 +6723,7 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus)
isHandlingUserInput = true;
break;
case NS_TOUCH_START: {
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
// if there is only one touch in this touchstart event, assume that it is
// the start of a new touch session and evict any old touches in the
// queue
@@ -6751,7 +6751,7 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus)
case NS_TOUCH_END: {
// Remove the changed touches
// need to make sure we only remove touches that are ending here
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
nsTArray< nsRefPtr<dom::Touch> >& touches = touchEvent->touches;
for (uint32_t i = 0; i < touches.Length(); ++i) {
dom::Touch* touch = touches[i];
@@ -6778,7 +6778,7 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus)
}
case NS_TOUCH_MOVE: {
// Check for touches that changed. Mark them add to queue
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
nsTArray< nsRefPtr<dom::Touch> >& touches = touchEvent->touches;
bool haveChanged = false;
for (int32_t i = touches.Length(); i; ) {
@@ -6943,7 +6943,7 @@ PresShell::DispatchTouchEvent(nsEvent *aEvent,
(aEvent->message == NS_TOUCH_MOVE && aTouchIsNew);
bool preventDefault = false;
nsEventStatus tmpStatus = nsEventStatus_eIgnore;
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
// loop over all touches and dispatch events on any that have changed
for (uint32_t i = 0; i < touchEvent->touches.Length(); ++i) {
@@ -6968,7 +6968,7 @@ PresShell::DispatchTouchEvent(nsEvent *aEvent,
content = capturingContent;
}
// copy the event
nsTouchEvent newEvent(touchEvent->mFlags.mIsTrusted, touchEvent);
WidgetTouchEvent newEvent(touchEvent->mFlags.mIsTrusted, touchEvent);
newEvent.target = targetPtr;
nsRefPtr<PresShell> contentPresShell;

View File

@@ -477,10 +477,10 @@ nsRangeFrame::GetValueAtEventPoint(nsGUIEvent* aEvent)
LayoutDeviceIntPoint absPoint;
if (aEvent->eventStructType == NS_TOUCH_EVENT) {
MOZ_ASSERT(static_cast<nsTouchEvent*>(aEvent)->touches.Length() == 1,
MOZ_ASSERT(static_cast<WidgetTouchEvent*>(aEvent)->touches.Length() == 1,
"Unexpected number of touches");
absPoint = LayoutDeviceIntPoint::FromUntyped(
static_cast<nsTouchEvent*>(aEvent)->touches[0]->mRefPoint);
static_cast<WidgetTouchEvent*>(aEvent)->touches[0]->mRefPoint);
} else {
absPoint = aEvent->refPoint;
}

View File

@@ -2080,7 +2080,7 @@ nsBoxFrame::GetEventPoint(nsGUIEvent* aEvent, nsIntPoint &aPoint) {
NS_ENSURE_TRUE(aEvent, false);
if (aEvent->eventStructType == NS_TOUCH_EVENT) {
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
// return false if there is more than one touch on the page, or if
// we can't find a touch point
if (touchEvent->touches.Length() != 1) {

View File

@@ -127,6 +127,5 @@ typedef WidgetWheelEvent WheelEvent;
typedef mozilla::WidgetGestureNotifyEvent nsGestureNotifyEvent;
typedef mozilla::WidgetSimpleGestureEvent nsSimpleGestureEvent;
typedef mozilla::WidgetTouchEvent nsTouchEvent;
#endif // mozilla_EventForwards_h__

View File

@@ -125,11 +125,12 @@ public:
};
/**
* Similar to nsTouchEvent, but for use off-main-thread. Also only stores a
* screen touch point instead of the many different coordinate spaces nsTouchEvent
* stores its touch point in. This includes a way to initialize itself from an
* nsTouchEvent by copying all relevant data over. Note that this copying from
* nsTouchEvent functionality can only be used on the main thread.
* Similar to WidgetTouchEvent, but for use off-main-thread. Also only stores a
* screen touch point instead of the many different coordinate spaces
* WidgetTouchEvent stores its touch point in. This includes a way to initialize
* itself from a WidgetTouchEvent by copying all relevant data over. Note that
* this copying from WidgetTouchEvent functionality can only be used on the main
* thread.
*
* Stores an array of SingleTouchData.
*/
@@ -158,7 +159,7 @@ public:
{
}
MultiTouchInput(const nsTouchEvent& aTouchEvent);
MultiTouchInput(const WidgetTouchEvent& aTouchEvent);
// This conversion from nsMouseEvent to MultiTouchInput is needed because on
// the B2G emulator we can only receive mouse events, but we need to be able

View File

@@ -141,7 +141,7 @@ public:
nsTArray<nsRefPtr<mozilla::dom::Touch>> touches;
void AssignTouchEventData(const nsTouchEvent& aEvent, bool aCopyTargets)
void AssignTouchEventData(const WidgetTouchEvent& aEvent, bool aCopyTargets)
{
AssignInputEventData(aEvent, aCopyTargets);
@@ -154,6 +154,5 @@ public:
// TODO: Remove following typedefs
typedef mozilla::WidgetGestureNotifyEvent nsGestureNotifyEvent;
typedef mozilla::WidgetSimpleGestureEvent nsSimpleGestureEvent;
typedef mozilla::WidgetTouchEvent nsTouchEvent;
#endif // mozilla_TouchEvents_h__

View File

@@ -704,7 +704,7 @@ AndroidGeckoEvent::Init(AndroidGeckoEvent *aResizeEvent)
mPoints = aResizeEvent->mPoints; // x,y coordinates
}
nsTouchEvent
WidgetTouchEvent
AndroidGeckoEvent::MakeTouchEvent(nsIWidget* widget)
{
int type = NS_EVENT_NULL;
@@ -737,7 +737,7 @@ AndroidGeckoEvent::MakeTouchEvent(nsIWidget* widget)
}
}
nsTouchEvent event(true, type, widget);
WidgetTouchEvent event(true, type, widget);
if (type == NS_EVENT_NULL) {
// An event we don't know about
return event;

View File

@@ -588,7 +588,7 @@ public:
int Width() { return mWidth; }
int Height() { return mHeight; }
int RequestId() { return mCount; } // for convenience
nsTouchEvent MakeTouchEvent(nsIWidget* widget);
WidgetTouchEvent MakeTouchEvent(nsIWidget* widget);
MultiTouchInput MakeMultiTouchInput(nsIWidget* widget);
void UnionRect(nsIntRect const& aRect);
nsIObserver *Observer() { return mObserver; }

View File

@@ -1228,7 +1228,7 @@ bool nsWindow::OnMultitouchEvent(AndroidGeckoEvent *ae)
bool preventDefaultActions = false;
bool isDownEvent = false;
nsTouchEvent event = ae->MakeTouchEvent(this);
WidgetTouchEvent event = ae->MakeTouchEvent(this);
if (event.message != NS_EVENT_NULL) {
nsEventStatus status;
DispatchEvent(&event, status);

View File

@@ -158,7 +158,7 @@ sendMouseEvent(uint32_t msg, uint64_t timeMs, int x, int y, bool forwardToChildr
}
static void
addDOMTouch(UserInputData& data, nsTouchEvent& event, int i)
addDOMTouch(UserInputData& data, WidgetTouchEvent& event, int i)
{
const ::Touch& touch = data.motion.touches[i];
event.touches.AppendElement(
@@ -194,7 +194,7 @@ sendTouchEvent(UserInputData& data, bool* captured)
break;
}
nsTouchEvent event(true, msg, NULL);
WidgetTouchEvent event(true, msg, NULL);
event.time = data.timeMs;

View File

@@ -201,9 +201,9 @@ struct ParamTraits<nsMouseEvent>
};
template<>
struct ParamTraits<nsTouchEvent>
struct ParamTraits<mozilla::WidgetTouchEvent>
{
typedef nsTouchEvent paramType;
typedef mozilla::WidgetTouchEvent paramType;
static void Write(Message* aMsg, const paramType& aParam)
{

View File

@@ -6080,8 +6080,8 @@ bool nsWindow::OnTouch(WPARAM wParam, LPARAM lParam)
PTOUCHINPUT pInputs = new TOUCHINPUT[cInputs];
if (mGesture.GetTouchInputInfo((HTOUCHINPUT)lParam, cInputs, pInputs)) {
nsTouchEvent* touchEventToSend = nullptr;
nsTouchEvent* touchEndEventToSend = nullptr;
WidgetTouchEvent* touchEventToSend = nullptr;
WidgetTouchEvent* touchEndEventToSend = nullptr;
nsEventStatus status;
// Walk across the touch point array processing each contact point
@@ -6091,7 +6091,7 @@ bool nsWindow::OnTouch(WPARAM wParam, LPARAM lParam)
if (pInputs[i].dwFlags & (TOUCHEVENTF_DOWN | TOUCHEVENTF_MOVE)) {
// Create a standard touch event to send
if (!touchEventToSend) {
touchEventToSend = new nsTouchEvent(true, NS_TOUCH_MOVE, this);
touchEventToSend = new WidgetTouchEvent(true, NS_TOUCH_MOVE, this);
touchEventToSend->time = ::GetMessageTime();
ModifierKeyState modifierKeyState;
modifierKeyState.InitInputEvent(*touchEventToSend);
@@ -6109,7 +6109,7 @@ bool nsWindow::OnTouch(WPARAM wParam, LPARAM lParam)
// separate NS_TOUCH_END event containing only the contact points
// that were removed.
if (!touchEndEventToSend) {
touchEndEventToSend = new nsTouchEvent(true, NS_TOUCH_END, this);
touchEndEventToSend = new WidgetTouchEvent(true, NS_TOUCH_END, this);
touchEndEventToSend->time = ::GetMessageTime();
ModifierKeyState modifierKeyState;
modifierKeyState.InitInputEvent(*touchEndEventToSend);

View File

@@ -398,7 +398,7 @@ MetroInput::OnPointerNonTouch(UI::Input::IPointerPoint* aPoint) {
}
void
MetroInput::InitTouchEventTouchList(nsTouchEvent* aEvent)
MetroInput::InitTouchEventTouchList(WidgetTouchEvent* aEvent)
{
MOZ_ASSERT(aEvent);
mTouches.Enumerate(&AppendToTouchList,
@@ -439,8 +439,8 @@ MetroInput::OnPointerPressed(UI::Core::ICoreWindow* aSender,
touch->mChanged = true;
mTouches.Put(pointerId, touch);
nsTouchEvent* touchEvent =
new nsTouchEvent(true, NS_TOUCH_START, mWidget.Get());
WidgetTouchEvent* touchEvent =
new WidgetTouchEvent(true, NS_TOUCH_START, mWidget.Get());
if (mTouches.Count() == 1) {
// If this is the first touchstart of a touch session reset some
@@ -544,8 +544,8 @@ MetroInput::OnPointerMoved(UI::Core::ICoreWindow* aSender,
// If we've accumulated a batch of pointer moves and we're now on a new batch
// at a new position send the previous batch. (perf opt)
if (!mIsFirstTouchMove && touch->mChanged) {
nsTouchEvent* touchEvent =
new nsTouchEvent(true, NS_TOUCH_MOVE, mWidget.Get());
WidgetTouchEvent* touchEvent =
new WidgetTouchEvent(true, NS_TOUCH_MOVE, mWidget.Get());
InitTouchEventTouchList(touchEvent);
DispatchAsyncTouchEventIgnoreStatus(touchEvent);
}
@@ -555,8 +555,8 @@ MetroInput::OnPointerMoved(UI::Core::ICoreWindow* aSender,
// replacing old touch point in mTouches map
mTouches.Put(pointerId, touch);
nsTouchEvent* touchEvent =
new nsTouchEvent(true, NS_TOUCH_MOVE, mWidget.Get());
WidgetTouchEvent* touchEvent =
new WidgetTouchEvent(true, NS_TOUCH_MOVE, mWidget.Get());
// If this is the first touch move of our session, we should check the result.
// Note we may lose some touch move data here for the recognizer since we want
@@ -623,8 +623,8 @@ MetroInput::OnPointerReleased(UI::Core::ICoreWindow* aSender,
// Purge any pending moves for this pointer
if (touch->mChanged) {
nsTouchEvent* touchEvent =
new nsTouchEvent(true, NS_TOUCH_MOVE, mWidget.Get());
WidgetTouchEvent* touchEvent =
new WidgetTouchEvent(true, NS_TOUCH_MOVE, mWidget.Get());
InitTouchEventTouchList(touchEvent);
DispatchAsyncTouchEventIgnoreStatus(touchEvent);
}
@@ -635,8 +635,8 @@ MetroInput::OnPointerReleased(UI::Core::ICoreWindow* aSender,
mTouches.Remove(pointerId);
// touchend events only have a single touch; the touch that has been removed
nsTouchEvent* touchEvent =
new nsTouchEvent(true, NS_TOUCH_END, mWidget.Get());
WidgetTouchEvent* touchEvent =
new WidgetTouchEvent(true, NS_TOUCH_END, mWidget.Get());
touchEvent->touches.AppendElement(CreateDOMTouch(currentPoint.Get()));
DispatchAsyncTouchEventIgnoreStatus(touchEvent);
@@ -1148,7 +1148,7 @@ MetroInput::DeliverNextQueuedEventIgnoreStatus()
}
void
MetroInput::DispatchAsyncTouchEventIgnoreStatus(nsTouchEvent* aEvent)
MetroInput::DispatchAsyncTouchEventIgnoreStatus(WidgetTouchEvent* aEvent)
{
aEvent->time = ::GetMessageTime();
mModifierKeyState.Update();
@@ -1163,7 +1163,8 @@ nsEventStatus
MetroInput::DeliverNextQueuedTouchEvent()
{
nsEventStatus status;
nsTouchEvent* event = static_cast<nsTouchEvent*>(mInputEventQueue.PopFront());
WidgetTouchEvent* event =
static_cast<WidgetTouchEvent*>(mInputEventQueue.PopFront());
MOZ_ASSERT(event);
AutoDeleteEvent wrap(event);
@@ -1212,7 +1213,7 @@ MetroInput::DeliverNextQueuedTouchEvent()
// Forward event data to apz. If the apz consumes the event, don't forward to
// content if this is not a cancelable event.
nsTouchEvent transformedEvent(*event);
WidgetTouchEvent transformedEvent(*event);
status = mWidget->ApzReceiveInputEvent(event, &transformedEvent);
if (!mCancelable && status == nsEventStatus_eConsumeNoDefault) {
if (!mTouchCancelSent) {
@@ -1237,13 +1238,14 @@ MetroInput::DispatchTouchCancel()
// not be included in the touches and targetTouches attributes.
// (We are 'removing' all touch points that have been sent to content
// thus far.)
nsTouchEvent touchEvent(true, NS_TOUCH_CANCEL, mWidget.Get());
WidgetTouchEvent touchEvent(true, NS_TOUCH_CANCEL, mWidget.Get());
InitTouchEventTouchList(&touchEvent);
mWidget->DispatchEvent(&touchEvent, sThrowawayStatus);
}
void
MetroInput::DispatchAsyncTouchEventWithCallback(nsTouchEvent* aEvent, void (MetroInput::*Callback)())
MetroInput::DispatchAsyncTouchEventWithCallback(WidgetTouchEvent* aEvent,
void (MetroInput::*Callback)())
{
aEvent->time = ::GetMessageTime();
mModifierKeyState.Update();

View File

@@ -223,7 +223,7 @@ private:
// the updated touchpoint info and record the fact that the touchpoint
// has changed. If ever we try to update a touchpoint has already
// changed, we dispatch a touch event containing all the changed touches.
void InitTouchEventTouchList(nsTouchEvent* aEvent);
void InitTouchEventTouchList(WidgetTouchEvent* aEvent);
nsBaseHashtable<nsUint32HashKey,
nsRefPtr<mozilla::dom::Touch>,
nsRefPtr<mozilla::dom::Touch> > mTouches;
@@ -264,8 +264,9 @@ private:
// Async event dispatching
void DispatchAsyncEventIgnoreStatus(nsInputEvent* aEvent);
void DispatchAsyncTouchEventIgnoreStatus(nsTouchEvent* aEvent);
void DispatchAsyncTouchEventWithCallback(nsTouchEvent* aEvent, void (MetroInput::*Callback)());
void DispatchAsyncTouchEventIgnoreStatus(WidgetTouchEvent* aEvent);
void DispatchAsyncTouchEventWithCallback(WidgetTouchEvent* aEvent,
void (MetroInput::*Callback)());
// Async event callbacks
void DeliverNextQueuedEventIgnoreStatus();

View File

@@ -15,11 +15,11 @@ namespace mozilla {
using namespace dom;
MultiTouchInput::MultiTouchInput(const nsTouchEvent& aTouchEvent)
MultiTouchInput::MultiTouchInput(const WidgetTouchEvent& aTouchEvent)
: InputData(MULTITOUCH_INPUT, aTouchEvent.time)
{
NS_ABORT_IF_FALSE(NS_IsMainThread(),
"Can only copy from nsTouchEvent on main thread");
"Can only copy from WidgetTouchEvent on main thread");
switch (aTouchEvent.message) {
case NS_TOUCH_START: