Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2005)

Unified Diff: Source/modules/device_orientation/DeviceMotionData.cpp

Issue 21256002: Fire null Device Motion events only once. (Closed) Base URL: https://chromium.googlesource.com/chromium/blink.git@master
Patch Set: fixed comments Created 7 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: Source/modules/device_orientation/DeviceMotionData.cpp
diff --git a/Source/modules/device_orientation/DeviceMotionData.cpp b/Source/modules/device_orientation/DeviceMotionData.cpp
index c49583c2956ce01b166470082b822f032c4a05b0..b2c338fe65c2cd7707c62faf6ec5b661c4d2b109 100644
--- a/Source/modules/device_orientation/DeviceMotionData.cpp
+++ b/Source/modules/device_orientation/DeviceMotionData.cpp
@@ -109,4 +109,13 @@ DeviceMotionData::DeviceMotionData(PassRefPtr<Acceleration> acceleration, PassRe
{
}
+bool DeviceMotionData::canProvideEventData() const
+{
+ const bool hasAcceleration = m_acceleration && (m_acceleration->canProvideX() || m_acceleration->canProvideY() || m_acceleration->canProvideZ());
+ const bool hasAccelerationIncludingGravity = m_accelerationIncludingGravity && (m_accelerationIncludingGravity->canProvideX() || m_accelerationIncludingGravity->canProvideY() || m_accelerationIncludingGravity->canProvideZ());
+ const bool hasRotationRate = m_rotationRate && (m_rotationRate->canProvideAlpha() || m_rotationRate->canProvideBeta() || m_rotationRate->canProvideGamma());
+
+ return hasAcceleration || hasAccelerationIncludingGravity || hasRotationRate;
+}
+
} // namespace WebCore
« no previous file with comments | « Source/modules/device_orientation/DeviceMotionData.h ('k') | Source/modules/device_orientation/DeviceMotionDispatcher.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698