Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(168)

Side by Side Diff: sky/engine/core/dom/ScriptedAnimationController.cpp

Issue 880473003: sky-scrollable should use a reasonable fling curve (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Now with heights Created 5 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
123 eventTarget->dispatchEvent(events[i]); 123 eventTarget->dispatchEvent(events[i]);
124 } 124 }
125 } 125 }
126 126
127 void ScriptedAnimationController::executeCallbacks(double monotonicTimeNow) 127 void ScriptedAnimationController::executeCallbacks(double monotonicTimeNow)
128 { 128 {
129 // dispatchEvents() runs script which can cause the document to be destroyed . 129 // dispatchEvents() runs script which can cause the document to be destroyed .
130 if (!m_document) 130 if (!m_document)
131 return; 131 return;
132 132
133 double highResNowMs = 1000.0 * m_document->timing()->monotonicTimeToZeroBase dDocumentTime(monotonicTimeNow); 133 double highResNowMs = 1000.0 * monotonicTimeNow;
134 double legacyHighResNowMs = 1000.0 * m_document->timing()->monotonicTimeToPs eudoWallTime(monotonicTimeNow);
135 134
136 // First, generate a list of callbacks to consider. Callbacks registered fr om this point 135 // First, generate a list of callbacks to consider. Callbacks registered fr om this point
137 // on are considered only for the "next" frame, not this one. 136 // on are considered only for the "next" frame, not this one.
138 ASSERT(m_callbacksToInvoke.isEmpty()); 137 ASSERT(m_callbacksToInvoke.isEmpty());
139 m_callbacksToInvoke.swap(m_callbacks); 138 m_callbacksToInvoke.swap(m_callbacks);
140 139
141 for (size_t i = 0; i < m_callbacksToInvoke.size(); ++i) { 140 for (size_t i = 0; i < m_callbacksToInvoke.size(); ++i) {
142 RequestAnimationFrameCallback* callback = m_callbacksToInvoke[i].get(); 141 RequestAnimationFrameCallback* callback = m_callbacksToInvoke[i].get();
143 if (!callback->m_cancelled) { 142 if (!callback->m_cancelled)
144 TRACE_EVENT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "FireAn imationFrame", "data", InspectorAnimationFrameEvent::data(m_document, callback-> m_id)); 143 callback->handleEvent(highResNowMs);
145 if (callback->m_useLegacyTimeBase)
146 callback->handleEvent(legacyHighResNowMs);
147 else
148 callback->handleEvent(highResNowMs);
149 TRACE_EVENT_INSTANT1(TRACE_DISABLED_BY_DEFAULT("devtools.timeline"), "UpdateCounters", TRACE_EVENT_SCOPE_PROCESS, "data", InspectorUpdateCountersEve nt::data());
150 }
151 } 144 }
152 145
153 m_callbacksToInvoke.clear(); 146 m_callbacksToInvoke.clear();
154 } 147 }
155 148
156 void ScriptedAnimationController::callMediaQueryListListeners() 149 void ScriptedAnimationController::callMediaQueryListListeners()
157 { 150 {
158 MediaQueryListListeners listeners; 151 MediaQueryListListeners listeners;
159 listeners.swap(m_mediaQueryListListeners); 152 listeners.swap(m_mediaQueryListListeners);
160 153
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 return; 217 return;
225 218
226 if (!m_callbacks.size() && !m_eventQueue.size() && !m_mediaQueryListListener s.size()) 219 if (!m_callbacks.size() && !m_eventQueue.size() && !m_mediaQueryListListener s.size())
227 return; 220 return;
228 221
229 if (FrameView* frameView = m_document->view()) 222 if (FrameView* frameView = m_document->view())
230 frameView->scheduleAnimation(); 223 frameView->scheduleAnimation();
231 } 224 }
232 225
233 } 226 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698