Bug 1230047 (part 1) - Make SynthesizeNativeTouch{Point,Tap}() take ScreenIntPoints. r=kats.

This commit is contained in:
Nicholas Nethercote 2015-12-02 21:45:38 -08:00
parent a062cb8f52
commit 209e8be54e
13 changed files with 36 additions and 33 deletions

View File

@ -1075,9 +1075,10 @@ nsDOMWindowUtils::SendNativeTouchPoint(uint32_t aPointerId,
}
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
<uint32_t, nsIWidget::TouchPointerState, nsIntPoint, double, uint32_t, nsIObserver*>
<uint32_t, nsIWidget::TouchPointerState, ScreenIntPoint, double, uint32_t, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeTouchPoint, aPointerId,
(nsIWidget::TouchPointerState)aTouchState, nsIntPoint(aScreenX, aScreenY),
(nsIWidget::TouchPointerState)aTouchState,
ScreenIntPoint(aScreenX, aScreenY),
aPressure, aOrientation, aObserver));
return NS_OK;
}
@ -1094,9 +1095,9 @@ nsDOMWindowUtils::SendNativeTouchTap(int32_t aScreenX,
}
NS_DispatchToMainThread(NS_NewRunnableMethodWithArgs
<nsIntPoint, bool, nsIObserver*>
<ScreenIntPoint, bool, nsIObserver*>
(widget, &nsIWidget::SynthesizeNativeTouchTap,
nsIntPoint(aScreenX, aScreenY), aLongTap, aObserver));
ScreenIntPoint(aScreenX, aScreenY), aLongTap, aObserver));
return NS_OK;
}

View File

