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 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 DeviceOrientationDispatcher::instance().addDeviceOrientationController(this)
; | 82 DeviceOrientationDispatcher::instance().addDeviceOrientationController(this)
; |
83 } | 83 } |
84 | 84 |
85 void NewDeviceOrientationController::unregisterWithDispatcher() | 85 void NewDeviceOrientationController::unregisterWithDispatcher() |
86 { | 86 { |
87 DeviceOrientationDispatcher::instance().removeDeviceOrientationController(th
is); | 87 DeviceOrientationDispatcher::instance().removeDeviceOrientationController(th
is); |
88 } | 88 } |
89 | 89 |
90 bool NewDeviceOrientationController::isNullEvent(Event* event) | 90 bool NewDeviceOrientationController::isNullEvent(Event* event) |
91 { | 91 { |
92 ASSERT(event->type() == eventNames().deviceorientationEvent); | 92 DeviceOrientationEvent* orientationEvent = toDeviceOrientationEvent(event); |
93 DeviceOrientationEvent* orientationEvent = static_cast<DeviceOrientationEven
t*>(event); | |
94 return !orientationEvent->orientation()->canProvideEventData(); | 93 return !orientationEvent->orientation()->canProvideEventData(); |
95 } | 94 } |
96 | 95 |
97 void NewDeviceOrientationController::didAddEventListener(DOMWindow* window, cons
t AtomicString& eventType) | 96 void NewDeviceOrientationController::didAddEventListener(DOMWindow* window, cons
t AtomicString& eventType) |
98 { | 97 { |
99 if (eventType == eventNames().deviceorientationEvent && RuntimeEnabledFeatur
es::deviceOrientationEnabled()) | 98 if (eventType == eventNames().deviceorientationEvent && RuntimeEnabledFeatur
es::deviceOrientationEnabled()) |
100 startUpdating(); | 99 startUpdating(); |
101 } | 100 } |
102 | 101 |
103 void NewDeviceOrientationController::didRemoveEventListener(DOMWindow* window, c
onst AtomicString& eventType) | 102 void NewDeviceOrientationController::didRemoveEventListener(DOMWindow* window, c
onst AtomicString& eventType) |
104 { | 103 { |
105 if (eventType == eventNames().deviceorientationEvent) | 104 if (eventType == eventNames().deviceorientationEvent) |
106 stopUpdating(); | 105 stopUpdating(); |
107 } | 106 } |
108 | 107 |
109 void NewDeviceOrientationController::didRemoveAllEventListeners(DOMWindow* windo
w) | 108 void NewDeviceOrientationController::didRemoveAllEventListeners(DOMWindow* windo
w) |
110 { | 109 { |
111 stopUpdating(); | 110 stopUpdating(); |
112 } | 111 } |
113 | 112 |
114 } // namespace WebCore | 113 } // namespace WebCore |
OLD | NEW |