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 |
11 * documentation and/or other materials provided with the distribution. | 11 * documentation and/or other materials provided with the distribution. |
12 * | 12 * |
13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND A NY | 13 * THIS SOFTWARE IS PROVIDED BY APPLE INC. AND ITS CONTRIBUTORS ``AS IS'' AND A NY |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | 15 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE |
16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR A NY | 16 * DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR ITS CONTRIBUTORS BE LIABLE FOR A NY |
17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES |
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; |
19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | 19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON |
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THI S | 21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THI S |
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 * | 23 * |
24 */ | 24 */ |
25 | 25 |
26 #include "config.h" | 26 #include "config.h" |
27 #include "core/dom/ScriptedAnimationController.h" | 27 #include "core/dom/ScriptedAnimationController.h" |
28 | 28 |
29 #include "core/css/MediaQueryMatcher.h" | |
29 #include "core/dom/Document.h" | 30 #include "core/dom/Document.h" |
30 #include "core/dom/RequestAnimationFrameCallback.h" | 31 #include "core/dom/RequestAnimationFrameCallback.h" |
31 #include "core/events/Event.h" | 32 #include "core/events/Event.h" |
32 #include "core/frame/LocalDOMWindow.h" | 33 #include "core/frame/LocalDOMWindow.h" |
33 #include "core/frame/FrameView.h" | 34 #include "core/frame/FrameView.h" |
34 #include "core/inspector/InspectorInstrumentation.h" | 35 #include "core/inspector/InspectorInstrumentation.h" |
35 #include "core/inspector/InspectorTraceEvents.h" | 36 #include "core/inspector/InspectorTraceEvents.h" |
36 #include "core/loader/DocumentLoader.h" | 37 #include "core/loader/DocumentLoader.h" |
37 | 38 |
38 namespace WebCore { | 39 namespace WebCore { |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
164 InspectorInstrumentation::didFireAnimationFrame(cookie); | 165 InspectorInstrumentation::didFireAnimationFrame(cookie); |
165 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", "data", InspectorUpdateCountersEvent::data()); | 166 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", "data", InspectorUpdateCountersEvent::data()); |
166 } | 167 } |
167 } | 168 } |
168 | 169 |
169 m_callbacksToInvoke.clear(); | 170 m_callbacksToInvoke.clear(); |
170 } | 171 } |
171 | 172 |
172 void ScriptedAnimationController::serviceScriptedAnimations(double monotonicTime Now) | 173 void ScriptedAnimationController::serviceScriptedAnimations(double monotonicTime Now) |
173 { | 174 { |
174 if (!m_callbacks.size() && !m_eventQueue.size()) | 175 if (!m_callbacks.size() && !m_eventQueue.size() && !m_document->mediaQueryMa tcher().hasDelayedListeners()) |
175 return; | 176 return; |
176 | 177 |
177 if (m_suspendCount) | 178 if (m_suspendCount) |
178 return; | 179 return; |
179 | 180 |
180 RefPtrWillBeRawPtr<ScriptedAnimationController> protect(this); | 181 RefPtrWillBeRawPtr<ScriptedAnimationController> protect(this); |
181 | 182 |
183 m_document->mediaQueryMatcher().notifyDelayedListeners(); | |
182 dispatchEvents(); | 184 dispatchEvents(); |
183 executeCallbacks(monotonicTimeNow); | 185 executeCallbacks(monotonicTimeNow); |
184 | 186 |
185 scheduleAnimationIfNeeded(); | 187 scheduleAnimationIfNeeded(); |
186 } | 188 } |
187 | 189 |
188 void ScriptedAnimationController::enqueueEvent(PassRefPtrWillBeRawPtr<Event> eve nt) | 190 void ScriptedAnimationController::enqueueEvent(PassRefPtrWillBeRawPtr<Event> eve nt) |
189 { | 191 { |
190 InspectorInstrumentation::didEnqueueEvent(event->target(), event.get()); | 192 InspectorInstrumentation::didEnqueueEvent(event->target(), event.get()); |
191 m_eventQueue.append(event); | 193 m_eventQueue.append(event); |
192 scheduleAnimationIfNeeded(); | 194 scheduleAnimationIfNeeded(); |
193 } | 195 } |
194 | 196 |
195 void ScriptedAnimationController::enqueuePerFrameEvent(PassRefPtrWillBeRawPtr<Ev ent> event) | 197 void ScriptedAnimationController::enqueuePerFrameEvent(PassRefPtrWillBeRawPtr<Ev ent> event) |
196 { | 198 { |
197 if (!m_perFrameEvents.add(eventTargetKey(event.get())).isNewEntry) | 199 if (!m_perFrameEvents.add(eventTargetKey(event.get())).isNewEntry) |
198 return; | 200 return; |
199 enqueueEvent(event); | 201 enqueueEvent(event); |
200 } | 202 } |
201 | 203 |
202 void ScriptedAnimationController::scheduleAnimationIfNeeded() | 204 void ScriptedAnimationController::scheduleAnimationIfNeeded() |
203 { | 205 { |
204 if (!m_document) | 206 if (!m_document) |
205 return; | 207 return; |
206 | 208 |
207 if (m_suspendCount) | 209 if (m_suspendCount) |
208 return; | 210 return; |
209 | 211 |
210 if (!m_callbacks.size() && !m_eventQueue.size()) | 212 if (!m_callbacks.size() && !m_eventQueue.size() && !m_document->mediaQueryMa tcher().hasDelayedListeners()) |
esprehn
2014/07/01 00:01:06
ScriptedAnimationController should not be reaching
cbiesinger
2014/07/01 00:12:09
So, what should I do instead?
| |
211 return; | 213 return; |
212 | 214 |
213 if (FrameView* frameView = m_document->view()) | 215 if (FrameView* frameView = m_document->view()) |
214 frameView->scheduleAnimation(); | 216 frameView->scheduleAnimation(); |
215 } | 217 } |
216 | 218 |
217 } | 219 } |
OLD | NEW |