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 17 matching lines...) Expand all Loading... |
28 | 28 |
29 #include "bindings/v8/V8Binding.h" | 29 #include "bindings/v8/V8Binding.h" |
30 #include "modules/device_orientation/DeviceOrientationData.h" | 30 #include "modules/device_orientation/DeviceOrientationData.h" |
31 #include <v8.h> | 31 #include <v8.h> |
32 | 32 |
33 namespace WebCore { | 33 namespace WebCore { |
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 DeviceOrientationEvent* impl = V8DeviceOrientationEvent::toNative(info.Holde
r()); | 37 DeviceOrientationEvent* impl = V8DeviceOrientationEvent::toNative(info.Holde
r()); |
38 V8TRYCATCH_FOR_V8STRINGRESOURCE_VOID(V8StringResource<>, type, info[0]); | 38 V8STRINGRESOURCE_PREPARE_VOID(V8StringResource<>, type, info[0]); |
39 bool bubbles = info[1]->BooleanValue(); | 39 bool bubbles = info[1]->BooleanValue(); |
40 bool cancelable = info[2]->BooleanValue(); | 40 bool cancelable = info[2]->BooleanValue(); |
41 // If alpha, beta, gamma or absolute are null or undefined, mark them as not
provided. | 41 // If alpha, beta, gamma or absolute are null or undefined, mark them as not
provided. |
42 // Otherwise, use the standard JavaScript conversion. | 42 // Otherwise, use the standard JavaScript conversion. |
43 bool alphaProvided = !isUndefinedOrNull(info[3]); | 43 bool alphaProvided = !isUndefinedOrNull(info[3]); |
44 double alpha = info[3]->NumberValue(); | 44 double alpha = info[3]->NumberValue(); |
45 bool betaProvided = !isUndefinedOrNull(info[4]); | 45 bool betaProvided = !isUndefinedOrNull(info[4]); |
46 double beta = info[4]->NumberValue(); | 46 double beta = info[4]->NumberValue(); |
47 bool gammaProvided = !isUndefinedOrNull(info[5]); | 47 bool gammaProvided = !isUndefinedOrNull(info[5]); |
48 double gamma = info[5]->NumberValue(); | 48 double gamma = info[5]->NumberValue(); |
49 bool absoluteProvided = !isUndefinedOrNull(info[6]); | 49 bool absoluteProvided = !isUndefinedOrNull(info[6]); |
50 bool absolute = info[6]->BooleanValue(); | 50 bool absolute = info[6]->BooleanValue(); |
51 RefPtrWillBeRawPtr<DeviceOrientationData> orientation = DeviceOrientationDat
a::create(alphaProvided, alpha, betaProvided, beta, gammaProvided, gamma, absolu
teProvided, absolute); | 51 RefPtrWillBeRawPtr<DeviceOrientationData> orientation = DeviceOrientationDat
a::create(alphaProvided, alpha, betaProvided, beta, gammaProvided, gamma, absolu
teProvided, absolute); |
52 impl->initDeviceOrientationEvent(type, bubbles, cancelable, orientation.get(
)); | 52 impl->initDeviceOrientationEvent(type, bubbles, cancelable, orientation.get(
)); |
53 } | 53 } |
54 | 54 |
55 } // namespace WebCore | 55 } // namespace WebCore |
OLD | NEW |