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 11 matching lines...) Expand all Loading... |
22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | 22 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 23 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "modules/device_orientation/DeviceMotionData.h" | 27 #include "modules/device_orientation/DeviceMotionData.h" |
28 #include "public/platform/WebDeviceMotionData.h" | 28 #include "public/platform/WebDeviceMotionData.h" |
29 | 29 |
30 namespace WebCore { | 30 namespace WebCore { |
31 | 31 |
32 DEFINE_GC_INFO(DeviceMotionData::Acceleration); | |
33 DEFINE_GC_INFO(DeviceMotionData::RotationRate); | |
34 DEFINE_GC_INFO(DeviceMotionData); | |
35 | |
36 PassRefPtrWillBeRawPtr<DeviceMotionData::Acceleration> DeviceMotionData::Acceler
ation::create( | 32 PassRefPtrWillBeRawPtr<DeviceMotionData::Acceleration> DeviceMotionData::Acceler
ation::create( |
37 bool canProvideX, double x, bool canProvideY, double y, bool canProvideZ, do
uble z) | 33 bool canProvideX, double x, bool canProvideY, double y, bool canProvideZ, do
uble z) |
38 { | 34 { |
39 return adoptRefWillBeNoop(new DeviceMotionData::Acceleration(canProvideX, x,
canProvideY, y, canProvideZ, z)); | 35 return adoptRefWillBeNoop(new DeviceMotionData::Acceleration(canProvideX, x,
canProvideY, y, canProvideZ, z)); |
40 } | 36 } |
41 | 37 |
42 DeviceMotionData::Acceleration::Acceleration(bool canProvideX, double x, bool ca
nProvideY, double y, bool canProvideZ, double z) | 38 DeviceMotionData::Acceleration::Acceleration(bool canProvideX, double x, bool ca
nProvideY, double y, bool canProvideZ, double z) |
43 : m_x(x) | 39 : m_x(x) |
44 , m_y(y) | 40 , m_y(y) |
45 , m_z(z) | 41 , m_z(z) |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 bool DeviceMotionData::canProvideEventData() const | 125 bool DeviceMotionData::canProvideEventData() const |
130 { | 126 { |
131 const bool hasAcceleration = m_acceleration && (m_acceleration->canProvideX(
) || m_acceleration->canProvideY() || m_acceleration->canProvideZ()); | 127 const bool hasAcceleration = m_acceleration && (m_acceleration->canProvideX(
) || m_acceleration->canProvideY() || m_acceleration->canProvideZ()); |
132 const bool hasAccelerationIncludingGravity = m_accelerationIncludingGravity
&& (m_accelerationIncludingGravity->canProvideX() || m_accelerationIncludingGrav
ity->canProvideY() || m_accelerationIncludingGravity->canProvideZ()); | 128 const bool hasAccelerationIncludingGravity = m_accelerationIncludingGravity
&& (m_accelerationIncludingGravity->canProvideX() || m_accelerationIncludingGrav
ity->canProvideY() || m_accelerationIncludingGravity->canProvideZ()); |
133 const bool hasRotationRate = m_rotationRate && (m_rotationRate->canProvideAl
pha() || m_rotationRate->canProvideBeta() || m_rotationRate->canProvideGamma()); | 129 const bool hasRotationRate = m_rotationRate && (m_rotationRate->canProvideAl
pha() || m_rotationRate->canProvideBeta() || m_rotationRate->canProvideGamma()); |
134 | 130 |
135 return hasAcceleration || hasAccelerationIncludingGravity || hasRotationRate
; | 131 return hasAcceleration || hasAccelerationIncludingGravity || hasRotationRate
; |
136 } | 132 } |
137 | 133 |
138 } // namespace WebCore | 134 } // namespace WebCore |
OLD | NEW |