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 27 matching lines...) Expand all Loading... |
38 : m_orientation(DeviceOrientationData::create()) | 38 : m_orientation(DeviceOrientationData::create()) |
39 { | 39 { |
40 } | 40 } |
41 | 41 |
42 DeviceOrientationEvent::DeviceOrientationEvent(const AtomicString& eventType, De
viceOrientationData* orientation) | 42 DeviceOrientationEvent::DeviceOrientationEvent(const AtomicString& eventType, De
viceOrientationData* orientation) |
43 : Event(eventType, false, false) // Can't bubble, not cancelable | 43 : Event(eventType, false, false) // Can't bubble, not cancelable |
44 , m_orientation(orientation) | 44 , m_orientation(orientation) |
45 { | 45 { |
46 } | 46 } |
47 | 47 |
48 void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type
, bool bubbles, bool cancelable, DeviceOrientationData* orientation) | 48 void DeviceOrientationEvent::initDeviceOrientationEvent(const AtomicString& type
, bool bubbles, bool cancelable, const Nullable<double>& alpha, const Nullable<d
ouble>& beta, const Nullable<double>& gamma, const Nullable<bool>& absolute) |
49 { | 49 { |
50 if (dispatched()) | 50 if (dispatched()) |
51 return; | 51 return; |
52 | 52 |
53 initEvent(type, bubbles, cancelable); | 53 initEvent(type, bubbles, cancelable); |
54 m_orientation = orientation; | 54 m_orientation = DeviceOrientationData::create(alpha, beta, gamma, absolute); |
55 } | 55 } |
56 | 56 |
57 double DeviceOrientationEvent::alpha(bool& isNull) const | 57 double DeviceOrientationEvent::alpha(bool& isNull) const |
58 { | 58 { |
59 if (m_orientation->canProvideAlpha()) | 59 if (m_orientation->canProvideAlpha()) |
60 return m_orientation->alpha(); | 60 return m_orientation->alpha(); |
61 | 61 |
62 isNull = true; | 62 isNull = true; |
63 return 0; | 63 return 0; |
64 } | 64 } |
(...skipping 30 matching lines...) Expand all Loading... |
95 return EventNames::DeviceOrientationEvent; | 95 return EventNames::DeviceOrientationEvent; |
96 } | 96 } |
97 | 97 |
98 DEFINE_TRACE(DeviceOrientationEvent) | 98 DEFINE_TRACE(DeviceOrientationEvent) |
99 { | 99 { |
100 visitor->trace(m_orientation); | 100 visitor->trace(m_orientation); |
101 Event::trace(visitor); | 101 Event::trace(visitor); |
102 } | 102 } |
103 | 103 |
104 } // namespace blink | 104 } // namespace blink |
OLD | NEW |