[BlackBerry] Fill more data in device motion event
authorleo.yang@torchmobile.com.cn <leo.yang@torchmobile.com.cn@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Jun 2012 04:31:48 +0000 (04:31 +0000)
committerleo.yang@torchmobile.com.cn <leo.yang@torchmobile.com.cn@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 26 Jun 2012 04:31:48 +0000 (04:31 +0000)
https://bugs.webkit.org/show_bug.cgi?id=89857

Reviewed by Antonio Gomes.

Reviewed internally by Robin Cao.

Fill acceleration and rotation rate into DeviceMotionData.

* WebCoreSupport/DeviceMotionClientBlackBerry.cpp:
(DeviceMotionClientBlackBerry::onMotion):

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121225 268f45cc-cd09-0410-ab3c-d52691b4dbfc

Source/WebKit/blackberry/ChangeLog
Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.cpp

index 5919be5..c52c057 100644 (file)
@@ -1,3 +1,17 @@
+2012-06-25  Leo Yang  <leo.yang@torchmobile.com.cn>
+
+        [BlackBerry] Fill more data in device motion event
+        https://bugs.webkit.org/show_bug.cgi?id=89857
+
+        Reviewed by Antonio Gomes.
+
+        Reviewed internally by Robin Cao.
+
+        Fill acceleration and rotation rate into DeviceMotionData.
+
+        * WebCoreSupport/DeviceMotionClientBlackBerry.cpp:
+        (DeviceMotionClientBlackBerry::onMotion):
+
 2012-06-25  Yong Li  <yoli@rim.com>
 
         [BlackBerry] Add JSC statistics into about:memory
index 8b0078f..b826ba8 100644 (file)
@@ -71,11 +71,19 @@ DeviceMotionData* DeviceMotionClientBlackBerry::lastMotion() const
 
 void DeviceMotionClientBlackBerry::onMotion(const BlackBerry::Platform::DeviceMotionEvent* event)
 {
-    RefPtr<DeviceMotionData::Acceleration> accel = DeviceMotionData::Acceleration::create(
-            true, event->x, true, event->y, true, event->z);
+    // All boolean parameters in the following create() calls indicate that if the following parameter is validly provided.
+
+    RefPtr<DeviceMotionData::Acceleration> acceleration = DeviceMotionData::Acceleration::create(
+        true, event->acceleration.x, true, event->acceleration.y, true, event->acceleration.z);
+
+    RefPtr<DeviceMotionData::Acceleration> accelerationIncludingGravity = DeviceMotionData::Acceleration::create(
+        true, event->accelerationIncludingGravity.x, true, event->accelerationIncludingGravity.y, true, event->accelerationIncludingGravity.z);
+
+    RefPtr<DeviceMotionData::RotationRate> rotationRate = DeviceMotionData::RotationRate::create(
+        true, event->rotationRate.alpha, true, event->rotationRate.beta, true, event->rotationRate.gamma);
 
     double now = WTF::currentTimeMS();
-    m_currentMotion = DeviceMotionData::create(0, accel, 0, m_lastEventTime, m_lastEventTime - now);
+    m_currentMotion = DeviceMotionData::create(acceleration, accelerationIncludingGravity, rotationRate, m_lastEventTime, m_lastEventTime - now);
     m_lastEventTime = now;
 
     if (!m_controller)