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 |
14 * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | 14 * ANY 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 |
17 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 17 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL |
18 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | 18 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR |
19 * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON | 19 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER |
20 * ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | 20 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, |
21 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THI
S | 21 * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
22 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | 22 * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
23 * | 23 * |
24 */ | 24 */ |
25 | 25 |
26 #include "core/dom/ScriptedAnimationController.h" | 26 #include "core/dom/ScriptedAnimationController.h" |
27 | 27 |
28 #include "core/css/MediaQueryListListener.h" | 28 #include "core/css/MediaQueryListListener.h" |
29 #include "core/dom/Document.h" | 29 #include "core/dom/Document.h" |
30 #include "core/dom/FrameRequestCallback.h" | 30 #include "core/dom/FrameRequestCallback.h" |
31 #include "core/events/Event.h" | 31 #include "core/events/Event.h" |
32 #include "core/frame/FrameView.h" | 32 #include "core/frame/FrameView.h" |
(...skipping 17 matching lines...) Expand all Loading... |
50 visitor->trace(m_eventQueue); | 50 visitor->trace(m_eventQueue); |
51 visitor->trace(m_mediaQueryListListeners); | 51 visitor->trace(m_mediaQueryListListeners); |
52 visitor->trace(m_perFrameEvents); | 52 visitor->trace(m_perFrameEvents); |
53 } | 53 } |
54 | 54 |
55 void ScriptedAnimationController::suspend() { | 55 void ScriptedAnimationController::suspend() { |
56 ++m_suspendCount; | 56 ++m_suspendCount; |
57 } | 57 } |
58 | 58 |
59 void ScriptedAnimationController::resume() { | 59 void ScriptedAnimationController::resume() { |
60 // It would be nice to put an DCHECK(m_suspendCount > 0) here, but in WK1 resu
me() can be called | 60 // It would be nice to put an DCHECK(m_suspendCount > 0) here, but in WK1 |
61 // even when suspend hasn't (if a tab was created in the background). | 61 // resume() can be called even when suspend hasn't (if a tab was created in |
| 62 // the background). |
62 if (m_suspendCount > 0) | 63 if (m_suspendCount > 0) |
63 --m_suspendCount; | 64 --m_suspendCount; |
64 scheduleAnimationIfNeeded(); | 65 scheduleAnimationIfNeeded(); |
65 } | 66 } |
66 | 67 |
67 void ScriptedAnimationController::dispatchEventsAndCallbacksForPrinting() { | 68 void ScriptedAnimationController::dispatchEventsAndCallbacksForPrinting() { |
68 dispatchEvents(EventNames::MediaQueryListEvent); | 69 dispatchEvents(EventNames::MediaQueryListEvent); |
69 callMediaQueryListListeners(); | 70 callMediaQueryListListeners(); |
70 } | 71 } |
71 | 72 |
(...skipping 22 matching lines...) Expand all Loading... |
94 events.append(event.release()); | 95 events.append(event.release()); |
95 } else { | 96 } else { |
96 remaining.append(event.release()); | 97 remaining.append(event.release()); |
97 } | 98 } |
98 } | 99 } |
99 remaining.swap(m_eventQueue); | 100 remaining.swap(m_eventQueue); |
100 } | 101 } |
101 | 102 |
102 for (size_t i = 0; i < events.size(); ++i) { | 103 for (size_t i = 0; i < events.size(); ++i) { |
103 EventTarget* eventTarget = events[i]->target(); | 104 EventTarget* eventTarget = events[i]->target(); |
104 // FIXME: we should figure out how to make dispatchEvent properly virtual to
avoid | 105 // FIXME: we should figure out how to make dispatchEvent properly virtual to |
105 // special casting window. | 106 // avoid special casting window. |
106 // FIXME: We should not fire events for nodes that are no longer in the tree
. | 107 // FIXME: We should not fire events for nodes that are no longer in the |
| 108 // tree. |
107 InspectorInstrumentation::AsyncTask asyncTask( | 109 InspectorInstrumentation::AsyncTask asyncTask( |
108 eventTarget->getExecutionContext(), events[i]); | 110 eventTarget->getExecutionContext(), events[i]); |
109 if (LocalDOMWindow* window = eventTarget->toLocalDOMWindow()) | 111 if (LocalDOMWindow* window = eventTarget->toLocalDOMWindow()) |
110 window->dispatchEvent(events[i], nullptr); | 112 window->dispatchEvent(events[i], nullptr); |
111 else | 113 else |
112 eventTarget->dispatchEvent(events[i]); | 114 eventTarget->dispatchEvent(events[i]); |
113 } | 115 } |
114 } | 116 } |
115 | 117 |
116 void ScriptedAnimationController::executeCallbacks(double monotonicTimeNow) { | 118 void ScriptedAnimationController::executeCallbacks(double monotonicTimeNow) { |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 return; | 186 return; |
185 | 187 |
186 if (!m_document) | 188 if (!m_document) |
187 return; | 189 return; |
188 | 190 |
189 if (FrameView* frameView = m_document->view()) | 191 if (FrameView* frameView = m_document->view()) |
190 frameView->scheduleAnimation(); | 192 frameView->scheduleAnimation(); |
191 } | 193 } |
192 | 194 |
193 } // namespace blink | 195 } // namespace blink |
OLD | NEW |