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

Side by Side 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, 4 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 unified diff | Download patch
OLDNEW
1 /* 1 /*
2 * Copyright (C) 2010 Apple Inc. All rights reserved. 2 * Copyright (C) 2010 Apple Inc. All rights reserved.
3 * 3 *
4 * Redistribution and use in source and binary forms, with or without 4 * Redistribution and use in source and binary forms, with or without
5 * modification, are permitted provided that the following conditions 5 * modification, are permitted provided that the following conditions
6 * are met: 6 * are met:
7 * * Redistributions of source code must retain the above copyright 7 * * Redistributions of source code must retain the above copyright
8 * notice, this list of conditions and the following disclaimer. 8 * notice, this list of conditions and the following disclaimer.
9 * * Redistributions in binary form must reproduce the above copyright 9 * * Redistributions in binary form must reproduce the above copyright
10 * notice, this list of conditions and the following disclaimer in the 10 * notice, this list of conditions and the following disclaimer in the
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 DeviceMotionData::DeviceMotionData(PassRefPtr<Acceleration> acceleration, PassRe fPtr<Acceleration> accelerationIncludingGravity, 102 DeviceMotionData::DeviceMotionData(PassRefPtr<Acceleration> acceleration, PassRe fPtr<Acceleration> accelerationIncludingGravity,
103 PassRefPtr<RotationRate> rotationRate, bool c anProvideInterval, double interval) 103 PassRefPtr<RotationRate> rotationRate, bool c anProvideInterval, double interval)
104 : m_acceleration(acceleration) 104 : m_acceleration(acceleration)
105 , m_accelerationIncludingGravity(accelerationIncludingGravity) 105 , m_accelerationIncludingGravity(accelerationIncludingGravity)
106 , m_rotationRate(rotationRate) 106 , m_rotationRate(rotationRate)
107 , m_canProvideInterval(canProvideInterval) 107 , m_canProvideInterval(canProvideInterval)
108 , m_interval(interval) 108 , m_interval(interval)
109 { 109 {
110 } 110 }
111 111
112 bool DeviceMotionData::canProvideEventData() const
113 {
114 const bool hasAcceleration = m_acceleration && (m_acceleration->canProvideX( ) || m_acceleration->canProvideY() || m_acceleration->canProvideZ());
115 const bool hasAccelerationIncludingGravity = m_accelerationIncludingGravity && (m_accelerationIncludingGravity->canProvideX() || m_accelerationIncludingGrav ity->canProvideY() || m_accelerationIncludingGravity->canProvideZ());
116 const bool hasRotationRate = m_rotationRate && (m_rotationRate->canProvideAl pha() || m_rotationRate->canProvideBeta() || m_rotationRate->canProvideGamma());
117
118 return hasAcceleration || hasAccelerationIncludingGravity || hasRotationRate ;
119 }
120
112 } // namespace WebCore 121 } // namespace WebCore
OLDNEW
« 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