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 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
95 if (!canProvideAlpha && !canProvideBeta && !canProvideGamma) | 95 if (!canProvideAlpha && !canProvideBeta && !canProvideGamma) |
96 return nullptr; | 96 return nullptr; |
97 | 97 |
98 return DeviceMotionData::RotationRate::create(canProvideAlpha, alpha, canPro
videBeta, beta, canProvideGamma, gamma); | 98 return DeviceMotionData::RotationRate::create(canProvideAlpha, alpha, canPro
videBeta, beta, canProvideGamma, gamma); |
99 } | 99 } |
100 | 100 |
101 } // namespace | 101 } // namespace |
102 | 102 |
103 void V8DeviceMotionEvent::initDeviceMotionEventMethodCustom(const v8::FunctionCa
llbackInfo<v8::Value>& info) | 103 void V8DeviceMotionEvent::initDeviceMotionEventMethodCustom(const v8::FunctionCa
llbackInfo<v8::Value>& info) |
104 { | 104 { |
| 105 ExceptionState exceptionState(ExceptionState::ExecutionContext, "initDeviceM
otionEvent", "DeviceMotionEvent", info.Holder(), info.GetIsolate()); |
105 DeviceMotionEvent* impl = V8DeviceMotionEvent::toImpl(info.Holder()); | 106 DeviceMotionEvent* impl = V8DeviceMotionEvent::toImpl(info.Holder()); |
106 v8::Isolate* isolate = info.GetIsolate(); | 107 v8::Isolate* isolate = info.GetIsolate(); |
107 TOSTRING_VOID(V8StringResource<>, type, info[0]); | 108 V8StringResource<> type(info[0]); |
| 109 if (!type.prepare()) |
| 110 return; |
108 bool bubbles = info[1]->BooleanValue(); | 111 bool bubbles = info[1]->BooleanValue(); |
109 bool cancelable = info[2]->BooleanValue(); | 112 bool cancelable = info[2]->BooleanValue(); |
110 DeviceMotionData::Acceleration* acceleration = readAccelerationArgument(info
[3], isolate); | 113 DeviceMotionData::Acceleration* acceleration = readAccelerationArgument(info
[3], isolate); |
111 DeviceMotionData::Acceleration* accelerationIncludingGravity = readAccelerat
ionArgument(info[4], isolate); | 114 DeviceMotionData::Acceleration* accelerationIncludingGravity = readAccelerat
ionArgument(info[4], isolate); |
112 DeviceMotionData::RotationRate* rotationRate = readRotationRateArgument(info
[5], isolate); | 115 DeviceMotionData::RotationRate* rotationRate = readRotationRateArgument(info
[5], isolate); |
113 bool intervalProvided = !isUndefinedOrNull(info[6]); | 116 bool intervalProvided = !isUndefinedOrNull(info[6]); |
114 double interval = info[6]->NumberValue(); | 117 double interval = 0; |
| 118 if (intervalProvided) { |
| 119 interval = toRestrictedDouble(info[6], exceptionState); |
| 120 if (exceptionState.throwIfNeeded()) |
| 121 return; |
| 122 } |
115 DeviceMotionData* deviceMotionData = DeviceMotionData::create(acceleration,
accelerationIncludingGravity, rotationRate, intervalProvided, interval); | 123 DeviceMotionData* deviceMotionData = DeviceMotionData::create(acceleration,
accelerationIncludingGravity, rotationRate, intervalProvided, interval); |
116 impl->initDeviceMotionEvent(type, bubbles, cancelable, deviceMotionData); | 124 impl->initDeviceMotionEvent(type, bubbles, cancelable, deviceMotionData); |
117 } | 125 } |
118 | 126 |
119 } // namespace blink | 127 } // namespace blink |
OLD | NEW |