OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2010 Google Inc. All rights reserved. | 2 * Copyright (C) 2010 Google 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 21 matching lines...) Expand all Loading... |
32 | 32 |
33 namespace blink { | 33 namespace blink { |
34 | 34 |
35 void V8DeviceOrientationEvent::initDeviceOrientationEventMethodCustom(const v8::
FunctionCallbackInfo<v8::Value>& info) | 35 void V8DeviceOrientationEvent::initDeviceOrientationEventMethodCustom(const v8::
FunctionCallbackInfo<v8::Value>& info) |
36 { | 36 { |
37 ExceptionState exceptionState(ExceptionState::ExecutionContext, "initDeviceO
rientationEvent", "DeviceOrientationEvent", info.Holder(), info.GetIsolate()); | 37 ExceptionState exceptionState(ExceptionState::ExecutionContext, "initDeviceO
rientationEvent", "DeviceOrientationEvent", info.Holder(), info.GetIsolate()); |
38 DeviceOrientationEvent* impl = V8DeviceOrientationEvent::toImpl(info.Holder(
)); | 38 DeviceOrientationEvent* impl = V8DeviceOrientationEvent::toImpl(info.Holder(
)); |
39 V8StringResource<> type(info[0]); | 39 V8StringResource<> type(info[0]); |
40 if (!type.prepare()) | 40 if (!type.prepare()) |
41 return; | 41 return; |
42 bool bubbles = info[1]->BooleanValue(); | 42 v8::Local<v8::Context> context = info.GetIsolate()->GetCurrentContext(); |
43 bool cancelable = info[2]->BooleanValue(); | 43 bool bubbles; |
| 44 V8_MAYBE(bubbles, info[1], BooleanValue(context), return); |
| 45 bool cancelable; |
| 46 V8_MAYBE(cancelable, info[2], BooleanValue(context), return); |
44 // If alpha, beta, gamma or absolute are null or undefined, mark them as not
provided. | 47 // If alpha, beta, gamma or absolute are null or undefined, mark them as not
provided. |
45 // Otherwise, use the standard JavaScript conversion. | 48 // Otherwise, use the standard JavaScript conversion. |
46 bool alphaProvided = !isUndefinedOrNull(info[3]); | 49 bool alphaProvided = !isUndefinedOrNull(info[3]); |
47 double alpha = 0; | 50 double alpha = 0; |
48 if (alphaProvided) { | 51 if (alphaProvided) { |
49 alpha = toRestrictedDouble(info[3], exceptionState); | 52 alpha = toRestrictedDouble(info[3], exceptionState); |
50 if (exceptionState.throwIfNeeded()) | 53 if (exceptionState.throwIfNeeded()) |
51 return; | 54 return; |
52 } | 55 } |
53 bool betaProvided = !isUndefinedOrNull(info[4]); | 56 bool betaProvided = !isUndefinedOrNull(info[4]); |
(...skipping 10 matching lines...) Expand all Loading... |
64 if (exceptionState.throwIfNeeded()) | 67 if (exceptionState.throwIfNeeded()) |
65 return; | 68 return; |
66 } | 69 } |
67 bool absoluteProvided = !isUndefinedOrNull(info[6]); | 70 bool absoluteProvided = !isUndefinedOrNull(info[6]); |
68 bool absolute = info[6]->BooleanValue(); | 71 bool absolute = info[6]->BooleanValue(); |
69 DeviceOrientationData* orientation = DeviceOrientationData::create(alphaProv
ided, alpha, betaProvided, beta, gammaProvided, gamma, absoluteProvided, absolut
e); | 72 DeviceOrientationData* orientation = DeviceOrientationData::create(alphaProv
ided, alpha, betaProvided, beta, gammaProvided, gamma, absoluteProvided, absolut
e); |
70 impl->initDeviceOrientationEvent(type, bubbles, cancelable, orientation); | 73 impl->initDeviceOrientationEvent(type, bubbles, cancelable, orientation); |
71 } | 74 } |
72 | 75 |
73 } // namespace blink | 76 } // namespace blink |
OLD | NEW |