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

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

Issue 82843003: Fire overflowchanged events at raf timing (Closed) Base URL: svn://svn.chromium.org/blink/trunk
Patch Set: Add a test Created 7 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
« no previous file with comments | « Source/core/dom/ScriptedAnimationController.h ('k') | Source/core/frame/FrameView.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: Source/core/dom/ScriptedAnimationController.cpp
diff --git a/Source/core/dom/ScriptedAnimationController.cpp b/Source/core/dom/ScriptedAnimationController.cpp
index 6438e51afa9b6bf5fc83aa67cb3c06ddf43505ba..33446c8e85835e2137a614e139e4ec09dc0a5ec1 100644
--- a/Source/core/dom/ScriptedAnimationController.cpp
+++ b/Source/core/dom/ScriptedAnimationController.cpp
@@ -36,7 +36,7 @@
namespace WebCore {
-std::pair<EventTarget*, StringImpl*> scheduledEventTargetKey(const Event* event)
+std::pair<EventTarget*, StringImpl*> eventTargetKey(const Event* event)
{
return std::make_pair(event->target(), event->type().impl());
}
@@ -95,11 +95,13 @@ void ScriptedAnimationController::dispatchEvents()
{
Vector<RefPtr<Event> > events;
events.swap(m_eventQueue);
- m_scheduledEventTargets.clear();
+ m_perFrameEvents.clear();
for (size_t i = 0; i < events.size(); ++i) {
EventTarget* eventTarget = events[i]->target();
- // FIXME: we should figure out how to make dispatchEvent properly virtual to avoid this.
+ // FIXME: we should figure out how to make dispatchEvent properly virtual to avoid
+ // special casting window.
+ // FIXME: We should not fire events for nodes that are no longer in the tree.
if (DOMWindow* window = eventTarget->toDOMWindow())
window->dispatchEvent(events[i], 0);
else
@@ -158,14 +160,19 @@ void ScriptedAnimationController::serviceScriptedAnimations(double monotonicTime
scheduleAnimationIfNeeded();
}
-void ScriptedAnimationController::scheduleEvent(PassRefPtr<Event> event)
+void ScriptedAnimationController::enqueueEvent(PassRefPtr<Event> event)
{
- if (!m_scheduledEventTargets.add(scheduledEventTargetKey(event.get())).isNewEntry)
- return;
m_eventQueue.append(event);
scheduleAnimationIfNeeded();
}
+void ScriptedAnimationController::enqueuePerFrameEvent(PassRefPtr<Event> event)
+{
+ if (!m_perFrameEvents.add(eventTargetKey(event.get())).isNewEntry)
+ return;
+ enqueueEvent(event);
+}
+
void ScriptedAnimationController::scheduleAnimationIfNeeded()
{
if (!m_document)
« no previous file with comments | « Source/core/dom/ScriptedAnimationController.h ('k') | Source/core/frame/FrameView.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698