| 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 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 100 if (event && event->interfaceName() == eventInterfaceFilter) { | 100 if (event && event->interfaceName() == eventInterfaceFilter) { |
| 101 m_perFrameEvents.remove(eventTargetKey(event.get())); | 101 m_perFrameEvents.remove(eventTargetKey(event.get())); |
| 102 events.append(event.release()); | 102 events.append(event.release()); |
| 103 } else { | 103 } else { |
| 104 remaining.append(event.release()); | 104 remaining.append(event.release()); |
| 105 } | 105 } |
| 106 } | 106 } |
| 107 remaining.swap(m_eventQueue); | 107 remaining.swap(m_eventQueue); |
| 108 } | 108 } |
| 109 | 109 |
| 110 for (size_t i = 0; i < events.size(); ++i) { | 110 for (const auto& event : events) { |
| 111 EventTarget* eventTarget = events[i]->target(); | 111 EventTarget* eventTarget = event->target(); |
| 112 // FIXME: we should figure out how to make dispatchEvent properly virtual to | 112 // FIXME: we should figure out how to make dispatchEvent properly virtual to |
| 113 // avoid special casting window. | 113 // avoid special casting window. |
| 114 // FIXME: We should not fire events for nodes that are no longer in the | 114 // FIXME: We should not fire events for nodes that are no longer in the |
| 115 // tree. | 115 // tree. |
| 116 InspectorInstrumentation::AsyncTask asyncTask( | 116 InspectorInstrumentation::AsyncTask asyncTask( |
| 117 eventTarget->getExecutionContext(), events[i]); | 117 eventTarget->getExecutionContext(), event); |
| 118 if (LocalDOMWindow* window = eventTarget->toLocalDOMWindow()) | 118 if (LocalDOMWindow* window = eventTarget->toLocalDOMWindow()) |
| 119 window->dispatchEvent(events[i], nullptr); | 119 window->dispatchEvent(event, nullptr); |
| 120 else | 120 else |
| 121 eventTarget->dispatchEvent(events[i]); | 121 eventTarget->dispatchEvent(event); |
| 122 } | 122 } |
| 123 } | 123 } |
| 124 | 124 |
| 125 void ScriptedAnimationController::executeCallbacks(double monotonicTimeNow) { | 125 void ScriptedAnimationController::executeCallbacks(double monotonicTimeNow) { |
| 126 // dispatchEvents() runs script which can cause the document to be destroyed. | 126 // dispatchEvents() runs script which can cause the document to be destroyed. |
| 127 if (!m_document) | 127 if (!m_document) |
| 128 return; | 128 return; |
| 129 | 129 |
| 130 double highResNowMs = | 130 double highResNowMs = |
| 131 1000.0 * | 131 1000.0 * |
| (...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 182 } | 182 } |
| 183 | 183 |
| 184 void ScriptedAnimationController::enqueuePerFrameEvent(Event* event) { | 184 void ScriptedAnimationController::enqueuePerFrameEvent(Event* event) { |
| 185 if (!m_perFrameEvents.add(eventTargetKey(event)).isNewEntry) | 185 if (!m_perFrameEvents.add(eventTargetKey(event)).isNewEntry) |
| 186 return; | 186 return; |
| 187 enqueueEvent(event); | 187 enqueueEvent(event); |
| 188 } | 188 } |
| 189 | 189 |
| 190 void ScriptedAnimationController::enqueueMediaQueryChangeListeners( | 190 void ScriptedAnimationController::enqueueMediaQueryChangeListeners( |
| 191 HeapVector<Member<MediaQueryListListener>>& listeners) { | 191 HeapVector<Member<MediaQueryListListener>>& listeners) { |
| 192 for (size_t i = 0; i < listeners.size(); ++i) { | 192 for (const auto& listener : listeners) { |
| 193 m_mediaQueryListListeners.add(listeners[i]); | 193 m_mediaQueryListListeners.add(listener); |
| 194 } | 194 } |
| 195 scheduleAnimationIfNeeded(); | 195 scheduleAnimationIfNeeded(); |
| 196 } | 196 } |
| 197 | 197 |
| 198 void ScriptedAnimationController::scheduleAnimationIfNeeded() { | 198 void ScriptedAnimationController::scheduleAnimationIfNeeded() { |
| 199 if (!hasScheduledItems()) | 199 if (!hasScheduledItems()) |
| 200 return; | 200 return; |
| 201 | 201 |
| 202 if (!m_document) | 202 if (!m_document) |
| 203 return; | 203 return; |
| 204 | 204 |
| 205 if (FrameView* frameView = m_document->view()) | 205 if (FrameView* frameView = m_document->view()) |
| 206 frameView->scheduleAnimation(); | 206 frameView->scheduleAnimation(); |
| 207 } | 207 } |
| 208 | 208 |
| 209 } // namespace blink | 209 } // namespace blink |
| OLD | NEW |