Bug 964261 - Declare a widget to events created by TabParent::InjectTouchEvent. r=kats
authorVivien Nicolas <vnicolas@mozilla.com>
Tue, 28 Jan 2014 12:42:44 +0100
changeset 181540 7422401971491c425769b3a9818f549e46e43d2b
parent 181539 a0489a2299c5bd31551cc4985bd2627789cdb083
child 181541 91532e8446c449476c7e6a92466dfc45024d3be5
push id3343
push userffxbld
push dateMon, 17 Mar 2014 21:55:32 +0000
treeherdermozilla-beta@2f7d3415f79f [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewerskats
bugs964261
milestone29.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 964261 - Declare a widget to events created by TabParent::InjectTouchEvent. r=kats
dom/ipc/TabParent.cpp
--- a/dom/ipc/TabParent.cpp
+++ b/dom/ipc/TabParent.cpp
@@ -1911,27 +1911,37 @@ TabParent::InjectTouchEvent(const nsAStr
 {
   uint32_t msg;
   nsContentUtils::GetEventIdAndAtom(aType, NS_TOUCH_EVENT, &msg);
   if (msg != NS_TOUCH_START && msg != NS_TOUCH_MOVE &&
       msg != NS_TOUCH_END && msg != NS_TOUCH_CANCEL) {
     return NS_ERROR_FAILURE;
   }
 
-  WidgetTouchEvent event(true, msg, nullptr);
+  nsCOMPtr<nsIWidget> widget = GetWidget();
+  if (!widget) {
+    return NS_ERROR_FAILURE;
+  }
+
+  WidgetTouchEvent event(true, msg, widget);
   event.modifiers = aModifiers;
   event.time = PR_IntervalNow();
 
   event.touches.SetCapacity(aCount);
   for (uint32_t i = 0; i < aCount; ++i) {
     nsRefPtr<Touch> t = new Touch(aIdentifiers[i],
                                   nsIntPoint(aXs[i], aYs[i]),
                                   nsIntPoint(aRxs[i], aRys[i]),
                                   aRotationAngles[i],
                                   aForces[i]);
+
+    // Consider all injected touch events as changedTouches. For more details
+    // about the meaning of changedTouches for each event, see
+    // https://developer.mozilla.org/docs/Web/API/TouchEvent.changedTouches
+    t->mChanged = true;
     event.touches.AppendElement(t);
   }
 
   SendRealTouchEvent(event);
   return NS_OK;
 }
 
 NS_IMETHODIMP