OLD | NEW |
1 /* | 1 /* |
2 * Copyright (C) 2011 Google Inc. All Rights Reserved. | 2 * Copyright (C) 2011 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 * 1. Redistributions of source code must retain the above copyright | 7 * 1. 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 * 2. Redistributions in binary form must reproduce the above copyright | 9 * 2. 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 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
115 InspectorInstrumentation::didCancelAnimationFrame(m_document, id); | 115 InspectorInstrumentation::didCancelAnimationFrame(m_document, id); |
116 m_callbacksToInvoke[i]->m_cancelled = true; | 116 m_callbacksToInvoke[i]->m_cancelled = true; |
117 // will be removed at the end of executeCallbacks() | 117 // will be removed at the end of executeCallbacks() |
118 return; | 118 return; |
119 } | 119 } |
120 } | 120 } |
121 } | 121 } |
122 | 122 |
123 void ScriptedAnimationController::dispatchEvents(const AtomicString& eventInterf
aceFilter) | 123 void ScriptedAnimationController::dispatchEvents(const AtomicString& eventInterf
aceFilter) |
124 { | 124 { |
125 WillBeHeapVector<RefPtrWillBeMember<Event> > events; | 125 WillBeHeapVector<RefPtrWillBeMember<Event>> events; |
126 if (eventInterfaceFilter.isEmpty()) { | 126 if (eventInterfaceFilter.isEmpty()) { |
127 events.swap(m_eventQueue); | 127 events.swap(m_eventQueue); |
128 m_perFrameEvents.clear(); | 128 m_perFrameEvents.clear(); |
129 } else { | 129 } else { |
130 WillBeHeapVector<RefPtrWillBeMember<Event> > remaining; | 130 WillBeHeapVector<RefPtrWillBeMember<Event>> remaining; |
131 for (auto& event : m_eventQueue) { | 131 for (auto& event : m_eventQueue) { |
132 if (event && event->interfaceName() == eventInterfaceFilter) { | 132 if (event && event->interfaceName() == eventInterfaceFilter) { |
133 m_perFrameEvents.remove(eventTargetKey(event.get())); | 133 m_perFrameEvents.remove(eventTargetKey(event.get())); |
134 events.append(event.release()); | 134 events.append(event.release()); |
135 } else { | 135 } else { |
136 remaining.append(event.release()); | 136 remaining.append(event.release()); |
137 } | 137 } |
138 } | 138 } |
139 remaining.swap(m_eventQueue); | 139 remaining.swap(m_eventQueue); |
140 } | 140 } |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
219 scheduleAnimationIfNeeded(); | 219 scheduleAnimationIfNeeded(); |
220 } | 220 } |
221 | 221 |
222 void ScriptedAnimationController::enqueuePerFrameEvent(PassRefPtrWillBeRawPtr<Ev
ent> event) | 222 void ScriptedAnimationController::enqueuePerFrameEvent(PassRefPtrWillBeRawPtr<Ev
ent> event) |
223 { | 223 { |
224 if (!m_perFrameEvents.add(eventTargetKey(event.get())).isNewEntry) | 224 if (!m_perFrameEvents.add(eventTargetKey(event.get())).isNewEntry) |
225 return; | 225 return; |
226 enqueueEvent(event); | 226 enqueueEvent(event); |
227 } | 227 } |
228 | 228 |
229 void ScriptedAnimationController::enqueueMediaQueryChangeListeners(WillBeHeapVec
tor<RefPtrWillBeMember<MediaQueryListListener> >& listeners) | 229 void ScriptedAnimationController::enqueueMediaQueryChangeListeners(WillBeHeapVec
tor<RefPtrWillBeMember<MediaQueryListListener>>& listeners) |
230 { | 230 { |
231 for (size_t i = 0; i < listeners.size(); ++i) { | 231 for (size_t i = 0; i < listeners.size(); ++i) { |
232 m_mediaQueryListListeners.add(listeners[i]); | 232 m_mediaQueryListListeners.add(listeners[i]); |
233 } | 233 } |
234 scheduleAnimationIfNeeded(); | 234 scheduleAnimationIfNeeded(); |
235 } | 235 } |
236 | 236 |
237 void ScriptedAnimationController::scheduleAnimationIfNeeded() | 237 void ScriptedAnimationController::scheduleAnimationIfNeeded() |
238 { | 238 { |
239 if (!m_document) | 239 if (!m_document) |
240 return; | 240 return; |
241 | 241 |
242 if (m_suspendCount) | 242 if (m_suspendCount) |
243 return; | 243 return; |
244 | 244 |
245 if (!m_callbacks.size() && !m_eventQueue.size() && !m_mediaQueryListListener
s.size()) | 245 if (!m_callbacks.size() && !m_eventQueue.size() && !m_mediaQueryListListener
s.size()) |
246 return; | 246 return; |
247 | 247 |
248 if (FrameView* frameView = m_document->view()) | 248 if (FrameView* frameView = m_document->view()) |
249 frameView->scheduleAnimation(); | 249 frameView->scheduleAnimation(); |
250 } | 250 } |
251 | 251 |
252 } | 252 } |
OLD | NEW |