OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010, The Android Open Source Project | 2 * Copyright 2010, The Android Open Source Project |
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 29 matching lines...) Expand all Loading... |
40 const DeviceOrientationEventInit& initializer) | 40 const DeviceOrientationEventInit& initializer) |
41 : Event(eventType, initializer), | 41 : Event(eventType, initializer), |
42 m_orientation(DeviceOrientationData::create(initializer)) {} | 42 m_orientation(DeviceOrientationData::create(initializer)) {} |
43 | 43 |
44 DeviceOrientationEvent::DeviceOrientationEvent( | 44 DeviceOrientationEvent::DeviceOrientationEvent( |
45 const AtomicString& eventType, | 45 const AtomicString& eventType, |
46 DeviceOrientationData* orientation) | 46 DeviceOrientationData* orientation) |
47 : Event(eventType, false, false), // Can't bubble, not cancelable | 47 : Event(eventType, false, false), // Can't bubble, not cancelable |
48 m_orientation(orientation) {} | 48 m_orientation(orientation) {} |
49 | 49 |
50 void DeviceOrientationEvent::initDeviceOrientationEvent( | |
51 const AtomicString& type, | |
52 bool bubbles, | |
53 bool cancelable, | |
54 const Nullable<double>& alpha, | |
55 const Nullable<double>& beta, | |
56 const Nullable<double>& gamma, | |
57 bool absolute) { | |
58 if (isBeingDispatched()) | |
59 return; | |
60 | |
61 initEvent(type, bubbles, cancelable); | |
62 m_orientation = DeviceOrientationData::create(alpha, beta, gamma, absolute); | |
63 } | |
64 | |
65 double DeviceOrientationEvent::alpha(bool& isNull) const { | 50 double DeviceOrientationEvent::alpha(bool& isNull) const { |
66 if (m_orientation->canProvideAlpha()) | 51 if (m_orientation->canProvideAlpha()) |
67 return m_orientation->alpha(); | 52 return m_orientation->alpha(); |
68 | 53 |
69 isNull = true; | 54 isNull = true; |
70 return 0; | 55 return 0; |
71 } | 56 } |
72 | 57 |
73 double DeviceOrientationEvent::beta(bool& isNull) const { | 58 double DeviceOrientationEvent::beta(bool& isNull) const { |
74 if (m_orientation->canProvideBeta()) | 59 if (m_orientation->canProvideBeta()) |
(...skipping 18 matching lines...) Expand all Loading... |
93 const AtomicString& DeviceOrientationEvent::interfaceName() const { | 78 const AtomicString& DeviceOrientationEvent::interfaceName() const { |
94 return EventNames::DeviceOrientationEvent; | 79 return EventNames::DeviceOrientationEvent; |
95 } | 80 } |
96 | 81 |
97 DEFINE_TRACE(DeviceOrientationEvent) { | 82 DEFINE_TRACE(DeviceOrientationEvent) { |
98 visitor->trace(m_orientation); | 83 visitor->trace(m_orientation); |
99 Event::trace(visitor); | 84 Event::trace(visitor); |
100 } | 85 } |
101 | 86 |
102 } // namespace blink | 87 } // namespace blink |
OLD | NEW |