| 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 12 matching lines...) Expand all Loading... |
| 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 "bindings/modules/v8/V8DeviceMotionEvent.h" | 27 #include "bindings/modules/v8/V8DeviceMotionEvent.h" |
| 28 | 28 |
| 29 #include "bindings/core/v8/V8Binding.h" | 29 #include "bindings/core/v8/V8Binding.h" |
| 30 #include "modules/device_orientation/DeviceMotionData.h" | 30 #include "modules/device_orientation/DeviceMotionData.h" |
| 31 #include <v8.h> | 31 #include <v8.h> |
| 32 | 32 |
| 33 namespace WebCore { | 33 namespace blink { |
| 34 | 34 |
| 35 namespace { | 35 namespace { |
| 36 | 36 |
| 37 PassRefPtrWillBeRawPtr<DeviceMotionData::Acceleration> readAccelerationArgument(
v8::Local<v8::Value> value, v8::Isolate* isolate) | 37 PassRefPtrWillBeRawPtr<DeviceMotionData::Acceleration> readAccelerationArgument(
v8::Local<v8::Value> value, v8::Isolate* isolate) |
| 38 { | 38 { |
| 39 if (isUndefinedOrNull(value)) | 39 if (isUndefinedOrNull(value)) |
| 40 return nullptr; | 40 return nullptr; |
| 41 | 41 |
| 42 // Given the test above, this will always yield an object. | 42 // Given the test above, this will always yield an object. |
| 43 v8::Local<v8::Object> object = value->ToObject(); | 43 v8::Local<v8::Object> object = value->ToObject(); |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 109 bool cancelable = info[2]->BooleanValue(); | 109 bool cancelable = info[2]->BooleanValue(); |
| 110 RefPtrWillBeRawPtr<DeviceMotionData::Acceleration> acceleration = readAccele
rationArgument(info[3], isolate); | 110 RefPtrWillBeRawPtr<DeviceMotionData::Acceleration> acceleration = readAccele
rationArgument(info[3], isolate); |
| 111 RefPtrWillBeRawPtr<DeviceMotionData::Acceleration> accelerationIncludingGrav
ity = readAccelerationArgument(info[4], isolate); | 111 RefPtrWillBeRawPtr<DeviceMotionData::Acceleration> accelerationIncludingGrav
ity = readAccelerationArgument(info[4], isolate); |
| 112 RefPtrWillBeRawPtr<DeviceMotionData::RotationRate> rotationRate = readRotati
onRateArgument(info[5], isolate); | 112 RefPtrWillBeRawPtr<DeviceMotionData::RotationRate> rotationRate = readRotati
onRateArgument(info[5], isolate); |
| 113 bool intervalProvided = !isUndefinedOrNull(info[6]); | 113 bool intervalProvided = !isUndefinedOrNull(info[6]); |
| 114 double interval = info[6]->NumberValue(); | 114 double interval = info[6]->NumberValue(); |
| 115 RefPtrWillBeRawPtr<DeviceMotionData> deviceMotionData = DeviceMotionData::cr
eate(acceleration.release(), accelerationIncludingGravity.release(), rotationRat
e.release(), intervalProvided, interval); | 115 RefPtrWillBeRawPtr<DeviceMotionData> deviceMotionData = DeviceMotionData::cr
eate(acceleration.release(), accelerationIncludingGravity.release(), rotationRat
e.release(), intervalProvided, interval); |
| 116 impl->initDeviceMotionEvent(type, bubbles, cancelable, deviceMotionData.get(
)); | 116 impl->initDeviceMotionEvent(type, bubbles, cancelable, deviceMotionData.get(
)); |
| 117 } | 117 } |
| 118 | 118 |
| 119 } // namespace WebCore | 119 } // namespace blink |
| OLD | NEW |