From 612c6c5a8c54de3b224b3219f673c83ae51d1c43 Mon Sep 17 00:00:00 2001 From: "leo.yang@torchmobile.com.cn" Date: Tue, 26 Jun 2012 04:31:48 +0000 Subject: [PATCH] [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): git-svn-id: http://svn.webkit.org/repository/webkit/trunk@121225 268f45cc-cd09-0410-ab3c-d52691b4dbfc --- Source/WebKit/blackberry/ChangeLog | 14 ++++++++++++++ .../WebCoreSupport/DeviceMotionClientBlackBerry.cpp | 14 +++++++++++--- 2 files changed, 25 insertions(+), 3 deletions(-) diff --git a/Source/WebKit/blackberry/ChangeLog b/Source/WebKit/blackberry/ChangeLog index 5919be5..c52c057 100644 --- a/Source/WebKit/blackberry/ChangeLog +++ b/Source/WebKit/blackberry/ChangeLog @@ -1,3 +1,17 @@ +2012-06-25 Leo Yang + + [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 [BlackBerry] Add JSC statistics into about:memory diff --git a/Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.cpp b/Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.cpp index 8b0078f..b826ba8 100644 --- a/Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.cpp +++ b/Source/WebKit/blackberry/WebCoreSupport/DeviceMotionClientBlackBerry.cpp @@ -71,11 +71,19 @@ DeviceMotionData* DeviceMotionClientBlackBerry::lastMotion() const void DeviceMotionClientBlackBerry::onMotion(const BlackBerry::Platform::DeviceMotionEvent* event) { - RefPtr 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 acceleration = DeviceMotionData::Acceleration::create( + true, event->acceleration.x, true, event->acceleration.y, true, event->acceleration.z); + + RefPtr accelerationIncludingGravity = DeviceMotionData::Acceleration::create( + true, event->accelerationIncludingGravity.x, true, event->accelerationIncludingGravity.y, true, event->accelerationIncludingGravity.z); + + RefPtr 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) -- 2.7.4