| Index: third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp
|
| diff --git a/third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp b/third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp
|
| index 05e09a4ca48b9b9877118a3151132cf402a5f9fd..1fdfc54efb8cee105ecde2fe2434c650d7a155ed 100644
|
| --- a/third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp
|
| +++ b/third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp
|
| @@ -81,6 +81,13 @@ void ScriptedAnimationController::cancelCallback(CallbackId id) {
|
| m_callbackCollection.cancelCallback(id);
|
| }
|
|
|
| +void ScriptedAnimationController::runTasks() {
|
| + // TODO(foolip): can running a task append to the task queue?
|
| + for (std::unique_ptr<WTF::Closure>& task : m_taskQueue)
|
| + (*task)();
|
| + m_taskQueue.clear();
|
| +}
|
| +
|
| void ScriptedAnimationController::dispatchEvents(
|
| const AtomicString& eventInterfaceFilter) {
|
| HeapVector<Member<Event>> events;
|
| @@ -144,8 +151,8 @@ bool ScriptedAnimationController::hasScheduledItems() const {
|
| if (m_suspendCount)
|
| return false;
|
|
|
| - return !m_callbackCollection.isEmpty() || !m_eventQueue.isEmpty() ||
|
| - !m_mediaQueryListListeners.isEmpty();
|
| + return !m_callbackCollection.isEmpty() || !m_taskQueue.isEmpty() ||
|
| + !m_eventQueue.isEmpty() || !m_mediaQueryListListeners.isEmpty();
|
| }
|
|
|
| void ScriptedAnimationController::serviceScriptedAnimations(
|
| @@ -155,11 +162,18 @@ void ScriptedAnimationController::serviceScriptedAnimations(
|
|
|
| callMediaQueryListListeners();
|
| dispatchEvents();
|
| + runTasks(); // must be after resize event per spec
|
| executeCallbacks(monotonicTimeNow);
|
|
|
| scheduleAnimationIfNeeded();
|
| }
|
|
|
| +void ScriptedAnimationController::enqueueTask(
|
| + std::unique_ptr<WTF::Closure> task) {
|
| + m_taskQueue.append(std::move(task));
|
| + scheduleAnimationIfNeeded();
|
| +}
|
| +
|
| void ScriptedAnimationController::enqueueEvent(Event* event) {
|
| InspectorInstrumentation::asyncTaskScheduled(
|
| event->target()->getExecutionContext(), event->type(), event);
|
|
|