| OLD | NEW |
| 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 Loading... |
| 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 |
| OLD | NEW |