OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2010 Apple Inc. All rights reserved. | 2 * Copyright 2010 Apple Inc. All rights reserved. |
3 * Copyright (C) 2012 Samsung Electronics. All rights reserved. | 3 * Copyright (C) 2012 Samsung Electronics. All rights reserved. |
4 * | 4 * |
5 * Redistribution and use in source and binary forms, with or without | 5 * Redistribution and use in source and binary forms, with or without |
6 * modification, are permitted provided that the following conditions | 6 * modification, are permitted provided that the following conditions |
7 * are met: | 7 * are met: |
8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
10 * * Redistributions in binary form must reproduce the above copyright | 10 * * Redistributions in binary form must reproduce the above copyright |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 DeviceMotionDispatcher::instance().addDeviceMotionController(this); | 84 DeviceMotionDispatcher::instance().addDeviceMotionController(this); |
85 } | 85 } |
86 | 86 |
87 void DeviceMotionController::unregisterWithDispatcher() | 87 void DeviceMotionController::unregisterWithDispatcher() |
88 { | 88 { |
89 DeviceMotionDispatcher::instance().removeDeviceMotionController(this); | 89 DeviceMotionDispatcher::instance().removeDeviceMotionController(this); |
90 } | 90 } |
91 | 91 |
92 bool DeviceMotionController::isNullEvent(Event* event) | 92 bool DeviceMotionController::isNullEvent(Event* event) |
93 { | 93 { |
94 ASSERT(event->type() == EventNames::devicemotion); | 94 DeviceMotionEvent* motionEvent = toDeviceMotionEvent(event); |
95 DeviceMotionEvent* motionEvent = static_cast<DeviceMotionEvent*>(event); | |
96 return !motionEvent->deviceMotionData()->canProvideEventData(); | 95 return !motionEvent->deviceMotionData()->canProvideEventData(); |
97 } | 96 } |
98 | 97 |
99 void DeviceMotionController::didAddEventListener(DOMWindow*, const AtomicString&
eventType) | 98 void DeviceMotionController::didAddEventListener(DOMWindow*, const AtomicString&
eventType) |
100 { | 99 { |
101 if (eventType == EventNames::devicemotion && RuntimeEnabledFeatures::deviceM
otionEnabled()) { | 100 if (eventType == EventNames::devicemotion && RuntimeEnabledFeatures::deviceM
otionEnabled()) { |
102 if (page() && page()->visibilityState() == PageVisibilityStateVisible) | 101 if (page() && page()->visibilityState() == PageVisibilityStateVisible) |
103 startUpdating(); | 102 startUpdating(); |
104 m_hasEventListener = true; | 103 m_hasEventListener = true; |
105 } | 104 } |
(...skipping 18 matching lines...) Expand all Loading... |
124 if (!m_hasEventListener) | 123 if (!m_hasEventListener) |
125 return; | 124 return; |
126 | 125 |
127 if (page()->visibilityState() == PageVisibilityStateVisible) | 126 if (page()->visibilityState() == PageVisibilityStateVisible) |
128 startUpdating(); | 127 startUpdating(); |
129 else | 128 else |
130 stopUpdating(); | 129 stopUpdating(); |
131 } | 130 } |
132 | 131 |
133 } // namespace WebCore | 132 } // namespace WebCore |
OLD | NEW |