Bug 920377 part.13 Get rid of nsTouchEvent r=roc
This commit is contained in:
@@ -144,7 +144,7 @@ nsCoreUtils::DispatchTouchEvent(uint32_t aEventType, int32_t aX, int32_t aY,
|
|||||||
if (!nsDOMTouchEvent::PrefEnabled())
|
if (!nsDOMTouchEvent::PrefEnabled())
|
||||||
return;
|
return;
|
||||||
|
|
||||||
nsTouchEvent event(true, aEventType, aRootWidget);
|
WidgetTouchEvent event(true, aEventType, aRootWidget);
|
||||||
|
|
||||||
event.time = PR_IntervalNow();
|
event.time = PR_IntervalNow();
|
||||||
|
|
||||||
|
|||||||
@@ -741,8 +741,8 @@ nsDOMEvent::DuplicatePrivateData()
|
|||||||
}
|
}
|
||||||
case NS_TOUCH_EVENT:
|
case NS_TOUCH_EVENT:
|
||||||
{
|
{
|
||||||
nsTouchEvent* oldTouchEvent = static_cast<nsTouchEvent*>(mEvent);
|
WidgetTouchEvent* oldTouchEvent = static_cast<WidgetTouchEvent*>(mEvent);
|
||||||
nsTouchEvent* touchEvent = new nsTouchEvent(false, oldTouchEvent);
|
WidgetTouchEvent* touchEvent = new WidgetTouchEvent(false, oldTouchEvent);
|
||||||
touchEvent->AssignTouchEventData(*oldTouchEvent, true);
|
touchEvent->AssignTouchEventData(*oldTouchEvent, true);
|
||||||
newEvent = touchEvent;
|
newEvent = touchEvent;
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -54,9 +54,9 @@ nsDOMTouchList::IdentifiedTouch(int32_t aIdentifier) const
|
|||||||
|
|
||||||
nsDOMTouchEvent::nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
|
nsDOMTouchEvent::nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
|
||||||
nsPresContext* aPresContext,
|
nsPresContext* aPresContext,
|
||||||
nsTouchEvent* aEvent)
|
WidgetTouchEvent* aEvent)
|
||||||
: nsDOMUIEvent(aOwner, aPresContext,
|
: nsDOMUIEvent(aOwner, aPresContext,
|
||||||
aEvent ? aEvent : new nsTouchEvent(false, 0, nullptr))
|
aEvent ? aEvent : new WidgetTouchEvent(false, 0, nullptr))
|
||||||
{
|
{
|
||||||
if (aEvent) {
|
if (aEvent) {
|
||||||
mEventIsInternal = false;
|
mEventIsInternal = false;
|
||||||
@@ -74,7 +74,7 @@ nsDOMTouchEvent::nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
|
|||||||
nsDOMTouchEvent::~nsDOMTouchEvent()
|
nsDOMTouchEvent::~nsDOMTouchEvent()
|
||||||
{
|
{
|
||||||
if (mEventIsInternal && mEvent) {
|
if (mEventIsInternal && mEvent) {
|
||||||
delete static_cast<nsTouchEvent*>(mEvent);
|
delete static_cast<WidgetTouchEvent*>(mEvent);
|
||||||
mEvent = nullptr;
|
mEvent = nullptr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -126,7 +126,7 @@ nsDOMTouchList*
|
|||||||
nsDOMTouchEvent::Touches()
|
nsDOMTouchEvent::Touches()
|
||||||
{
|
{
|
||||||
if (!mTouches) {
|
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) {
|
if (mEvent->message == NS_TOUCH_END || mEvent->message == NS_TOUCH_CANCEL) {
|
||||||
// for touchend events, remove any changed touches from the touches array
|
// for touchend events, remove any changed touches from the touches array
|
||||||
nsTArray< nsRefPtr<Touch> > unchangedTouches;
|
nsTArray< nsRefPtr<Touch> > unchangedTouches;
|
||||||
@@ -149,7 +149,7 @@ nsDOMTouchEvent::TargetTouches()
|
|||||||
{
|
{
|
||||||
if (!mTargetTouches) {
|
if (!mTargetTouches) {
|
||||||
nsTArray< nsRefPtr<Touch> > targetTouches;
|
nsTArray< nsRefPtr<Touch> > targetTouches;
|
||||||
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(mEvent);
|
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(mEvent);
|
||||||
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
|
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
|
||||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||||
// for touchend/cancel events, don't append to the target list if this is a
|
// for touchend/cancel events, don't append to the target list if this is a
|
||||||
@@ -171,7 +171,7 @@ nsDOMTouchEvent::ChangedTouches()
|
|||||||
{
|
{
|
||||||
if (!mChangedTouches) {
|
if (!mChangedTouches) {
|
||||||
nsTArray< nsRefPtr<Touch> > changedTouches;
|
nsTArray< nsRefPtr<Touch> > changedTouches;
|
||||||
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(mEvent);
|
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(mEvent);
|
||||||
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
|
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
|
||||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||||
if (touches[i]->mChanged) {
|
if (touches[i]->mChanged) {
|
||||||
@@ -225,7 +225,7 @@ nsresult
|
|||||||
NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult,
|
NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult,
|
||||||
mozilla::dom::EventTarget* aOwner,
|
mozilla::dom::EventTarget* aOwner,
|
||||||
nsPresContext* aPresContext,
|
nsPresContext* aPresContext,
|
||||||
nsTouchEvent *aEvent)
|
WidgetTouchEvent* aEvent)
|
||||||
{
|
{
|
||||||
nsDOMTouchEvent* it = new nsDOMTouchEvent(aOwner, aPresContext, aEvent);
|
nsDOMTouchEvent* it = new nsDOMTouchEvent(aOwner, aPresContext, aEvent);
|
||||||
return CallQueryInterface(it, aInstancePtrResult);
|
return CallQueryInterface(it, aInstancePtrResult);
|
||||||
|
|||||||
@@ -82,7 +82,8 @@ class nsDOMTouchEvent : public nsDOMUIEvent
|
|||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
|
nsDOMTouchEvent(mozilla::dom::EventTarget* aOwner,
|
||||||
nsPresContext* aPresContext, nsTouchEvent* aEvent);
|
nsPresContext* aPresContext,
|
||||||
|
mozilla::WidgetTouchEvent* aEvent);
|
||||||
virtual ~nsDOMTouchEvent();
|
virtual ~nsDOMTouchEvent();
|
||||||
|
|
||||||
NS_DECL_ISUPPORTS_INHERITED
|
NS_DECL_ISUPPORTS_INHERITED
|
||||||
|
|||||||
@@ -741,7 +741,7 @@ nsEventDispatcher::CreateEvent(mozilla::dom::EventTarget* aOwner,
|
|||||||
static_cast<nsSimpleGestureEvent*>(aEvent));
|
static_cast<nsSimpleGestureEvent*>(aEvent));
|
||||||
case NS_TOUCH_EVENT:
|
case NS_TOUCH_EVENT:
|
||||||
return NS_NewDOMTouchEvent(aDOMEvent, aOwner, aPresContext,
|
return NS_NewDOMTouchEvent(aDOMEvent, aOwner, aPresContext,
|
||||||
static_cast<nsTouchEvent*>(aEvent));
|
static_cast<WidgetTouchEvent*>(aEvent));
|
||||||
case NS_TRANSITION_EVENT:
|
case NS_TRANSITION_EVENT:
|
||||||
return NS_NewDOMTransitionEvent(aDOMEvent, aOwner, aPresContext,
|
return NS_NewDOMTransitionEvent(aDOMEvent, aOwner, aPresContext,
|
||||||
static_cast<InternalTransitionEvent*>(aEvent));
|
static_cast<InternalTransitionEvent*>(aEvent));
|
||||||
|
|||||||
@@ -1399,7 +1399,7 @@ nsEventStateManager::DispatchCrossProcessEvent(nsEvent* aEvent,
|
|||||||
// Let the child process synthesize a mouse event if needed, and
|
// Let the child process synthesize a mouse event if needed, and
|
||||||
// ensure we don't synthesize one in this process.
|
// ensure we don't synthesize one in this process.
|
||||||
*aStatus = nsEventStatus_eConsumeNoDefault;
|
*aStatus = nsEventStatus_eConsumeNoDefault;
|
||||||
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
|
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
|
||||||
return remote->SendRealTouchEvent(*touchEvent);
|
return remote->SendRealTouchEvent(*touchEvent);
|
||||||
}
|
}
|
||||||
default: {
|
default: {
|
||||||
@@ -1516,7 +1516,7 @@ nsEventStateManager::HandleCrossProcessEvent(nsEvent *aEvent,
|
|||||||
//
|
//
|
||||||
// This loop is similar to the one used in
|
// This loop is similar to the one used in
|
||||||
// PresShell::DispatchTouchEvent().
|
// PresShell::DispatchTouchEvent().
|
||||||
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aEvent);
|
WidgetTouchEvent* touchEvent = static_cast<WidgetTouchEvent*>(aEvent);
|
||||||
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
|
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
|
||||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||||
Touch* touch = touches[i];
|
Touch* touch = touches[i];
|
||||||
|
|||||||
@@ -3709,7 +3709,8 @@ HTMLInputElement::PostHandleEventForRangeThumb(nsEventChainPostVisitor& aVisitor
|
|||||||
CancelRangeThumbDrag();
|
CancelRangeThumbDrag();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
nsTouchEvent* touchEvent = static_cast<nsTouchEvent*>(aVisitor.mEvent);
|
WidgetTouchEvent* touchEvent =
|
||||||
|
static_cast<WidgetTouchEvent*>(aVisitor.mEvent);
|
||||||
if (touchEvent->touches.Length() == 1) {
|
if (touchEvent->touches.Length() == 1) {
|
||||||
StartRangeThumbDrag(inputEvent);
|
StartRangeThumbDrag(inputEvent);
|
||||||
} else if (mIsDraggingRange) {
|
} else if (mIsDraggingRange) {
|
||||||
|
|||||||
@@ -876,7 +876,7 @@ nsDOMWindowUtils::SendTouchEvent(const nsAString& aType,
|
|||||||
} else {
|
} else {
|
||||||
return NS_ERROR_UNEXPECTED;
|
return NS_ERROR_UNEXPECTED;
|
||||||
}
|
}
|
||||||
nsTouchEvent event(true, msg, widget);
|
WidgetTouchEvent event(true, msg, widget);
|
||||||
event.modifiers = GetWidgetModifiers(aModifiers);
|
event.modifiers = GetWidgetModifiers(aModifiers);
|
||||||
event.widget = widget;
|
event.widget = widget;
|
||||||
event.time = PR_Now();
|
event.time = PR_Now();
|
||||||
|
|||||||
@@ -375,7 +375,7 @@ nsresult
|
|||||||
NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult,
|
NS_NewDOMTouchEvent(nsIDOMEvent** aInstancePtrResult,
|
||||||
mozilla::dom::EventTarget* aOwner,
|
mozilla::dom::EventTarget* aOwner,
|
||||||
nsPresContext* aPresContext,
|
nsPresContext* aPresContext,
|
||||||
nsTouchEvent* aEvent);
|
mozilla::WidgetTouchEvent* aEvent);
|
||||||
nsresult
|
nsresult
|
||||||
NS_NewDOMMozSettingsEvent(nsIDOMEvent** aInstancePtrResult,
|
NS_NewDOMMozSettingsEvent(nsIDOMEvent** aInstancePtrResult,
|
||||||
mozilla::dom::EventTarget* aOwner,
|
mozilla::dom::EventTarget* aOwner,
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ using nsQueryContentEvent;
|
|||||||
using nsRect;
|
using nsRect;
|
||||||
using nsSelectionEvent;
|
using nsSelectionEvent;
|
||||||
using nsTextEvent;
|
using nsTextEvent;
|
||||||
using nsTouchEvent;
|
using mozilla::WidgetTouchEvent;
|
||||||
using RemoteDOMEvent;
|
using RemoteDOMEvent;
|
||||||
using mozilla::dom::ScreenOrientation;
|
using mozilla::dom::ScreenOrientation;
|
||||||
using mozilla::layers::TextureFactoryIdentifier;
|
using mozilla::layers::TextureFactoryIdentifier;
|
||||||
@@ -367,10 +367,10 @@ child:
|
|||||||
RealMouseEvent(nsMouseEvent event);
|
RealMouseEvent(nsMouseEvent event);
|
||||||
RealKeyEvent(nsKeyEvent event);
|
RealKeyEvent(nsKeyEvent event);
|
||||||
MouseWheelEvent(WheelEvent event);
|
MouseWheelEvent(WheelEvent event);
|
||||||
RealTouchEvent(nsTouchEvent event);
|
RealTouchEvent(WidgetTouchEvent event);
|
||||||
// We use a separate message for touchmove events only to apply
|
// We use a separate message for touchmove events only to apply
|
||||||
// compression to them.
|
// compression to them.
|
||||||
RealTouchMoveEvent(nsTouchEvent event) compress;
|
RealTouchMoveEvent(WidgetTouchEvent event) compress;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @see nsIDOMWindowUtils sendKeyEvent.
|
* @see nsIDOMWindowUtils sendKeyEvent.
|
||||||
|
|||||||
@@ -1702,7 +1702,7 @@ TabChild::DispatchSynthesizedMouseEvent(uint32_t aMsg, uint64_t aTime,
|
|||||||
}
|
}
|
||||||
|
|
||||||
static Touch*
|
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) {
|
for (uint32_t i = 0; i < aEvent.touches.Length(); ++i) {
|
||||||
Touch* touch = static_cast<Touch*>(aEvent.touches[i].get());
|
Touch* touch = static_cast<Touch*>(aEvent.touches[i].get());
|
||||||
@@ -1714,7 +1714,7 @@ GetTouchForIdentifier(const nsTouchEvent& aEvent, int32_t aId)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
TabChild::UpdateTapState(const nsTouchEvent& aEvent, nsEventStatus aStatus)
|
TabChild::UpdateTapState(const WidgetTouchEvent& aEvent, nsEventStatus aStatus)
|
||||||
{
|
{
|
||||||
static bool sHavePrefs;
|
static bool sHavePrefs;
|
||||||
static bool sClickHoldContextMenusEnabled;
|
static bool sClickHoldContextMenusEnabled;
|
||||||
@@ -1833,9 +1833,9 @@ TabChild::CancelTapTracking()
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TabChild::RecvRealTouchEvent(const nsTouchEvent& aEvent)
|
TabChild::RecvRealTouchEvent(const WidgetTouchEvent& aEvent)
|
||||||
{
|
{
|
||||||
nsTouchEvent localEvent(aEvent);
|
WidgetTouchEvent localEvent(aEvent);
|
||||||
nsEventStatus status = DispatchWidgetEvent(localEvent);
|
nsEventStatus status = DispatchWidgetEvent(localEvent);
|
||||||
|
|
||||||
if (IsAsyncPanZoomEnabled()) {
|
if (IsAsyncPanZoomEnabled()) {
|
||||||
@@ -1853,7 +1853,7 @@ TabChild::RecvRealTouchEvent(const nsTouchEvent& aEvent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool
|
bool
|
||||||
TabChild::RecvRealTouchMoveEvent(const nsTouchEvent& aEvent)
|
TabChild::RecvRealTouchMoveEvent(const WidgetTouchEvent& aEvent)
|
||||||
{
|
{
|
||||||
return RecvRealTouchEvent(aEvent);
|
return RecvRealTouchEvent(aEvent);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -218,8 +218,8 @@ public:
|
|||||||
virtual bool RecvRealMouseEvent(const nsMouseEvent& event);
|
virtual bool RecvRealMouseEvent(const nsMouseEvent& event);
|
||||||
virtual bool RecvRealKeyEvent(const nsKeyEvent& event);
|
virtual bool RecvRealKeyEvent(const nsKeyEvent& event);
|
||||||
virtual bool RecvMouseWheelEvent(const mozilla::WheelEvent& event);
|
virtual bool RecvMouseWheelEvent(const mozilla::WheelEvent& event);
|
||||||
virtual bool RecvRealTouchEvent(const nsTouchEvent& event);
|
virtual bool RecvRealTouchEvent(const WidgetTouchEvent& event);
|
||||||
virtual bool RecvRealTouchMoveEvent(const nsTouchEvent& event);
|
virtual bool RecvRealTouchMoveEvent(const WidgetTouchEvent& event);
|
||||||
virtual bool RecvKeyEvent(const nsString& aType,
|
virtual bool RecvKeyEvent(const nsString& aType,
|
||||||
const int32_t& aKeyCode,
|
const int32_t& aKeyCode,
|
||||||
const int32_t& aCharCode,
|
const int32_t& aCharCode,
|
||||||
@@ -442,7 +442,7 @@ private:
|
|||||||
// FireContextMenuEvent().
|
// FireContextMenuEvent().
|
||||||
void FireContextMenuEvent();
|
void FireContextMenuEvent();
|
||||||
void CancelTapTracking();
|
void CancelTapTracking();
|
||||||
void UpdateTapState(const nsTouchEvent& aEvent, nsEventStatus aStatus);
|
void UpdateTapState(const WidgetTouchEvent& aEvent, nsEventStatus aStatus);
|
||||||
|
|
||||||
nsresult
|
nsresult
|
||||||
BrowserFrameProvideWindow(nsIDOMWindow* aOpener,
|
BrowserFrameProvideWindow(nsIDOMWindow* aOpener,
|
||||||
|
|||||||
@@ -621,7 +621,7 @@ TabParent::MapEventCoordinatesForChildProcess(
|
|||||||
aEvent->refPoint = aOffset;
|
aEvent->refPoint = aOffset;
|
||||||
} else {
|
} else {
|
||||||
aEvent->refPoint = LayoutDeviceIntPoint();
|
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
|
// Then offset all the touch points by that distance, to put them
|
||||||
// in the space where top-left is 0,0.
|
// in the space where top-left is 0,0.
|
||||||
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
|
const nsTArray< nsRefPtr<Touch> >& touches = touchEvent->touches;
|
||||||
@@ -673,7 +673,7 @@ bool TabParent::SendRealKeyEvent(nsKeyEvent& event)
|
|||||||
return PBrowserParent::SendRealKeyEvent(e);
|
return PBrowserParent::SendRealKeyEvent(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
bool TabParent::SendRealTouchEvent(nsTouchEvent& event)
|
bool TabParent::SendRealTouchEvent(WidgetTouchEvent& event)
|
||||||
{
|
{
|
||||||
if (mIsDestroyed) {
|
if (mIsDestroyed) {
|
||||||
return false;
|
return false;
|
||||||
@@ -699,7 +699,7 @@ bool TabParent::SendRealTouchEvent(nsTouchEvent& event)
|
|||||||
++mEventCaptureDepth;
|
++mEventCaptureDepth;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsTouchEvent e(event);
|
WidgetTouchEvent e(event);
|
||||||
// PresShell::HandleEventInternal adds touches on touch end/cancel.
|
// PresShell::HandleEventInternal adds touches on touch end/cancel.
|
||||||
// This confuses remote content into thinking that the added touches
|
// This confuses remote content into thinking that the added touches
|
||||||
// are part of the touchend/cancel, when actually they're not.
|
// are part of the touchend/cancel, when actually they're not.
|
||||||
@@ -736,7 +736,7 @@ TabParent::TryCapture(const nsGUIEvent& aEvent)
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsTouchEvent event(static_cast<const nsTouchEvent&>(aEvent));
|
WidgetTouchEvent event(static_cast<const WidgetTouchEvent&>(aEvent));
|
||||||
|
|
||||||
bool isTouchPointUp = (event.message == NS_TOUCH_END ||
|
bool isTouchPointUp = (event.message == NS_TOUCH_END ||
|
||||||
event.message == NS_TOUCH_CANCEL);
|
event.message == NS_TOUCH_CANCEL);
|
||||||
|
|||||||
@@ -196,7 +196,7 @@ public:
|
|||||||
bool SendRealMouseEvent(nsMouseEvent& event);
|
bool SendRealMouseEvent(nsMouseEvent& event);
|
||||||
bool SendMouseWheelEvent(mozilla::WheelEvent& event);
|
bool SendMouseWheelEvent(mozilla::WheelEvent& event);
|
||||||
bool SendRealKeyEvent(nsKeyEvent& event);
|
bool SendRealKeyEvent(nsKeyEvent& event);
|
||||||
bool SendRealTouchEvent(nsTouchEvent& event);
|
bool SendRealTouchEvent(WidgetTouchEvent& event);
|
||||||
|
|
||||||
virtual PDocumentRendererParent*
|
virtual PDocumentRendererParent*
|
||||||
AllocPDocumentRendererParent(const nsRect& documentRect, const gfxMatrix& transform,
|
AllocPDocumentRendererParent(const nsRect& documentRect, const gfxMatrix& transform,
|
||||||
|
|||||||
@@ -297,7 +297,8 @@ APZCTreeManager::ReceiveInputEvent(const InputData& aEvent)
|
|||||||
}
|
}
|
||||||
|
|
||||||
AsyncPanZoomController*
|
AsyncPanZoomController*
|
||||||
APZCTreeManager::GetTouchInputBlockAPZC(const nsTouchEvent& aEvent, ScreenPoint aPoint)
|
APZCTreeManager::GetTouchInputBlockAPZC(const WidgetTouchEvent& aEvent,
|
||||||
|
ScreenPoint aPoint)
|
||||||
{
|
{
|
||||||
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aPoint);
|
nsRefPtr<AsyncPanZoomController> apzc = GetTargetAPZC(aPoint);
|
||||||
gfx3DMatrix transformToApzc, transformToScreen;
|
gfx3DMatrix transformToApzc, transformToScreen;
|
||||||
@@ -325,8 +326,8 @@ APZCTreeManager::GetTouchInputBlockAPZC(const nsTouchEvent& aEvent, ScreenPoint
|
|||||||
}
|
}
|
||||||
|
|
||||||
nsEventStatus
|
nsEventStatus
|
||||||
APZCTreeManager::ProcessTouchEvent(const nsTouchEvent& aEvent,
|
APZCTreeManager::ProcessTouchEvent(const WidgetTouchEvent& aEvent,
|
||||||
nsTouchEvent* aOutEvent)
|
WidgetTouchEvent* aOutEvent)
|
||||||
{
|
{
|
||||||
// For computing the input for the APZC, used the cached transform.
|
// For computing the input for the APZC, used the cached transform.
|
||||||
// This ensures that the sequence of touch points an APZC sees in an
|
// This ensures that the sequence of touch points an APZC sees in an
|
||||||
@@ -344,7 +345,7 @@ APZCTreeManager::ProcessTouchEvent(const nsTouchEvent& aEvent,
|
|||||||
gfx3DMatrix transformToScreen;
|
gfx3DMatrix transformToScreen;
|
||||||
GetInputTransforms(mApzcForInputBlock, transformToApzc, transformToScreen);
|
GetInputTransforms(mApzcForInputBlock, transformToApzc, transformToScreen);
|
||||||
gfx3DMatrix outTransform = 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++) {
|
for (size_t i = 0; i < outEvent->touches.Length(); i++) {
|
||||||
ApplyTransform(&(outEvent->touches[i]->mRefPoint), outTransform);
|
ApplyTransform(&(outEvent->touches[i]->mRefPoint), outTransform);
|
||||||
}
|
}
|
||||||
@@ -402,7 +403,8 @@ APZCTreeManager::ReceiveInputEvent(const nsInputEvent& aEvent,
|
|||||||
|
|
||||||
switch (aEvent.eventStructType) {
|
switch (aEvent.eventStructType) {
|
||||||
case NS_TOUCH_EVENT: {
|
case NS_TOUCH_EVENT: {
|
||||||
const nsTouchEvent& touchEvent = static_cast<const nsTouchEvent&>(aEvent);
|
const WidgetTouchEvent& touchEvent =
|
||||||
|
static_cast<const WidgetTouchEvent&>(aEvent);
|
||||||
if (!touchEvent.touches.Length()) {
|
if (!touchEvent.touches.Length()) {
|
||||||
return nsEventStatus_eIgnore;
|
return nsEventStatus_eIgnore;
|
||||||
}
|
}
|
||||||
@@ -413,7 +415,7 @@ APZCTreeManager::ReceiveInputEvent(const nsInputEvent& aEvent,
|
|||||||
if (!mApzcForInputBlock) {
|
if (!mApzcForInputBlock) {
|
||||||
return nsEventStatus_eIgnore;
|
return nsEventStatus_eIgnore;
|
||||||
}
|
}
|
||||||
nsTouchEvent* outEvent = static_cast<nsTouchEvent*>(aOutEvent);
|
WidgetTouchEvent* outEvent = static_cast<WidgetTouchEvent*>(aOutEvent);
|
||||||
return ProcessTouchEvent(touchEvent, outEvent);
|
return ProcessTouchEvent(touchEvent, outEvent);
|
||||||
}
|
}
|
||||||
case NS_MOUSE_EVENT: {
|
case NS_MOUSE_EVENT: {
|
||||||
@@ -435,7 +437,7 @@ APZCTreeManager::ReceiveInputEvent(nsInputEvent& aEvent)
|
|||||||
|
|
||||||
switch (aEvent.eventStructType) {
|
switch (aEvent.eventStructType) {
|
||||||
case NS_TOUCH_EVENT: {
|
case NS_TOUCH_EVENT: {
|
||||||
nsTouchEvent& touchEvent = static_cast<nsTouchEvent&>(aEvent);
|
WidgetTouchEvent& touchEvent = static_cast<WidgetTouchEvent&>(aEvent);
|
||||||
if (!touchEvent.touches.Length()) {
|
if (!touchEvent.touches.Length()) {
|
||||||
return nsEventStatus_eIgnore;
|
return nsEventStatus_eIgnore;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -148,7 +148,7 @@ public:
|
|||||||
/**
|
/**
|
||||||
* nsInputEvent handler. Sets |aOutEvent| (which is assumed to be an
|
* nsInputEvent handler. Sets |aOutEvent| (which is assumed to be an
|
||||||
* already-existing instance of an nsInputEvent which may 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.
|
* event can be passed through the DOM and content can handle them.
|
||||||
*
|
*
|
||||||
* NOTE: Be careful of invoking the nsInputEvent variant. This can only be
|
* 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* GetAPZCAtPoint(AsyncPanZoomController* aApzc, const gfxPoint& aHitTestPoint);
|
||||||
AsyncPanZoomController* CommonAncestor(AsyncPanZoomController* aApzc1, AsyncPanZoomController* aApzc2);
|
AsyncPanZoomController* CommonAncestor(AsyncPanZoomController* aApzc1, AsyncPanZoomController* aApzc2);
|
||||||
AsyncPanZoomController* RootAPZCForLayersId(AsyncPanZoomController* aApzc);
|
AsyncPanZoomController* RootAPZCForLayersId(AsyncPanZoomController* aApzc);
|
||||||
AsyncPanZoomController* GetTouchInputBlockAPZC(const nsTouchEvent& aEvent, ScreenPoint aPoint);
|
AsyncPanZoomController* GetTouchInputBlockAPZC(const WidgetTouchEvent& aEvent, ScreenPoint aPoint);
|
||||||
nsEventStatus ProcessTouchEvent(const nsTouchEvent& touchEvent, nsTouchEvent* aOutEvent);
|
nsEventStatus ProcessTouchEvent(const WidgetTouchEvent& touchEvent, WidgetTouchEvent* aOutEvent);
|
||||||
nsEventStatus ProcessMouseEvent(const nsMouseEvent& mouseEvent, nsMouseEvent* aOutEvent);
|
nsEventStatus ProcessMouseEvent(const nsMouseEvent& mouseEvent, nsMouseEvent* aOutEvent);
|
||||||
nsEventStatus ProcessEvent(const nsInputEvent& inputEvent, nsInputEvent* aOutEvent);
|
nsEventStatus ProcessEvent(const nsInputEvent& inputEvent, nsInputEvent* aOutEvent);
|
||||||
|
|
||||||
|
|||||||
@@ -5960,7 +5960,7 @@ EvictTouchPoint(nsRefPtr<dom::Touch>& aTouch)
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsTouchEvent event(true, NS_TOUCH_END, widget);
|
WidgetTouchEvent event(true, NS_TOUCH_END, widget);
|
||||||
event.widget = widget;
|
event.widget = widget;
|
||||||
event.time = PR_IntervalNow();
|
event.time = PR_IntervalNow();
|
||||||
event.touches.AppendElement(aTouch);
|
event.touches.AppendElement(aTouch);
|
||||||
@@ -6202,7 +6202,7 @@ PresShell::HandleEvent(nsIFrame *aFrame,
|
|||||||
uint32_t flags = 0;
|
uint32_t flags = 0;
|
||||||
if (aEvent->message == NS_TOUCH_START) {
|
if (aEvent->message == NS_TOUCH_START) {
|
||||||
flags |= INPUT_IGNORE_ROOT_SCROLL_FRAME;
|
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
|
// 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
|
// in the same document by taking the target of the events already in
|
||||||
// the capture list
|
// the capture list
|
||||||
@@ -6334,7 +6334,7 @@ PresShell::HandleEvent(nsIFrame *aFrame,
|
|||||||
case NS_TOUCH_CANCEL:
|
case NS_TOUCH_CANCEL:
|
||||||
case NS_TOUCH_END: {
|
case NS_TOUCH_END: {
|
||||||
// get the correct shell to dispatch to
|
// 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;
|
nsTArray< nsRefPtr<dom::Touch> >& touches = touchEvent->touches;
|
||||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||||
dom::Touch* touch = touches[i];
|
dom::Touch* touch = touches[i];
|
||||||
@@ -6723,7 +6723,7 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus)
|
|||||||
isHandlingUserInput = true;
|
isHandlingUserInput = true;
|
||||||
break;
|
break;
|
||||||
case NS_TOUCH_START: {
|
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
|
// 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
|
// the start of a new touch session and evict any old touches in the
|
||||||
// queue
|
// queue
|
||||||
@@ -6751,7 +6751,7 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus)
|
|||||||
case NS_TOUCH_END: {
|
case NS_TOUCH_END: {
|
||||||
// Remove the changed touches
|
// Remove the changed touches
|
||||||
// need to make sure we only remove touches that are ending here
|
// 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;
|
nsTArray< nsRefPtr<dom::Touch> >& touches = touchEvent->touches;
|
||||||
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
for (uint32_t i = 0; i < touches.Length(); ++i) {
|
||||||
dom::Touch* touch = touches[i];
|
dom::Touch* touch = touches[i];
|
||||||
@@ -6778,7 +6778,7 @@ PresShell::HandleEventInternal(nsEvent* aEvent, nsEventStatus* aStatus)
|
|||||||
}
|
}
|
||||||
case NS_TOUCH_MOVE: {
|
case NS_TOUCH_MOVE: {
|
||||||
// Check for touches that changed. Mark them add to queue
|
// 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;
|
nsTArray< nsRefPtr<dom::Touch> >& touches = touchEvent->touches;
|
||||||
bool haveChanged = false;
|
bool haveChanged = false;
|
||||||
for (int32_t i = touches.Length(); i; ) {
|
for (int32_t i = touches.Length(); i; ) {
|
||||||
@@ -6943,7 +6943,7 @@ PresShell::DispatchTouchEvent(nsEvent *aEvent,
|
|||||||
(aEvent->message == NS_TOUCH_MOVE && aTouchIsNew);
|
(aEvent->message == NS_TOUCH_MOVE && aTouchIsNew);
|
||||||
bool preventDefault = false;
|
bool preventDefault = false;
|
||||||
nsEventStatus tmpStatus = nsEventStatus_eIgnore;
|
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
|
// loop over all touches and dispatch events on any that have changed
|
||||||
for (uint32_t i = 0; i < touchEvent->touches.Length(); ++i) {
|
for (uint32_t i = 0; i < touchEvent->touches.Length(); ++i) {
|
||||||
@@ -6968,7 +6968,7 @@ PresShell::DispatchTouchEvent(nsEvent *aEvent,
|
|||||||
content = capturingContent;
|
content = capturingContent;
|
||||||
}
|
}
|
||||||
// copy the event
|
// copy the event
|
||||||
nsTouchEvent newEvent(touchEvent->mFlags.mIsTrusted, touchEvent);
|
WidgetTouchEvent newEvent(touchEvent->mFlags.mIsTrusted, touchEvent);
|
||||||
newEvent.target = targetPtr;
|
newEvent.target = targetPtr;
|
||||||
|
|
||||||
nsRefPtr<PresShell> contentPresShell;
|
nsRefPtr<PresShell> contentPresShell;
|
||||||
|
|||||||
@@ -477,10 +477,10 @@ nsRangeFrame::GetValueAtEventPoint(nsGUIEvent* aEvent)
|
|||||||
|
|
||||||
LayoutDeviceIntPoint absPoint;
|
LayoutDeviceIntPoint absPoint;
|
||||||
if (aEvent->eventStructType == NS_TOUCH_EVENT) {
|
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");
|
"Unexpected number of touches");
|
||||||
absPoint = LayoutDeviceIntPoint::FromUntyped(
|
absPoint = LayoutDeviceIntPoint::FromUntyped(
|
||||||
static_cast<nsTouchEvent*>(aEvent)->touches[0]->mRefPoint);
|
static_cast<WidgetTouchEvent*>(aEvent)->touches[0]->mRefPoint);
|
||||||
} else {
|
} else {
|
||||||
absPoint = aEvent->refPoint;
|
absPoint = aEvent->refPoint;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2080,7 +2080,7 @@ nsBoxFrame::GetEventPoint(nsGUIEvent* aEvent, nsIntPoint &aPoint) {
|
|||||||
NS_ENSURE_TRUE(aEvent, false);
|
NS_ENSURE_TRUE(aEvent, false);
|
||||||
|
|
||||||
if (aEvent->eventStructType == NS_TOUCH_EVENT) {
|
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
|
// return false if there is more than one touch on the page, or if
|
||||||
// we can't find a touch point
|
// we can't find a touch point
|
||||||
if (touchEvent->touches.Length() != 1) {
|
if (touchEvent->touches.Length() != 1) {
|
||||||
|
|||||||
@@ -127,6 +127,5 @@ typedef WidgetWheelEvent WheelEvent;
|
|||||||
|
|
||||||
typedef mozilla::WidgetGestureNotifyEvent nsGestureNotifyEvent;
|
typedef mozilla::WidgetGestureNotifyEvent nsGestureNotifyEvent;
|
||||||
typedef mozilla::WidgetSimpleGestureEvent nsSimpleGestureEvent;
|
typedef mozilla::WidgetSimpleGestureEvent nsSimpleGestureEvent;
|
||||||
typedef mozilla::WidgetTouchEvent nsTouchEvent;
|
|
||||||
|
|
||||||
#endif // mozilla_EventForwards_h__
|
#endif // mozilla_EventForwards_h__
|
||||||
|
|||||||
@@ -125,11 +125,12 @@ public:
|
|||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Similar to nsTouchEvent, but for use off-main-thread. Also only stores a
|
* Similar to WidgetTouchEvent, but for use off-main-thread. Also only stores a
|
||||||
* screen touch point instead of the many different coordinate spaces nsTouchEvent
|
* screen touch point instead of the many different coordinate spaces
|
||||||
* stores its touch point in. This includes a way to initialize itself from an
|
* WidgetTouchEvent stores its touch point in. This includes a way to initialize
|
||||||
* nsTouchEvent by copying all relevant data over. Note that this copying from
|
* itself from a WidgetTouchEvent by copying all relevant data over. Note that
|
||||||
* nsTouchEvent functionality can only be used on the main thread.
|
* this copying from WidgetTouchEvent functionality can only be used on the main
|
||||||
|
* thread.
|
||||||
*
|
*
|
||||||
* Stores an array of SingleTouchData.
|
* 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
|
// 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
|
// the B2G emulator we can only receive mouse events, but we need to be able
|
||||||
|
|||||||
@@ -141,7 +141,7 @@ public:
|
|||||||
|
|
||||||
nsTArray<nsRefPtr<mozilla::dom::Touch>> touches;
|
nsTArray<nsRefPtr<mozilla::dom::Touch>> touches;
|
||||||
|
|
||||||
void AssignTouchEventData(const nsTouchEvent& aEvent, bool aCopyTargets)
|
void AssignTouchEventData(const WidgetTouchEvent& aEvent, bool aCopyTargets)
|
||||||
{
|
{
|
||||||
AssignInputEventData(aEvent, aCopyTargets);
|
AssignInputEventData(aEvent, aCopyTargets);
|
||||||
|
|
||||||
@@ -154,6 +154,5 @@ public:
|
|||||||
// TODO: Remove following typedefs
|
// TODO: Remove following typedefs
|
||||||
typedef mozilla::WidgetGestureNotifyEvent nsGestureNotifyEvent;
|
typedef mozilla::WidgetGestureNotifyEvent nsGestureNotifyEvent;
|
||||||
typedef mozilla::WidgetSimpleGestureEvent nsSimpleGestureEvent;
|
typedef mozilla::WidgetSimpleGestureEvent nsSimpleGestureEvent;
|
||||||
typedef mozilla::WidgetTouchEvent nsTouchEvent;
|
|
||||||
|
|
||||||
#endif // mozilla_TouchEvents_h__
|
#endif // mozilla_TouchEvents_h__
|
||||||
|
|||||||
@@ -704,7 +704,7 @@ AndroidGeckoEvent::Init(AndroidGeckoEvent *aResizeEvent)
|
|||||||
mPoints = aResizeEvent->mPoints; // x,y coordinates
|
mPoints = aResizeEvent->mPoints; // x,y coordinates
|
||||||
}
|
}
|
||||||
|
|
||||||
nsTouchEvent
|
WidgetTouchEvent
|
||||||
AndroidGeckoEvent::MakeTouchEvent(nsIWidget* widget)
|
AndroidGeckoEvent::MakeTouchEvent(nsIWidget* widget)
|
||||||
{
|
{
|
||||||
int type = NS_EVENT_NULL;
|
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) {
|
if (type == NS_EVENT_NULL) {
|
||||||
// An event we don't know about
|
// An event we don't know about
|
||||||
return event;
|
return event;
|
||||||
|
|||||||
@@ -588,7 +588,7 @@ public:
|
|||||||
int Width() { return mWidth; }
|
int Width() { return mWidth; }
|
||||||
int Height() { return mHeight; }
|
int Height() { return mHeight; }
|
||||||
int RequestId() { return mCount; } // for convenience
|
int RequestId() { return mCount; } // for convenience
|
||||||
nsTouchEvent MakeTouchEvent(nsIWidget* widget);
|
WidgetTouchEvent MakeTouchEvent(nsIWidget* widget);
|
||||||
MultiTouchInput MakeMultiTouchInput(nsIWidget* widget);
|
MultiTouchInput MakeMultiTouchInput(nsIWidget* widget);
|
||||||
void UnionRect(nsIntRect const& aRect);
|
void UnionRect(nsIntRect const& aRect);
|
||||||
nsIObserver *Observer() { return mObserver; }
|
nsIObserver *Observer() { return mObserver; }
|
||||||
|
|||||||
@@ -1228,7 +1228,7 @@ bool nsWindow::OnMultitouchEvent(AndroidGeckoEvent *ae)
|
|||||||
bool preventDefaultActions = false;
|
bool preventDefaultActions = false;
|
||||||
bool isDownEvent = false;
|
bool isDownEvent = false;
|
||||||
|
|
||||||
nsTouchEvent event = ae->MakeTouchEvent(this);
|
WidgetTouchEvent event = ae->MakeTouchEvent(this);
|
||||||
if (event.message != NS_EVENT_NULL) {
|
if (event.message != NS_EVENT_NULL) {
|
||||||
nsEventStatus status;
|
nsEventStatus status;
|
||||||
DispatchEvent(&event, status);
|
DispatchEvent(&event, status);
|
||||||
|
|||||||
@@ -158,7 +158,7 @@ sendMouseEvent(uint32_t msg, uint64_t timeMs, int x, int y, bool forwardToChildr
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
addDOMTouch(UserInputData& data, nsTouchEvent& event, int i)
|
addDOMTouch(UserInputData& data, WidgetTouchEvent& event, int i)
|
||||||
{
|
{
|
||||||
const ::Touch& touch = data.motion.touches[i];
|
const ::Touch& touch = data.motion.touches[i];
|
||||||
event.touches.AppendElement(
|
event.touches.AppendElement(
|
||||||
@@ -194,7 +194,7 @@ sendTouchEvent(UserInputData& data, bool* captured)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
nsTouchEvent event(true, msg, NULL);
|
WidgetTouchEvent event(true, msg, NULL);
|
||||||
|
|
||||||
event.time = data.timeMs;
|
event.time = data.timeMs;
|
||||||
|
|
||||||
|
|||||||
@@ -201,9 +201,9 @@ struct ParamTraits<nsMouseEvent>
|
|||||||
};
|
};
|
||||||
|
|
||||||
template<>
|
template<>
|
||||||
struct ParamTraits<nsTouchEvent>
|
struct ParamTraits<mozilla::WidgetTouchEvent>
|
||||||
{
|
{
|
||||||
typedef nsTouchEvent paramType;
|
typedef mozilla::WidgetTouchEvent paramType;
|
||||||
|
|
||||||
static void Write(Message* aMsg, const paramType& aParam)
|
static void Write(Message* aMsg, const paramType& aParam)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -6080,8 +6080,8 @@ bool nsWindow::OnTouch(WPARAM wParam, LPARAM lParam)
|
|||||||
PTOUCHINPUT pInputs = new TOUCHINPUT[cInputs];
|
PTOUCHINPUT pInputs = new TOUCHINPUT[cInputs];
|
||||||
|
|
||||||
if (mGesture.GetTouchInputInfo((HTOUCHINPUT)lParam, cInputs, pInputs)) {
|
if (mGesture.GetTouchInputInfo((HTOUCHINPUT)lParam, cInputs, pInputs)) {
|
||||||
nsTouchEvent* touchEventToSend = nullptr;
|
WidgetTouchEvent* touchEventToSend = nullptr;
|
||||||
nsTouchEvent* touchEndEventToSend = nullptr;
|
WidgetTouchEvent* touchEndEventToSend = nullptr;
|
||||||
nsEventStatus status;
|
nsEventStatus status;
|
||||||
|
|
||||||
// Walk across the touch point array processing each contact point
|
// 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)) {
|
if (pInputs[i].dwFlags & (TOUCHEVENTF_DOWN | TOUCHEVENTF_MOVE)) {
|
||||||
// Create a standard touch event to send
|
// Create a standard touch event to send
|
||||||
if (!touchEventToSend) {
|
if (!touchEventToSend) {
|
||||||
touchEventToSend = new nsTouchEvent(true, NS_TOUCH_MOVE, this);
|
touchEventToSend = new WidgetTouchEvent(true, NS_TOUCH_MOVE, this);
|
||||||
touchEventToSend->time = ::GetMessageTime();
|
touchEventToSend->time = ::GetMessageTime();
|
||||||
ModifierKeyState modifierKeyState;
|
ModifierKeyState modifierKeyState;
|
||||||
modifierKeyState.InitInputEvent(*touchEventToSend);
|
modifierKeyState.InitInputEvent(*touchEventToSend);
|
||||||
@@ -6109,7 +6109,7 @@ bool nsWindow::OnTouch(WPARAM wParam, LPARAM lParam)
|
|||||||
// separate NS_TOUCH_END event containing only the contact points
|
// separate NS_TOUCH_END event containing only the contact points
|
||||||
// that were removed.
|
// that were removed.
|
||||||
if (!touchEndEventToSend) {
|
if (!touchEndEventToSend) {
|
||||||
touchEndEventToSend = new nsTouchEvent(true, NS_TOUCH_END, this);
|
touchEndEventToSend = new WidgetTouchEvent(true, NS_TOUCH_END, this);
|
||||||
touchEndEventToSend->time = ::GetMessageTime();
|
touchEndEventToSend->time = ::GetMessageTime();
|
||||||
ModifierKeyState modifierKeyState;
|
ModifierKeyState modifierKeyState;
|
||||||
modifierKeyState.InitInputEvent(*touchEndEventToSend);
|
modifierKeyState.InitInputEvent(*touchEndEventToSend);
|
||||||
|
|||||||
@@ -398,7 +398,7 @@ MetroInput::OnPointerNonTouch(UI::Input::IPointerPoint* aPoint) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MetroInput::InitTouchEventTouchList(nsTouchEvent* aEvent)
|
MetroInput::InitTouchEventTouchList(WidgetTouchEvent* aEvent)
|
||||||
{
|
{
|
||||||
MOZ_ASSERT(aEvent);
|
MOZ_ASSERT(aEvent);
|
||||||
mTouches.Enumerate(&AppendToTouchList,
|
mTouches.Enumerate(&AppendToTouchList,
|
||||||
@@ -439,8 +439,8 @@ MetroInput::OnPointerPressed(UI::Core::ICoreWindow* aSender,
|
|||||||
touch->mChanged = true;
|
touch->mChanged = true;
|
||||||
mTouches.Put(pointerId, touch);
|
mTouches.Put(pointerId, touch);
|
||||||
|
|
||||||
nsTouchEvent* touchEvent =
|
WidgetTouchEvent* touchEvent =
|
||||||
new nsTouchEvent(true, NS_TOUCH_START, mWidget.Get());
|
new WidgetTouchEvent(true, NS_TOUCH_START, mWidget.Get());
|
||||||
|
|
||||||
if (mTouches.Count() == 1) {
|
if (mTouches.Count() == 1) {
|
||||||
// If this is the first touchstart of a touch session reset some
|
// 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
|
// 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)
|
// at a new position send the previous batch. (perf opt)
|
||||||
if (!mIsFirstTouchMove && touch->mChanged) {
|
if (!mIsFirstTouchMove && touch->mChanged) {
|
||||||
nsTouchEvent* touchEvent =
|
WidgetTouchEvent* touchEvent =
|
||||||
new nsTouchEvent(true, NS_TOUCH_MOVE, mWidget.Get());
|
new WidgetTouchEvent(true, NS_TOUCH_MOVE, mWidget.Get());
|
||||||
InitTouchEventTouchList(touchEvent);
|
InitTouchEventTouchList(touchEvent);
|
||||||
DispatchAsyncTouchEventIgnoreStatus(touchEvent);
|
DispatchAsyncTouchEventIgnoreStatus(touchEvent);
|
||||||
}
|
}
|
||||||
@@ -555,8 +555,8 @@ MetroInput::OnPointerMoved(UI::Core::ICoreWindow* aSender,
|
|||||||
// replacing old touch point in mTouches map
|
// replacing old touch point in mTouches map
|
||||||
mTouches.Put(pointerId, touch);
|
mTouches.Put(pointerId, touch);
|
||||||
|
|
||||||
nsTouchEvent* touchEvent =
|
WidgetTouchEvent* touchEvent =
|
||||||
new nsTouchEvent(true, NS_TOUCH_MOVE, mWidget.Get());
|
new WidgetTouchEvent(true, NS_TOUCH_MOVE, mWidget.Get());
|
||||||
|
|
||||||
// If this is the first touch move of our session, we should check the result.
|
// 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
|
// 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
|
// Purge any pending moves for this pointer
|
||||||
if (touch->mChanged) {
|
if (touch->mChanged) {
|
||||||
nsTouchEvent* touchEvent =
|
WidgetTouchEvent* touchEvent =
|
||||||
new nsTouchEvent(true, NS_TOUCH_MOVE, mWidget.Get());
|
new WidgetTouchEvent(true, NS_TOUCH_MOVE, mWidget.Get());
|
||||||
InitTouchEventTouchList(touchEvent);
|
InitTouchEventTouchList(touchEvent);
|
||||||
DispatchAsyncTouchEventIgnoreStatus(touchEvent);
|
DispatchAsyncTouchEventIgnoreStatus(touchEvent);
|
||||||
}
|
}
|
||||||
@@ -635,8 +635,8 @@ MetroInput::OnPointerReleased(UI::Core::ICoreWindow* aSender,
|
|||||||
mTouches.Remove(pointerId);
|
mTouches.Remove(pointerId);
|
||||||
|
|
||||||
// touchend events only have a single touch; the touch that has been removed
|
// touchend events only have a single touch; the touch that has been removed
|
||||||
nsTouchEvent* touchEvent =
|
WidgetTouchEvent* touchEvent =
|
||||||
new nsTouchEvent(true, NS_TOUCH_END, mWidget.Get());
|
new WidgetTouchEvent(true, NS_TOUCH_END, mWidget.Get());
|
||||||
touchEvent->touches.AppendElement(CreateDOMTouch(currentPoint.Get()));
|
touchEvent->touches.AppendElement(CreateDOMTouch(currentPoint.Get()));
|
||||||
DispatchAsyncTouchEventIgnoreStatus(touchEvent);
|
DispatchAsyncTouchEventIgnoreStatus(touchEvent);
|
||||||
|
|
||||||
@@ -1148,7 +1148,7 @@ MetroInput::DeliverNextQueuedEventIgnoreStatus()
|
|||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MetroInput::DispatchAsyncTouchEventIgnoreStatus(nsTouchEvent* aEvent)
|
MetroInput::DispatchAsyncTouchEventIgnoreStatus(WidgetTouchEvent* aEvent)
|
||||||
{
|
{
|
||||||
aEvent->time = ::GetMessageTime();
|
aEvent->time = ::GetMessageTime();
|
||||||
mModifierKeyState.Update();
|
mModifierKeyState.Update();
|
||||||
@@ -1163,7 +1163,8 @@ nsEventStatus
|
|||||||
MetroInput::DeliverNextQueuedTouchEvent()
|
MetroInput::DeliverNextQueuedTouchEvent()
|
||||||
{
|
{
|
||||||
nsEventStatus status;
|
nsEventStatus status;
|
||||||
nsTouchEvent* event = static_cast<nsTouchEvent*>(mInputEventQueue.PopFront());
|
WidgetTouchEvent* event =
|
||||||
|
static_cast<WidgetTouchEvent*>(mInputEventQueue.PopFront());
|
||||||
MOZ_ASSERT(event);
|
MOZ_ASSERT(event);
|
||||||
|
|
||||||
AutoDeleteEvent wrap(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
|
// Forward event data to apz. If the apz consumes the event, don't forward to
|
||||||
// content if this is not a cancelable event.
|
// content if this is not a cancelable event.
|
||||||
nsTouchEvent transformedEvent(*event);
|
WidgetTouchEvent transformedEvent(*event);
|
||||||
status = mWidget->ApzReceiveInputEvent(event, &transformedEvent);
|
status = mWidget->ApzReceiveInputEvent(event, &transformedEvent);
|
||||||
if (!mCancelable && status == nsEventStatus_eConsumeNoDefault) {
|
if (!mCancelable && status == nsEventStatus_eConsumeNoDefault) {
|
||||||
if (!mTouchCancelSent) {
|
if (!mTouchCancelSent) {
|
||||||
@@ -1237,13 +1238,14 @@ MetroInput::DispatchTouchCancel()
|
|||||||
// not be included in the touches and targetTouches attributes.
|
// not be included in the touches and targetTouches attributes.
|
||||||
// (We are 'removing' all touch points that have been sent to content
|
// (We are 'removing' all touch points that have been sent to content
|
||||||
// thus far.)
|
// thus far.)
|
||||||
nsTouchEvent touchEvent(true, NS_TOUCH_CANCEL, mWidget.Get());
|
WidgetTouchEvent touchEvent(true, NS_TOUCH_CANCEL, mWidget.Get());
|
||||||
InitTouchEventTouchList(&touchEvent);
|
InitTouchEventTouchList(&touchEvent);
|
||||||
mWidget->DispatchEvent(&touchEvent, sThrowawayStatus);
|
mWidget->DispatchEvent(&touchEvent, sThrowawayStatus);
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
MetroInput::DispatchAsyncTouchEventWithCallback(nsTouchEvent* aEvent, void (MetroInput::*Callback)())
|
MetroInput::DispatchAsyncTouchEventWithCallback(WidgetTouchEvent* aEvent,
|
||||||
|
void (MetroInput::*Callback)())
|
||||||
{
|
{
|
||||||
aEvent->time = ::GetMessageTime();
|
aEvent->time = ::GetMessageTime();
|
||||||
mModifierKeyState.Update();
|
mModifierKeyState.Update();
|
||||||
|
|||||||
@@ -223,7 +223,7 @@ private:
|
|||||||
// the updated touchpoint info and record the fact that the touchpoint
|
// the updated touchpoint info and record the fact that the touchpoint
|
||||||
// has changed. If ever we try to update a touchpoint has already
|
// has changed. If ever we try to update a touchpoint has already
|
||||||
// changed, we dispatch a touch event containing all the changed touches.
|
// changed, we dispatch a touch event containing all the changed touches.
|
||||||
void InitTouchEventTouchList(nsTouchEvent* aEvent);
|
void InitTouchEventTouchList(WidgetTouchEvent* aEvent);
|
||||||
nsBaseHashtable<nsUint32HashKey,
|
nsBaseHashtable<nsUint32HashKey,
|
||||||
nsRefPtr<mozilla::dom::Touch>,
|
nsRefPtr<mozilla::dom::Touch>,
|
||||||
nsRefPtr<mozilla::dom::Touch> > mTouches;
|
nsRefPtr<mozilla::dom::Touch> > mTouches;
|
||||||
@@ -264,8 +264,9 @@ private:
|
|||||||
|
|
||||||
// Async event dispatching
|
// Async event dispatching
|
||||||
void DispatchAsyncEventIgnoreStatus(nsInputEvent* aEvent);
|
void DispatchAsyncEventIgnoreStatus(nsInputEvent* aEvent);
|
||||||
void DispatchAsyncTouchEventIgnoreStatus(nsTouchEvent* aEvent);
|
void DispatchAsyncTouchEventIgnoreStatus(WidgetTouchEvent* aEvent);
|
||||||
void DispatchAsyncTouchEventWithCallback(nsTouchEvent* aEvent, void (MetroInput::*Callback)());
|
void DispatchAsyncTouchEventWithCallback(WidgetTouchEvent* aEvent,
|
||||||
|
void (MetroInput::*Callback)());
|
||||||
|
|
||||||
// Async event callbacks
|
// Async event callbacks
|
||||||
void DeliverNextQueuedEventIgnoreStatus();
|
void DeliverNextQueuedEventIgnoreStatus();
|
||||||
|
|||||||
@@ -15,11 +15,11 @@ namespace mozilla {
|
|||||||
|
|
||||||
using namespace dom;
|
using namespace dom;
|
||||||
|
|
||||||
MultiTouchInput::MultiTouchInput(const nsTouchEvent& aTouchEvent)
|
MultiTouchInput::MultiTouchInput(const WidgetTouchEvent& aTouchEvent)
|
||||||
: InputData(MULTITOUCH_INPUT, aTouchEvent.time)
|
: InputData(MULTITOUCH_INPUT, aTouchEvent.time)
|
||||||
{
|
{
|
||||||
NS_ABORT_IF_FALSE(NS_IsMainThread(),
|
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) {
|
switch (aTouchEvent.message) {
|
||||||
case NS_TOUCH_START:
|
case NS_TOUCH_START:
|
||||||
|
|||||||
Reference in New Issue
Block a user