Bug 1289435 - Ensure that the synthesized native touch events have sane timestamps. r=mstange

MozReview-Commit-ID: 6QxB7XBx7T7
This commit is contained in:
Kartikaya Gupta 2016-08-03 12:06:58 -04:00
Родитель 6d50a6b8e2
Коммит ebadfda552
4 изменённых файлов: 15 добавлений и 3 удалений

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

@ -1208,8 +1208,9 @@ nsresult nsChildView::SynthesizeNativeTouchPoint(uint32_t aPointerId,
LayoutDeviceIntPoint pointInWindow = aPoint - WidgetToScreenOffset();
MultiTouchInput inputToDispatch = UpdateSynthesizedTouchState(
mSynthesizedTouchInput.get(), aPointerId, aPointerState,
pointInWindow, aPointerPressure, aPointerOrientation);
mSynthesizedTouchInput.get(), PR_IntervalNow(), TimeStamp::Now(),
aPointerId, aPointerState, pointInWindow, aPointerPressure,
aPointerOrientation);
if (mAPZC) {
uint64_t inputBlockId = 0;

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

@ -273,8 +273,13 @@ nsWindow::SynthesizeNativeTouchPoint(uint32_t aPointerId,
mSynthesizedTouchInput = MakeUnique<MultiTouchInput>();
}
// We should probably use a real timestamp here, but this is B2G and
// so this probably never even exercised any more.
uint32_t time = 0;
TimeStamp timestamp = TimeStamp::FromSystemTime(time);
MultiTouchInput inputToDispatch = UpdateSynthesizedTouchState(
mSynthesizedTouchInput.get(), aPointerId, aPointerState,
mSynthesizedTouchInput.get(), time, timeStamp, aPointerId, aPointerState,
aPoint, aPointerPressure, aPointerOrientation);
// Can't use NewRunnableMethod here because that will pass a const-ref

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

@ -2073,6 +2073,8 @@ nsIWidget::ClearNativeTouchSequence(nsIObserver* aObserver)
MultiTouchInput
nsBaseWidget::UpdateSynthesizedTouchState(MultiTouchInput* aState,
uint32_t aTime,
mozilla::TimeStamp aTimeStamp,
uint32_t aPointerId,
TouchPointerState aPointerState,
LayoutDeviceIntPoint aPoint,
@ -2089,6 +2091,8 @@ nsBaseWidget::UpdateSynthesizedTouchState(MultiTouchInput* aState,
// touch(es). We use |inputToDispatch| for this purpose.
MultiTouchInput inputToDispatch;
inputToDispatch.mInputType = MULTITOUCH_INPUT;
inputToDispatch.mTime = aTime;
inputToDispatch.mTimeStamp = aTimeStamp;
int32_t index = aState->IndexOfTouch((int32_t)aPointerId);
if (aPointerState == TOUCH_CONTACT) {

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

@ -568,6 +568,8 @@ protected:
*/
mozilla::MultiTouchInput
UpdateSynthesizedTouchState(mozilla::MultiTouchInput* aState,
uint32_t aTime,
mozilla::TimeStamp aTimeStamp,
uint32_t aPointerId,
TouchPointerState aPointerState,
LayoutDeviceIntPoint aPoint,