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

Unified Diff: third_party/WebKit/Source/core/dom/ScriptedAnimationController.cpp

Issue 2202493002: NOT FOR REVIEW: Fullscreen WIP (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase Created 4 years, 1 month 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 side-by-side diff with in-line comments
Download patch
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);

Powered by Google App Engine
This is Rietveld 408576698