@ -26,8 +26,9 @@ using class mozilla::gfx::Matrix from "mozilla/gfx/Matrix.h";
using struct gfxSize from "gfxPoint.h";
using CSSRect from "Units.h";
using CSSSize from "Units.h";
using LayoutDeviceIntRect from "Units.h";
using mozilla::LayoutDeviceIntRect from "Units.h";
using mozilla::LayoutDeviceIntPoint from "Units.h";
using mozilla::ScreenIntPoint from "Units.h";
using ScreenIntSize from "Units.h";
using struct mozilla::layers::FrameMetrics from "FrameMetrics.h";
using struct mozilla::layers::ScrollableLayerGuid from "FrameMetrics.h";
@ -490,11 +491,11 @@ parent:
uint64_t aObserverId);
SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
IntPoint aPointerScreenPoint,
ScreenIntPoint aPointerScreenPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
uint64_t aObserverId);
SynthesizeNativeTouchTap(IntPoint aPointerScreenPoint,
SynthesizeNativeTouchTap(ScreenIntPoint aPointerScreenPoint,
bool aLongTap,
uint64_t aObserverId);
ClearNativeTouchSequence(uint64_t aObserverId);

View File

@ -1633,7 +1633,7 @@ TabParent::RecvSynthesizeNativeMouseScrollEvent(const LayoutDeviceIntPoint& aPoi
bool
TabParent::RecvSynthesizeNativeTouchPoint(const uint32_t& aPointerId,
const TouchPointerState& aPointerState,
const nsIntPoint& aPointerScreenPoint,
const ScreenIntPoint& aPointerScreenPoint,
const double& aPointerPressure,
const uint32_t& aPointerOrientation,
const uint64_t& aObserverId)
@ -1648,7 +1648,7 @@ TabParent::RecvSynthesizeNativeTouchPoint(const uint32_t& aPointerId,
}
bool
TabParent::RecvSynthesizeNativeTouchTap(const nsIntPoint& aPointerScreenPoint,
TabParent::RecvSynthesizeNativeTouchTap(const ScreenIntPoint& aPointerScreenPoint,
const bool& aLongTap,
const uint64_t& aObserverId)
{

View File

@ -328,11 +328,11 @@ public:
const uint64_t& aObserverId) override;
virtual bool RecvSynthesizeNativeTouchPoint(const uint32_t& aPointerId,
const TouchPointerState& aPointerState,
const nsIntPoint& aPointerScreenPoint,
const ScreenIntPoint& aPointerScreenPoint,
const double& aPointerPressure,
const uint32_t& aPointerOrientation,
const uint64_t& aObserverId) override;
virtual bool RecvSynthesizeNativeTouchTap(const nsIntPoint& aPointerScreenPoint,
virtual bool RecvSynthesizeNativeTouchTap(const ScreenIntPoint& aPointerScreenPoint,
const bool& aLongTap,
const uint64_t& aObserverId) override;
virtual bool RecvClearNativeTouchSequence(const uint64_t& aObserverId) override;

View File

@ -444,7 +444,7 @@ PuppetWidget::SynthesizeNativeMouseScrollEvent(mozilla::LayoutDeviceIntPoint aPo
nsresult
PuppetWidget::SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
nsIntPoint aPointerScreenPoint,
ScreenIntPoint aPointerScreenPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver)
@ -460,7 +460,7 @@ PuppetWidget::SynthesizeNativeTouchPoint(uint32_t aPointerId,
}
nsresult
PuppetWidget::SynthesizeNativeTouchTap(nsIntPoint aPointerScreenPoint,
PuppetWidget::SynthesizeNativeTouchTap(ScreenIntPoint aPointerScreenPoint,
bool aLongTap,
nsIObserver* aObserver)
{

View File

@ -242,11 +242,11 @@ public:
nsIObserver* aObserver) override;
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
nsIntPoint aPointerScreenPoint,
ScreenIntPoint aPointerScreenPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver) override;
virtual nsresult SynthesizeNativeTouchTap(nsIntPoint aPointerScreenPoint,
virtual nsresult SynthesizeNativeTouchTap(ScreenIntPoint aPointerScreenPoint,
bool aLongTap,
nsIObserver* aObserver) override;
virtual nsresult ClearNativeTouchSequence(nsIObserver* aObserver) override;

View File

@ -258,7 +258,7 @@ private:
nsresult
nsWindow::SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
nsIntPoint aPointerScreenPoint,
ScreenIntPoint aPointerScreenPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver)
@ -286,7 +286,7 @@ nsWindow::SynthesizeNativeTouchPoint(uint32_t aPointerId,
if (index >= 0) {
// found an existing touch point, update it
SingleTouchData& point = mSynthesizedTouchInput->mTouches[index];
point.mScreenPoint = ScreenIntPoint::FromUnknownPoint(aPointerScreenPoint);
point.mScreenPoint = aPointerScreenPoint;
point.mRotationAngle = (float)aPointerOrientation;
point.mForce = (float)aPointerPressure;
inputToDispatch.mType = MultiTouchInput::MULTITOUCH_MOVE;
@ -294,7 +294,7 @@ nsWindow::SynthesizeNativeTouchPoint(uint32_t aPointerId,
// new touch point, add it
mSynthesizedTouchInput->mTouches.AppendElement(SingleTouchData(
(int32_t)aPointerId,
ScreenIntPoint::FromUnknownPoint(aPointerScreenPoint),
aPointerScreenPoint,
ScreenSize(0, 0),
(float)aPointerOrientation,
(float)aPointerPressure));
@ -312,7 +312,7 @@ nsWindow::SynthesizeNativeTouchPoint(uint32_t aPointerId,
: MultiTouchInput::MULTITOUCH_CANCEL);
inputToDispatch.mTouches.AppendElement(SingleTouchData(
(int32_t)aPointerId,
ScreenIntPoint::FromUnknownPoint(aPointerScreenPoint),
aPointerScreenPoint,
ScreenSize(0, 0),
(float)aPointerOrientation,
(float)aPointerPressure));

View File

@ -88,7 +88,7 @@ public:
nsEventStatus& aStatus);
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
nsIntPoint aPointerScreenPoint,
ScreenIntPoint aPointerScreenPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver) override;

View File

@ -1840,7 +1840,7 @@ nsBaseWidget::GetWidgetScreen()
}
nsresult
nsIWidget::SynthesizeNativeTouchTap(nsIntPoint aPointerScreenPoint, bool aLongTap,
nsIWidget::SynthesizeNativeTouchTap(ScreenIntPoint aPointerScreenPoint, bool aLongTap,
nsIObserver* aObserver)
{
AutoObserverNotifier notifier(aObserver, "touchtap");
@ -1916,7 +1916,7 @@ nsIWidget::OnLongTapTimerCallback(nsITimer* aTimer, void* aClosure)
return;
}
AutoObserverNotifier notiifer(self->mLongTapTouchPoint->mObserver, "touchtap");
AutoObserverNotifier notifier(self->mLongTapTouchPoint->mObserver, "touchtap");
// finished, remove the touch point
self->mLongTapTimer->Cancel();

View File

@ -414,7 +414,7 @@ protected:
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
nsIntPoint aPointerScreenPoint,
ScreenIntPoint aPointerScreenPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver) override

View File

@ -337,6 +337,7 @@ class nsIWidget : public nsISupports {
typedef mozilla::LayoutDeviceIntRect LayoutDeviceIntRect;
typedef mozilla::LayoutDeviceIntRegion LayoutDeviceIntRegion;
typedef mozilla::LayoutDeviceIntSize LayoutDeviceIntSize;
typedef mozilla::ScreenIntPoint ScreenIntPoint;
// Used in UpdateThemeGeometries.
struct ThemeGeometry {
@ -1643,7 +1644,7 @@ class nsIWidget : public nsISupports {
*/
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
nsIntPoint aPointerScreenPoint,
ScreenIntPoint aPointerScreenPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver) = 0;
@ -1656,7 +1657,7 @@ class nsIWidget : public nsISupports {
* @param aObserver The observer that will get notified once the events
* have been dispatched.
*/
virtual nsresult SynthesizeNativeTouchTap(nsIntPoint aPointerScreenPoint,
virtual nsresult SynthesizeNativeTouchTap(ScreenIntPoint aPointerScreenPoint,
bool aLongTap,
nsIObserver* aObserver);
@ -1692,7 +1693,7 @@ private:
class LongTapInfo
{
public:
LongTapInfo(int32_t aPointerId, nsIntPoint& aPoint,
LongTapInfo(int32_t aPointerId, ScreenIntPoint& aPoint,
mozilla::TimeDuration aDuration,
nsIObserver* aObserver) :
mPointerId(aPointerId),
@ -1704,7 +1705,7 @@ private:
}
int32_t mPointerId;
nsIntPoint mPosition;
ScreenIntPoint mPosition;
mozilla::TimeDuration mDuration;
nsCOMPtr<nsIObserver> mObserver;
mozilla::TimeStamp mStamp;

View File

@ -70,7 +70,7 @@ nsWindowBase::InitTouchInjection()
}
bool
nsWindowBase::InjectTouchPoint(uint32_t aId, nsIntPoint& aPointerScreenPoint,
nsWindowBase::InjectTouchPoint(uint32_t aId, ScreenIntPoint& aPointerScreenPoint,
POINTER_FLAGS aFlags, uint32_t aPressure,
uint32_t aOrientation)
{
@ -108,7 +108,7 @@ nsWindowBase::InjectTouchPoint(uint32_t aId, nsIntPoint& aPointerScreenPoint,
nsresult
nsWindowBase::SynthesizeNativeTouchPoint(uint32_t aPointerId,
nsIWidget::TouchPointerState aPointerState,
nsIntPoint aPointerScreenPoint,
ScreenIntPoint aPointerScreenPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver)

View File

@ -90,7 +90,7 @@ public:
*/
virtual nsresult SynthesizeNativeTouchPoint(uint32_t aPointerId,
TouchPointerState aPointerState,
nsIntPoint aPointerScreenPoint,
ScreenIntPoint aPointerScreenPoint,
double aPointerPressure,
uint32_t aPointerOrientation,
nsIObserver* aObserver) override;
@ -105,21 +105,21 @@ public:
protected:
static bool InitTouchInjection();
bool InjectTouchPoint(uint32_t aId, nsIntPoint& aPointerScreenPoint,
bool InjectTouchPoint(uint32_t aId, ScreenIntPoint& aPointerScreenPoint,
POINTER_FLAGS aFlags, uint32_t aPressure = 1024,
uint32_t aOrientation = 90);
class PointerInfo
{
public:
PointerInfo(int32_t aPointerId, nsIntPoint& aPoint) :
PointerInfo(int32_t aPointerId, ScreenIntPoint& aPoint) :
mPointerId(aPointerId),
mPosition(aPoint)
{
}
int32_t mPointerId;
nsIntPoint mPosition;
ScreenIntPoint mPosition;
};
nsClassHashtable<nsUint32HashKey, PointerInfo> mActivePointers;